Exemplo n.º 1
0
 protected function doInclude($view, array $data = [])
 {
     // normalize $view
     // find file
     $path = $this->finder->find($view);
     $this->expandFile($path);
 }
Exemplo n.º 2
0
 /**
  * Return path to template without the need for the extension.
  *
  * @param string $name Template file name or path.
  *
  * @throws \Twig_Error_Loader
  * @return string Path to template
  */
 public function findTemplate($name)
 {
     if ($this->files->exists($name)) {
         return $name;
     }
     $name = $this->normalizeName($name);
     if (isset($this->cache[$name])) {
         return $this->cache[$name];
     }
     try {
         $this->cache[$name] = $this->finder->find($name);
     } catch (InvalidArgumentException $ex) {
         throw new Twig_Error_Loader($ex->getMessage());
     }
     return $this->cache[$name];
 }
Exemplo n.º 3
0
 /**
  * Determine if a given view exists.
  *
  * @param  string  $view
  * @return bool
  */
 public function exists($view)
 {
     try {
         $this->finder->find($view);
     } catch (InvalidArgumentException $e) {
         return false;
     }
     return true;
 }
Exemplo n.º 4
0
 /**
  * Get a evaluated Markdown contents for the given Markdown.
  *
  * @param  string  $markdown
  * @return Markdown
  */
 public function make($markdown)
 {
     try {
         $path = $this->finder->find($markdown);
         return new Markdown($this, $this->getEngineFromPath($path), $markdown, $path);
     } catch (\InvalidArgumentException $e) {
         if (!is_null($this->notFoundHandler)) {
             if ($this->notFoundHandler instanceof Closure) {
                 return call_user_func($this->notFoundHandler, $markdown);
             } else {
                 $handler = explode('@', $this->notFoundHandler);
                 if (class_exists($class = $handler[0])) {
                     $controller = new $class();
                     $action = isset($handler[1]) ? $handler[1] : 'index';
                     return $controller->callAction($action, array($markdown));
                 }
             }
         }
         throw $e;
     }
 }
Exemplo n.º 5
0
 public function loadFile($name)
 {
     $path = $this->finder->find($name);
     return $this->files->get($path);
 }
Exemplo n.º 6
0
 /**
  * Get a evaluated LESS contents for the given LESS.
  *
  * @param  string  $less
  * @return VTalbot\Less\Less
  */
 public function make($less)
 {
     $path = $this->finder->find($less);
     return new Less($this, $this->getEngineFromPath($path), $less, $path);
 }
Exemplo n.º 7
0
 /**
  * Get a evaluated CoffeeScript contents for the given CoffeeScript.
  *
  * @param  string  $coffee
  * @return VTalbot\Coffee\Coffee
  */
 public function make($coffee)
 {
     $path = $this->finder->find($coffee);
     return new Coffee($this, $this->getEngineFromPath($path), $coffee, $path);
 }