BladeCompiler
class BladeCompiler extends Compiler implements CompilerInterface
Traits
Properties
protected Filesystem | $files | The Filesystem instance. |
from Compiler |
protected string | $cachePath | Get the cache path for the compiled views. |
from Compiler |
protected string | $lastSection | The name of the last section that was started. |
from CompilesLayouts |
protected int | $forElseCounter | Counter to keep track of nested forelse statements. |
from CompilesLoops |
protected array | $extensions | All of the registered extensions. |
|
protected array | $customDirectives | All custom "directive" handlers. |
|
protected string | $path | The file currently being compiled. |
|
protected array | $compilers | All of the available compiler functions. |
|
protected array | $rawTags | Array of opening and closing tags for raw echos. |
|
protected array | $contentTags | Array of opening and closing tags for regular echos. |
|
protected array | $escapedTags | Array of opening and closing tags for escaped echos. |
|
protected string | $echoFormat | The "regular" / legacy echo string format. |
|
protected array | $footer | Array of footer lines to be added to template. |
|
protected string | $verbatimPlaceholder | Placeholder to temporary mark the position of verbatim blocks. |
|
protected array | $verbatimBlocks | Array to temporary store the verbatim blocks found in the template. |
Methods
Compile the can statements into valid PHP.
Compile the cannot statements into valid PHP.
Compile the else-can statements into valid PHP.
Compile the else-cannot statements into valid PHP.
Compile the end-cannot statements into valid PHP.
Compile Blade comments into an empty string.
Compile the component statements into valid PHP.
Compile the end-component statements into valid PHP.
Compile the slot statements into valid PHP.
Compile the has-section statements into valid PHP.
Compile the if-auth statements into valid PHP.
Compile the if-guest statements into valid PHP.
Compile the if statements into valid PHP.
Compile the unless statements into valid PHP.
Compile the else-if statements into valid PHP.
Compile the end-unless statements into valid PHP.
Compile the if-isset statements into valid PHP.
Compile the default values for the echo statement.
Compile the each statements into valid PHP.
Compile the include statements into valid PHP.
Compile the include-if statements into valid PHP.
Compile the include-when statements into valid PHP.
Compile the inject statements into valid PHP.
Compile the extends statements into valid PHP.
Compile the section statements into valid PHP.
Compile the yield statements into valid PHP.
Compile the for-else statements into valid PHP.
Compile the for-else-empty and empty statements into valid PHP.
Compile the for-each statements into valid PHP.
Compile the break statements into valid PHP.
Compile the continue statements into valid PHP.
Compile the while statements into valid PHP.
Compile the raw PHP statements into valid PHP.
Compile the unset statements into valid PHP.
Compile the stack statements into the content.
Compile the push statements into valid PHP.
Compile the prepend statements into valid PHP.
Compile the lang statements into valid PHP.
Compile the choice statements into valid PHP.
Compile the view at the given path.
Get the path currently being compiled.
Set the path currently being compiled.
Compile the given Blade template contents.
Store the verbatim blocks and replace them with a temporary placeholder.
Replace the raw placeholders with the original code stored in the raw blocks.
Add the stored footers onto the given content.
Parse the tokens from the template.
Execute the user defined extensions.
Compile Blade statements that start with "@".
Compile a single Blade @ statement.
Call the given directive with the given value.
Strip the parentheses from the given expression.
Register a custom Blade compiler.
Get the extensions used by the compiler.
Register a handler for custom directives.
Get the list of custom directives.
Set the echo format to be used by the compiler.
Details
in
Compiler at line 33
void
__construct(Filesystem $files, string $cachePath)
Create a new compiler instance.
in
Compiler at line 49
string
getCompiledPath(string $path)
Get the path to the compiled version of a view.
in
Compiler at line 60
bool
isExpired(string $path)
Determine if the view at the given path is expired.
in
CompilesAuthorizations at line 13
protected string
compileCan(string $expression)
Compile the can statements into valid PHP.
in
CompilesAuthorizations at line 24
protected string
compileCannot(string $expression)
Compile the cannot statements into valid PHP.
in
CompilesAuthorizations at line 35
protected string
compileElsecan(string $expression)
Compile the else-can statements into valid PHP.
in
CompilesAuthorizations at line 46
protected string
compileElsecannot(string $expression)
Compile the else-cannot statements into valid PHP.
in
CompilesAuthorizations at line 56
protected string
compileEndcan()
Compile the end-can statements into valid PHP.
in
CompilesAuthorizations at line 66
protected string
compileEndcannot()
Compile the end-cannot statements into valid PHP.
in
CompilesComments at line 13
protected string
compileComments(string $value)
Compile Blade comments into an empty string.
in
CompilesComponents at line 13
protected string
compileComponent(string $expression)
Compile the component statements into valid PHP.
in
CompilesComponents at line 23
protected string
compileEndComponent()
Compile the end-component statements into valid PHP.
in
CompilesComponents at line 34
protected string
compileSlot(string $expression)
Compile the slot statements into valid PHP.
in
CompilesComponents at line 44
protected string
compileEndSlot()
Compile the end-slot statements into valid PHP.
in
CompilesConditionals at line 13
protected string
compileHasSection(string $expression)
Compile the has-section statements into valid PHP.
in
CompilesConditionals at line 24
protected string
compileAuth(string|null $guard = null)
Compile the if-auth statements into valid PHP.
in
CompilesConditionals at line 36
protected string
compileEndAuth()
Compile the end-auth statements into valid PHP.
in
CompilesConditionals at line 47
protected string
compileGuest(string|null $guard = null)
Compile the if-guest statements into valid PHP.
in
CompilesConditionals at line 59
protected string
compileEndGuest()
Compile the end-guest statements into valid PHP.
in
CompilesConditionals at line 70
protected string
compileIf(string $expression)
Compile the if statements into valid PHP.
in
CompilesConditionals at line 81
protected string
compileUnless(string $expression)
Compile the unless statements into valid PHP.
in
CompilesConditionals at line 92
protected string
compileElseif(string $expression)
Compile the else-if statements into valid PHP.
in
CompilesConditionals at line 102
protected string
compileElse()
Compile the else statements into valid PHP.
in
CompilesConditionals at line 112
protected string
compileEndif()
Compile the end-if statements into valid PHP.
in
CompilesConditionals at line 122
protected string
compileEndunless()
Compile the end-unless statements into valid PHP.
in
CompilesConditionals at line 133
protected string
compileIsset(string $expression)
Compile the if-isset statements into valid PHP.
in
CompilesConditionals at line 143
protected string
compileEndIsset()
Compile the end-isset statements into valid PHP.
in
CompilesEchos at line 13
protected string
compileEchos(string $value)
Compile Blade echos into valid PHP.
in
CompilesEchos at line 27
protected array
getEchoMethods()
Get the echo methods in the proper order for compilation.
in
CompilesEchos at line 42
protected string
compileRawEchos(string $value)
Compile the "raw" echo statements.
in
CompilesEchos at line 61
protected string
compileRegularEchos(string $value)
Compile the "regular" echo statements.
in
CompilesEchos at line 82
protected string
compileEscapedEchos(string $value)
Compile the escaped echo statements.
in
CompilesEchos at line 101
string
compileEchoDefaults(string $value)
Compile the default values for the echo statement.
in
CompilesIncludes at line 13
protected string
compileEach(string $expression)
Compile the each statements into valid PHP.
in
CompilesIncludes at line 24
protected string
compileInclude(string $expression)
Compile the include statements into valid PHP.
in
CompilesIncludes at line 37
protected string
compileIncludeIf(string $expression)
Compile the include-if statements into valid PHP.
in
CompilesIncludes at line 50
protected string
compileIncludeWhen(string $expression)
Compile the include-when statements into valid PHP.
in
CompilesInjections at line 13
protected string
compileInject(string $expression)
Compile the inject statements into valid PHP.
in
CompilesLayouts at line 22
protected string
compileExtends(string $expression)
Compile the extends statements into valid PHP.
in
CompilesLayouts at line 39
protected string
compileSection(string $expression)
Compile the section statements into valid PHP.
in
CompilesLayouts at line 51
protected string
compileParent()
Replace the @parent directive to a placeholder.
in
CompilesLayouts at line 62
protected string
compileYield(string $expression)
Compile the yield statements into valid PHP.
in
CompilesLayouts at line 72
protected string
compileShow()
Compile the show statements into valid PHP.
in
CompilesLayouts at line 82
protected string
compileAppend()
Compile the append statements into valid PHP.
in
CompilesLayouts at line 92
protected string
compileOverwrite()
Compile the overwrite statements into valid PHP.
in
CompilesLayouts at line 102
protected string
compileStop()
Compile the stop statements into valid PHP.
in
CompilesLayouts at line 112
protected string
compileEndsection()
Compile the end-section statements into valid PHP.
in
CompilesLoops at line 20
protected string
compileForelse(string $expression)
Compile the for-else statements into valid PHP.
in
CompilesLoops at line 43
protected string
compileEmpty(string $expression)
Compile the for-else-empty and empty statements into valid PHP.
in
CompilesLoops at line 59
protected string
compileEndforelse()
Compile the end-for-else statements into valid PHP.
in
CompilesLoops at line 69
protected string
compileEndEmpty()
Compile the end-empty statements into valid PHP.
in
CompilesLoops at line 80
protected string
compileFor(string $expression)
Compile the for statements into valid PHP.
in
CompilesLoops at line 91
protected string
compileForeach(string $expression)
Compile the for-each statements into valid PHP.
in
CompilesLoops at line 112
protected string
compileBreak(string $expression)
Compile the break statements into valid PHP.
in
CompilesLoops at line 129
protected string
compileContinue(string $expression)
Compile the continue statements into valid PHP.
in
CompilesLoops at line 145
protected string
compileEndfor()
Compile the end-for statements into valid PHP.
in
CompilesLoops at line 155
protected string
compileEndforeach()
Compile the end-for-each statements into valid PHP.
in
CompilesLoops at line 166
protected string
compileWhile(string $expression)
Compile the while statements into valid PHP.
in
CompilesLoops at line 176
protected string
compileEndwhile()
Compile the end-while statements into valid PHP.
in
CompilesRawPhp at line 13
protected string
compilePhp(string $expression)
Compile the raw PHP statements into valid PHP.
in
CompilesRawPhp at line 23
protected string
compileEndphp()
Compile end-php statements into valid PHP.
in
CompilesRawPhp at line 34
protected string
compileUnset(string $expression)
Compile the unset statements into valid PHP.
in
CompilesStacks at line 13
protected string
compileStack(string $expression)
Compile the stack statements into the content.
in
CompilesStacks at line 24
protected string
compilePush(string $expression)
Compile the push statements into valid PHP.
in
CompilesStacks at line 34
protected string
compileEndpush()
Compile the end-push statements into valid PHP.
in
CompilesStacks at line 45
protected string
compilePrepend(string $expression)
Compile the prepend statements into valid PHP.
in
CompilesStacks at line 55
protected string
compileEndprepend()
Compile the end-prepend statements into valid PHP.
in
CompilesTranslations at line 13
protected string
compileLang(string $expression)
Compile the lang statements into valid PHP.
in
CompilesTranslations at line 29
protected string
compileEndlang()
Compile the end-lang statements into valid PHP.
in
CompilesTranslations at line 40
protected string
compileChoice(string $expression)
Compile the choice statements into valid PHP.
at line 113
void
compile(string $path = null)
Compile the view at the given path.
at line 131
string
getPath()
Get the path currently being compiled.
at line 142
void
setPath(string $path)
Set the path currently being compiled.
at line 153
string
compileString(string $value)
Compile the given Blade template contents.
at line 190
protected string
storeVerbatimBlocks(string $value)
Store the verbatim blocks and replace them with a temporary placeholder.
at line 205
protected string
restoreVerbatimBlocks(string $result)
Replace the raw placeholders with the original code stored in the raw blocks.
at line 222
protected string
addFooters(string $result)
Add the stored footers onto the given content.
at line 234
protected string
parseToken(array $token)
Parse the tokens from the template.
at line 253
protected string
compileExtensions(string $value)
Execute the user defined extensions.
at line 268
protected string
compileStatements(string $value)
Compile Blade statements that start with "@".
at line 283
protected string
compileStatement(array $match)
Compile a single Blade @ statement.
at line 303
protected string
callCustomDirective(string $name, string|null $value)
Call the given directive with the given value.
at line 318
string
stripParentheses(string $expression)
Strip the parentheses from the given expression.
at line 333
void
extend(callable $compiler)
Register a custom Blade compiler.
at line 343
array
getExtensions()
Get the extensions used by the compiler.
at line 355
void
directive(string $name, callable $handler)
Register a handler for custom directives.
at line 365
array
getCustomDirectives()
Get the list of custom directives.
at line 376
void
setEchoFormat(string $format)
Set the echo format to be used by the compiler.