You are here

public function Twig_Loader_Chain::isFresh in Translation template extractor 7.3

Same name and namespace in other branches
  1. 6.3 vendor/Twig/Loader/Chain.php \Twig_Loader_Chain::isFresh()

Returns true if the template is still fresh.

Parameters

string $name The template name:

int $time Timestamp of the last modification time of the: cached template

Return value

bool true if the template is fresh, false otherwise

Throws

Twig_Error_Loader When $name is not found

Overrides Twig_LoaderInterface::isFresh

File

vendor/Twig/Loader/Chain.php, line 121

Class

Twig_Loader_Chain
Loads templates from other loaders.

Code

public function isFresh($name, $time) {
  $exceptions = array();
  foreach ($this->loaders as $loader) {
    if ($loader instanceof Twig_ExistsLoaderInterface && !$loader
      ->exists($name)) {
      continue;
    }
    try {
      return $loader
        ->isFresh($name, $time);
    } catch (Twig_Error_Loader $e) {
      $exceptions[] = get_class($loader) . ': ' . $e
        ->getMessage();
    }
  }
  throw new Twig_Error_Loader(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' (' . implode(', ', $exceptions) . ')' : ''));
}