Use instance variable directly instead of passing it around

This commit is contained in:
Franz Liedke 2018-09-07 01:37:07 +02:00
parent df6f10da20
commit 30bc979fcb

View File

@ -46,7 +46,7 @@ class ControllerRouteHandler
*/
public function __invoke(ServerRequestInterface $request, array $routeParams)
{
$controller = $this->resolveController($this->controller);
$controller = $this->resolveController();
$request = $request->withQueryParams(array_merge($request->getQueryParams(), $routeParams));
@ -54,15 +54,14 @@ class ControllerRouteHandler
}
/**
* @param string|callable $class
* @return RequestHandlerInterface
*/
protected function resolveController($class)
protected function resolveController()
{
if (is_callable($class)) {
$controller = $this->container->call($class);
if (is_callable($this->controller)) {
$controller = $this->container->call($this->controller);
} else {
$controller = $this->container->make($class);
$controller = $this->container->make($this->controller);
}
if (! ($controller instanceof RequestHandlerInterface)) {