Properties

$modules

$modules : \Phug\Util\Partial\array<ModuleInterface>

Type

\Phug\Util\Partial\array

$formats

$formats : array

Type

array

$mixinsPreCalled

$mixinsPreCalled : array

Type

array

$destructors

$destructors : \SplObjectStorage

Type

\SplObjectStorage

$mixinsAllRequired

$mixinsAllRequired : boolean

Type

boolean

$debugNodes

$debugNodes : array

Type

array

Methods

setLevel()

setLevel(integer  $level) : $this

Parameters

integer $level

Returns

$this

hasModule()

hasModule(string|\Phug\Util\ModuleInterface  $module) : boolean

Parameters

string|\Phug\Util\ModuleInterface $module

Returns

boolean

getModules()

getModules() : \Phug\Util\Partial\array<ModuleInterface>

Returns

\Phug\Util\Partial\array

getStaticModules()

getStaticModules() : \Phug\Util\Partial\array<string>

Returns

\Phug\Util\Partial\array

addModule()

addModule(string|\Phug\Util\ModuleInterface  $module) : $this

Parameters

string|\Phug\Util\ModuleInterface $module

Returns

$this

addModules()

addModules(\Phug\Util\Partial\array<string|\Phug\Util\Partial\ModuleInterface>  $modules) : $this

Parameters

\Phug\Util\Partial\array $modules

Returns

$this

removeModule()

removeModule(string|\Phug\Util\ModuleInterface  $module) : $this

Parameters

string|\Phug\Util\ModuleInterface $module

Returns

$this

getModuleBaseClassName()

getModuleBaseClassName() 

__construct()

__construct(array|null  $options = null) 

Creates a new formatter instance.

The formatter will turn DocumentNode tree into a PHTML string

Parameters

array|null $options

the options array

storeDebugNode()

storeDebugNode(\Phug\Parser\NodeInterface  $node) : integer

Store a node in a debug list and return the allocated index for it.

Parameters

\Phug\Parser\NodeInterface $node

Returns

integer

debugIdExists()

debugIdExists(integer  $nodeId) : boolean

Parameters

integer $nodeId

Returns

boolean

getNodeFromDebugId()

getNodeFromDebugId(integer  $nodeId) : \Phug\Parser\NodeInterface

Parameters

integer $nodeId

Returns

\Phug\Parser\NodeInterface

getDebugError()

getDebugError(\Throwable  $error, string  $code, string  $path = null) : \Phug\Util\Exception\LocatedException|\Throwable

Return a formatted error linked to pug source.

Parameters

\Throwable $error
string $code
string $path

Throws

\Throwable

Returns

\Phug\Util\Exception\LocatedException|\Throwable

setFormatHandler()

setFormatHandler(string  $doctype, \Phug\Formatter\FormatInterface|string  $format) : $this

Set the format handler for a given doctype identifier.

Parameters

string $doctype

doctype identifier

\Phug\Formatter\FormatInterface|string $format

format handler

Returns

$this

initFormats()

initFormats() : $this

Initialize the formats list and dependencies.

Returns

$this

getFormatInstance()

getFormatInstance(  $format = null) : \Phug\Formatter\FormatInterface

Return current format as instance of FormatInterface.

Parameters

$format

Returns

\Phug\Formatter\FormatInterface

handleCode()

handleCode(string  $phpCode) : string

Handle PHP code with the pattern php_handle_code.

Parameters

string $phpCode

Returns

string

formatCode()

formatCode(string  $code, boolean  $checked = false, boolean  $noTransformation = false) : string

Format a code with transform_expression and tokens handlers.

Parameters

string $code

input code

boolean $checked

test variables

boolean $noTransformation

disable transform_expression

Returns

string

setFormat()

setFormat(string  $doctype) : $this

Set a format name as the current or fallback to default if not available.

Parameters

string $doctype

format identifier

Returns

$this

getDestructors()

getDestructors() : \SplObjectStorage

Returns

\SplObjectStorage

requireAllMixins()

requireAllMixins() : $this

Returns

$this

requireMixin()

requireMixin(  $name) : $this

Parameters

$name

Returns

$this

formatDependencies()

formatDependencies() 

Create/reset the dependency injector.

getDependencyStorage()

getDependencyStorage(string  $name) : string

Parameters

string $name

dependency name

Returns

string

format()

format(\Phug\Formatter\ElementInterface  $element, \Phug\Formatter\FormatInterface|null  $format = null) : string

Entry point of the Formatter, typically waiting for a DocumentElement and a format, to return a string with HTML and PHP nested.

Parameters

\Phug\Formatter\ElementInterface $element
\Phug\Formatter\FormatInterface|null $format

Returns

string

fileContains()

fileContains(  $file,   $needle) 

Parameters

$file
$needle

getSourceLine()

getSourceLine(  $error) 

Parameters

$error