summaryrefslogtreecommitdiff
path: root/inc/lib/Twig/Loader/String.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/lib/Twig/Loader/String.php')
-rw-r--r--inc/lib/Twig/Loader/String.php34
1 files changed, 17 insertions, 17 deletions
diff --git a/inc/lib/Twig/Loader/String.php b/inc/lib/Twig/Loader/String.php
index 26eb0096..8ad9856c 100644
--- a/inc/lib/Twig/Loader/String.php
+++ b/inc/lib/Twig/Loader/String.php
@@ -12,22 +12,21 @@
/**
* 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.
*
- * @package twig
- * @author Fabien Potencier <fabien@symfony.com>
+ * @author Fabien Potencier <fabien@symfony.com>
*/
-class Twig_Loader_String implements Twig_LoaderInterface
+class Twig_Loader_String implements Twig_LoaderInterface, Twig_ExistsLoaderInterface
{
/**
- * Gets the source code of a template, given its name.
- *
- * @param string $name The name of the template to load
- *
- * @return string The template source code
+ * {@inheritdoc}
*/
public function getSource($name)
{
@@ -35,11 +34,15 @@ class Twig_Loader_String implements Twig_LoaderInterface
}
/**
- * Gets the cache key to use for the cache for a given template name.
- *
- * @param string $name The name of the template to load
- *
- * @return string The cache key
+ * {@inheritdoc}
+ */
+ public function exists($name)
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritdoc}
*/
public function getCacheKey($name)
{
@@ -47,10 +50,7 @@ class Twig_Loader_String implements Twig_LoaderInterface
}
/**
- * Returns true if the template is still fresh.
- *
- * @param string $name The template name
- * @param timestamp $time The last modification time of the cached template
+ * {@inheritdoc}
*/
public function isFresh($name, $time)
{