View
View
Template-backed HTML response.
class View extends \Hazaar\Controller\Response\HTMLThis response wraps a {@see HazaarView} instance and exposes a lightweight data container for template variables. It integrates with controller preparation hooks to populate and render view content before output.
The class supports both direct view objects and view identifiers/paths, enabling flexible controller return values while preserving HTML response behavior from the parent class.
Properties
_view
public HazaarView $_view__data
private array $__dataMethods
__construct
public __construct(string $view, ?array $data): voidParameters
| Parameter | Type | Description |
|---|---|---|
$view | string | |
$data | array |
__prepare
Prepare the response content prior to dispatch output.
protected __prepare(Controller $controller): voidInjects accumulated template data into the view, renders it, and stores the rendered markup as the response body.
Parameters
| Parameter | Type | Description |
|---|---|---|
$controller | Controller | active controller instance |
__call
public __call(string $method, array $paramArr): mixedParameters
| Parameter | Type | Description |
|---|---|---|
$method | string | |
$paramArr | array |
__set
Magic setter for assigning template variables.
public __set(mixed $key, mixed $value): voidParameters
| Parameter | Type | Description |
|---|---|---|
$key | mixed | template variable key |
$value | mixed | template variable value |
__get
Magic getter for retrieving template variable values.
public __get(mixed $key): mixedReturns a reference to preserve read/write behavior expected by callers.
Parameters
| Parameter | Type | Description |
|---|---|---|
$key | mixed | template variable key |
populate
public populate(array $values): voidParameters
| Parameter | Type | Description |
|---|---|---|
$values | array |
load
Load a view source into the response.
public load(string $view): voidAccepts either an existing view instance or a view identifier/path that will be resolved into a new {@see HazaarView}.
Parameters
| Parameter | Type | Description |
|---|---|---|
$view | string | view instance or resolvable view reference |
getContent
Render and return response content.
public getContent(): stringGenerated by Hazaar API Doc Generator on Tue, 21 Apr 2026 04:00:24 +0000