1
0
mirror of https://github.com/flarum/core.git synced 2025-07-30 13:10:24 +02:00

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 4770a5c906
commit 2367a45c18

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)) {