HumHub Documentation (unofficial)

FilesystemLoader
in package
implements LoaderInterface

Loads template from the filesystem.

Tags
author

Fabien Potencier fabien@symfony.com

Table of Contents

Interfaces

LoaderInterface
Interface all loaders must implement.

Constants

MAIN_NAMESPACE  = '__main__'
Identifier of the main namespace.

Properties

$cache  : mixed
$errorCache  : mixed
$paths  : mixed
$rootPath  : mixed

Methods

__construct()  : mixed
addPath()  : void
exists()  : bool
getCacheKey()  : string
Gets the cache key to use for the cache for a given template name.
getNamespaces()  : array<string|int, mixed>
Returns the path namespaces.
getPaths()  : array<string|int, mixed>
Returns the paths to the templates.
getSourceContext()  : Source
Returns the source context for a given template logical name.
isFresh()  : bool
prependPath()  : void
setPaths()  : void
findTemplate()  : string|null
isAbsolutePath()  : bool
normalizeName()  : string
parseName()  : array<string|int, mixed>
validateName()  : void

Constants

MAIN_NAMESPACE

Identifier of the main namespace.

public mixed MAIN_NAMESPACE = '__main__'

Properties

Methods

__construct()

public __construct([string|array<string|int, mixed> $paths = [] ][, string|null $rootPath = null ]) : mixed
Parameters
$paths : string|array<string|int, mixed> = []

A path or an array of paths where to look for templates

$rootPath : string|null = null

The root path common to all relative paths (null for getcwd())

addPath()

public addPath(string $path[, string $namespace = self::MAIN_NAMESPACE ]) : void
Parameters
$path : string
$namespace : string = self::MAIN_NAMESPACE
Tags
throws
LoaderError

exists()

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

getCacheKey()

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

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

getNamespaces()

Returns the path namespaces.

public getNamespaces() : array<string|int, mixed>

The main namespace is always defined.

Return values
array<string|int, mixed>

getPaths()

Returns the paths to the templates.

public getPaths([string $namespace = self::MAIN_NAMESPACE ]) : array<string|int, mixed>
Parameters
$namespace : string = self::MAIN_NAMESPACE
Return values
array<string|int, mixed>

getSourceContext()

Returns the source context for a given template logical name.

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

isFresh()

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

Timestamp of the last modification time of the cached template

Return values
bool

prependPath()

public prependPath(string $path[, string $namespace = self::MAIN_NAMESPACE ]) : void
Parameters
$path : string
$namespace : string = self::MAIN_NAMESPACE
Tags
throws
LoaderError

setPaths()

public setPaths(string|array<string|int, mixed> $paths[, string $namespace = self::MAIN_NAMESPACE ]) : void
Parameters
$paths : string|array<string|int, mixed>

A path or an array of paths where to look for templates

$namespace : string = self::MAIN_NAMESPACE

findTemplate()

protected findTemplate(string $name[, bool $throw = true ]) : string|null
Parameters
$name : string
$throw : bool = true
Return values
string|null

isAbsolutePath()

private isAbsolutePath(string $file) : bool
Parameters
$file : string
Return values
bool

normalizeName()

private normalizeName(string $name) : string
Parameters
$name : string
Return values
string

parseName()

private parseName(string $name[, string $default = self::MAIN_NAMESPACE ]) : array<string|int, mixed>
Parameters
$name : string
$default : string = self::MAIN_NAMESPACE
Return values
array<string|int, mixed>

validateName()

private validateName(string $name) : void
Parameters
$name : string

        
On this page

Search results