/** * Constructor * * @param string $templateDir * @param bool $cacheDir * * @throws TemplateDirectoryNotFoundException */ public function __Construct($templateDir, $cacheDir = false) { if (realpath($templateDir) === false) { throw new TemplateDirectoryNotFoundException(sprintf('template directory not found in "%s"', $templateDir)); } $this->application = Application::getInstance(); $this->loader = new \Twig_Loader_Filesystem($templateDir); $this->template = new \Twig_Environment($this->loader, array('cache' => $cacheDir, 'auto_reload' => true, 'strict_variables' => true)); $this->template->addGlobal('app', $this->application); }
/** * final private function __clone(); // Inhibe le clonage des exceptions. * * final public function getMessage(); // message de l'exception * final public function getCode(); // code de l'exception * final public function getFile(); // nom du fichier source * final public function getLine(); // ligne du fichier source * final public function getTrace(); // un tableau de backtrace() * final public function getPrevious(); // exception précédente (depuis PHP 5.3) * final public function getTraceAsString(); // chaîne formatée de trace * * @param Exception $exception * @param integer $type */ public function wrap($exception, $type = null) { $application = Application::getInstance(); }
protected function setUp() { $this->application = Application::getInstance(); }
/** * Redirect to new route * * @param $route * @param array $params */ public function redirect($route, array $params = array()) { \header('Location: ' . $this->app->path($route, $params)); exit; }