PEEL Shopping
Open source ecommerce : PEEL Shopping
Public Member Functions
Twig_Loader_String Class Reference

Loads a template from a string. More...

Inheritance diagram for Twig_Loader_String:
Twig_LoaderInterface Twig_ExistsLoaderInterface

Public Member Functions

 getSource ($name)
 {Gets the source code of a template, given its name.
Parameters
string$nameThe name of the template to load
Returns
string The template source code
Exceptions
Twig_Error_LoaderWhen $name is not found
} More...
 
 exists ($name)
 {Check if we have the source code of a template, given its name.
Parameters
string$nameThe name of the template to check if we can load
Returns
boolean If the template source code is handled by this loader or not
} More...
 
 getCacheKey ($name)
 {Gets the cache key to use for the cache for a given template name.
Parameters
string$nameThe name of the template to load
Returns
string The cache key
Exceptions
Twig_Error_LoaderWhen $name is not found
} More...
 
 isFresh ($name, $time)
 {Returns true if the template is still fresh.
Parameters
string$nameThe template name
timestamp$timeThe last modification time of the cached template
Returns
Boolean true if the template is fresh, false otherwise
Exceptions
Twig_Error_LoaderWhen $name is not found
} More...
 

Detailed Description

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.

Author
Fabien Potencier fabie.nosp@m.n@sy.nosp@m.mfony.nosp@m..com

Definition at line 26 of file String.php.

Member Function Documentation

exists (   $name)

{Check if we have the source code of a template, given its name.

Parameters
string$nameThe name of the template to check if we can load
Returns
boolean If the template source code is handled by this loader or not
}

Implements Twig_ExistsLoaderInterface.

Definition at line 39 of file String.php.

getCacheKey (   $name)

{Gets the cache key to use for the cache for a given template name.

Parameters
string$nameThe name of the template to load
Returns
string The cache key
Exceptions
Twig_Error_LoaderWhen $name is not found
}

Implements Twig_LoaderInterface.

Definition at line 47 of file String.php.

getSource (   $name)

{Gets the source code of a template, given its name.

Parameters
string$nameThe name of the template to load
Returns
string The template source code
Exceptions
Twig_Error_LoaderWhen $name is not found
}

Implements Twig_LoaderInterface.

Definition at line 31 of file String.php.

isFresh (   $name,
  $time 
)

{Returns true if the template is still fresh.

Parameters
string$nameThe template name
timestamp$timeThe last modification time of the cached template
Returns
Boolean true if the template is fresh, false otherwise
Exceptions
Twig_Error_LoaderWhen $name is not found
}

Implements Twig_LoaderInterface.

Definition at line 55 of file String.php.


The documentation for this class was generated from the following file:

This documentation for Open ecommerce PEEL Shopping and PEEL.fr has been generated by Doxygen on Thu Oct 15 2015 14:41:44 - Peel ecommerce is a product of Agence web Advisto SAS. All rights reserved.