Skip to content

Commit

Permalink
simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexDpy committed Sep 16, 2016
1 parent 74936f2 commit af5469c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Templating/TwigEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Pyrite\Templating;

use Symfony\Bridge\Twig\Extension\DumpExtension;
use Pyrite\Container\Container;
use Pyrite\Templating\Twig\Extension;
use Symfony\Bridge\Twig\Extension\DumpExtension;
use Symfony\Component\VarDumper\Cloner\VarCloner;

class TwigEngine implements Engine
Expand All @@ -15,15 +15,15 @@ public function __construct(Container $container)
{
$rootDir = $container->getParameter('root_dir');
$productionMode = $container->getParameter('production_mode');
$debug = !($productionMode === true);
$debug = !$productionMode;

$loader = new \Twig_Loader_Filesystem($rootDir);
$this->twig = new \Twig_Environment($loader, array(
'cache' => $rootDir . '/tmp',
'debug' => $debug
));

if ($debug && class_exists('Symfony\Component\VarDumper\Cloner\VarCloner') && class_exists('Symfony\Bridge\Twig\Extension\DumpExtension')) {
if ($debug && class_exists(VarCloner::class) && class_exists(DumpExtension::class)) {
$this->twig->addExtension(new DumpExtension(new VarCloner()));
}
}
Expand Down

0 comments on commit af5469c

Please sign in to comment.