PHP Class TwigBridge\Engine\Twig

Inheritance: extends Illuminate\View\Engines\CompilerEngine
Show file Open project: rcrowe/TwigBridge

Protected Properties

Property Type Description
$globalData array Data that is passed to all templates.
$loader TwigBridge\Twig\Loader Used to find the file that has failed.

Public Methods

Method Description
__construct ( TwigBridge\Engine\Compiler $compiler, Loader $loader, array $globalData = [] ) Create a new Twig view engine instance.
get ( string $path, array $data = [] ) : string Get the evaluated contents of the view.
getGlobalData ( ) : array Get the global data.
setGlobalData ( array $globalData ) : void Set global data sent to the view.

Protected Methods

Method Description
handleTwigError ( Twig_Error $ex ) Handle a TwigError exception.

Method Details

__construct() public method

Create a new Twig view engine instance.
public __construct ( TwigBridge\Engine\Compiler $compiler, Loader $loader, array $globalData = [] )
$compiler TwigBridge\Engine\Compiler
$loader TwigBridge\Twig\Loader
$globalData array

get() public method

Get the evaluated contents of the view.
public get ( string $path, array $data = [] ) : string
$path string Full file path to Twig template.
$data array
return string

getGlobalData() public method

Get the global data.
public getGlobalData ( ) : array
return array

handleTwigError() protected method

Handle a TwigError exception.
protected handleTwigError ( Twig_Error $ex )
$ex Twig_Error

setGlobalData() public method

Set global data sent to the view.
public setGlobalData ( array $globalData ) : void
$globalData array Global data.
return void

Property Details

$globalData protected property

Data that is passed to all templates.
protected array $globalData
return array

$loader protected property

Used to find the file that has failed.
protected Loader,TwigBridge\Twig $loader
return TwigBridge\Twig\Loader