src/Router.php
private function runController($controller, array $parameters, ServerRequestInterface $request)
    {
        try {
            if (is_string($controller) && strpos($controller, '@')) {
                list($className, $methodName) = explode('@', $controller);

                if (class_exists($className) == false) {
                    throw new InvalidControllerException("Controller class `$controller` not found.");
                }

                $classObject = new $className();

                if (method_exists($classObject, $methodName) == false) {
                    throw new InvalidControllerException("Controller method `$methodName` not found.");
                }

                $parameters = $this->arrangeMethodParameters($className, $methodName, $parameters, $request);

                $controller = [$classObject, $methodName];
            } elseif (is_callable($controller)) {
                $parameters = $this->arrangeFunctionParameters($controller, $parameters, $request);
            } else {
                throw new InvalidControllerException('Invalid controller: '.$controller);
            }

            return call_user_func_array($controller, $parameters);
        } catch (ReflectionException $e) {
            throw new InvalidControllerException('', 0, $e);
        }
    }
private function runController($controller, array $parameters, ServerRequestInterface $request)
    {
        try {
            if (is_string($controller) && strpos($controller, '@')) {
                list($className, $methodName) = explode('@', $controller);

                if (class_exists($className) == false) {
                    throw new InvalidControllerException("Controller class `$controller` not found.");
                }

                $classObject = new $className();

                if (method_exists($classObject, $methodName) == false) {
                    throw new InvalidControllerException("Controller method `$methodName` not found.");
                }

                $parameters = $this->arrangeMethodParameters($className, $methodName, $parameters, $request);

                $controller = [$classObject, $methodName];
            } elseif (is_callable($controller)) {
                $parameters = $this->arrangeFunctionParameters($controller, $parameters, $request);
            } else {
                throw new InvalidControllerException('Invalid controller: '.$controller);
            }

            return call_user_func_array($controller, $parameters);
        } catch (ReflectionException $e) {
            throw new InvalidControllerException('', 0, $e);
        }
    }
Run the controller

@param Closure|callable|string $controller
@param array $parameters
@param ServerRequestInterface $request
@return ResponseInterface|null
@throws InvalidControllerException