\Phug\RendererAbstractAdapter

Extending AbstractAdapter gives you helpers to create an adapter in an easier way.

It mainly brings:

  • options methods (see OptionTrait)
  • a link to the current renderer (->getRenderer())
  • a default render method based on capturing output of the display method

Summary

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

Properties

$replaceFunction

$replaceFunction : callable

Type

callable

$recursiveReplaceFunction

$recursiveReplaceFunction : callable

Type

callable

$nonDeepOptions

$nonDeepOptions : array<mixed,string>

Type

array<mixed,string>

$options

$options : \ArrayObject

Type

\ArrayObject

$optionNameHandlers

$optionNameHandlers : array

Type

array

$renderer

$renderer : 

Type

Methods

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() 

__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

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