Default configuration.
public array $defaultConfig = array (
'controller' => 'index',
'action' => 'index',
'args' =>
array (
),
)
Internal controllers.
public array $internal = array (
'hazaar' => '\\Hazaar\\Controller\\Internal',
)
private Loader $routeLoader
public __construct(array $config): void
Parameter | Type | Description |
---|
$config | array | |
public initialise(): bool
Evaluates the given request and matches it against the defined routes.
public evaluateRequest(Request $request): ?Route
Parameter | Type | Description |
---|
$request | Request | the request to evaluate |
Adds a route to the router.
public addRoute(Route $route): void
This method sets the router for the given route and then adds the route to the list of routes managed by this router.
Parameter | Type | Description |
---|
$route | Route | the route to be added |
Retrieves the error controller instance.
public getErrorController(): Error
This method checks the configuration for a specified error controller class. If the class exists and is a subclass of the Error class, it instantiates and returns the error controller. If no valid error controller is found in the configuration, it returns a default Error instance.
public get(string $path, mixed $callable): void
Parameter | Type | Description |
---|
$path | string | |
$callable | mixed | |
public post(string $path, mixed $callable): void
Parameter | Type | Description |
---|
$path | string | |
$callable | mixed | |
public put(string $path, mixed $callable): void
Parameter | Type | Description |
---|
$path | string | |
$callable | mixed | |
public delete(string $path, mixed $callable): void
Parameter | Type | Description |
---|
$path | string | |
$callable | mixed | |
public patch(string $path, mixed $callable): void
Parameter | Type | Description |
---|
$path | string | |
$callable | mixed | |
public options(string $path, mixed $callable): void
Parameter | Type | Description |
---|
$path | string | |
$callable | mixed | |
public any(string $path, mixed $callable): void
Parameter | Type | Description |
---|
$path | string | |
$callable | mixed | |
public (string $methods, string $path, mixed $callable): void
Parameter | Type | Description |
---|
$methods | string | |
$path | string | |
$callable | mixed | |
public add(Route $route): void
Parameter | Type | Description |
---|
$route | Route | |
Generated by Hazaar API Doc Generator