PHP Class Xiaoler\Blade\Factory

Exibir arquivo Open project: xiaoler/blade Class Usage Examples

Protected Properties

Property Type Description
$aliases array Array of registered view name aliases.
$engine Xiaoler\Blade\Engines\EngineInterface The engine implementation.
$finder Xiaoler\Blade\ViewFinderInterface The view finder implementation.
$loopsStack array The stack of in-progress loops.
$names array All of the registered view names.
$pushStack array The stack of in-progress push sections.
$pushes array All of the finished, captured push sections.
$renderCount integer The number of active rendering operations.
$sectionStack array The stack of in-progress sections.
$sections array All of the finished, captured sections.
$shared array Data that should be available to all templates.

Public Methods

Method Description
__construct ( Xiaoler\Blade\Engines\EngineInterface $engine, Xiaoler\Blade\ViewFinderInterface $finder ) : void Create a new view factory instance.
addLocation ( string $location ) : void Add a location to the array of view locations.
addLoop ( array | Countable $data ) : void Add new loop to the stack.
addNamespace ( string $namespace, string | array $hints ) : void Add a new namespace to the loader.
alias ( string $view, string $alias ) : void Add an alias for a view.
appendSection ( ) : string Stop injecting content into a section and append it.
decrementRender ( ) : void Decrement the rendering counter.
doneRendering ( ) : boolean Check if there are no active render operations.
exists ( string $view ) : boolean Determine if a given view exists.
file ( string $path, array $data = [], array $mergeData = [] ) : Xiaoler\Blade\View Get the evaluated view contents for the given view.
flushSections ( ) : void Flush all of the section contents.
flushSectionsIfDoneRendering ( ) : void Flush all of the section contents if done rendering.
getFinder ( ) : Xiaoler\Blade\ViewFinderInterface Get the view finder instance.
getFirstLoop ( ) : array Get an instance of the first loop in the stack.
getLoopStack ( ) : array Get the entire loop stack.
getNames ( ) : array Get all of the registered named views in environment.
getSections ( ) : array Get the entire array of sections.
getShared ( ) : array Get all of the shared data for the environment.
hasSection ( string $name ) : boolean Check if section exists.
incrementLoopIndices ( ) : void Increment the top loop's indices.
incrementRender ( ) : void Increment the rendering counter.
inject ( string $section, string $content ) : void Inject inline content into a section.
make ( string $view, array $data = [], array $mergeData = [] ) : Xiaoler\Blade\View Get the evaluated view contents for the given view.
name ( string $view, string $name ) : void Register a named view.
of ( string $view, mixed $data = [] ) : Xiaoler\Blade\View Get the evaluated view contents for a named view.
popLoop ( ) : void Pop a loop from the top of the loop stack.
prependNamespace ( string $namespace, string | array $hints ) : void Prepend a new namespace to the loader.
renderEach ( string $view, array $data, string $iterator, string $empty = 'raw|' ) : string Get the rendered contents of a partial from a loop.
setFinder ( Xiaoler\Blade\ViewFinderInterface $finder ) : void Set the view finder instance.
share ( array | string $key, mixed $value = null ) : mixed Add a piece of shared data to the environment.
shared ( string $key, mixed $default = null ) : mixed Get an item from the shared data.
startPush ( string $section, string $content = '' ) : void Start injecting content into a push section.
startSection ( string $section, string $content = '' ) : void Start injecting content into a section.
stopPush ( ) : string Stop injecting content into a push section.
stopSection ( boolean $overwrite = false ) : string Stop injecting content into a section.
yieldContent ( string $section, string $default = '' ) : string Get the string contents of a section.
yieldPushContent ( string $section, string $default = '' ) : string Get the string contents of a push section.
yieldSection ( ) : string Stop injecting content into a section and return its contents.

Protected Methods

Method Description
extendPush ( string $section, string $content ) : void Append content to a given push section.
extendSection ( string $section, string $content ) : void Append content to a given section.
normalizeName ( string $name ) : string Normalize a view name.

Method Details

__construct() public method

Create a new view factory instance.
public __construct ( Xiaoler\Blade\Engines\EngineInterface $engine, Xiaoler\Blade\ViewFinderInterface $finder ) : void
$engine Xiaoler\Blade\Engines\EngineInterface
$finder Xiaoler\Blade\ViewFinderInterface
return void

addLocation() public method

Add a location to the array of view locations.
public addLocation ( string $location ) : void
$location string
return void

addLoop() public method

Add new loop to the stack.
public addLoop ( array | Countable $data ) : void
$data array | Countable
return void

addNamespace() public method

Add a new namespace to the loader.
public addNamespace ( string $namespace, string | array $hints ) : void
$namespace string
$hints string | array
return void

alias() public method

Add an alias for a view.
public alias ( string $view, string $alias ) : void
$view string
$alias string
return void

appendSection() public method

Stop injecting content into a section and append it.
public appendSection ( ) : string
return string

decrementRender() public method

Decrement the rendering counter.
public decrementRender ( ) : void
return void

doneRendering() public method

Check if there are no active render operations.
public doneRendering ( ) : boolean
return boolean

exists() public method

Determine if a given view exists.
public exists ( string $view ) : boolean
$view string
return boolean

extendPush() protected method

Append content to a given push section.
protected extendPush ( string $section, string $content ) : void
$section string
$content string
return void

extendSection() protected method

Append content to a given section.
protected extendSection ( string $section, string $content ) : void
$section string
$content string
return void

file() public method

Get the evaluated view contents for the given view.
public file ( string $path, array $data = [], array $mergeData = [] ) : Xiaoler\Blade\View
$path string
$data array
$mergeData array
return Xiaoler\Blade\View

flushSections() public method

Flush all of the section contents.
public flushSections ( ) : void
return void

flushSectionsIfDoneRendering() public method

Flush all of the section contents if done rendering.
public flushSectionsIfDoneRendering ( ) : void
return void

getFinder() public method

Get the view finder instance.
public getFinder ( ) : Xiaoler\Blade\ViewFinderInterface
return Xiaoler\Blade\ViewFinderInterface

getFirstLoop() public method

Get an instance of the first loop in the stack.
public getFirstLoop ( ) : array
return array

getLoopStack() public method

Get the entire loop stack.
public getLoopStack ( ) : array
return array

getNames() public method

Get all of the registered named views in environment.
public getNames ( ) : array
return array

getSections() public method

Get the entire array of sections.
public getSections ( ) : array
return array

getShared() public method

Get all of the shared data for the environment.
public getShared ( ) : array
return array

hasSection() public method

Check if section exists.
public hasSection ( string $name ) : boolean
$name string
return boolean

incrementLoopIndices() public method

Increment the top loop's indices.
public incrementLoopIndices ( ) : void
return void

incrementRender() public method

Increment the rendering counter.
public incrementRender ( ) : void
return void

inject() public method

Inject inline content into a section.
public inject ( string $section, string $content ) : void
$section string
$content string
return void

make() public method

Get the evaluated view contents for the given view.
public make ( string $view, array $data = [], array $mergeData = [] ) : Xiaoler\Blade\View
$view string
$data array
$mergeData array
return Xiaoler\Blade\View

name() public method

Register a named view.
public name ( string $view, string $name ) : void
$view string
$name string
return void

normalizeName() protected method

Normalize a view name.
protected normalizeName ( string $name ) : string
$name string
return string

of() public method

Get the evaluated view contents for a named view.
public of ( string $view, mixed $data = [] ) : Xiaoler\Blade\View
$view string
$data mixed
return Xiaoler\Blade\View

popLoop() public method

Pop a loop from the top of the loop stack.
public popLoop ( ) : void
return void

prependNamespace() public method

Prepend a new namespace to the loader.
public prependNamespace ( string $namespace, string | array $hints ) : void
$namespace string
$hints string | array
return void

renderEach() public method

Get the rendered contents of a partial from a loop.
public renderEach ( string $view, array $data, string $iterator, string $empty = 'raw|' ) : string
$view string
$data array
$iterator string
$empty string
return string

setFinder() public method

Set the view finder instance.
public setFinder ( Xiaoler\Blade\ViewFinderInterface $finder ) : void
$finder Xiaoler\Blade\ViewFinderInterface
return void

share() public method

Add a piece of shared data to the environment.
public share ( array | string $key, mixed $value = null ) : mixed
$key array | string
$value mixed
return mixed

shared() public method

Get an item from the shared data.
public shared ( string $key, mixed $default = null ) : mixed
$key string
$default mixed
return mixed

startPush() public method

Start injecting content into a push section.
public startPush ( string $section, string $content = '' ) : void
$section string
$content string
return void

startSection() public method

Start injecting content into a section.
public startSection ( string $section, string $content = '' ) : void
$section string
$content string
return void

stopPush() public method

Stop injecting content into a push section.
public stopPush ( ) : string
return string

stopSection() public method

Stop injecting content into a section.
public stopSection ( boolean $overwrite = false ) : string
$overwrite boolean
return string

yieldContent() public method

Get the string contents of a section.
public yieldContent ( string $section, string $default = '' ) : string
$section string
$default string
return string

yieldPushContent() public method

Get the string contents of a push section.
public yieldPushContent ( string $section, string $default = '' ) : string
$section string
$default string
return string

yieldSection() public method

Stop injecting content into a section and return its contents.
public yieldSection ( ) : string
return string

Property Details

$aliases protected_oe property

Array of registered view name aliases.
protected array $aliases
return array

$engine protected_oe property

The engine implementation.
protected EngineInterface,Xiaoler\Blade\Engines $engine
return Xiaoler\Blade\Engines\EngineInterface

$finder protected_oe property

The view finder implementation.
protected ViewFinderInterface,Xiaoler\Blade $finder
return Xiaoler\Blade\ViewFinderInterface

$loopsStack protected_oe property

The stack of in-progress loops.
protected array $loopsStack
return array

$names protected_oe property

All of the registered view names.
protected array $names
return array

$pushStack protected_oe property

The stack of in-progress push sections.
protected array $pushStack
return array

$pushes protected_oe property

All of the finished, captured push sections.
protected array $pushes
return array

$renderCount protected_oe property

The number of active rendering operations.
protected int $renderCount
return integer

$sectionStack protected_oe property

The stack of in-progress sections.
protected array $sectionStack
return array

$sections protected_oe property

All of the finished, captured sections.
protected array $sections
return array

$shared protected_oe property

Data that should be available to all templates.
protected array $shared
return array