Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug in Twig_Loader_Cakephp interface #8

Merged
merged 1 commit into from Jun 8, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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