View
View
Template-backed HTML response.
class View extends \Hazaar\Controller\Response\HTMLExtends: Hazaar\Controller\Response\HTML
This response wraps a Hazaar\View 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 $_viewType: Hazaar\View
__data
private array $__dataType: array
Methods
__construct
public __construct(HazaarView|string $view, ?array $data): voidParameters
| Parameter | Type | Description |
|---|---|---|
$view | Hazaar\View | string |
$data | array |
__prepare
Prepare the response content prior to dispatch output.
protected __prepare(Controller $controller): voidReturns: void
Injects accumulated template data into the view, renders it, and stores the rendered markup as the response body.
Parameters
| Parameter | Type | Description |
|---|---|---|
$controller | Hazaar\Controller | active controller instance |
__call
public __call(string $method, array $paramArr): mixedReturns: mixed
Parameters
| Parameter | Type | Description |
|---|---|---|
$method | string | |
$paramArr | array |
__set
Magic setter for assigning template variables.
public __set(mixed $key, mixed $value): voidReturns: void
Parameters
| 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: mixed
Returns a reference to preserve read/write behavior expected by callers.
Parameters
| Parameter | Type | Description |
|---|---|---|
$key | mixed | template variable key |
populate
public populate(array $values): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$values | array |
load
Load a view source into the response.
public load(HazaarView|string $view): voidReturns: void
Accepts either an existing view instance or a view identifier/path that will be resolved into a new Hazaar\View.
Parameters
| Parameter | Type | Description |
|---|---|---|
$view | Hazaar\View | string |
getContent
Render and return response content.
public getContent(): stringReturns: string
Generated by Hazaar API Doc Generator on Fri, 04 Sep 2026 23:32:16 +0000