\Phug\Renderer\AdapterEvalAdapter

Renderer using `eval()` PHP language construct.

Note: this is not more risky than other evaluation ways. Every adapter will execute the code of the Pug templates (inside code statements and expressions). To be safe, you should not render uncontrolled templates unless your environment is a restricted sandbox.

Summary

Methods
Properties
Constants
__construct()
getRenderer()
captureBuffer()
render()
getOptions()
setOptions()
setOptionsRecursive()
setOptionsDefaults()
hasOption()
getOption()
setOption()
unsetOption()
addOptionNameHandlers()
resetOptions()
display()
No public properties found
No constants found
execute()
$replaceFunction
$recursiveReplaceFunction
$nonDeepOptions
N/A
handleOptionName()
filterTraversable()
setOptionArrays()
mergeOptionValue()
setDefaultOption()
withVariableReference()
withOptionReference()
$renderer
$options
$optionNameHandlers
N/A

Properties

$replaceFunction

$replaceFunction : callable

Type

callable

$recursiveReplaceFunction

$recursiveReplaceFunction : callable

Type

callable

$nonDeepOptions

$nonDeepOptions : array<mixed,string>

Type

array<mixed,string>

$renderer

$renderer : 

Type

$options

$options : \ArrayObject

Type

\ArrayObject

$optionNameHandlers

$optionNameHandlers : array

Type

array

Methods

__construct()

__construct(\Phug\Renderer  $renderer, array|\ArrayObject  $options) 

AbstractAdapter constructor.

Parameters

\Phug\Renderer $renderer

current renderer used.

array|\ArrayObject $options

options array/object to be propagated from renderer to the adapter.

getRenderer()

getRenderer() : \Phug\Renderer

Get the current linked renderer.

Returns

\Phug\Renderer

captureBuffer()

captureBuffer(callable  $display) : string

Get a callable that display/output text/HTML and return as string what those callable would have displayed.

Parameters

callable $display

function/closure that display renderer code.

Throws

\Throwable

Returns

string

render()

render(string  $php, array  $parameters) : string

Return rendered code based on capturing output of the ->display() method.

Parameters

string $php

PHP code resulting from the rendering.

array $parameters

Render local variables.

Throws

\Throwable

Returns

string

getOptions()

getOptions() 

{@inheritdoc}

setOptions()

setOptions(  $options) 

{@inheritdoc}

Parameters

$options

setOptionsRecursive()

setOptionsRecursive(  $options) 

{@inheritdoc}

Parameters

$options

setOptionsDefaults()

setOptionsDefaults(  $options = null) 

{@inheritdoc}

Parameters

$options

hasOption()

hasOption(  $name) 

{@inheritdoc}

Parameters

$name

getOption()

getOption(  $name) 

{@inheritdoc}

Parameters

$name

setOption()

setOption(  $name,   $value) 

{@inheritdoc}

Parameters

$name
$value

unsetOption()

unsetOption(  $name) 

{@inheritdoc}

Parameters

$name

addOptionNameHandlers()

addOptionNameHandlers(callable  $handler) 

Parameters

callable $handler

resetOptions()

resetOptions() 

display()

display(  $__pug_php, array  $__pug_parameters) 

Parameters

$__pug_php
array $__pug_parameters

execute()

execute(\Closure  $execution, array  $variables) 

Bind context ($this) to a given closure if passed in local variables, and bind the current adapter as __pug_adapter variable.

Parameters

\Closure $execution

Function to be executed to render/display the rendered template.

array $variables

Render local variables.

handleOptionName()

handleOptionName(string  $name) : string

Parameters

string $name

Returns

string

filterTraversable()

filterTraversable(  $values) 

Parameters

$values

setOptionArrays()

setOptionArrays(array  $arrays, string  $functionName) : $this

Parameters

array $arrays
string $functionName

Returns

$this

mergeOptionValue()

mergeOptionValue(  $name,   $current,   $addedValue,   $functionName) 

Parameters

$name
$current
$addedValue
$functionName

setDefaultOption()

setDefaultOption(  $key,   $value) 

Parameters

$key
$value

withVariableReference()

withVariableReference(mixed  $variable,   $name, callable  $callback) : \Phug\Util\Partial\&$options

Parameters

mixed $variable
$name
callable $callback

Returns

\Phug\Util\Partial\&$options

withOptionReference()

withOptionReference(  $name, callable  $callback) : \Phug\Util\Partial\&$options

Parameters

$name
callable $callback

Returns

\Phug\Util\Partial\&$options