FunctionHandler
FunctionHandler
Properties
view
private View $viewMethods
__construct
public __construct(View $view): voidParameters
| Parameter | Type | Description |
|---|---|---|
$view | View |
__default
Dynamically calls a method on a view helper.
public __default(string $name, array $args): ?stringAttempts to retrieve a helper by name from the view. If the helper exists, it calls the specified method (defaulting to 'render' if not provided) with the given arguments. Returns the result as a string, or null if the helper or method does not exist.
Parameters
| Parameter | Type | Description |
|---|---|---|
$name | string | the name of the helper to retrieve |
$args | array | Arguments to pass to the helper method. The first argument can optionally specify the method name. |
layout
Returns the layout content if the current view is an instance of Layout.
public layout(): stringurl
Generates a URL based on the provided controller, action, parameters, and absolute flag.
public url(?string $controller, ?string $action, array $params, bool $absolute): URLParameters
| Parameter | Type | Description |
|---|---|---|
$controller | string | the name of the controller |
$action | string | the name of the action |
$params | array | an array of parameters to be included in the URL |
$absolute | bool | determines whether the generated URL should be absolute or relative |
date
Returns a date string formatted to the current set date format.
public date(string $date = 'now'): stringParameters
| Parameter | Type | Description |
|---|---|---|
$date | string |
time
Returns a time string formatted to the current set time format.
public time(string $time = 'now'): stringParameters
| Parameter | Type | Description |
|---|---|---|
$time | string |
timestamp
Return a date/time type as a timestamp string.
public timestamp(string $value = 'now'): stringThis is for making it quick and easy to output consistent timestamp strings.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | string |
datetime
Return a formatted date as a string.
public datetime(mixed $value = 'now', ?string $format): stringParameters
| Parameter | Type | Description |
|---|---|---|
$value | mixed | This can be practically any date type. Either a \Hazaar\Util\DateTime object, epoch int, or even a string. |
$format | string | Optionally specify the format to display the date. Otherwise the current default is used. |
config
Loads a configuration file and sets a key-value pair in the view if the key exists.
public config(string $file, ?string $name, ?string $key): voidOpens the specified configuration file, retrieves the value for the given key, and if the value is not null, sets it in the view context under the same key.
Parameters
| Parameter | Type | Description |
|---|---|---|
$file | string | the configuration file to open |
$name | string | the name of the configuration section to retrieve (optional) |
$key | string | the key under which to set the retrieved value in the view context (optional, defaults to the name of the configuration section) |
Generated by Hazaar API Doc Generator on Sun, 01 Mar 2026 09:22:26 +0000