PHP Class Phrozn\Processor\Twig

Author: Victor Farazdagi
Inheritance: extends Base, implements Phrozn\Processor
ファイルを表示 Open project: farazdagi/phrozn Class Usage Examples

Protected Properties

Property Type Description
$loader Twig_LoaderInterface Reference to twig current template loader
$twig Twig_Environment Reference to twig engine environment object

Public Methods

Method Description
__construct ( array $options = [] ) : Twig If configuration options are passed then twig environment is initialized right away
render ( string $tpl, array $vars = [] ) : string Parse the incoming template

Protected Methods

Method Description
getEnvironment ( boolean $reset = false ) : Twig_Environment Get (init if necessary) twig environment
getLoader ( ) : Twig_LoaderInterface Get template loader chain

Method Details

__construct() public method

If configuration options are passed then twig environment is initialized right away
public __construct ( array $options = [] ) : Twig
$options array Processor options
return Twig

getEnvironment() protected method

Get (init if necessary) twig environment
protected getEnvironment ( boolean $reset = false ) : Twig_Environment
$reset boolean Force re-initialization (helpful for UTs)
return Twig_Environment

getLoader() protected method

Get template loader chain
protected getLoader ( ) : Twig_LoaderInterface
return Twig_LoaderInterface

render() public method

Parse the incoming template
public render ( string $tpl, array $vars = [] ) : string
$tpl string Source template content
$vars array List of variables passed to template engine
return string Processed template

Property Details

$loader protected_oe property

Reference to twig current template loader
protected Twig_LoaderInterface $loader
return Twig_LoaderInterface

$twig protected_oe property

Reference to twig engine environment object
protected Twig_Environment $twig
return Twig_Environment