Factory
class Factory implements Factory
Traits
Properties
protected array | $componentStack | The components being rendered. |
from ManagesComponents |
protected array | $componentData | The original data passed to the component. |
from ManagesComponents |
protected array | $slots | The slot contents for the component. |
from ManagesComponents |
protected array | $slotStack | The names of the slots being rendered. |
from ManagesComponents |
protected array | $sections | All of the finished, captured sections. |
from ManagesLayouts |
protected array | $sectionStack | The stack of in-progress sections. |
from ManagesLayouts |
static protected string | $parentPlaceholder | The parent placeholder for the request. |
from ManagesLayouts |
protected array | $loopsStack | The stack of in-progress loops. |
from ManagesLoops |
protected array | $pushes | All of the finished, captured push sections. |
from ManagesStacks |
protected array | $prepends | All of the finished, captured prepend sections. |
from ManagesStacks |
protected array | $pushStack | The stack of in-progress push sections. |
from ManagesStacks |
protected array | $translationReplacements | The translation replacements for the translation being rendered. |
from ManagesTranslations |
protected EngineResolver | $engines | The engine implementation. |
|
protected ViewFinderInterface | $finder | The view finder implementation. |
|
protected Dispatcher | $events | The event dispatcher instance. |
|
protected Container | $container | The IoC container instance. |
|
protected array | $shared | Data that should be available to all templates. |
|
protected array | $extensions | The extension to engine bindings. |
|
protected array | $composers | The view composer events. |
|
protected int | $renderCount | The number of active rendering operations. |
Methods
Start a component rendering process.
Start the slot rendering process.
Add an event for a given view.
Register a class based view composer.
Build a class based container callback Closure.
Parse a class based composer name.
Determine the class event method based on the given prefix.
Start injecting content into a section.
Inject inline content into a section.
Stop injecting content into a section and return its contents.
Stop injecting content into a section.
Append content to a given section.
Get the string contents of a section.
Get the parent placeholder for the current request.
Get the contents of a section.
Start injecting content into a push section.
Append content to a given push section.
Start prepending content into a push section.
Prepend content to a given stack.
Get the string contents of a push section.
Create a new view factory instance.
Get the evaluated view contents for the given view.
Get the evaluated view contents for the given view.
Get the rendered content of the view based on a given condition.
Get the rendered contents of a partial from a loop.
Normalize a view name.
Parse the given data into a raw array.
Create a new view instance from the given arguments.
Determine if a given view exists.
Get the appropriate view engine for the given path.
Get the extension used by the view file.
Add a piece of shared data to the environment.
Increment the rendering counter.
Decrement the rendering counter.
Check if there are no active render operations.
Add a location to the array of view locations.
Add a new namespace to the loader.
Prepend a new namespace to the loader.
Replace the namespace hints for the given namespace.
Register a valid view extension and its engine.
Flush all of the factory state like sections and stacks.
Flush all of the section contents if done rendering.
Get the extension to engine bindings.
Get the engine resolver instance.
Get the view finder instance.
Flush the cache of views located by the finder.
Get the event dispatcher instance.
Get the IoC container instance.
Get an item from the shared data.
Get all of the shared data for the environment.
Details
in
ManagesComponents at line 44
void
startComponent(string $name, array $data = [])
Start a component rendering process.
in
ManagesComponents at line 60
string
renderComponent()
Render the current component.
in
ManagesComponents at line 73
protected array
componentData(string $name)
Get the data for the given component.
in
ManagesComponents at line 89
void
slot(string $name, string|null $content = null)
Start the slot rendering process.
in
ManagesComponents at line 107
void
endSlot()
Save the slot content for rendering.
in
ManagesComponents at line 124
protected int
currentComponent()
Get the index for the current component.
in
ManagesEvents at line 18
array
creator(array|string $views, Closure|string $callback)
Register a view creator event.
in
ManagesEvents at line 35
array
composers(array $composers)
Register multiple view composers via an array.
in
ManagesEvents at line 53
array
composer(array|string $views, Closure|string $callback)
Register a view composer event.
in
ManagesEvents at line 72
protected Closure|null
addViewEvent(string $view, Closure|string $callback, string $prefix = 'composing: ')
Add an event for a given view.
in
ManagesEvents at line 93
protected Closure
addClassEvent(string $view, string $class, string $prefix)
Register a class based view composer.
in
ManagesEvents at line 116
protected Closure
buildClassEventCallback(string $class, string $prefix)
Build a class based container callback Closure.
in
ManagesEvents at line 137
protected array
parseClassEvent(string $class, string $prefix)
Parse a class based composer name.
in
ManagesEvents at line 148
protected string
classEventMethodForPrefix(string $prefix)
Determine the class event method based on the given prefix.
in
ManagesEvents at line 160
protected void
addEventListener(string $name, Closure $callback)
Add a listener to the event dispatcher.
in
ManagesEvents at line 177
void
callComposer(View $view)
Call the composer for a given view.
in
ManagesEvents at line 188
void
callCreator(View $view)
Call the creator for a given view.
in
ManagesLayouts at line 38
void
startSection(string $section, string|null $content = null)
Start injecting content into a section.
in
ManagesLayouts at line 56
void
inject(string $section, string $content)
Inject inline content into a section.
in
ManagesLayouts at line 66
string
yieldSection()
Stop injecting content into a section and return its contents.
in
ManagesLayouts at line 82
string
stopSection(bool $overwrite = false)
Stop injecting content into a section.
in
ManagesLayouts at line 105
string
appendSection()
Stop injecting content into a section and append it.
in
ManagesLayouts at line 129
protected void
extendSection(string $section, string $content)
Append content to a given section.
in
ManagesLayouts at line 145
string
yieldContent(string $section, string $default = '')
Get the string contents of a section.
in
ManagesLayouts at line 166
static string
parentPlaceholder(string $section = '')
Get the parent placeholder for the current request.
in
ManagesLayouts at line 181
bool
hasSection(string $name)
Check if section exists.
in
ManagesLayouts at line 193
mixed
getSection(string $name, string $default = null)
Get the contents of a section.
in
ManagesLayouts at line 203
array
getSections()
Get the entire array of sections.
in
ManagesLayouts at line 213
void
flushSections()
Flush all of the sections.
in
ManagesLoops at line 23
void
addLoop(Countable|array $data)
Add new loop to the stack.
in
ManagesLoops at line 46
void
incrementLoopIndices()
Increment the top loop's indices.
in
ManagesLoops at line 64
void
popLoop()
Pop a loop from the top of the loop stack.
in
ManagesLoops at line 74
stdClass|null
getLastLoop()
Get an instance of the last loop in the stack.
in
ManagesLoops at line 86
array
getLoopStack()
Get the entire loop stack.
in
ManagesStacks at line 37
void
startPush(string $section, string $content = '')
Start injecting content into a push section.
in
ManagesStacks at line 54
string
stopPush()
Stop injecting content into a push section.
in
ManagesStacks at line 72
protected void
extendPush(string $section, string $content)
Append content to a given push section.
in
ManagesStacks at line 92
void
startPrepend(string $section, string $content = '')
Start prepending content into a push section.
in
ManagesStacks at line 109
string
stopPrepend()
Stop prepending content into a push section.
in
ManagesStacks at line 127
protected void
extendPrepend(string $section, string $content)
Prepend content to a given stack.
in
ManagesStacks at line 147
string
yieldPushContent(string $section, string $default = '')
Get the string contents of a push section.
in
ManagesStacks at line 171
void
flushStacks()
Flush all of the stacks.
in
ManagesTranslations at line 20
void
startTranslation(array $replacements = [])
Start a translation block.
in
ManagesTranslations at line 32
string
renderTranslation()
Render the current translation.
at line 91
void
__construct(EngineResolver $engines, ViewFinderInterface $finder, Dispatcher $events)
Create a new view factory instance.
at line 108
View
file(string $path, array $data = [], array $mergeData = [])
Get the evaluated view contents for the given view.
at line 125
View
make(string $view, array $data = [], array $mergeData = [])
Get the evaluated view contents for the given view.
at line 150
string
renderWhen(bool $condition, string $view, array $data = [], array $mergeData = [])
Get the rendered content of the view based on a given condition.
at line 168
string
renderEach(string $view, array $data, string $iterator, string $empty = 'raw|')
Get the rendered contents of a partial from a loop.
at line 201
protected string
normalizeName(string $name)
Normalize a view name.
at line 212
protected array
parseData(mixed $data)
Parse the given data into a raw array.
at line 225
protected View
viewInstance(string $view, string $path, array $data)
Create a new view instance from the given arguments.
at line 236
bool
exists(string $view)
Determine if a given view exists.
at line 255
EngineInterface
getEngineFromPath(string $path)
Get the appropriate view engine for the given path.
at line 272
protected string
getExtension(string $path)
Get the extension used by the view file.
at line 288
mixed
share(array|string $key, mixed $value = null)
Add a piece of shared data to the environment.
at line 304
void
incrementRender()
Increment the rendering counter.
at line 314
void
decrementRender()
Decrement the rendering counter.
at line 324
bool
doneRendering()
Check if there are no active render operations.
at line 335
void
addLocation(string $location)
Add a location to the array of view locations.
at line 347
$this
addNamespace(string $namespace, string|array $hints)
Add a new namespace to the loader.
at line 361
$this
prependNamespace(string $namespace, string|array $hints)
Prepend a new namespace to the loader.
at line 375
$this
replaceNamespace(string $namespace, string|array $hints)
Replace the namespace hints for the given namespace.
at line 390
void
addExtension(string $extension, string $engine, Closure $resolver = null)
Register a valid view extension and its engine.
at line 408
void
flushState()
Flush all of the factory state like sections and stacks.
at line 421
void
flushStateIfDoneRendering()
Flush all of the section contents if done rendering.
at line 433
array
getExtensions()
Get the extension to engine bindings.
at line 443
EngineResolver
getEngineResolver()
Get the engine resolver instance.
at line 453
ViewFinderInterface
getFinder()
Get the view finder instance.
at line 464
void
setFinder(ViewFinderInterface $finder)
Set the view finder instance.
at line 474
void
flushFinderCache()
Flush the cache of views located by the finder.
at line 484
Dispatcher
getDispatcher()
Get the event dispatcher instance.
at line 495
void
setDispatcher(Dispatcher $events)
Set the event dispatcher instance.
at line 505
Container
getContainer()
Get the IoC container instance.
at line 516
void
setContainer(Container $container)
Set the IoC container instance.
at line 528
mixed
shared(string $key, mixed $default = null)
Get an item from the shared data.
at line 538
array
getShared()
Get all of the shared data for the environment.