protected function callController($controller)
    {
        if (is_string($controller) && strpos($controller, self::SEPARATOR) !== false) {
            list($controller, $action) = explode(self::SEPARATOR, $controller);
            $response = $this->callClassController($controller, $action);
        } elseif (is_callable($controller)) {
            $response = $this->callCallableController($controller);
        } else {
            throw new AppException(sprintf('Invalid controller type, got "%s"', $this->getType($controller)));
        }

        if (!$response) {
            throw new AppException(sprintf('There was no response returned from the controller handling "%s"', $this->request()->uri(true)));
        }

        if (!$response instanceof ResponseInterface) {
            throw new AppException(sprintf('Invalid response returned from handling "%s", expected ResponseInterface, got "%s"', $this->request()->uri(true), $this->getType($response)));
        }

        return $response;
    }
protected function callController($controller)
    {
        if (is_string($controller) && strpos($controller, self::SEPARATOR) !== false) {
            list($controller, $action) = explode(self::SEPARATOR, $controller);
            $response = $this->callClassController($controller, $action);
        } elseif (is_callable($controller)) {
            $response = $this->callCallableController($controller);
        } else {
            throw new AppException(sprintf('Invalid controller type, got "%s"', $this->getType($controller)));
        }

        if (!$response) {
            throw new AppException(sprintf('There was no response returned from the controller handling "%s"', $this->request()->uri(true)));
        }

        if (!$response instanceof ResponseInterface) {
            throw new AppException(sprintf('Invalid response returned from handling "%s", expected ResponseInterface, got "%s"', $this->request()->uri(true), $this->getType($response)));
        }

        return $response;
    }
protected function callController ( $ controller ) { if ( is_string ( $ controller ) && strpos ( $ controller , self :: SEPARATOR ) !== false ) { list ( $ controller , $ action ) = explode ( self :: SEPARATOR , $ controller ) ; $ response = $ this -> callClassController ( $ controller , $ action ) ; } elseif ( is_callable ( $ controller ) ) { $ response = $ this -> callCallableController ( $ controller ) ; } else { throw new AppException ( sprintf ( 'Invalid controller type, got "%s"' , $ this -> getType ( $ controller ) ) ) ; } if ( ! $ response ) { throw new AppException ( sprintf ( 'There was no response returned from the controller handling "%s"' , $ this -> request ( ) -> uri ( true ) ) ) ; } if ( ! $ response instanceof ResponseInterface ) { throw new AppException ( sprintf ( 'Invalid response returned from handling "%s", expected ResponseInterface, got "%s"' , $ this -> request ( ) -> uri ( true ) , $ this -> getType ( $ response ) ) ) ; } return $ response ; }
Calls controller from callable or class

@param string|array|callable $controller

@return ResponseInterface
@throws AppException
Calls controller from callable or class