twig === null) { $this->twig = new Twig_Environment($this->getLoader()); } return $this->twig; } /** * @return Twig_Loader_Filesystem */ public function getLoader() { if ($this->loader === null) { $this->loader = new Twig_Loader_Filesystem($this->getTemplatePath()); } return $this->loader; } /** * @return string * @throws \Exception */ public function getTemplatePath() { if ($this->templatePath === null) { throw new \Exception('Templates path not defined'); } return $this->templatePath; } /** * @param string $templatePath */ public function setTemplatePath($templatePath) { $this->templatePath = $templatePath; } }