Loads a template from an array.
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.
This loader should only be used for unit testing.
package | Default |
---|
__construct(array $templates = array())
array
An array of templates (keys are the names, and values are the source code)
exists(string $name): boolean
string
The name of the template to check if we can load
boolean
If the template source code is handled by this loader or not
getCacheKey(string $name): string
string
The name of the template to load
string
The cache key
getSource(string $name): string
string
The name of the template to load
string
The template source code
getSourceContext(string $name): \Twig\Source
isFresh(string $name,integer $time): boolean
string
The template name
integer
Timestamp of the last modification time of the cached template
boolean
true if the template is fresh, false otherwise
setTemplate(string $name,string $template)
string
The template name
string
The template source
templates :