Documentation

BladeOne
in package

BladeOne - A Blade Template implementation in a single file

Tags
copyright

Copyright (c) 2016-2019 Jorge Patricio Castro Castillo MIT License. Don't delete this comment, its part of the license. Part of this code is based in the work of Laravel PHP Components.

version
3.31

2019-08-09

link
https://github.com/EFTEC/BladeOne

Table of Contents

MODE_AUTO  = 0
MODE_DEBUG  = 5
MODE_FAST  = 2
MODE_SLOW  = 1
$authAnyCallBack  : callable
$authCallBack  : callable
$csrf_token  : string
$currentPermission  : array<string|int, string>
$currentRole  : string
$currentUser  : string
$dictionary  : array<string|int, mixed>
$errorCallBack  : callable
$missingLog  : string
$phpTag  : string
$assetDict  : array<string|int, string>
$baseUrl  : string
$compiledPath  : string
$compileExtension  : string
$compilers  : array<string|int, mixed>
$componentData  : array<string|int, mixed>
$componentStack  : array<string|int, mixed>
$conditions  : array<string|int, mixed>
$contentTags  : array<string|int, mixed>
$customDirectives  : array<string|int, mixed>
$customDirectivesRT  : array<string|int, bool>
$echoFormat  : string
$escapedTags  : array<string|int, mixed>
$extensions  : array<string|int, mixed>
$fileExtension  : string
$fileName  : string
$footer  : array<string|int, mixed>
$forelseCounter  : int
$injectResolver  : callable
$isCompiled  : bool
$isRunFast  : bool
$loopsStack  : array<string|int, mixed>
$mode  : int
Indicates the compile mode.
$optimize  : bool
$PARENTKEY  : string
$pushes  : array<string|int, mixed>
$pushStack  : array<string|int, mixed>
$rawTags  : array<string|int, mixed>
$relativePath  : string
$renderCount  : int
$sections  : array<string|int, mixed>
$sectionStack  : array<string|int, mixed>
$slots  : array<string|int, mixed>
$slotStack  : array<string|int, mixed>
$templatePath  : string|array<string|int, string>
$uidCounter  : int
$variables  : array<string|int, mixed>
$variablesGlobal  : null
$verbatimBlocks  : array<string|int, mixed>
$verbatimPlaceholder  : string
$firstCaseInSwitch  : bool
$switchCount  : int
__call()  : mixed
__construct()  : mixed
Bob the constructor.
_e()  : string
Tries to translate the word if its in the array defined by BladeOneLang::$dictionary If the operation fails then, it returns the original expression without translation.
_ef()  : string
Its the same than @_e, however it parses the text (using sprintf).
_n()  : string
if num is more than one then it returns the phrase in plural, otherwise the phrase in singular.
addAssetDict()  : mixed
It add an alias to the link of the resources.<br> addAssetDict('name','url/res.jpg')<br> addAssetDict(['name'=>'url/res.jpg','name2'=>'url/res2.jpg');
addInclude()  : mixed
addLoop()  : void
Add new loop to the stack.
appendSection()  : string
Stop injecting content into a section and append it.
check()  : bool
Check the result of a condition.
compile()  : bool|string
Compile the view at the given path.
compilePrepend()  : string
Compile the push statements into valid PHP.
compilePush()  : string
Compile the push statements into valid PHP.
compilePushOnce()  : string
Compile the push statements into valid PHP.
contains()  : bool
Determine if a given string contains a given substring.
convertArg()  : string
Convert an array such as ["class1"=>"myclass","style="mystyle"] to class1='myclass' style='mystyle' string
csrfIsValid()  : bool
Validates if the csrf token is valid or not.
directive()  : void
Register a handler for custom directives.
directiveRT()  : void
Register a handler for custom directives for run at runtime
dump()  : mixed
e()  : string
Escape HTML entities in a string.
endSlot()  : void
Save the slot content for rendering.
exists()  : bool
Determine if the given key exists in the provided array.
extend()  : void
Register a custom Blade compiler.
first()  : mixed
Return the first element in an array passing a given truth test.
get()  : mixed
Get an item from an array using "dot" notation.
getBaseUrl()  : string
Returns the current base url
getCompiledExtension()  : string
Get the file extension for template files.
getCompiledFile()  : string
Get the full path of the compiled file.
getContentTags()  : array<string|int, mixed>
Gets the content tags used for the compiler.
getCsrfToken()  : string
Returns the current token. if there is not a token then it generates a new one.
getCurrentPermission()  : array<string|int, string>
getCurrentRole()  : string
getCurrentUser()  : string
getEscapedContentTags()  : array<string|int, mixed>
Gets the escaped content tags used for the compiler.
getFile()  : string
Get the contents of a file.
getFileExtension()  : string
Get the file extension for template files.
getFirstLoop()  : array<string|int, mixed>|object
Get an instance of the first loop in the stack.
getLoopStack()  : array<string|int, mixed>
Get the entire loop stack.
getMode()  : mixed
Get the mode of the engine.See BladeOne::MODE_* constants
getPhpTag()  : string
getTemplateFile()  : string
Get the full path of the template file.
includeFirst()  : string
includeWhen()  : string
incrementLoopIndices()  : void
Increment the top loop's indices.
ipClient()  : mixed
isExpired()  : bool
Determine if the view is expired.
last()  : mixed
Return the last element in an array passing a given truth test.
popLoop()  : void
Pop a loop from the top of the loop stack.
regenerateToken()  : mixed
Regenerates the csrf token and stores in the session.
registerIfStatement()  : string
Register an "if" statement directive.
relative()  : string
it calculates the relative path of a web.<br> This function uses the current url and the baseurl
renderComponent()  : string
Render the current component.
renderEach()  : string
Get the rendered contents of a partial from a loop.
run()  : string
run the blade engine. It returns the result of the code.
runChild()  : string
Macro of function run
runString()  : string
run the blade engine. It returns the result of the code.
setAnyFunction()  : mixed
It sets the callback function for authentication. It is used by @canany
setAuth()  : mixed
Authentication. Sets with a user,role and permission
setBaseUrl()  : mixed
It sets the base url and it also calculates the relative path.<br> The base url is calculated to determine the relativity of the resources.<br> The trailing slash is removed automatically if it's present.
setCanFunction()  : mixed
It sets the callback function for authentication. It is used by @can and @cannot
setCompiledExtension()  : mixed
Set the file extension for the compiled files.
setContentTags()  : void
Sets the content tags used for the compiler.
setCurrentPermission()  : mixed
setCurrentRole()  : mixed
setCurrentUser()  : mixed
setErrorFunction()  : mixed
It sets the callback function for errors. It is used by @error
setEscapedContentTags()  : void
Sets the escaped content tags used for the compiler.
setFileExtension()  : mixed
Set the file extension for the template files.
setInjectResolver()  : mixed
Sets the function used for resolving classes with inject.
setIsCompiled()  : BladeOne
If false then the file is not compiled and it is executed directly from the memory.<br> By default the value is true<br> It also sets the mode to MODE_SLOW
setMode()  : void
Set the compile mode
setOptimize()  : BladeOne
If true then it optimizes the result (it removes tab and extra spaces).
setPath()  : mixed
It sets the template and compile path (without trailing slash).
setPhpTag()  : mixed
share()  : mixed
Adds a global variable
showError()  : string
Show an error in the web.
slot()  : void
Start the slot rendering process.
splitForeach()  : string
Get the string contents of a push section.
startComponent()  : void
Start a component rendering process.
startPrepend()  : void
Start injecting content into a push section.
startPush()  : void
Start injecting content into a push section.
startSection()  : void
Start injecting content into a section.
startsWith()  : bool
Determine if a given string starts with a given substring.
stopPrepend()  : string
Stop injecting content into a push section.
stopPush()  : string
Stop injecting content into a push section.
stopSection()  : string
Stop injecting content into a section.
stripParentheses()  : string
Strip the parentheses from the given expression.
stripQuotes()  : null|string|array<string|int, string>
Remove first and end quote from a quoted string of text
value()  : mixed
Return the default value of the given value.
yieldContent()  : string
Get the string contents of a section.
yieldPushContent()  : string
Get the string contents of a push section.
yieldSection()  : string
Stop injecting content into a section and return its contents.
compile_e()  : string
Used for @_e directive.
compile_ef()  : string
Used for @_ef directive.
compile_n()  : string
Used for @_n directive.
compileAppend()  : string
Compile the append statements into valid PHP.
compileAsset()  : mixed
compileAuth()  : string
Compile the auth statements into valid PHP.
compileBreak()  : string
Compile the break statements into valid PHP.
compileCan()  : mixed
compileCanAny()  : string
Compile the canany statements into valid PHP.
compileCannot()  : mixed
compileCase()  : string
Execute the case tag.
compileComments()  : string
Compile Blade comments into valid PHP.
compileComponent()  : string
Compile the component statements into valid PHP.
compileContinue()  : string
Compile the continue statements into valid PHP.
compilecsrf()  : mixed
compileDd()  : mixed
compileDefault()  : string
default tag used for switch/case
compileDump()  : mixed
compileEach()  : string
Compile the each statements into valid PHP.
compileEchoDefaults()  : string
Compile the default values for the echo statement.
compileEchos()  : string
Compile Blade echos into valid PHP.
compileElse()  : string
Compile the else statements into valid PHP.
compileElseAuth()  : string
Compile the elseauth statements into valid PHP.
compileElseCan()  : string
Compile the else statements into valid PHP.
compileElseCanAny()  : string
Compile the else statements into valid PHP.
compileElseCannot()  : string
Compile the elsecannot statements into valid PHP.
compileElseGuest()  : string
Compile the else statements into valid PHP.
compileElseif()  : string
Compile the else-if statements into valid PHP.
compileEmpty()  : string
Compile the forelse statements into valid PHP.
compileEndAuth()  : string
Compile the end-auth statements into valid PHP.
compileEndcan()  : string
Compile the end-can statements into valid PHP.
compileEndcanany()  : string
Compile the end-can statements into valid PHP.
compileEndcannot()  : string
Compile the end-cannot statements into valid PHP.
compileEndComponent()  : string
Compile the end-component statements into valid PHP.
compileEndEmpty()  : mixed
compileEndError()  : string
Compile the end-error statements into valid PHP.
compileEndfor()  : string
Compile the end-for statements into valid PHP.
compileEndforeach()  : string
Compile the end-for-each statements into valid PHP.
compileEndforelse()  : string
Compile the end-for-else statements into valid PHP.
compileEndGuest()  : string
/** Compile the end-auth statements into valid PHP.
compileEndif()  : string
Compile the end-if statements into valid PHP.
compileEndIsset()  : mixed
compileEndphp()  : string
Compile end-php statement into valid PHP.
compileEndPrepend()  : string
Compile the endpush statements into valid PHP.
compileEndpush()  : string
Compile the endpush statements into valid PHP.
compileEndpushOnce()  : string
Compile the endpushonce statements into valid PHP.
compileEndsection()  : string
Compile the end-section statements into valid PHP.
compileEndSlot()  : string
Compile the end-slot statements into valid PHP.
compileEndSwitch()  : mixed
compileEndunless()  : string
Compile the endunless statements into valid PHP.
compileEndwhile()  : string
Compile the end-while statements into valid PHP.
compileError()  : string
compileEscapedEchos()  : string
Compile the escaped echo statements.
compileExtends()  : string
Compile the extends statements into valid PHP.
compileExtensions()  : string
Execute the user defined extensions.
compileFor()  : string
Compile the for statements into valid PHP.
compileForeach()  : string
Compile the foreach statements into valid PHP.
compileForelse()  : string
Compile the forelse statements into valid PHP.
compileGuest()  : string
Compile the guest statements into valid PHP.
compileHasSection()  : string
Compile the has section statements into valid PHP.
compileIf()  : string
Compile the if statements into valid PHP.
compileInclude()  : string
Compile the include statements into valid PHP.
compileIncludeFast()  : string
It loads an compiled template and paste inside the code.<br> It uses more disk space but it decreases the number of includes<br>
compileIncludeFirst()  : string
Compile the includefirst statement
compileIncludeIf()  : string
Compile the include statements into valid PHP.
compileIncludeWhen()  : string
Compile the include statements into valid PHP.
compileInject()  : string
Compile while statements into valid PHP.
compileIsset()  : mixed
compileJSon()  : mixed
compileMethod()  : mixed
compileOverwrite()  : string
Compile the overwrite statements into valid PHP.
compileParent()  : string
Execute the @parent command. This operation works in tandem with extendSection
compilePhp()  : string
Compile the raw PHP statements into valid PHP.
compileRawEchos()  : string
Compile the "raw" echo statements.
compileRegularEchos()  : string
Compile the "regular" echo statements.
compileRelative()  : mixed
compileSection()  : string
Compile the section statements into valid PHP.
compileSet()  : mixed
compileShow()  : string
Compile the show statements into valid PHP.
compileSlot()  : string
Compile the slot statements into valid PHP.
compileSplitForeach()  : string
Compile a split of a foreach cycle. Used for example when we want to separate limites each "n" elements.
compileStack()  : string
Compile the stack statements into the content.
compileStatementCustom()  : string
For compile custom directive at runtime.
compileStatements()  : mixed
Compile Blade statements that start with "@".
compileStop()  : string
Compile the stop statements into valid PHP.
compileString()  : string
Compile the given Blade template contents.
compileSwitch()  : mixed
compileUnless()  : string
Compile the unless statements into valid PHP.
compileUnset()  : string
Compile the unset statements into valid PHP.
compileUser()  : string
Compile the User statements into valid PHP.
compileWhile()  : string
Compile the while statements into valid PHP.
compileYield()  : string
Compile the yield statements into valid PHP.
componentData()  : array<string|int, mixed>
Get the data for the given component.
convertArgCallBack()  : mixed
currentComponent()  : int
Get the index for the current component.
evaluatePath()  : string
Evaluates a compiled file using the current variables
evaluateText()  : string
Evaluates a text (string) using the current variables
extendPush()  : void
Append content to a given push section.
extendSection()  : void
Append content to a given section.
extendStartPush()  : void
Append content to a given push section.
getEchoMethods()  : array<string|int, mixed>
Get the echo methods in the proper order for compilation.
getTags()  : array<string|int, mixed>
Gets the tags used for the compiler.
handleViewException()  : void
Handle a view exception.
injectClass()  : mixed
Resolve a given class using the injectResolver callable.
parseToken()  : string
Parse the tokens from the template.
restoreVerbatimBlocks()  : string
Replace the raw placeholders with the original code stored in the raw blocks.
storeVerbatimBlocks()  : string
Store the verbatim blocks and replace them with a temporary placeholder.
locateTemplate()  : string
Find template file with the given name in all template paths in the order the paths were written
missingTranslation()  : mixed
Log a missing translation into the file $this->missingLog.<br> If the file is not defined, then it doesn't write the log.
runInternal()  : string
run the blade engine. It returns the result of the code.
templateExist()  : bool
Returns true if the template exists. Otherwise it returns false

Constants

MODE_AUTO

public int MODE_AUTO = 0

BladeOne reads if the compiled file has changed. If has changed,then the file is replaced.

MODE_DEBUG

public int MODE_DEBUG = 5

DEBUG MODE, the file is always compiled and the filename is identifiable.

MODE_FAST

public int MODE_FAST = 2

The compiled file is never replaced. It's fast and it's useful for production.

MODE_SLOW

public int MODE_SLOW = 1

Then compiled file is always replaced. It's slow and it's useful for development.

Properties

$authAnyCallBack

public callable $authAnyCallBack

callback of validation. It is used for @canany

$authCallBack

public callable $authCallBack

callback of validation. It is used for @can,@cannot

$csrf_token

public string $csrf_token = ""

security token

$currentPermission

public array<string|int, string> $currentPermission = []

Current permission. Example ['edit','add']

$currentRole

public string $currentRole = null

Current role. Example: admin

$currentUser

public string $currentUser = null

Current user. Example: john

$dictionary

public static array<string|int, mixed> $dictionary = []

Hold dictionary of translations

$errorCallBack

public callable $errorCallBack

callback of errors. It is used for @error

$missingLog

public string $missingLog = ''

The path to the missing translations log file. If empty then every missing key is not saved.

$phpTag

public string $phpTag = '<?php '

PHP tag. You could use <?php or <? (if shorttag is active in php.ini)

$assetDict

protected array<string|int, string> $assetDict

Dictionary of assets

$baseUrl

protected string $baseUrl = '.'

The main url of the system. Don't use raw $_SERVER values unless sanitized

$compiledPath

protected string $compiledPath

Get the compiled path for the compiled views. If null then it uses the default path

$compileExtension

protected string $compileExtension = '.bladec'

the extension of the compiled file.

$compilers

protected array<string|int, mixed> $compilers = ['Extensions', 'Statements', 'Comments', 'Echos']

All of the available compiler functions.

$componentData

protected array<string|int, mixed> $componentData = []

The original data passed to the component.

$componentStack

protected array<string|int, mixed> $componentStack = []

The components being rendered.

$conditions

protected array<string|int, mixed> $conditions = []

Used for conditional if.

$contentTags

protected array<string|int, mixed> $contentTags = ['{{', '}}']

Array of opening and closing tags for regular echos.

$customDirectives

protected array<string|int, mixed> $customDirectives = []

Custom "directive" dictionary. Those directives run at compile time.

$customDirectivesRT

protected array<string|int, bool> $customDirectivesRT = []

Custom directive dictionary. Those directives run at runtime.

$echoFormat

protected string $echoFormat = 'static::e(%s)'

The "regular" / legacy echo string format.

$escapedTags

protected array<string|int, mixed> $escapedTags = ['{{{', '}}}']

Array of opening and closing tags for escaped echos.

$extensions

protected array<string|int, mixed> $extensions = []

All of the registered extensions.

$fileExtension

protected string $fileExtension = '.blade.php'

File extension for the template files.

$fileName

protected string $fileName

The template currently being compiled. For example "folder.template"

protected array<string|int, mixed> $footer = []

Lines that will be added at the footer of the template

$forelseCounter

protected int $forelseCounter = 0

Counter to keep track of nested forelse statements.

$injectResolver

protected callable $injectResolver

Function used for resolving injected classes.

$isCompiled

protected bool $isCompiled = true

if false, then the template is not compiled (but executed on memory).

$isRunFast

protected bool $isRunFast = false

$loopsStack

protected array<string|int, mixed> $loopsStack = []

The stack of in-progress loops.

$mode

Indicates the compile mode.

protected int $mode

if the constant BLADEONE_MODE is defined, then it is used instead of this field.

MODE_*

$optimize

protected bool $optimize = true

if true then it removes tabs and unneeded spaces

$PARENTKEY

protected string $PARENTKEY = '@parentXYZABC'

tag unique

$pushes

protected array<string|int, mixed> $pushes = []

All of the finished, captured push sections.

$pushStack

protected array<string|int, mixed> $pushStack = []

The stack of in-progress push sections.

$rawTags

protected array<string|int, mixed> $rawTags = ['{!!', '!!}']

Array of opening and closing tags for raw echos.

$relativePath

protected string $relativePath = ""

it is a relative path calculated between baseUrl and the current url. Example ../../

$renderCount

protected int $renderCount = 0

The number of active rendering operations.

$sections

protected array<string|int, mixed> $sections = []

All of the finished, captured sections.

$sectionStack

protected array<string|int, mixed> $sectionStack = []

The stack of in-progress sections.

$slots

protected array<string|int, mixed> $slots = []

The slot contents for the component.

$slotStack

protected array<string|int, mixed> $slotStack = []

The names of the slots being rendered.

$templatePath

protected string|array<string|int, string> $templatePath

Get the template path for the compiled views.

$uidCounter

protected int $uidCounter = 0

Unique counter. It's used for extends

$variables

protected array<string|int, mixed> $variables = []

Dictionary of variables

$variablesGlobal

protected null $variablesGlobal = []

Dictionary of global variables

$verbatimBlocks

protected array<string|int, mixed> $verbatimBlocks = []

Array to temporary store the verbatim blocks found in the template.

$verbatimPlaceholder

protected string $verbatimPlaceholder = '$__verbatim__$'

Placeholder to temporary mark the position of verbatim blocks.

$firstCaseInSwitch

private bool $firstCaseInSwitch = true

Indicates if the switch is recently open

$switchCount

private int $switchCount = 0

Indicates the number of open switches

Methods

__call()

public __call(string $name,  $args) : mixed
Parameters
$name : string
$args :

[]

Tags
throws
BadMethodCallException
Return values
mixed

__construct()

Bob the constructor.

public __construct([string|array<string|int, mixed> $templatePath = null ][, string $compiledPath = null ], int $mode) : mixed

The folder at $compiledPath is created in case it doesn't exist.

Parameters
$templatePath : string|array<string|int, mixed> = null

If null then it uses (caller_folder)/views

$compiledPath : string = null

If null then it uses (caller_folder)/compiles

$mode : int

=[BladeOne::MODE_AUTO,BladeOne::MODE_DEBUG,BladeOne::MODE_FAST,BladeOne::MODE_SLOW][$i]

Return values
mixed

_e()

Tries to translate the word if its in the array defined by BladeOneLang::$dictionary If the operation fails then, it returns the original expression without translation.

public _e( $phrase) : string
Parameters
$phrase :
Return values
string

_ef()

Its the same than @_e, however it parses the text (using sprintf).

public _ef( $phrase) : string

If the operation fails then, it returns the original expression without translation.

Parameters
$phrase :
Return values
string

_n()

if num is more than one then it returns the phrase in plural, otherwise the phrase in singular.

public _n(string $phrase, string $phrases, int $num) : string

Note: the translation should be as follow: $msg['Person']='Person' $msg=['Person']['p']='People'

Parameters
$phrase : string
$phrases : string
$num : int
Return values
string

addAssetDict()

It add an alias to the link of the resources.<br> addAssetDict('name','url/res.jpg')<br> addAssetDict(['name'=>'url/res.jpg','name2'=>'url/res2.jpg');

public addAssetDict(string|array<string|int, mixed> $name[, string $url = "" ]) : mixed
Parameters
$name : string|array<string|int, mixed>

example 'css/style.css', you could also add an array

$url : string = ""

example https://www.web.com/style.css'

Return values
mixed

addInclude()

public addInclude(string $view[, string|null $alias = null ]) : mixed
Parameters
$view : string

example "folder.template"

$alias : string|null = null

example "mynewop". If null then it uses the name of the template.

Return values
mixed

addLoop()

Add new loop to the stack.

public addLoop(array<string|int, mixed>|Countable $data) : void
Parameters
$data : array<string|int, mixed>|Countable
Return values
void

appendSection()

Stop injecting content into a section and append it.

public appendSection() : string
Tags
throws
InvalidArgumentException
Return values
string

check()

Check the result of a condition.

public check(string $name, array<string|int, mixed> ...$parameters) : bool
Parameters
$name : string
$parameters : array<string|int, mixed>
Return values
bool

compile()

Compile the view at the given path.

public compile([string $templateName = null ][, bool $forced = false ]) : bool|string
Parameters
$templateName : string = null

The name of the template. Example folder.template

$forced : bool = false

If the compilation will be forced (always compile) or not.

Tags
throws
Exception
Return values
bool|string

True if the operation was correct, or false (if not exception) if it fails. It returns a string (the content compiled) if isCompiled=false

compilePrepend()

Compile the push statements into valid PHP.

public compilePrepend(string $expression) : string
Parameters
$expression : string
Return values
string

compilePush()

Compile the push statements into valid PHP.

public compilePush(string $expression) : string
Parameters
$expression : string
Return values
string

compilePushOnce()

Compile the push statements into valid PHP.

public compilePushOnce(string $expression) : string
Parameters
$expression : string
Return values
string

contains()

Determine if a given string contains a given substring.

public static contains(string $haystack, string|array<string|int, mixed> $needles) : bool
Parameters
$haystack : string
$needles : string|array<string|int, mixed>
Return values
bool

convertArg()

Convert an array such as ["class1"=>"myclass","style="mystyle"] to class1='myclass' style='mystyle' string

public convertArg(array<string|int, mixed>|string $array) : string
Parameters
$array : array<string|int, mixed>|string

array to convert

Return values
string

csrfIsValid()

Validates if the csrf token is valid or not.

public csrfIsValid() : bool

It could require an open session.

Return values
bool

directive()

Register a handler for custom directives.

public directive(string $name, callable $handler) : void
Parameters
$name : string
$handler : callable
Return values
void

directiveRT()

Register a handler for custom directives for run at runtime

public directiveRT(string $name, callable $handler) : void
Parameters
$name : string
$handler : callable
Return values
void

dump()

public dump(mixed $object[, mixed $jsconsole = false ]) : mixed
Parameters
$object : mixed
$jsconsole : mixed = false
Return values
mixed

e()

Escape HTML entities in a string.

public static e(string $value) : string
Parameters
$value : string
Return values
string

endSlot()

Save the slot content for rendering.

public endSlot() : void
Return values
void

exists()

Determine if the given key exists in the provided array.

public static exists(ArrayAccess|array<string|int, mixed> $array, string|int $key) : bool
Parameters
$array : ArrayAccess|array<string|int, mixed>
$key : string|int
Return values
bool

extend()

Register a custom Blade compiler.

public extend(callable $compiler) : void
Parameters
$compiler : callable
Return values
void

first()

Return the first element in an array passing a given truth test.

public static first(array<string|int, mixed> $array[, callable|null $callback = null ][, mixed $default = null ]) : mixed
Parameters
$array : array<string|int, mixed>
$callback : callable|null = null
$default : mixed = null
Return values
mixed

get()

Get an item from an array using "dot" notation.

public static get(ArrayAccess|array<string|int, mixed> $array, string $key[, mixed $default = null ]) : mixed
Parameters
$array : ArrayAccess|array<string|int, mixed>
$key : string
$default : mixed = null
Return values
mixed

getBaseUrl()

Returns the current base url

public getBaseUrl() : string
Return values
string

getCompiledExtension()

Get the file extension for template files.

public getCompiledExtension() : string
Return values
string

getCompiledFile()

Get the full path of the compiled file.

public getCompiledFile([string $templateName = '' ]) : string
Parameters
$templateName : string = ''
Return values
string

getContentTags()

Gets the content tags used for the compiler.

public getContentTags() : array<string|int, mixed>
Return values
array<string|int, mixed>

getCsrfToken()

Returns the current token. if there is not a token then it generates a new one.

public getCsrfToken([bool $fullToken = false ]) : string

It could require an open session.

Parameters
$fullToken : bool = false

It returns a token with the current ip.

Return values
string

getCurrentPermission()

public getCurrentPermission() : array<string|int, string>
Return values
array<string|int, string>

getCurrentRole()

public getCurrentRole() : string
Return values
string

getCurrentUser()

public getCurrentUser() : string
Return values
string

getEscapedContentTags()

Gets the escaped content tags used for the compiler.

public getEscapedContentTags() : array<string|int, mixed>
Return values
array<string|int, mixed>

getFile()

Get the contents of a file.

public getFile( $fileName) : string
Parameters
$fileName :
Return values
string

getFileExtension()

Get the file extension for template files.

public getFileExtension() : string
Return values
string

getFirstLoop()

Get an instance of the first loop in the stack.

public getFirstLoop() : array<string|int, mixed>|object
Return values
array<string|int, mixed>|object

getLoopStack()

Get the entire loop stack.

public getLoopStack() : array<string|int, mixed>
Return values
array<string|int, mixed>

getMode()

Get the mode of the engine.See BladeOne::MODE_* constants

public getMode() : mixed
Return values
mixed

getPhpTag()

public getPhpTag() : string
Return values
string

getTemplateFile()

Get the full path of the template file.

public getTemplateFile([string $templateName = '' ]) : string

Example: getTemplateFile('.abc.def')

Parameters
$templateName : string = ''

template name. If not template is set then it uses the base template.

Return values
string

includeFirst()

public includeFirst([array<string|int, mixed> $views = [] ][, array<string|int, mixed> $value = [] ]) : string
Parameters
$views : array<string|int, mixed> = []

array of views

$value : array<string|int, mixed> = []
Tags
throws
Exception
Return values
string

includeWhen()

public includeWhen([bool $bool = false ][, string $view = '' ][, array<string|int, mixed> $value = [] ]) : string
Parameters
$bool : bool = false
$view : string = ''

name of the view

$value : array<string|int, mixed> = []

arrays of values

Tags
throws
Exception
Return values
string

incrementLoopIndices()

Increment the top loop's indices.

public incrementLoopIndices() : void
Return values
void

ipClient()

public ipClient() : mixed
Return values
mixed

isExpired()

Determine if the view is expired.

public isExpired(string|null $fileName) : bool
Parameters
$fileName : string|null
Return values
bool

last()

Return the last element in an array passing a given truth test.

public static last(array<string|int, mixed> $array[, callable|null $callback = null ][, mixed $default = null ]) : mixed
Parameters
$array : array<string|int, mixed>
$callback : callable|null = null
$default : mixed = null
Return values
mixed

popLoop()

Pop a loop from the top of the loop stack.

public popLoop() : void
Return values
void

regenerateToken()

Regenerates the csrf token and stores in the session.

public regenerateToken() : mixed

It requires an open session.

Return values
mixed

registerIfStatement()

Register an "if" statement directive.

public registerIfStatement(string $name, callable $callback) : string
Parameters
$name : string
$callback : callable
Return values
string

relative()

it calculates the relative path of a web.<br> This function uses the current url and the baseurl

public relative(string $relativeWeb) : string
Parameters
$relativeWeb : string

. Example img/images.jpg

Return values
string

Example ../../img/images.jpg

renderComponent()

Render the current component.

public renderComponent() : string
Tags
throws
Exception
Return values
string

renderEach()

Get the rendered contents of a partial from a loop.

public renderEach(string $view, array<string|int, mixed> $data, string $iterator[, string $empty = 'raw|' ]) : string
Parameters
$view : string
$data : array<string|int, mixed>
$iterator : string
$empty : string = 'raw|'
Tags
throws
Exception
Return values
string

run()

run the blade engine. It returns the result of the code.

public run( $view[, array<string|int, mixed> $variables = [] ]) : string
Parameters
$view :
$variables : array<string|int, mixed> = []
Tags
throws
Exception
Return values
string

runChild()

Macro of function run

public runChild( $view[, array<string|int, mixed> $variables = [] ]) : string
Parameters
$view :
$variables : array<string|int, mixed> = []
Tags
throws
Exception
Return values
string

runString()

run the blade engine. It returns the result of the code.

public runString(mixed $string[, array<string|int, mixed> $data = [] ]) : string
Parameters
$string : mixed
$data : array<string|int, mixed> = []
Tags
throws
Exception
Return values
string

setAnyFunction()

It sets the callback function for authentication. It is used by @canany

public setAnyFunction(callable $fn) : mixed
Parameters
$fn : callable
Return values
mixed

setAuth()

Authentication. Sets with a user,role and permission

public setAuth([string $user = '' ][, null $role = null ][, array<string|int, mixed> $permission = [] ]) : mixed
Parameters
$user : string = ''
$role : null = null
$permission : array<string|int, mixed> = []
Return values
mixed

setBaseUrl()

It sets the base url and it also calculates the relative path.<br> The base url is calculated to determine the relativity of the resources.<br> The trailing slash is removed automatically if it's present.

public setBaseUrl(string $baseUrl) : mixed
Parameters
$baseUrl : string

Example http://www.web.com/folder https://www.web.com/folder/anotherfolder

Return values
mixed

setCanFunction()

It sets the callback function for authentication. It is used by @can and @cannot

public setCanFunction(callable $fn) : mixed
Parameters
$fn : callable
Return values
mixed

setCompiledExtension()

Set the file extension for the compiled files.

public setCompiledExtension( $fileExtension) : mixed

Including the leading dot for the extension is required, e.g. .bladec

Parameters
$fileExtension :
Return values
mixed

setContentTags()

Sets the content tags used for the compiler.

public setContentTags(string $openTag, string $closeTag[, bool $escaped = false ]) : void
Parameters
$openTag : string
$closeTag : string
$escaped : bool = false
Return values
void

setCurrentPermission()

public setCurrentPermission(array<string|int, string> $currentPermission) : mixed
Parameters
$currentPermission : array<string|int, string>
Return values
mixed

setCurrentRole()

public setCurrentRole(string $currentRole) : mixed
Parameters
$currentRole : string
Return values
mixed

setCurrentUser()

public setCurrentUser(string $currentUser) : mixed
Parameters
$currentUser : string
Return values
mixed

setErrorFunction()

It sets the callback function for errors. It is used by @error

public setErrorFunction(callable $fn) : mixed
Parameters
$fn : callable
Return values
mixed

setEscapedContentTags()

Sets the escaped content tags used for the compiler.

public setEscapedContentTags(string $openTag, string $closeTag) : void
Parameters
$openTag : string
$closeTag : string
Return values
void

setFileExtension()

Set the file extension for the template files.

public setFileExtension(string $fileExtension) : mixed

It must includes the leading dot e.g. .blade.php

Parameters
$fileExtension : string

Example: .prefix.ext

Return values
mixed

setInjectResolver()

Sets the function used for resolving classes with inject.

public setInjectResolver(callable $function) : mixed
Parameters
$function : callable
Return values
mixed

setIsCompiled()

If false then the file is not compiled and it is executed directly from the memory.<br> By default the value is true<br> It also sets the mode to MODE_SLOW

public setIsCompiled([bool $bool = false ]) : BladeOne
Parameters
$bool : bool = false
Tags
see
BladeOne::setMode
Return values
BladeOne

setMode()

Set the compile mode

public setMode( $mode) : void
Parameters
$mode :

int=[self::MODE_AUTO,self::MODE_DEBUG,self::MODE_FAST,self::MODE_SLOW][$i]

Return values
void

setOptimize()

If true then it optimizes the result (it removes tab and extra spaces).

public setOptimize([bool $bool = false ]) : BladeOne
Parameters
$bool : bool = false
Return values
BladeOne

setPath()

It sets the template and compile path (without trailing slash).

public setPath(null|string|array<string|int, string> $templatePath, null|string $compiledPath) : mixed

Example:setPath("somefolder","otherfolder");

Parameters
$templatePath : null|string|array<string|int, string>

If null then it uses the current path /views folder

$compiledPath : null|string

If null then it uses the current path /views folder

Return values
mixed

setPhpTag()

public setPhpTag(string $phpTag) : mixed
Parameters
$phpTag : string
Return values
mixed

share()

Adds a global variable

public share( $varname,  $value) : mixed
Parameters
$varname :
$value :
Return values
mixed

showError()

Show an error in the web.

public showError(string $id, string $text[, bool $critic = false ]) : string
Parameters
$id : string

Title of the error

$text : string

Message of the error

$critic : bool = false

if true then the compilation is ended, otherwise it continues

Return values
string

slot()

Start the slot rendering process.

public slot(string $name[, string|null $content = null ]) : void
Parameters
$name : string
$content : string|null = null
Return values
void

splitForeach()

Get the string contents of a push section.

public splitForeach([int $each = 1 ][, string $splitText = ',' ][, string $splitEnd = '' ]) : string
Parameters
$each : int = 1
$splitText : string = ','
$splitEnd : string = ''
Return values
string

startComponent()

Start a component rendering process.

public startComponent(string $name[, array<string|int, mixed> $data = [] ]) : void
Parameters
$name : string
$data : array<string|int, mixed> = []
Return values
void

startPrepend()

Start injecting content into a push section.

public startPrepend(string $section[, string $content = '' ]) : void
Parameters
$section : string
$content : string = ''
Return values
void

startPush()

Start injecting content into a push section.

public startPush(string $section[, string $content = '' ]) : void
Parameters
$section : string
$content : string = ''
Return values
void

startSection()

Start injecting content into a section.

public startSection(string $section[, string $content = '' ]) : void
Parameters
$section : string
$content : string = ''
Return values
void

startsWith()

Determine if a given string starts with a given substring.

public static startsWith(string $haystack, string|array<string|int, mixed> $needles) : bool
Parameters
$haystack : string
$needles : string|array<string|int, mixed>
Return values
bool

stopPrepend()

Stop injecting content into a push section.

public stopPrepend() : string
Return values
string

stopPush()

Stop injecting content into a push section.

public stopPush() : string
Return values
string

stopSection()

Stop injecting content into a section.

public stopSection([bool $overwrite = false ]) : string
Parameters
$overwrite : bool = false
Return values
string

stripParentheses()

Strip the parentheses from the given expression.

public stripParentheses(string $expression) : string
Parameters
$expression : string
Return values
string

stripQuotes()

Remove first and end quote from a quoted string of text

public stripQuotes(mixed $text) : null|string|array<string|int, string>
Parameters
$text : mixed
Return values
null|string|array<string|int, string>

value()

Return the default value of the given value.

public static value(mixed $value) : mixed
Parameters
$value : mixed
Return values
mixed

yieldContent()

Get the string contents of a section.

public yieldContent(string $section[, string $default = '' ]) : string
Parameters
$section : string
$default : string = ''
Return values
string

yieldPushContent()

Get the string contents of a push section.

public yieldPushContent(string $section[, string $default = '' ]) : string
Parameters
$section : string
$default : string = ''
Return values
string

yieldSection()

Stop injecting content into a section and return its contents.

public yieldSection() : string
Return values
string

compile_e()

Used for @_e directive.

protected compile_e( $expression) : string
Parameters
$expression :
Return values
string

compile_ef()

Used for @_ef directive.

protected compile_ef( $expression) : string
Parameters
$expression :
Return values
string

compile_n()

Used for @_n directive.

protected compile_n( $expression) : string
Parameters
$expression :
Return values
string

compileAppend()

Compile the append statements into valid PHP.

protected compileAppend() : string
Return values
string

compileAsset()

protected compileAsset(mixed $expression) : mixed
Parameters
$expression : mixed
Return values
mixed

compileAuth()

Compile the auth statements into valid PHP.

protected compileAuth([string $expression = '' ]) : string
Parameters
$expression : string = ''
Return values
string

compileBreak()

Compile the break statements into valid PHP.

protected compileBreak(string $expression) : string
Parameters
$expression : string
Return values
string

compileCan()

protected compileCan(mixed $expression) : mixed
Parameters
$expression : mixed
Return values
mixed

compileCanAny()

Compile the canany statements into valid PHP.

protected compileCanAny( $expression) : string

canany(['edit','write'])

Parameters
$expression :
Return values
string

compileCannot()

protected compileCannot(mixed $expression) : mixed
Parameters
$expression : mixed
Return values
mixed

compileCase()

Execute the case tag.

protected compileCase( $expression) : string
Parameters
$expression :
Return values
string

compileComments()

Compile Blade comments into valid PHP.

protected compileComments(string $value) : string
Parameters
$value : string
Return values
string

compileComponent()

Compile the component statements into valid PHP.

protected compileComponent(string $expression) : string
Parameters
$expression : string
Return values
string

compileContinue()

Compile the continue statements into valid PHP.

protected compileContinue(string $expression) : string
Parameters
$expression : string
Return values
string

compilecsrf()

protected compilecsrf() : mixed
Return values
mixed

compileDd()

protected compileDd(mixed $expression) : mixed
Parameters
$expression : mixed
Return values
mixed

compileDefault()

default tag used for switch/case

protected compileDefault() : string
Return values
string

compileDump()

protected compileDump(mixed $expression) : mixed
Parameters
$expression : mixed
Return values
mixed

compileEach()

Compile the each statements into valid PHP.

protected compileEach(string $expression) : string
Parameters
$expression : string
Return values
string

compileEchoDefaults()

Compile the default values for the echo statement.

protected compileEchoDefaults(string $value) : string
Parameters
$value : string
Return values
string

compileEchos()

Compile Blade echos into valid PHP.

protected compileEchos(string $value) : string
Parameters
$value : string
Return values
string

compileElse()

Compile the else statements into valid PHP.

protected compileElse() : string
Return values
string

compileElseAuth()

Compile the elseauth statements into valid PHP.

protected compileElseAuth([string $expression = '' ]) : string
Parameters
$expression : string = ''
Return values
string

compileElseCan()

Compile the else statements into valid PHP.

protected compileElseCan([string $expression = '' ]) : string
Parameters
$expression : string = ''
Return values
string

compileElseCanAny()

Compile the else statements into valid PHP.

protected compileElseCanAny( $expression) : string
Parameters
$expression :
Return values
string

compileElseCannot()

Compile the elsecannot statements into valid PHP.

protected compileElseCannot([string $expression = '' ]) : string
Parameters
$expression : string = ''
Return values
string

compileElseGuest()

Compile the else statements into valid PHP.

protected compileElseGuest( $expression) : string
Parameters
$expression :
Return values
string

compileElseif()

Compile the else-if statements into valid PHP.

protected compileElseif(string $expression) : string
Parameters
$expression : string
Return values
string

compileEmpty()

Compile the forelse statements into valid PHP.

protected compileEmpty([string $expression = '' ]) : string
Parameters
$expression : string = ''

empty if it's inside a for loop.

Return values
string

compileEndAuth()

Compile the end-auth statements into valid PHP.

protected compileEndAuth() : string
Return values
string

compileEndcan()

Compile the end-can statements into valid PHP.

protected compileEndcan() : string
Return values
string

compileEndcanany()

Compile the end-can statements into valid PHP.

protected compileEndcanany() : string
Return values
string

compileEndcannot()

Compile the end-cannot statements into valid PHP.

protected compileEndcannot() : string
Return values
string

compileEndComponent()

Compile the end-component statements into valid PHP.

protected compileEndComponent() : string
Return values
string

compileEndEmpty()

protected compileEndEmpty() : mixed
Return values
mixed

compileEndError()

Compile the end-error statements into valid PHP.

protected compileEndError() : string
Return values
string

compileEndfor()

Compile the end-for statements into valid PHP.

protected compileEndfor() : string
Return values
string

compileEndforeach()

Compile the end-for-each statements into valid PHP.

protected compileEndforeach() : string
Return values
string

compileEndforelse()

Compile the end-for-else statements into valid PHP.

protected compileEndforelse() : string
Return values
string

compileEndGuest()

/** Compile the end-auth statements into valid PHP.

protected compileEndGuest() : string
Return values
string

compileEndif()

Compile the end-if statements into valid PHP.

protected compileEndif() : string
Return values
string

compileEndIsset()

protected compileEndIsset() : mixed
Return values
mixed

compileEndphp()

Compile end-php statement into valid PHP.

protected compileEndphp() : string
Return values
string

compileEndPrepend()

Compile the endpush statements into valid PHP.

protected compileEndPrepend() : string
Return values
string

compileEndpush()

Compile the endpush statements into valid PHP.

protected compileEndpush() : string
Return values
string

compileEndpushOnce()

Compile the endpushonce statements into valid PHP.

protected compileEndpushOnce() : string
Return values
string

compileEndsection()

Compile the end-section statements into valid PHP.

protected compileEndsection() : string
Return values
string

compileEndSlot()

Compile the end-slot statements into valid PHP.

protected compileEndSlot() : string
Return values
string

compileEndSwitch()

protected compileEndSwitch() : mixed
Return values
mixed

compileEndunless()

Compile the endunless statements into valid PHP.

protected compileEndunless() : string
Return values
string

compileEndwhile()

Compile the end-while statements into valid PHP.

protected compileEndwhile() : string
Return values
string

compileError()

protected compileError( $expression) : string
Parameters
$expression :
Tags
error

('key')

Return values
string

compileEscapedEchos()

Compile the escaped echo statements.

protected compileEscapedEchos(string $value) : string
Parameters
$value : string
Return values
string

compileExtends()

Compile the extends statements into valid PHP.

protected compileExtends(string $expression) : string
Parameters
$expression : string
Return values
string

compileExtensions()

Execute the user defined extensions.

protected compileExtensions(string $value) : string
Parameters
$value : string
Return values
string

compileFor()

Compile the for statements into valid PHP.

protected compileFor(string $expression) : string
Parameters
$expression : string
Return values
string

compileForeach()

Compile the foreach statements into valid PHP.

protected compileForeach(string $expression) : string
Parameters
$expression : string
Return values
string

compileForelse()

Compile the forelse statements into valid PHP.

protected compileForelse(string $expression) : string
Parameters
$expression : string
Return values
string

compileGuest()

Compile the guest statements into valid PHP.

protected compileGuest([null $expression = null ]) : string
Parameters
$expression : null = null
Return values
string

compileHasSection()

Compile the has section statements into valid PHP.

protected compileHasSection(string $expression) : string
Parameters
$expression : string
Return values
string

compileIf()

Compile the if statements into valid PHP.

protected compileIf(string $expression) : string
Parameters
$expression : string
Return values
string

compileInclude()

Compile the include statements into valid PHP.

protected compileInclude(string $expression) : string
Parameters
$expression : string
Return values
string

compileIncludeFast()

It loads an compiled template and paste inside the code.<br> It uses more disk space but it decreases the number of includes<br>

protected compileIncludeFast( $expression) : string
Parameters
$expression :
Tags
throws
Exception
Return values
string

compileIncludeFirst()

Compile the includefirst statement

protected compileIncludeFirst(string $expression) : string
Parameters
$expression : string
Return values
string

compileIncludeIf()

Compile the include statements into valid PHP.

protected compileIncludeIf(string $expression) : string
Parameters
$expression : string
Return values
string

compileIncludeWhen()

Compile the include statements into valid PHP.

protected compileIncludeWhen(string $expression) : string
Parameters
$expression : string
Return values
string

compileInject()

Compile while statements into valid PHP.

protected compileInject(string $expression) : string
Parameters
$expression : string
Return values
string

compileIsset()

protected compileIsset(mixed $expression) : mixed
Parameters
$expression : mixed
Return values
mixed

compileJSon()

protected compileJSon(mixed $expression) : mixed
Parameters
$expression : mixed
Return values
mixed

compileMethod()

protected compileMethod(mixed $expression) : mixed
Parameters
$expression : mixed
Return values
mixed

compileOverwrite()

Compile the overwrite statements into valid PHP.

protected compileOverwrite() : string
Return values
string

compileParent()

Execute the @parent command. This operation works in tandem with extendSection

protected compileParent() : string
Tags
see
extendSection
Return values
string

compilePhp()

Compile the raw PHP statements into valid PHP.

protected compilePhp(string $expression) : string
Parameters
$expression : string
Return values
string

compileRawEchos()

Compile the "raw" echo statements.

protected compileRawEchos(string $value) : string
Parameters
$value : string
Return values
string

compileRegularEchos()

Compile the "regular" echo statements.

protected compileRegularEchos(string $value) : string
Parameters
$value : string
Return values
string

compileRelative()

protected compileRelative(mixed $expression) : mixed
Parameters
$expression : mixed
Return values
mixed

compileSection()

Compile the section statements into valid PHP.

protected compileSection(string $expression) : string
Parameters
$expression : string
Return values
string

compileSet()

protected compileSet(mixed $expression) : mixed
Parameters
$expression : mixed
Return values
mixed

compileShow()

Compile the show statements into valid PHP.

protected compileShow() : string
Return values
string

compileSlot()

Compile the slot statements into valid PHP.

protected compileSlot(string $expression) : string
Parameters
$expression : string
Return values
string

compileSplitForeach()

Compile a split of a foreach cycle. Used for example when we want to separate limites each "n" elements.

protected compileSplitForeach(string $expression) : string
Parameters
$expression : string
Return values
string

compileStack()

Compile the stack statements into the content.

protected compileStack(string $expression) : string
Parameters
$expression : string
Return values
string

compileStatementCustom()

For compile custom directive at runtime.

protected compileStatementCustom( $match) : string
Parameters
$match :
Return values
string

compileStatements()

Compile Blade statements that start with "@".

protected compileStatements(string $value) : mixed
Parameters
$value : string
Return values
mixed

compileStop()

Compile the stop statements into valid PHP.

protected compileStop() : string
Return values
string

compileString()

Compile the given Blade template contents.

protected compileString(string $value) : string
Parameters
$value : string
Return values
string

compileSwitch()

protected compileSwitch(mixed $expression) : mixed
Parameters
$expression : mixed
Return values
mixed

compileUnless()

Compile the unless statements into valid PHP.

protected compileUnless(string $expression) : string
Parameters
$expression : string
Return values
string

compileUnset()

Compile the unset statements into valid PHP.

protected compileUnset(string $expression) : string
Parameters
$expression : string
Return values
string

compileUser()

Compile the User statements into valid PHP.

protected compileUser() : string
Return values
string

compileWhile()

Compile the while statements into valid PHP.

protected compileWhile(string $expression) : string
Parameters
$expression : string
Return values
string

compileYield()

Compile the yield statements into valid PHP.

protected compileYield(string $expression) : string
Parameters
$expression : string
Return values
string

componentData()

Get the data for the given component.

protected componentData() : array<string|int, mixed>
Return values
array<string|int, mixed>

convertArgCallBack()

protected static convertArgCallBack(mixed $k, mixed $v) : mixed
Parameters
$k : mixed
$v : mixed
Return values
mixed

currentComponent()

Get the index for the current component.

protected currentComponent() : int
Return values
int

evaluatePath()

Evaluates a compiled file using the current variables

protected evaluatePath(string $compiledFile, array<string|int, mixed> $variables) : string
Parameters
$compiledFile : string

full path of the compile file.

$variables : array<string|int, mixed>
Tags
throws
Exception
Return values
string

evaluateText()

Evaluates a text (string) using the current variables

protected evaluateText(string $content, array<string|int, mixed> $variables) : string
Parameters
$content : string
$variables : array<string|int, mixed>
Tags
throws
Exception
Return values
string

extendPush()

Append content to a given push section.

protected extendPush(string $section, string $content) : void
Parameters
$section : string
$content : string
Return values
void

extendSection()

Append content to a given section.

protected extendSection(string $section, string $content) : void
Parameters
$section : string
$content : string
Return values
void

extendStartPush()

Append content to a given push section.

protected extendStartPush(string $section, string $content) : void
Parameters
$section : string
$content : string
Return values
void

getEchoMethods()

Get the echo methods in the proper order for compilation.

protected getEchoMethods() : array<string|int, mixed>
Return values
array<string|int, mixed>

getTags()

Gets the tags used for the compiler.

protected getTags([bool $escaped = false ]) : array<string|int, mixed>
Parameters
$escaped : bool = false
Return values
array<string|int, mixed>

handleViewException()

Handle a view exception.

protected handleViewException(Exception $e) : void
Parameters
$e : Exception
Return values
void

injectClass()

Resolve a given class using the injectResolver callable.

protected injectClass(string $className[, string|null $variableName = null ]) : mixed
Parameters
$className : string
$variableName : string|null = null
Return values
mixed

parseToken()

Parse the tokens from the template.

protected parseToken(array<string|int, mixed> $token) : string
Parameters
$token : array<string|int, mixed>
Return values
string

restoreVerbatimBlocks()

Replace the raw placeholders with the original code stored in the raw blocks.

protected restoreVerbatimBlocks(string $result) : string
Parameters
$result : string
Return values
string

storeVerbatimBlocks()

Store the verbatim blocks and replace them with a temporary placeholder.

protected storeVerbatimBlocks(string $value) : string
Parameters
$value : string
Return values
string

locateTemplate()

Find template file with the given name in all template paths in the order the paths were written

private locateTemplate(string $name) : string
Parameters
$name : string

Filename

Return values
string

template file

missingTranslation()

Log a missing translation into the file $this->missingLog.<br> If the file is not defined, then it doesn't write the log.

private missingTranslation(string $txt) : mixed
Parameters
$txt : string

Message to write on.

Return values
mixed

runInternal()

run the blade engine. It returns the result of the code.

private runInternal( $view[, array<string|int, mixed> $variables = [] ][, bool $forced = false ][, bool $isParent = true ][, bool $runFast = false ]) : string
Parameters
$view :
$variables : array<string|int, mixed> = []
$forced : bool = false

if true then it recompiles no matter if the compiled file exists or not.

$isParent : bool = true
$runFast : bool = false

if true then the code is not compiled neither checked and it runs directly the compiled version.

Tags
throws
Exception
Return values
string

templateExist()

Returns true if the template exists. Otherwise it returns false

private templateExist( $templateName) : bool
Parameters
$templateName :
Return values
bool

Search results