Skip to content

RouteAction

  • Full name: \Qubus\Routing\Route\RouteAction

Properties

callable

protected mixed $callable

controller

protected mixed $controller

invoker

protected ?\Qubus\Routing\Invoker $invoker

controllerName

protected ?string $controllerName

controllerMethod

protected ?string $controllerMethod

namespace

protected ?string $namespace

Methods

__construct

Constructor

public __construct(mixed $action, ?string $namespace = null, ?\Qubus\Routing\Invoker $invoker = null): mixed

Actions created with a Controller string (e.g. MyController@myMethod) are lazy loaded and the Controller class will only be instantiated when required.

Parameters:

Parameter Type Description
$action mixed
$namespace ?string
$invoker ?\Qubus\Routing\Invoker

invoke

Invoke the action.

public invoke(\Psr\Http\Message\ServerRequestInterface $request, \Qubus\Routing\Route\RouteParams $params): mixed

Parameters:

Parameter Type Description
$request \Psr\Http\Message\ServerRequestInterface
$params \Qubus\Routing\Route\RouteParams

createCallableFromAction

If the action is a Controller string, a factory callable is returned to allow for lazy loading.

private createCallableFromAction(mixed $action): callable

Parameters:

Parameter Type Description
$action mixed

isControllerAction

Is this a known Controller based action?

private isControllerAction(): bool

getController

Get the Controller for this action. The Controller will only be created once.

private getController(): string|object|null

Return Value:

Returns null if this is not a Controller based action.


createControllerFromClassName

Instantiate a Controller object from the provided class name.

private createControllerFromClassName(string $className): mixed

Parameters:

Parameter Type Description
$className string

providesMiddleware

Can this action provide Middleware.

private providesMiddleware(): bool

getMiddlewares

Get an array of Middleware.

public getMiddlewares(): array

convertClassStringToFactory

Create a factory Closure for the given Controller string.

private convertClassStringToFactory(string $string): \Closure

Parameters:

Parameter Type Description
$string string e.g. MyController@myMethod

Throws:


getActionName

Get the human-readable name of this action.

public getActionName(): string

resolveController

private resolveController(callable|object|string|string[] $controller): callable|object|string|string[]

Parameters:

Parameter Type Description
$controller callable|object|string|string[]


Automatically generated on 2025-10-13