LoaderInterface

Extends

Interface all loaders must implement.

author

Fabien Potencier fabien@symfony.com

package

Default

Methods

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

getCacheKey(string $name): string
Throws
\Twig\Error\LoaderError

When $name is not found

Arguments

$name

string

The name of the template to load

Response

string

The cache key

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

getSource(string $name): string
deprecated

since 1.27 (to be removed in 2.0), implement Twig\Loader\SourceContextLoaderInterface

Throws
\Twig\Error\LoaderError

When $name is not found

Arguments

$name

string

The name of the template to load

Response

string

The template source code

Returns true if the template is still fresh.

isFresh(string $name,integer $time): boolean
Throws
\Twig\Error\LoaderError

When $name is not found

Arguments

$name

string

The template name

$time

integer

Timestamp of the last modification time of the cached template

Response

boolean

true if the template is fresh, false otherwise