\Box\Brainy\Compiler\ConstructsConstructAssign

Summary

Methods
Properties
Constants
compileOpen()
hasArg()
getRequiredArg()
getOptionalArg()
openTag()
closeTag()
getScope()
No public properties found
No constants found
flattenCompiledArray()
exportArray()
No protected properties found
N/A
getDefaultScope()
No private properties found
N/A

Methods

compileOpen()

compileOpen(\Box\Brainy\Compiler\TemplateCompiler  $compiler, array|null  $args) : mixed

Compiles the opening tag for a function

Parameters

\Box\Brainy\Compiler\TemplateCompiler $compiler

A compiler reference

array|null $args

Arguments

Returns

mixed

hasArg()

hasArg(array|null  $args, string  $name) : boolean

Returns whether an argument is present or not

Parameters

array|null $args

The argument list

string $name

The argument name

Returns

boolean

getRequiredArg()

getRequiredArg(array|null  $args, string  $name) : mixed

Returns an argument from the args array

Parameters

array|null $args

The argument list

string $name

The argument name

Returns

mixed

getOptionalArg()

getOptionalArg(array|null  $args, string  $name, mixed|null|void  $default = null) : mixed

Returns an argument from the args array or a default

Parameters

array|null $args

The argument list

string $name

The argument name

mixed|null|void $default

The default value

Returns

mixed

openTag()

openTag(object  $compiler, string  $openTag, mixed  $data = null) 

Push opening tag name on stack

Optionally additional data can be saved on stack

Parameters

object $compiler

compiler object

string $openTag

the opening tag's name

mixed $data

optional data saved

closeTag()

closeTag(\Box\Brainy\Compiler\TemplateCompiler  $compiler, array|string  $expectedTag) : mixed

Pop closing tag

Raise an error if this stack-top doesn't match with expected opening tags

Parameters

\Box\Brainy\Compiler\TemplateCompiler $compiler
array|string $expectedTag

the expected opening tag names

Returns

mixed —

any type the opening tag's name or saved data

getScope()

getScope(  $args, integer|null|void  $default = null) : integer

Returns the scope, given the raw scope string

Parameters

$args
integer|null|void $default

The default scope, or null

Returns

integer

flattenCompiledArray()

flattenCompiledArray(array  $arr) : array

Flattens an associative array of arrays into an associative array of strings

Parameters

array $arr

Returns

array

exportArray()

exportArray(array<mixed,string>  $arr) : string

Collapse an array of strings into an array with pre-encoded values.

This is very similar to var_export($arr, true), but the values of the associative array are not changed.

Parameters

array<mixed,string> $arr

Returns

string

getDefaultScope()

getDefaultScope(integer|null|void  $default) : string

Parameters

integer|null|void $default

Returns

string