PHP Class FOF30\View\Compiler\Blade

Inheritance: implements FOF30\View\Compiler\CompilerInterface
Show file Open project: akeeba/fof

Protected Properties

Property Type Description
$compilers array All of the available compiler functions. Each one is called against every HTML block in the template.
$contentTags array Array of opening and closing tags for escaped echos.
$escapedTags array Array of opening and closing tags for escaped echos.
$extensions array All of the registered compiler extensions.
$footer array Array of footer lines to be added to template.
$forelseCounter integer Counter to keep track of nested forelse statements.
$isCacheable boolean Are the results of this engine cacheable?
$path string The file currently being compiled.

Public Methods

Method Description
compile ( $path, array $forceParams = [] )
compileEchoDefaults ( string $value ) : string Compile the default values for the echo statement.
compileString ( string $value ) : string Compile the given Blade template contents.
createMatcher ( string $function ) : string Get the regular expression for a generic Blade function.
createOpenMatcher ( string $function ) : string Get the regular expression for a generic Blade function.
createPlainMatcher ( string $function ) : string Create a plain Blade matcher.
extend ( callable $compiler ) : void Register a custom Blade compiler.
getContentTags ( ) : string Gets the content tags used for the compiler.
getEscapedContentTags ( ) : string Gets the escaped content tags used for the compiler.
getPath ( ) : string Get the path currently being compiled.
isCacheable ( ) : mixed Are the results of this compiler engine cacheable? If the engine makes use of the forcedParams it must return false.
setContentTags ( string $openTag, string $closeTag, boolean $escaped = false ) : void Sets the content tags used for the compiler.
setEscapedContentTags ( string $openTag, string $closeTag ) : void Sets the escaped content tags used for the compiler.
setPath ( string $path ) : void Set the path currently being compiled.

Protected Methods

Method Description
compileAppend ( string $expression ) : string Compile the append statements into valid PHP.
compileComments ( string $value ) : string Compile Blade comments into valid PHP.
compileCss ( string $expression ) : string Compile the css statements into valid PHP.
compileEach ( string $expression ) : string Compile the each statements into valid PHP.
compileEchos ( string $value ) : string Compile Blade echos into valid PHP.
compileEditor ( string $expression ) : string Compile the editor statements into valid PHP.
compileElse ( string $expression ) : string Compile the else statements into valid PHP.
compileElseif ( string $expression ) : string Compile the else-if statements into valid PHP.
compileEmpty ( string $expression ) : string Compile the forelse statements into valid PHP.
compileEndRepeatable ( string $expression ) : string Compile the end endRepeatable statements into valid PHP.
compileEndfor ( string $expression ) : string Compile the end-for statements into valid PHP.
compileEndforeach ( string $expression ) : string Compile the end-for-each statements into valid PHP.
compileEndforelse ( string $expression ) : string Compile the end-for-else statements into valid PHP.
compileEndif ( string $expression ) : string Compile the end-if statements into valid PHP.
compileEndpush ( string $expression ) : string Compile the endpush statements into valid PHP.
compileEndsection ( string $expression ) : string Compile the end-section statements into valid PHP.
compileEndunless ( string $expression ) : string Compile the end unless statements into valid PHP.
compileEndwhile ( string $expression ) : string Compile the end-while statements into valid PHP.
compileEscapedEchos ( string $value ) : string Compile the escaped echo statements.
compileEscapedEchosCallback ( array $matches ) : string Callback for compileEscapedEchos, since $this is not allowed in Closures under PHP 5.3.
compileExtends ( string $expression ) : string Compile the extends statements into valid PHP.
compileExtensions ( string $value ) : string Execute the user defined extensions.
compileFor ( string $expression ) : string Compile the for statements into valid PHP.
compileForeach ( string $expression ) : string Compile the foreach statements into valid PHP.
compileForelse ( string $expression ) : string Compile the forelse statements into valid PHP.
compileIf ( string $expression ) : string Compile the if statements into valid PHP.
compileInclude ( string $expression ) : string Compile the include statements into valid PHP.
compileInlineCss ( string $expression ) : string Compile the inlineCss statements into valid PHP.
compileInlineJs ( string $expression ) : string Compile the inlineJs statements into valid PHP.
compileJhtml ( string $expression ) : string Compile the jhtml statements into valid PHP.
compileJs ( string $expression ) : string Compile the js statements into valid PHP.
compileLang ( string $expression ) : string Compile the lang statements into valid PHP.
compileLess ( string $expression ) : string Compile the less statements into valid PHP.
compileMedia ( string $expression ) : string Compile the media statements into valid PHP.
compileModule ( string $expression ) : string Compile the module statements into valid PHP.
compileModules ( string $expression ) : string Compile the modules statements into valid PHP.
compileOverwrite ( string $expression ) : string Compile the overwrite statements into valid PHP.
compilePush ( string $expression ) : string Compile the push statements into valid PHP.
compileRegularEchos ( string $value ) : string Compile the "regular" echo statements.
compileRegularEchosCallback ( array $matches ) : string Callback for compileRegularEchos, since $this is not allowed in Closures under PHP 5.3.
compileRepeatable ( string $expression ) : string Compile the end repeatable statements into valid PHP.
compileRoute ( string $expression ) : string Compile the route statements into valid PHP.
compileSection ( string $expression ) : string Compile the section statements into valid PHP.
compileShow ( string $expression ) : string Compile the show statements into valid PHP.
compileSprintf ( string $expression ) : string Compile the sprintf statements into valid PHP.
compileStack ( string $expression ) : string Compile the stack statements into the content
compileStatements ( string $value ) : mixed Compile Blade Statements that start with "@"
compileStatementsCallback ( $match ) : string Callback for compileStatements, since $this is not allowed in Closures under PHP 5.3.
compileStop ( string $expression ) : string Compile the stop statements into valid PHP.
compileToken ( string $expression ) : string Compile the token statements into valid PHP.
compileUnless ( string $expression ) : string Compile the unless statements into valid PHP.
compileWhile ( string $expression ) : string Compile the while statements into valid PHP.
compileYield ( string $expression ) : string Compile the yield statements into valid PHP.
compileYieldRepeatable ( string $expression ) : string Compile the end yieldRepeatable statements into valid PHP.
getTags ( boolean $escaped = false ) : array Gets the tags used for the compiler.
parseToken ( array $token ) : string Parse the tokens from the template.

Method Details

compile() public method

public compile ( $path, array $forceParams = [] )
$forceParams array

compileAppend() protected method

Compile the append statements into valid PHP.
protected compileAppend ( string $expression ) : string
$expression string
return string

compileComments() protected method

Compile Blade comments into valid PHP.
protected compileComments ( string $value ) : string
$value string
return string

compileCss() protected method

Compile the css statements into valid PHP.
protected compileCss ( string $expression ) : string
$expression string
return string

compileEach() protected method

Compile the each statements into valid PHP.
protected compileEach ( string $expression ) : string
$expression string
return string

compileEchoDefaults() public method

Compile the default values for the echo statement.
public compileEchoDefaults ( string $value ) : string
$value string
return string

compileEchos() protected method

Compile Blade echos into valid PHP.
protected compileEchos ( string $value ) : string
$value string
return string

compileEditor() protected method

Compile the editor statements into valid PHP.
protected compileEditor ( string $expression ) : string
$expression string
return string

compileElse() protected method

Compile the else statements into valid PHP.
protected compileElse ( string $expression ) : string
$expression string
return string

compileElseif() protected method

Compile the else-if statements into valid PHP.
protected compileElseif ( string $expression ) : string
$expression string
return string

compileEmpty() protected method

Compile the forelse statements into valid PHP.
protected compileEmpty ( string $expression ) : string
$expression string
return string

compileEndRepeatable() protected method

Compile the end endRepeatable statements into valid PHP.
protected compileEndRepeatable ( string $expression ) : string
$expression string
return string

compileEndfor() protected method

Compile the end-for statements into valid PHP.
protected compileEndfor ( string $expression ) : string
$expression string
return string

compileEndforeach() protected method

Compile the end-for-each statements into valid PHP.
protected compileEndforeach ( string $expression ) : string
$expression string
return string

compileEndforelse() protected method

Compile the end-for-else statements into valid PHP.
protected compileEndforelse ( string $expression ) : string
$expression string
return string

compileEndif() protected method

Compile the end-if statements into valid PHP.
protected compileEndif ( string $expression ) : string
$expression string
return string

compileEndpush() protected method

Compile the endpush statements into valid PHP.
protected compileEndpush ( string $expression ) : string
$expression string
return string

compileEndsection() protected method

Compile the end-section statements into valid PHP.
protected compileEndsection ( string $expression ) : string
$expression string
return string

compileEndunless() protected method

Compile the end unless statements into valid PHP.
protected compileEndunless ( string $expression ) : string
$expression string
return string

compileEndwhile() protected method

Compile the end-while statements into valid PHP.
protected compileEndwhile ( string $expression ) : string
$expression string
return string

compileEscapedEchos() protected method

Compile the escaped echo statements.
protected compileEscapedEchos ( string $value ) : string
$value string
return string

compileEscapedEchosCallback() protected method

Callback for compileEscapedEchos, since $this is not allowed in Closures under PHP 5.3.
protected compileEscapedEchosCallback ( array $matches ) : string
$matches array
return string

compileExtends() protected method

Compile the extends statements into valid PHP.
protected compileExtends ( string $expression ) : string
$expression string
return string

compileExtensions() protected method

Execute the user defined extensions.
protected compileExtensions ( string $value ) : string
$value string
return string

compileFor() protected method

Compile the for statements into valid PHP.
protected compileFor ( string $expression ) : string
$expression string
return string

compileForeach() protected method

Compile the foreach statements into valid PHP.
protected compileForeach ( string $expression ) : string
$expression string
return string

compileForelse() protected method

Compile the forelse statements into valid PHP.
protected compileForelse ( string $expression ) : string
$expression string
return string

compileIf() protected method

Compile the if statements into valid PHP.
protected compileIf ( string $expression ) : string
$expression string
return string

compileInclude() protected method

Compile the include statements into valid PHP.
protected compileInclude ( string $expression ) : string
$expression string
return string

compileInlineCss() protected method

Compile the inlineCss statements into valid PHP.
protected compileInlineCss ( string $expression ) : string
$expression string
return string

compileInlineJs() protected method

Compile the inlineJs statements into valid PHP.
protected compileInlineJs ( string $expression ) : string
$expression string
return string

compileJhtml() protected method

Compile the jhtml statements into valid PHP.
protected compileJhtml ( string $expression ) : string
$expression string
return string

compileJs() protected method

Compile the js statements into valid PHP.
protected compileJs ( string $expression ) : string
$expression string
return string

compileLang() protected method

Compile the lang statements into valid PHP.
protected compileLang ( string $expression ) : string
$expression string
return string

compileLess() protected method

Compile the less statements into valid PHP.
protected compileLess ( string $expression ) : string
$expression string
return string

compileMedia() protected method

Compile the media statements into valid PHP.
protected compileMedia ( string $expression ) : string
$expression string
return string

compileModule() protected method

Compile the module statements into valid PHP.
protected compileModule ( string $expression ) : string
$expression string
return string

compileModules() protected method

Compile the modules statements into valid PHP.
protected compileModules ( string $expression ) : string
$expression string
return string

compileOverwrite() protected method

Compile the overwrite statements into valid PHP.
protected compileOverwrite ( string $expression ) : string
$expression string
return string

compilePush() protected method

Compile the push statements into valid PHP.
protected compilePush ( string $expression ) : string
$expression string
return string

compileRegularEchos() protected method

Compile the "regular" echo statements.
protected compileRegularEchos ( string $value ) : string
$value string
return string

compileRegularEchosCallback() protected method

Callback for compileRegularEchos, since $this is not allowed in Closures under PHP 5.3.
protected compileRegularEchosCallback ( array $matches ) : string
$matches array
return string

compileRepeatable() protected method

Compile the end repeatable statements into valid PHP.
protected compileRepeatable ( string $expression ) : string
$expression string
return string

compileRoute() protected method

Compile the route statements into valid PHP.
protected compileRoute ( string $expression ) : string
$expression string
return string

compileSection() protected method

Compile the section statements into valid PHP.
protected compileSection ( string $expression ) : string
$expression string
return string

compileShow() protected method

Compile the show statements into valid PHP.
protected compileShow ( string $expression ) : string
$expression string
return string

compileSprintf() protected method

Compile the sprintf statements into valid PHP.
protected compileSprintf ( string $expression ) : string
$expression string
return string

compileStack() protected method

Compile the stack statements into the content
protected compileStack ( string $expression ) : string
$expression string
return string

compileStatements() protected method

Compile Blade Statements that start with "@"
protected compileStatements ( string $value ) : mixed
$value string
return mixed

compileStatementsCallback() protected method

Callback for compileStatements, since $this is not allowed in Closures under PHP 5.3.
protected compileStatementsCallback ( $match ) : string
$match
return string

compileStop() protected method

Compile the stop statements into valid PHP.
protected compileStop ( string $expression ) : string
$expression string
return string

compileString() public method

Compile the given Blade template contents.
public compileString ( string $value ) : string
$value string
return string

compileToken() protected method

Compile the token statements into valid PHP.
protected compileToken ( string $expression ) : string
$expression string
return string

compileUnless() protected method

Compile the unless statements into valid PHP.
protected compileUnless ( string $expression ) : string
$expression string
return string

compileWhile() protected method

Compile the while statements into valid PHP.
protected compileWhile ( string $expression ) : string
$expression string
return string

compileYield() protected method

Compile the yield statements into valid PHP.
protected compileYield ( string $expression ) : string
$expression string
return string

compileYieldRepeatable() protected method

Compile the end yieldRepeatable statements into valid PHP.
protected compileYieldRepeatable ( string $expression ) : string
$expression string
return string

createMatcher() public method

Get the regular expression for a generic Blade function.
public createMatcher ( string $function ) : string
$function string
return string

createOpenMatcher() public method

Get the regular expression for a generic Blade function.
public createOpenMatcher ( string $function ) : string
$function string
return string

createPlainMatcher() public method

Create a plain Blade matcher.
public createPlainMatcher ( string $function ) : string
$function string
return string

extend() public method

Register a custom Blade compiler.
public extend ( callable $compiler ) : void
$compiler callable
return void

getContentTags() public method

Gets the content tags used for the compiler.
public getContentTags ( ) : string
return string

getEscapedContentTags() public method

Gets the escaped content tags used for the compiler.
public getEscapedContentTags ( ) : string
return string

getPath() public method

Get the path currently being compiled.
public getPath ( ) : string
return string

getTags() protected method

Gets the tags used for the compiler.
protected getTags ( boolean $escaped = false ) : array
$escaped boolean
return array

isCacheable() public method

Are the results of this compiler engine cacheable? If the engine makes use of the forcedParams it must return false.
public isCacheable ( ) : mixed
return mixed

parseToken() protected method

Parse the tokens from the template.
protected parseToken ( array $token ) : string
$token array
return string

setContentTags() public method

Sets the content tags used for the compiler.
public setContentTags ( string $openTag, string $closeTag, boolean $escaped = false ) : void
$openTag string
$closeTag string
$escaped boolean
return void

setEscapedContentTags() public method

Sets the escaped content tags used for the compiler.
public setEscapedContentTags ( string $openTag, string $closeTag ) : void
$openTag string
$closeTag string
return void

setPath() public method

Set the path currently being compiled.
public setPath ( string $path ) : void
$path string
return void

Property Details

$compilers protected property

All of the available compiler functions. Each one is called against every HTML block in the template.
protected array $compilers
return array

$contentTags protected property

Array of opening and closing tags for escaped echos.
protected array $contentTags
return array

$escapedTags protected property

Array of opening and closing tags for escaped echos.
protected array $escapedTags
return array

$extensions protected property

All of the registered compiler extensions.
protected array $extensions
return array

$forelseCounter protected property

Counter to keep track of nested forelse statements.
protected int $forelseCounter
return integer

$isCacheable protected property

Are the results of this engine cacheable?
protected bool $isCacheable
return boolean

$path protected property

The file currently being compiled.
protected string $path
return string