shop.balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

String.php (1574B)


      1 <?php
      2 
      3 /*
      4  * This file is part of Twig.
      5  *
      6  * (c) 2009 Fabien Potencier
      7  *
      8  * For the full copyright and license information, please view the LICENSE
      9  * file that was distributed with this source code.
     10  */
     11 
     12 @trigger_error('The Twig_Loader_String class is deprecated since version 1.18.1 and will be removed in 2.0. Use Twig_Loader_Array instead or Twig_Environment::createTemplate().', E_USER_DEPRECATED);
     13 
     14 /**
     15  * Loads a template from a string.
     16  *
     17  * This loader should NEVER be used. It only exists for Twig internal purposes.
     18  *
     19  * When using this loader with a cache mechanism, you should know that a new cache
     20  * key is generated each time a template content "changes" (the cache key being the
     21  * source code of the template). If you don't want to see your cache grows out of
     22  * control, you need to take care of clearing the old cache file by yourself.
     23  *
     24  * @deprecated since 1.18.1 (to be removed in 2.0)
     25  *
     26  * @internal
     27  *
     28  * @author Fabien Potencier <fabien@symfony.com>
     29  */
     30 class Twig_Loader_String implements Twig_LoaderInterface, Twig_ExistsLoaderInterface
     31 {
     32     /**
     33      * {@inheritdoc}
     34      */
     35     public function getSource($name)
     36     {
     37         return $name;
     38     }
     39 
     40     /**
     41      * {@inheritdoc}
     42      */
     43     public function exists($name)
     44     {
     45         return true;
     46     }
     47 
     48     /**
     49      * {@inheritdoc}
     50      */
     51     public function getCacheKey($name)
     52     {
     53         return $name;
     54     }
     55 
     56     /**
     57      * {@inheritdoc}
     58      */
     59     public function isFresh($name, $time)
     60     {
     61         return true;
     62     }
     63 }