Router creates Dispatcher instance in overridable method
This commit is contained in:
parent
45b13691a2
commit
d269970210
|
|
@ -67,11 +67,20 @@ class Router implements MiddlewareInterface
|
||||||
$statusCode = $response->getStatusCode();
|
$statusCode = $response->getStatusCode();
|
||||||
if (isset($this->statusHandlers[$statusCode])) {
|
if (isset($this->statusHandlers[$statusCode])) {
|
||||||
$middleware = $this->statusHandlers[$statusCode];
|
$middleware = $this->statusHandlers[$statusCode];
|
||||||
$dispatcher = new Dispatcher();
|
$dispatcher = $this->getDispatcher();
|
||||||
$dispatcher->dispatch($middleware, $request, $response);
|
$dispatcher->dispatch($middleware, $request, $response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an instance that can dispatch middleware.
|
||||||
|
* Override to provide a custom class.
|
||||||
|
*/
|
||||||
|
protected function getDispatcher()
|
||||||
|
{
|
||||||
|
return new Dispatcher();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return MethodMapInterface
|
* @return MethodMapInterface
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue