Skip to content

Commit

Permalink
Merge pull request #8 from HipsterCreative/master
Browse files Browse the repository at this point in the history
Fixed bug in Twig_Loader_Cakephp interface
  • Loading branch information
WyriHaximus committed Jun 8, 2014
2 parents ed383ce + 2aa937b commit c2b6535
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions Lib/Twig_Loader_Cakephp.php
Expand Up @@ -6,21 +6,39 @@ class Twig_Loader_Cakephp implements Twig_LoaderInterface {
* @{inheritDoc}
*/
public function getSource($name) {
return file_get_contents($this->resolveFileName($name));
$name = $this->resolveFileName($name);

if(file_exists( $name ) !== false) {
return file_get_contents($name);
}

throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name));
}

/**
* @{inheritDoc}
*/
public function getCacheKey($name) {
return $this->resolveFileName($name);
$name = $this->resolveFileName($name);

if(file_exists( $name ) !== false) {
return $name;
}

throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name));
}

/**
* @{inheritDoc}
*/
public function isFresh($name, $time) {
return filemtime($this->resolveFileName($name)) < $time;
$name = $this->resolveFileName($name);

if(file_exists( $name ) !== false) {
return filemtime($name) < $time;
}

throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name));
}

/**
Expand Down

0 comments on commit c2b6535

Please sign in to comment.