Properties

$renderer

$renderer : 

Type

$options

$options : \ArrayObject

Type

\ArrayObject

$optionNameHandlers

$optionNameHandlers : array

Type

array

$renderingFile

$renderingFile : 

Type

Methods

__construct()

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

Parameters

\Phug\Renderer $renderer
array|\ArrayObject $options

getRenderer()

getRenderer() : \Phug\Renderer

Return the renderer the adapter was constructed with.

Returns

\Phug\Renderer

captureBuffer()

captureBuffer(callable  $display) : mixed

Capture buffered output of a callable display action.

Parameters

callable $display

the action that potentially send output to the buffer.

Returns

mixed

render()

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

Return renderer HTML.

Parameters

string $php

PHP srouce code

array $parameters

variables names and values

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

cache()

cache(  $path, string  $input, callable  $rendered, boolean  $success = null) : string

Return the cached file path after cache optional process.

Parameters

$path
string $input

pug input

callable $rendered

method to compile the source into PHP

boolean $success

Returns

string

displayCached()

displayCached(string  $path, string  $input, callable  $rendered, array  $variables, boolean  $success = null) 

Display rendered template after optional cache process.

Parameters

string $path

path to pug file

string $input

pug input

callable $rendered

method to compile the source into PHP

array $variables

local variables

boolean $success

cacheFile()

cacheFile(string  $path) : boolean|integer

Cache a template file in the cache directory (even if the cache is up to date).

Returns the number of bytes written in the cache file or false if a failure occurred.

Parameters

string $path

Returns

boolean|integer

cacheFileIfChanged()

cacheFileIfChanged(string  $path) : boolean|integer

Cache a template file in the cache directory if the cache is obsolete.

Returns true if the cache is up to date and cache not change, else returns the number of bytes written in the cache file or false if a failure occurred.

Parameters

string $path

Returns

boolean|integer

cacheDirectory()

cacheDirectory(string  $directory) : array

Scan a directory recursively, compile them and save them into the cache directory.

Parameters

string $directory

the directory to search in pug

Throws

\Phug\RendererException

Returns

array —

count of cached files and error count

display()

display(  $__pug_php, array  $__pug_parameters) 

Parameters

$__pug_php
array $__pug_parameters

getRenderingFile()

getRenderingFile() 

cacheFileContents()

cacheFileContents(  $destination,   $output,   $importsMap = array()) 

Parameters

$destination
$output
$importsMap

createTemporaryFile()

createTemporaryFile() 

getCompiledFile()

getCompiledFile(  $php) 

Parameters

$php

handleOptionName()

handleOptionName(string  $name) : string

Parameters

string $name

Returns

string

isTraversable()

isTraversable(  $value) 

Parameters

$value

filterTraversable()

filterTraversable(  $values) 

Parameters

$values

setOptionArrays()

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

Parameters

array $arrays
string $functionName

Returns

$this

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

getCachePath()

getCachePath(string  $name) : string

Return a file path in the cache for a given name.

Parameters

string $name

Returns

string

hashPrint()

hashPrint(string  $input) : string

Return a hashed print from input file or content.

Parameters

string $input

Returns

string

hasExpiredImport()

hasExpiredImport(  $sourcePath,   $cachePath) : boolean

Returns true if the path has an expired imports linked.

Parameters

$sourcePath
$cachePath

Returns

boolean

isCacheUpToDate()

isCacheUpToDate(\Phug\Renderer\Adapter\&string  $path, string  $input = null) : boolean

Return true if the file or content is up to date in the cache folder, false else.

Parameters

\Phug\Renderer\Adapter\&string $path

to be filled

string $input

file or pug code

Returns

boolean

getCacheDirectory()

getCacheDirectory()