class Factory implements Factory (View source)

Traits

Methods

void
startComponent(string $name, array $data = array())

Start a component rendering process.

string
renderComponent()

Render the current component.

void
slot(string $name, string|null $content = null)

Start the slot rendering process.

void
endSlot()

Save the slot content for rendering.

array
creator(array|string $views, Closure|string $callback)

Register a view creator event.

array
composers(array $composers)

Register multiple view composers via an array.

array
composer(array|string $views, Closure|string $callback)

Register a view composer event.

void
callComposer(View $view)

Call the composer for a given view.

void
callCreator(View $view)

Call the creator for a given view.

void
startSection(string $section, string|null $content = null)

Start injecting content into a section.

void
inject(string $section, string $content)

Inject inline content into a section.

string
yieldSection()

Stop injecting content into a section and return its contents.

string
stopSection(bool $overwrite = false)

Stop injecting content into a section.

string
appendSection()

Stop injecting content into a section and append it.

string
yieldContent(string $section, string $default = '')

Get the string contents of a section.

static string
parentPlaceholder(string $section = '')

Get the parent placeholder for the current request.

bool
hasSection(string $name)

Check if section exists.

array
getSections()

Get the entire array of sections.

void
flushSections()

Flush all of the sections.

void
addLoop(Countable|array $data)

Add new loop to the stack.

void
incrementLoopIndices()

Increment the top loop's indices.

void
popLoop()

Pop a loop from the top of the loop stack.

StdClass|null
getLastLoop()

Get an instance of the last loop in the stack.

array
getLoopStack()

Get the entire loop stack.

void
startPush(string $section, string $content = '')

Start injecting content into a push section.

string
stopPush()

Stop injecting content into a push section.

void
startPrepend(string $section, string $content = '')

Start prepending content into a push section.

string
stopPrepend()

Stop prepending content into a push section.

string
yieldPushContent(string $section, string $default = '')

Get the string contents of a push section.

void
flushStacks()

Flush all of the stacks.

void
startTranslation(array $replacements = array())

Start a translation block.

string
renderTranslation()

Render the current translation.

void
__construct(EngineResolver $engines, ViewFinderInterface $finder, Dispatcher $events)

Create a new view factory instance.

file(string $path, array $data = array(), array $mergeData = array())

Get the evaluated view contents for the given view.

make(string $view, array $data = array(), array $mergeData = array())

Get the evaluated view contents for the given view.

string
renderWhen(bool $condition, string $view, array $data = array(), array $mergeData = array())

Get the rendered content of the view based on a given condition.

string
renderEach(string $view, array $data, string $iterator, string $empty = 'raw|')

Get the rendered contents of a partial from a loop.

bool
exists(string $view)

Determine if a given view exists.

getEngineFromPath(string $path)

Get the appropriate view engine for the given path.

mixed
share(array|string $key, mixed $value = null)

Add a piece of shared data to the environment.

void
incrementRender()

Increment the rendering counter.

void
decrementRender()

Decrement the rendering counter.

bool
doneRendering()

Check if there are no active render operations.

void
addLocation(string $location)

Add a location to the array of view locations.

$this
addNamespace(string $namespace, string|array $hints)

Add a new namespace to the loader.

$this
prependNamespace(string $namespace, string|array $hints)

Prepend a new namespace to the loader.

$this
replaceNamespace(string $namespace, string|array $hints)

Replace the namespace hints for the given namespace.

void
addExtension(string $extension, string $engine, Closure $resolver = null)

Register a valid view extension and its engine.

void
flushState()

Flush all of the factory state like sections and stacks.

void
flushStateIfDoneRendering()

Flush all of the section contents if done rendering.

array
getExtensions()

Get the extension to engine bindings.

getEngineResolver()

Get the engine resolver instance.

getFinder()

Get the view finder instance.

void
setFinder(ViewFinderInterface $finder)

Set the view finder instance.

void
flushFinderCache()

Flush the cache of views located by the finder.

getDispatcher()

Get the event dispatcher instance.

void
setDispatcher(Dispatcher $events)

Set the event dispatcher instance.

getContainer()

Get the IoC container instance.

void
setContainer(Container $container)

Set the IoC container instance.

mixed
shared(string $key, mixed $default = null)

Get an item from the shared data.

array
getShared()

Get all of the shared data for the environment.

Details

void startComponent(string $name, array $data = array())

Start a component rendering process.

Parameters

string $name
array $data

Return Value

void

string renderComponent()

Render the current component.

Return Value

string

void slot(string $name, string|null $content = null)

Start the slot rendering process.

Parameters

string $name
string|null $content

Return Value

void

void endSlot()

Save the slot content for rendering.

Return Value

void

array creator(array|string $views, Closure|string $callback)

Register a view creator event.

Parameters

array|string $views
Closure|string $callback

Return Value

array

array composers(array $composers)

Register multiple view composers via an array.

Parameters

array $composers

Return Value

array

array composer(array|string $views, Closure|string $callback)

Register a view composer event.

Parameters

array|string $views
Closure|string $callback

Return Value

array

void callComposer(View $view)

Call the composer for a given view.

Parameters

View $view

Return Value

void

void callCreator(View $view)

Call the creator for a given view.

Parameters

View $view

Return Value

void

void startSection(string $section, string|null $content = null)

Start injecting content into a section.

Parameters

string $section
string|null $content

Return Value

void

void inject(string $section, string $content)

Inject inline content into a section.

Parameters

string $section
string $content

Return Value

void

string yieldSection()

Stop injecting content into a section and return its contents.

Return Value

string

string stopSection(bool $overwrite = false)

Stop injecting content into a section.

Parameters

bool $overwrite

Return Value

string

Exceptions

InvalidArgumentException

string appendSection()

Stop injecting content into a section and append it.

Return Value

string

Exceptions

InvalidArgumentException

string yieldContent(string $section, string $default = '')

Get the string contents of a section.

Parameters

string $section
string $default

Return Value

string

static string parentPlaceholder(string $section = '')

Get the parent placeholder for the current request.

Parameters

string $section

Return Value

string

bool hasSection(string $name)

Check if section exists.

Parameters

string $name

Return Value

bool

array getSections()

Get the entire array of sections.

Return Value

array

void flushSections()

Flush all of the sections.

Return Value

void

void addLoop(Countable|array $data)

Add new loop to the stack.

Parameters

Countable|array $data

Return Value

void

void incrementLoopIndices()

Increment the top loop's indices.

Return Value

void

void popLoop()

Pop a loop from the top of the loop stack.

Return Value

void

StdClass|null getLastLoop()

Get an instance of the last loop in the stack.

Return Value

StdClass|null

array getLoopStack()

Get the entire loop stack.

Return Value

array

void startPush(string $section, string $content = '')

Start injecting content into a push section.

Parameters

string $section
string $content

Return Value

void

string stopPush()

Stop injecting content into a push section.

Return Value

string

Exceptions

InvalidArgumentException

void startPrepend(string $section, string $content = '')

Start prepending content into a push section.

Parameters

string $section
string $content

Return Value

void

string stopPrepend()

Stop prepending content into a push section.

Return Value

string

Exceptions

InvalidArgumentException

string yieldPushContent(string $section, string $default = '')

Get the string contents of a push section.

Parameters

string $section
string $default

Return Value

string

void flushStacks()

Flush all of the stacks.

Return Value

void

void startTranslation(array $replacements = array())

Start a translation block.

Parameters

array $replacements

Return Value

void

string renderTranslation()

Render the current translation.

Return Value

string

at line line 91
void __construct(EngineResolver $engines, ViewFinderInterface $finder, Dispatcher $events)

Create a new view factory instance.

Parameters

EngineResolver $engines
ViewFinderInterface $finder
Dispatcher $events

Return Value

void

at line line 108
View file(string $path, array $data = array(), array $mergeData = array())

Get the evaluated view contents for the given view.

Parameters

string $path
array $data
array $mergeData

Return Value

View

at line line 125
View make(string $view, array $data = array(), array $mergeData = array())

Get the evaluated view contents for the given view.

Parameters

string $view
array $data
array $mergeData

Return Value

View

at line line 150
string renderWhen(bool $condition, string $view, array $data = array(), array $mergeData = array())

Get the rendered content of the view based on a given condition.

Parameters

bool $condition
string $view
array $data
array $mergeData

Return Value

string

at line line 168
string renderEach(string $view, array $data, string $iterator, string $empty = 'raw|')

Get the rendered contents of a partial from a loop.

Parameters

string $view
array $data
string $iterator
string $empty

Return Value

string

at line line 236
bool exists(string $view)

Determine if a given view exists.

Parameters

string $view

Return Value

bool

at line line 255
EngineInterface getEngineFromPath(string $path)

Get the appropriate view engine for the given path.

Parameters

string $path

Return Value

EngineInterface

Exceptions

InvalidArgumentException

at line line 288
mixed share(array|string $key, mixed $value = null)

Add a piece of shared data to the environment.

Parameters

array|string $key
mixed $value

Return Value

mixed

at line line 304
void incrementRender()

Increment the rendering counter.

Return Value

void

at line line 314
void decrementRender()

Decrement the rendering counter.

Return Value

void

at line line 324
bool doneRendering()

Check if there are no active render operations.

Return Value

bool

at line line 335
void addLocation(string $location)

Add a location to the array of view locations.

Parameters

string $location

Return Value

void

at line line 347
$this addNamespace(string $namespace, string|array $hints)

Add a new namespace to the loader.

Parameters

string $namespace
string|array $hints

Return Value

$this

at line line 361
$this prependNamespace(string $namespace, string|array $hints)

Prepend a new namespace to the loader.

Parameters

string $namespace
string|array $hints

Return Value

$this

at line line 375
$this replaceNamespace(string $namespace, string|array $hints)

Replace the namespace hints for the given namespace.

Parameters

string $namespace
string|array $hints

Return Value

$this

at line line 390
void addExtension(string $extension, string $engine, Closure $resolver = null)

Register a valid view extension and its engine.

Parameters

string $extension
string $engine
Closure $resolver

Return Value

void

at line line 408
void flushState()

Flush all of the factory state like sections and stacks.

Return Value

void

at line line 421
void flushStateIfDoneRendering()

Flush all of the section contents if done rendering.

Return Value

void

at line line 433
array getExtensions()

Get the extension to engine bindings.

Return Value

array

at line line 443
EngineResolver getEngineResolver()

Get the engine resolver instance.

Return Value

EngineResolver

at line line 453
ViewFinderInterface getFinder()

Get the view finder instance.

Return Value

ViewFinderInterface

at line line 464
void setFinder(ViewFinderInterface $finder)

Set the view finder instance.

Parameters

ViewFinderInterface $finder

Return Value

void

at line line 474
void flushFinderCache()

Flush the cache of views located by the finder.

Return Value

void

at line line 484
Dispatcher getDispatcher()

Get the event dispatcher instance.

Return Value

Dispatcher

at line line 495
void setDispatcher(Dispatcher $events)

Set the event dispatcher instance.

Parameters

Dispatcher $events

Return Value

void

at line line 505
Container getContainer()

Get the IoC container instance.

Return Value

Container

at line line 516
void setContainer(Container $container)

Set the IoC container instance.

Parameters

Container $container

Return Value

void

at line line 528
mixed shared(string $key, mixed $default = null)

Get an item from the shared data.

Parameters

string $key
mixed $default

Return Value

mixed

at line line 538
array getShared()

Get all of the shared data for the environment.

Return Value

array