Revision 1852
Added by darkviper over 11 years ago
Array.php | ||
---|---|---|
20 | 20 |
* @package twig |
21 | 21 |
* @author Fabien Potencier <fabien@symfony.com> |
22 | 22 |
*/ |
23 |
class Twig_Loader_Array implements Twig_LoaderInterface |
|
23 |
class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterface
|
|
24 | 24 |
{ |
25 | 25 |
protected $templates; |
26 | 26 |
|
... | ... | |
51 | 51 |
} |
52 | 52 |
|
53 | 53 |
/** |
54 |
* Gets the source code of a template, given its name. |
|
55 |
* |
|
56 |
* @param string $name The name of the template to load |
|
57 |
* |
|
58 |
* @return string The template source code |
|
54 |
* {@inheritdoc} |
|
59 | 55 |
*/ |
60 | 56 |
public function getSource($name) |
61 | 57 |
{ |
... | ... | |
68 | 64 |
} |
69 | 65 |
|
70 | 66 |
/** |
71 |
* Gets the cache key to use for the cache for a given template name. |
|
72 |
* |
|
73 |
* @param string $name The name of the template to load |
|
74 |
* |
|
75 |
* @return string The cache key |
|
67 |
* {@inheritdoc} |
|
76 | 68 |
*/ |
69 |
public function exists($name) |
|
70 |
{ |
|
71 |
return isset($this->templates[(string) $name]); |
|
72 |
} |
|
73 |
|
|
74 |
/** |
|
75 |
* {@inheritdoc} |
|
76 |
*/ |
|
77 | 77 |
public function getCacheKey($name) |
78 | 78 |
{ |
79 | 79 |
$name = (string) $name; |
... | ... | |
85 | 85 |
} |
86 | 86 |
|
87 | 87 |
/** |
88 |
* Returns true if the template is still fresh. |
|
89 |
* |
|
90 |
* @param string $name The template name |
|
91 |
* @param timestamp $time The last modification time of the cached template |
|
88 |
* {@inheritdoc} |
|
92 | 89 |
*/ |
93 | 90 |
public function isFresh($name, $time) |
94 | 91 |
{ |
Also available in: Unified diff
updated Twig template engine to stable version 1.11.1 step2