Project

General

Profile

« Previous | Next » 

Revision 1852

Added by darkviper over 11 years ago

updated Twig template engine to stable version 1.11.1 step2

View differences:

String.php
12 12
/**
13 13
 * Loads a template from a string.
14 14
 *
15
 * This loader should only be used for unit testing as it has many limitations
16
 * (for instance, the include or extends tag does not make any sense for a string
17
 * loader).
18
 *
15 19
 * When using this loader with a cache mechanism, you should know that a new cache
16 20
 * key is generated each time a template content "changes" (the cache key being the
17 21
 * source code of the template). If you don't want to see your cache grows out of
......
20 24
 * @package    twig
21 25
 * @author     Fabien Potencier <fabien@symfony.com>
22 26
 */
23
class Twig_Loader_String implements Twig_LoaderInterface
27
class Twig_Loader_String implements Twig_LoaderInterface, Twig_ExistsLoaderInterface
24 28
{
25 29
    /**
26
     * Gets the source code of a template, given its name.
27
     *
28
     * @param  string $name The name of the template to load
29
     *
30
     * @return string The template source code
30
     * {@inheritdoc}
31 31
     */
32 32
    public function getSource($name)
33 33
    {
......
35 35
    }
36 36

  
37 37
    /**
38
     * Gets the cache key to use for the cache for a given template name.
39
     *
40
     * @param  string $name The name of the template to load
41
     *
42
     * @return string The cache key
38
     * {@inheritdoc}
43 39
     */
40
    public function exists($name)
41
    {
42
        return true;
43
    }
44

  
45
    /**
46
     * {@inheritdoc}
47
     */
44 48
    public function getCacheKey($name)
45 49
    {
46 50
        return $name;
47 51
    }
48 52

  
49 53
    /**
50
     * Returns true if the template is still fresh.
51
     *
52
     * @param string    $name The template name
53
     * @param timestamp $time The last modification time of the cached template
54
     * {@inheritdoc}
54 55
     */
55 56
    public function isFresh($name, $time)
56 57
    {

Also available in: Unified diff