removed obsolete code

This commit is contained in:
Fabien Potencier
2016-10-21 20:25:38 -07:00
parent 37cacdcde8
commit 02c0cb59f3
3 changed files with 3 additions and 22 deletions
+1 -10
View File
@@ -325,17 +325,8 @@ class Twig_Environment
}
if (!class_exists($cls, false)) {
$loader = $this->getLoader();
if (!$loader instanceof Twig_SourceContextLoaderInterface) {
$source = new Twig_Source($loader->getSource($name), $name);
} else {
$source = $loader->getSourceContext($name);
}
$content = $this->compileSource($source);
$content = $this->compileSource($this->getLoader()->getSourceContext($name));
$this->cache->write($key, $content);
eval('?>'.$content);
}
}
+1 -5
View File
@@ -1304,11 +1304,7 @@ function twig_source(Twig_Environment $env, $name, $ignoreMissing = false)
{
$loader = $env->getLoader();
try {
if (!$loader instanceof Twig_SourceContextLoaderInterface) {
return $loader->getSource($name);
} else {
return $loader->getSourceContext($name)->getCode();
}
return $loader->getSourceContext($name)->getCode();
} catch (Twig_Error_Loader $e) {
if (!$ignoreMissing) {
throw $e;
+1 -7
View File
@@ -209,13 +209,7 @@ abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase
foreach (array_keys($templates) as $name) {
echo "Template: $name\n";
$loader = $twig->getLoader();
if (!$loader instanceof Twig_SourceContextLoaderInterface) {
$source = new Twig_Source($loader->getSource($name), $name);
} else {
$source = $loader->getSourceContext($name);
}
echo $twig->compile($twig->parse($twig->tokenize($source)));
echo $twig->compile($twig->parse($twig->tokenize($twig->getLoader()->getSourceContext($name))));
}
}
$this->assertEquals($expected, $output, $message.' (in '.$file.')');