예제 #1
0
 /**
  * @param string $templatePath
  * @param string $target
  */
 private function copyAssets($templatePath, $target)
 {
     try {
         $files = $this->configDAO->findConfig($templatePath, 'files');
         foreach ($files as $file) {
             $this->createDirIfNotExist($target . '/' . $file);
             copy($templatePath . $file, $target . '/' . $file);
         }
     } catch (\InvalidArgumentException $e) {
         // Nothing to do
     }
 }
예제 #2
0
 /**
  * @param string $templatePath
  * @return \Twig_Environment
  */
 public function createInstance($templatePath)
 {
     $twig = new \Twig_Environment(new \Twig_Loader_Filesystem($templatePath));
     try {
         $extension = $this->configDAO->findConfig($templatePath, 'extension');
         foreach ($extension as $extensionName => $extension) {
             $twig->addGlobal($extensionName, new $extension());
         }
     } catch (\InvalidArgumentException $e) {
         // Nothing to do
     }
     return $twig;
 }