/** * @param FileParameter $Location * @param bool $Reload * * @return IBridgeInterface */ public function loadFile(FileParameter $Location, $Reload = false) { $this->Instance = new \Twig_Environment(new \Twig_Loader_Filesystem(array(dirname($Location->getFile()))), array('auto_reload' => $Reload, 'autoescape' => false, 'cache' => realpath(__DIR__ . '/TwigTemplate'))); $this->Instance->addFilter(new \Twig_SimpleFilter('utf8_encode', 'utf8_encode')); $this->Instance->addFilter(new \Twig_SimpleFilter('utf8_decode', 'utf8_decode')); $this->Template = $this->Instance->loadTemplate(basename($Location->getFile())); return $this; }
/** * @param FileParameter $Location * @param bool $Reload * * @return IBridgeInterface */ public function loadFile(FileParameter $Location, $Reload = false) { $this->Instance = new \Smarty(); $this->Instance->caching = !$Reload; $this->Instance->compile_dir = __DIR__ . '/SmartyTemplate'; $this->Instance->cache_dir = __DIR__ . '/SmartyTemplate'; $this->Template = $Location->getFile(); return $this; }
public function testFileParameter() { try { new FileParameter(null); } catch (\Exception $E) { $this->assertInstanceOf('MOC\\V\\Component\\Template\\Component\\Exception\\Repository\\EmptyFileException', $E); } $Parameter = new FileParameter(__FILE__); $this->assertEquals(__FILE__, $Parameter->getFile()); try { $Parameter->setFile(__DIR__); } catch (\Exception $E) { $this->assertInstanceOf('MOC\\V\\Component\\Template\\Component\\Exception\\Repository\\TypeFileException', $E); } }