Skip to content

NativeLoader

  • Full name: \Qubus\View\Native\NativeLoader
  • This class is marked as final and can't be subclassed
  • This class implements: \Qubus\View\Native\TemplateEngine
  • This class is a Final class

Properties

namespaces

private array $namespaces

functions

private array $functions

extension

private string $extension

Methods

__construct

Constructor for the engine.

public __construct(array $namespaces = [], array $functions = [], string $extension = 'phtml'): mixed

The key of the entries into the namespaces array should be the namespace and the value should be the root directory path for templates in that namespace.

The key of the entries to the functions array should be the method name to hook in the template context and the value should be a callable to invoke when this method is called.

Parameters:

Parameter Type Description
$namespaces array The template namespaces to register.
$functions array The functions to register.
$extension string The file extension of the templates.

render

public render(string $template, array $data = []): ?string

Parameters:

Parameter Type Description
$template string
$data array

Throws:


exists

Check to see if a template exists.

public exists(string $name): bool

Parameters:

Parameter Type Description
$name string The service name.

Return Value:

True if the container has the service, false otherwise.


getTemplatePath

Convert a template name to a file path.

public getTemplatePath(string $name): string

Parameters:

Parameter Type Description
$name string The template name.

Return Value:

The file path of the template.


callFunction

Call a function that has been registered with the templating engine.

public callFunction(string|callable $name, array $arguments = []): mixed

Parameters:

Parameter Type Description
$name string|callable The function name.
$arguments array The arguments to supply to the function.

Return Value:

The function result.

Throws:


batch

Apply multiple functions to variable.

public batch(string $var, string $functions): mixed

Parameters:

Parameter Type Description
$var string
$functions string


Automatically generated on 2025-10-13