Example #1
0
 /**
  * @\Nucleus\IService\EventDispatcher\Listen("ServiceContainer.warmUp")
  */
 public function warmUp()
 {
     $finder = new \Symfony\Component\Finder\Finder();
     $finder->files()->name('*.twig')->in($this->fileSystemLoader->getPaths());
     foreach ($finder as $file) {
         $fileName = $file->getRelativePathname();
         $this->generateCacheFile($fileName);
         if (strpos($fileName, DIRECTORY_SEPARATOR) !== 0) {
             $this->generateCacheFile(DIRECTORY_SEPARATOR . $fileName);
         }
     }
 }
 public function canRender($template)
 {
     $extension = pathinfo($template, PATHINFO_EXTENSION);
     if (!$extension) {
         foreach ($this->getExtensions() as $extension) {
             if ($this->canRender($template . '.' . $extension)) {
                 return true;
             }
         }
         return false;
     }
     return in_array(strtolower($extension), $this->extensions) && $this->fileLoader->exists($template);
 }