Exemple #1
0
 public function __construct(Application $application, array $handlers = [], array $processors = [], Console $consoleHandler = null)
 {
     if ($application->isDebugMode()) {
         if (null === $consoleHandler) {
             $consoleHandler = new Console($application);
         }
         $handlers[] = $consoleHandler;
     }
     parent::__construct($application->getName(), $handlers, $processors);
     $this->setApplication($application)->setConsoleHandler($consoleHandler);
 }
Exemple #2
0
 public function __construct(Application $application, \Twig_LoaderInterface $loader = null, array $options = [])
 {
     if (!array_key_exists("debug", $options)) {
         $options["debug"] = $application->isDebugMode();
     }
     if (!array_key_exists("cache", $options)) {
         if (!$options["debug"]) {
             $options["cache"] = $application->getAbsolutePath(static::DIR_CACHE);
         } else {
             $options["cache"] = false;
         }
     }
     parent::__construct($loader, $options);
     if ($options["debug"]) {
         $this->addExtension(new \Twig_Extension_Debug());
     }
     $this->addFunction(new \Twig_SimpleFunction("route", [$this, "handleRoute"]));
     $this->setApplication($application);
 }