Route
Route
Properties
router
public Router $router
callable
private mixed $callable
path
public string $path
methods
private array $methods
actionArgs
private array $actionArgs
callableParameters
private array $callableParameters
Methods
__construct
public __construct({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$callable | mixed | |
$path | string | |
$methods | array |
setRouter
Sets the router instance for the application.
public setRouter({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$router | Router | the router instance to be set |
getPath
Retrieves the path associated with the current route.
public getPath({Array})
Matches the given HTTP method and path against the route's method and path.
public ({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$method | string | The HTTP method to match (e.g., 'GET', 'POST'). |
$path | string | the request path to match |
getController
Retrieves the controller instance based on the callable property.
public getController({Array})
This method checks if the callable property is a Closure or an array. If it is a Closure, it returns a new Closure instance. If it is an array, it extracts the controller class name, verifies its existence, and returns a new instance of the controller class.
getAction
Retrieves the action to be executed.
public getAction({Array})
This method checks if the action is defined in the callable array. If it is, it returns that action. Otherwise, it falls back to the default action specified in the router configuration.
getActionArgs
Retrieve the action arguments.
public getActionArgs({Array})
This method returns an array of arguments that are passed to the action.
Generated by Hazaar API Doc Generator