Dispatcher
The final, innermost layer of the request–response dispatch queue.
This class supports the following handlers on Aura\Router\Route objects:
- Anonymous functions (closures and lambdas)
- An array containing a class name and a function name; this object will be retrieved from the container.
- A string; the object with this name in the container will be invoked.
- Copyright
- 2015-2016 Appertly
- License
- Apache-2.0
Constructors / Destructors
| Returns | Signature and Description |
|---|---|
void | __construct(, )Creates a new Dispatcher plugin |
Instance Methods
| Returns | Signature and Description |
|---|---|
ResponseInterface | __invoke(, , )Perform the actual routing and dispatch, returning the Response |
?ServerRequestInterface | Gets the last request that was passed to the |
Gets the plugin priority; larger means first. |
Method Details
__construct
__construct(Matcher $matcher, Container $container)Creates a new Dispatcher plugin
| Name | Type | Description |
|---|---|---|
$matcher | Matcher | The route matcher |
$container | Container | The dependency injection container |
__invoke
__invoke(ServerRequestInterface $request, ResponseInterface $response, (function(Request,Response):Response) $next)Perform the actual routing and dispatch, returning the Response
| Name | Type | Description |
|---|---|---|
$request | ServerRequestInterface | The server request |
$response | ResponseInterface | The response |
$next | (function(Request,Response):Response) | The next layer |
| Type | Description |
|---|---|
ResponseInterface | The new response |
| Type | Conditions |
|---|---|
Unroutable | if route matching fails |
Uncallable | if a controller method can't be invoked |
getLastDispatchedRequest
getLastDispatchedRequest()Gets the last request that was passed to the __invoke method.
- Since
- 0.6.3
| Type | Description |
|---|---|
?ServerRequestInterface | The last request or |
getPriority
getPriority()Gets the plugin priority; larger means first.
| Type | Description |
|---|---|
The plugin priority |