PHP Class Airship\Engine\Lens

For MVC developers, this is analogous to a View
Inheritance: use trait Airship\Engine\Bolt\Log
Afficher le fichier Open project: paragonie/airship Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( Twig_Environment $twigEnv ) Lens constructor.
addGlobal ( string $key, &mixed $value ) : self Add a global variable to Twig
append ( string $key, mixed $val ) : self Maintain an array of values for later rendering, appending the supplied value.
display ( string $base, array $params = [], string $mime = 'text/html;charset=UTF-8' ) : boolean Render a template and print out its contents.
filter ( string $name, callable $func = null ) : self Add a filter to Twig
func ( string $name, callable $func = null, array $is_safe = ['html'] ) : self Add a function to our Twig environment
listFilters ( ) : array Get all filters
loadMotifCargo ( string $name ) : self Load the cargo for these motifs
loadMotifConfig ( string $name ) : self Load the config for this motif
prepend ( string $key, mixed $val ) : self Maintain an array of values for later rendering, prepending the supplied value.
registerGlobal ( string $name, &array &$value ) : self Register an array or object as a Twig global.
render ( string $base, array $params = [] ) : string Render a template and return its contents as a string.
resetBaseTemplate ( ) : self Reset the base template
sendStandardHeaders ( string $mimeType ) : void Send HTTP headers
setActiveMotif ( string $name ) : boolean Set the active motif
setBaseTemplate ( string $name ) : self Override the base template
store ( string $key, mixed $val ) : self Persist state for later rendering.
unsafeDisplay ( string $file, array $params = [], string $mime = 'text/html;charset=UTF-8' ) : boolean Render a template and print out its contents without sanity checks.
unsafeRender ( string $file, array $params = [] ) : string Render a template and print out its contents without sanity checks.

Method Details

__construct() public méthode

Lens constructor.
public __construct ( Twig_Environment $twigEnv )
$twigEnv Twig_Environment

addGlobal() public méthode

Add a global variable to Twig
public addGlobal ( string $key, &mixed $value ) : self
$key string
$value &mixed
Résultat self

append() public méthode

Maintain an array of values for later rendering, appending the supplied value.
public append ( string $key, mixed $val ) : self
$key string Index
$val mixed Value
Résultat self

display() public méthode

Render a template and print out its contents.
public display ( string $base, array $params = [], string $mime = 'text/html;charset=UTF-8' ) : boolean
$base string Template to render (e.g. 'index' or 'dir/index')
$params array Parameters to pass towards the array
$mime string MIME type header to transmit
Résultat boolean

filter() public méthode

Add a filter to Twig
public filter ( string $name, callable $func = null ) : self
$name string - Name to access n Twig
$func callable - function to apply
Résultat self

func() public méthode

Add a function to our Twig environment
public func ( string $name, callable $func = null, array $is_safe = ['html'] ) : self
$name string - Name to access in Twig
$func callable - function definition
$is_safe array
Résultat self

listFilters() public méthode

Get all filters
public listFilters ( ) : array
Résultat array

loadMotifCargo() public méthode

Load the cargo for these motifs
public loadMotifCargo ( string $name ) : self
$name string
Résultat self

loadMotifConfig() public méthode

Load the config for this motif
public loadMotifConfig ( string $name ) : self
$name string
Résultat self

prepend() public méthode

Maintain an array of values for later rendering, prepending the supplied value.
public prepend ( string $key, mixed $val ) : self
$key string Index
$val mixed Value
Résultat self

registerGlobal() public méthode

Register an array or object as a Twig global.
public registerGlobal ( string $name, &array &$value ) : self
$name string Name to access in Twig (by ref)
$value &array
Résultat self

render() public méthode

Render a template and return its contents as a string.
public render ( string $base, array $params = [] ) : string
$base string Template to render (e.g. 'index' or 'dir/index')
$params array Parameters to pass towards the array
Résultat string

resetBaseTemplate() public méthode

Reset the base template
public resetBaseTemplate ( ) : self
Résultat self

sendStandardHeaders() public méthode

Send HTTP headers
public sendStandardHeaders ( string $mimeType ) : void
$mimeType string
Résultat void

setActiveMotif() public méthode

Set the active motif
public setActiveMotif ( string $name ) : boolean
$name string
Résultat boolean

setBaseTemplate() public méthode

Override the base template
public setBaseTemplate ( string $name ) : self
$name string
Résultat self

store() public méthode

Persist state for later rendering.
public store ( string $key, mixed $val ) : self
$key string Index
$val mixed Value
Résultat self

unsafeDisplay() public méthode

Render a template and print out its contents without sanity checks.
public unsafeDisplay ( string $file, array $params = [], string $mime = 'text/html;charset=UTF-8' ) : boolean
$file string Template to render (e.g. 'index' or 'dir/index')
$params array Parameters to pass towards the array
$mime string MIME type
Résultat boolean

unsafeRender() public méthode

Render a template and print out its contents without sanity checks.
public unsafeRender ( string $file, array $params = [] ) : string
$file string Template to render (e.g. 'index' or 'dir/index')
$params array Parameters to pass towards the array
Résultat string