src/Framework/App.php
private function exec(
        RouteInterface $route,
        RequestInterface $request,
        ResponseInterface $response,
        bool $error = false
    ) {
        $variables = $route->getVariables();
        $callback = $route->getCallback();

        // If extracted call back is string
        if (\is_string($callback)) {

            $className = $this->extractClass($callback);

            // Then class provided
            $class = new $className();
            $action = $this->detectAction($callback, $variables);

            // If method is not found in class and error is not triggered, then trigger error
            if (true !== $error && false === $this->methodCheck($class, $action)) {
                $router = $this->container('router');
                $routeError = $router->getError();
                return $this->exec($routeError, $request, $response, true);
            }

            // Call required action, with request/response
            $class->$action($request, $response, $variables);
        } else {
            // Else simple callback
            $callback($request, $response, $variables);
        }
        return $response->getBody();
    }
private function exec(
        RouteInterface $route,
        RequestInterface $request,
        ResponseInterface $response,
        bool $error = false
    ) {
        $variables = $route->getVariables();
        $callback = $route->getCallback();

        // If extracted call back is string
        if (\is_string($callback)) {

            $className = $this->extractClass($callback);

            // Then class provided
            $class = new $className();
            $action = $this->detectAction($callback, $variables);

            // If method is not found in class and error is not triggered, then trigger error
            if (true !== $error && false === $this->methodCheck($class, $action)) {
                $router = $this->container('router');
                $routeError = $router->getError();
                return $this->exec($routeError, $request, $response, true);
            }

            // Call required action, with request/response
            $class->$action($request, $response, $variables);
        } else {
            // Else simple callback
            $callback($request, $response, $variables);
        }
        return $response->getBody();
    }
private function exec ( RouteInterface $ route , RequestInterface $ request , ResponseInterface $ response , bool $ error = false ) { $ variables = $ route -> getVariables ( ) ; $ callback = $ route -> getCallback ( ) ; // If extracted call back is string if ( \ is_string ( $ callback ) ) { $ className = $ this -> extractClass ( $ callback ) ; // Then class provided $ class = new $ className ( ) ; $ action = $ this -> detectAction ( $ callback , $ variables ) ; // If method is not found in class and error is not triggered, then trigger error if ( true !== $ error && false === $ this -> methodCheck ( $ class , $ action ) ) { $ router = $ this -> container ( 'router' ) ; $ routeError = $ router -> getError ( ) ; return $ this -> exec ( $ routeError , $ request , $ response , true ) ; } // Call required action, with request/response $ class -> $ action ( $ request , $ response , $ variables ) ; } else { // Else simple callback $ callback ( $ request , $ response , $ variables ) ; } return $ response -> getBody ( ) ; }
Here we need to solve how to display the page, and if method is
not available need to show error

@param   RouteInterface $route
@param   RequestInterface $request
@param   ResponseInterface $response
@param   bool $error
@return  StreamInterface
Here we need to solve how to display the page and if method is not available need to show error