public function Twig_Environment::isTemplateFresh in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/twig/twig/lib/Twig/Environment.php \Twig_Environment::isTemplateFresh()
Returns true if the template is still fresh.
Besides checking the loader for freshness information, this method also checks if the enabled extensions have not changed.
Parameters
string $name The template name:
int $time The last modification time of the cached template:
Return value
bool true if the template is fresh, false otherwise
1 call to Twig_Environment::isTemplateFresh()
- Twig_Environment::loadTemplate in vendor/
twig/ twig/ lib/ Twig/ Environment.php - Loads a template by name.
File
- vendor/
twig/ twig/ lib/ Twig/ Environment.php, line 460
Class
- Twig_Environment
- Stores the Twig configuration.
Code
public function isTemplateFresh($name, $time) {
if (0 === $this->lastModifiedExtension) {
foreach ($this->extensions as $extension) {
$r = new ReflectionObject($extension);
if (file_exists($r
->getFileName()) && ($extensionTime = filemtime($r
->getFileName())) > $this->lastModifiedExtension) {
$this->lastModifiedExtension = $extensionTime;
}
}
}
return $this->lastModifiedExtension <= $time && $this
->getLoader()
->isFresh($name, $time);
}