class Twig_Loader_String implements Twig_LoaderInterface, Twig_ExistsLoaderInterface
Loads a template from a string.
This loader should only be used for unit testing as it has many limitations
(for instance, the include or extends tag does not make any sense for a string
loader).
When using this loader with a cache mechanism, you should know that a new cache
key is generated each time a template content "changes" (the cache key being the
source code of the template). If you don't want to see your cache grows out of
control, you need to take care of clearing the old cache file by yourself.
Methods
| string |
getSource(string $name)
Gets the source code of a template, given its name. |
|
| boolean |
exists(string $name)
Check if we have the source code of a template, given its name. |
|
| string |
getCacheKey(string $name)
Gets the cache key to use for the cache for a given template name. |
|
| Boolean |
isFresh(string $name, timestamp $time)
Returns true if the template is still fresh. |
Details
at line 31
public string
getSource(string $name)
Gets the source code of a template, given its name.
at line 39
public boolean
exists(string $name)
Check if we have the source code of a template, given its name.
at line 47
public string
getCacheKey(string $name)
Gets the cache key to use for the cache for a given template name.
at line 55
public Boolean
isFresh(string $name, timestamp $time)
Returns true if the template is still fresh.