PhpRenderer
A renderer produces the output as defined by a View
Synopsis
Section titled “Synopsis”class PhpRenderer extends Renderer implements IReusableRenderer
| Extends | Renderer |
| Implements | IReusableRenderer |
| Since | 1.0.0 |
| Source | Renderer/PhpRenderer.php |
Methods
Section titled “Methods”| Method | Description |
|---|---|
getStarterTemplate(): string | Returns the skeleton PHP template written for a newly scaffolded view. |
| [`render(TemplateLayer $layer, array<string, mixed> &$attributes = [], array<string, mixed> &$slots = [], array<int | string, mixed> &$moreAssigns = []): string`](#render) |
reset(): void | Clears the per-render state held for the template being included. |
getStarterTemplate()
Section titled “getStarterTemplate()”public function getStarterTemplate(): string
Returns the skeleton PHP template written for a newly scaffolded view.
The echoed expression follows the renderer’s current variable configuration: a bare $title when extract_vars is on, otherwise the title key of the configured template variable. The value is escaped in the template itself, since a plain PHP template has no auto-escaping.
Returns string
render()
Section titled “render()”public function render(TemplateLayer $layer, array<string, mixed> &$attributes = [], array<string, mixed> &$slots = [], array<int|string, mixed> &$moreAssigns = []): string
Render the presentation and return the result.
Associative array of additional assigns.
| Parameter | Type | Description |
|---|---|---|
$layer | TemplateLayer | The template layer to render. |
$attributes | array``<``string``, ``mixed``> | The template variables. |
$slots | array``<``string``, ``mixed``> | The slots. |
$moreAssigns | `array<int“ | string, mixed>` |
Returns string — A rendered result.
reset()
Section titled “reset()”public function reset(): void
Clears the per-render state held for the template being included.
Only the layer, attributes, slots and more-assigns are dropped; the parent reset is deliberately not invoked, so the renderer’s configured variable names, extraction flag and assigns survive for the next render.
Inherited methods
Section titled “Inherited methods”These come from an ancestor and are documented where they are declared.
| Method | Declared in | Description |
|---|---|---|
appendParameter() | ParameterHolder | Append a parameter. |
appendParameterByRef() | ParameterHolder | Append a parameter by reference. |
clearParameters() | ParameterHolder | Clear all parameters associated with this request. |
getContext() | Renderer | Retrieve the current application context. |
getDefaultExtension() | Renderer | Get the template file extension |
getFlatParameterNames() | ParameterHolder | Retrieve an array of flattened parameter names. |
getParameter() | ParameterHolder | Retrieve a parameter. |
getParameterNames() | ParameterHolder | Retrieve an array of parameter names. |
getParameters() | ParameterHolder | Retrieve an array of parameters. |
hasParameter() | ParameterHolder | Indicates whether or not a parameter exists. |
initialize() | Renderer | Initialize this Renderer. |
removeParameter() | ParameterHolder | Remove a parameter. |
setParameter() | ParameterHolder | Set a parameter. |
setParameterByRef() | ParameterHolder | Set a parameter by reference. |
setParameters() | ParameterHolder | Set an array of parameters. |
setParametersByRef() | ParameterHolder | Set an array of parameters by reference. |