Documentation

SourceContextLoaderInterface extends LoaderInterface

Empty interface for Twig 1.x compatibility.

Table of Contents

exists()  : bool
Check if we have the source code of a template, given its name.
getCacheKey()  : string
Gets the cache key to use for the cache for a given template name.
getSourceContext()  : Source
Returns the source context for a given template logical name.
isFresh()  : bool
Returns true if the template is still fresh.

Methods

exists()

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

public exists(string $name) : bool
Parameters
$name : string

The name of the template to check if we can load

Return values
bool

If the template source code is handled by this loader or not

getCacheKey()

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

public getCacheKey(string $name) : string
Parameters
$name : string

The name of the template to load

Tags
throws
LoaderError

When $name is not found

Return values
string

The cache key

getSourceContext()

Returns the source context for a given template logical name.

public getSourceContext(string $name) : Source
Parameters
$name : string

The template logical name

Tags
throws
LoaderError

When $name is not found

Return values
Source

isFresh()

Returns true if the template is still fresh.

public isFresh(string $name, int $time) : bool
Parameters
$name : string

The template name

$time : int

Timestamp of the last modification time of the cached template

Tags
throws
LoaderError

When $name is not found

Return values
bool

true if the template is fresh, false otherwise

Search results