\Phug\Renderer\PartialAdapterTrait

Trait AdapterTrait: require ModuleContainerInterface to be implemented.

Summary

Methods
Properties
Constants
initAdapter()
getAdapter()
setAdapterClassName()
getNewSandBox()
callAdapter()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
expectCacheAdapter()
getSandboxCall()
handleHtmlEvent()
$adapter
N/A

Properties

Methods

initAdapter()

initAdapter() : $this

Create/reset if needed the adapter.

Throws

\Phug\RendererException

Returns

$this

getAdapter()

getAdapter() : \Phug\Renderer\AdapterInterface

Get the current adapter used (file, stream, eval or custom adapter provided).

Returns

\Phug\Renderer\AdapterInterface

setAdapterClassName()

setAdapterClassName(  $adapterClassName) : $this

Set the current adapter engine (file, stream, eval or custom adapter provided).

Parameters

$adapterClassName

Returns

$this

getNewSandBox()

getNewSandBox(callable  $action) : \Phug\Util\SandBox

Return a sandbox with renderer settings for a given callable action.

Parameters

callable $action

Returns

\Phug\Util\SandBox

callAdapter()

callAdapter(string  $method, string  $path, string  $input, callable  $getSource, array  $parameters) : boolean|string|null

Call a method on the adapter (render, renderFile, display, displayFile, more methods can be available depending on the adapter user).

Parameters

string $method
string $path
string $input
callable $getSource
array $parameters

Throws

\Phug\RendererException|\Throwable

Returns

boolean|string|null

expectCacheAdapter()

expectCacheAdapter() 

Fallback to FileAdapter if the current adapter (typically an adapter) is not a cache adapter (implement CacheInterface).

getSandboxCall()

getSandboxCall(string  $source, string  $method, string  $path, string  $input, callable  $getSource, array  $parameters) : \Phug\Util\SandBox

Call an adapter method inside a sandbox and return the SandBox result.

Parameters

string $source
string $method
string $path
string $input
callable $getSource
array $parameters

Returns

\Phug\Util\SandBox

handleHtmlEvent()

handleHtmlEvent(\Phug\Renderer\Event\HtmlEvent  $htmlEvent, array  $parameters,   $path, callable  $getSource) : mixed

Handle an html event and accordingly to it, display, returns or throw the result/error.

Parameters

\Phug\Renderer\Event\HtmlEvent $htmlEvent
array $parameters
$path
callable $getSource

Throws

\Phug\RendererException|\Throwable

Returns

mixed