src/Yggdrasil/Core/Kernel.php
private function executeAction(Request $request, Response $response)
    {
        $route = $this->getRouter()->getRoute($request);

        if (!method_exists($route->getController(), $route->getAction())) {
            if ('prod' === $this->configuration['framework']['env']) {
                return $response
                    ->setContent($this->getRouter()->getConfiguration()->getNotFoundMsg() ?? 'Not found.')
                    ->setStatusCode(Response::HTTP_NOT_FOUND);
            }

            throw new ActionNotFoundException($route->getAction() . ' for ' . $route->getController() . ' not found.');
        }

        $errorController = $this->getRouter()->getConfiguration()->getControllerNamespace() . 'ErrorController';

        if (1 === preg_match('(Partial|Passive)', $route->getAction()) || $errorController === $route->getController()) {
            if ('prod' === $this->configuration['framework']['env']) {
                return $response
                    ->setContent('Forbidden.')
                    ->setStatusCode(Response::HTTP_FORBIDDEN);
            }

            throw new ActionForbiddenException('Partial, passive and error actions cannot be requested by user.');
        }

        $controllerName = $route->getController();
        $controller = new $controllerName($this->drivers, $request, $response);

        return $controller->{$route->getAction()}(...$route->getActionParams());
    }
private function executeAction(Request $request, Response $response)
    {
        $route = $this->getRouter()->getRoute($request);

        if (!method_exists($route->getController(), $route->getAction())) {
            if ('prod' === $this->configuration['framework']['env']) {
                return $response
                    ->setContent($this->getRouter()->getConfiguration()->getNotFoundMsg() ?? 'Not found.')
                    ->setStatusCode(Response::HTTP_NOT_FOUND);
            }

            throw new ActionNotFoundException($route->getAction() . ' for ' . $route->getController() . ' not found.');
        }

        $errorController = $this->getRouter()->getConfiguration()->getControllerNamespace() . 'ErrorController';

        if (1 === preg_match('(Partial|Passive)', $route->getAction()) || $errorController === $route->getController()) {
            if ('prod' === $this->configuration['framework']['env']) {
                return $response
                    ->setContent('Forbidden.')
                    ->setStatusCode(Response::HTTP_FORBIDDEN);
            }

            throw new ActionForbiddenException('Partial, passive and error actions cannot be requested by user.');
        }

        $controllerName = $route->getController();
        $controller = new $controllerName($this->drivers, $request, $response);

        return $controller->{$route->getAction()}(...$route->getActionParams());
    }
private function executeAction ( Request $ request , Response $ response ) { $ route = $ this -> getRouter ( ) -> getRoute ( $ request ) ; if ( ! method_exists ( $ route -> getController ( ) , $ route -> getAction ( ) ) ) { if ( 'prod' === $ this -> configuration [ 'framework' ] [ 'env' ] ) { return $ response -> setContent ( $ this -> getRouter ( ) -> getConfiguration ( ) -> getNotFoundMsg ( ) ?? 'Not found.' ) -> setStatusCode ( Response :: HTTP_NOT_FOUND ) ; } throw new ActionNotFoundException ( $ route -> getAction ( ) . ' for ' . $ route -> getController ( ) . ' not found.' ) ; } $ errorController = $ this -> getRouter ( ) -> getConfiguration ( ) -> getControllerNamespace ( ) . 'ErrorController' ; if ( 1 === preg_match ( '(Partial|Passive)' , $ route -> getAction ( ) ) || $ errorController === $ route -> getController ( ) ) { if ( 'prod' === $ this -> configuration [ 'framework' ] [ 'env' ] ) { return $ response -> setContent ( 'Forbidden.' ) -> setStatusCode ( Response :: HTTP_FORBIDDEN ) ; } throw new ActionForbiddenException ( 'Partial, passive and error actions cannot be requested by user.' ) ; } $ controllerName = $ route -> getController ( ) ; $ controller = new $ controllerName ( $ this -> drivers , $ request , $ response ) ; return $ controller -> { $ route -> getAction ( ) } ( ... $ route -> getActionParams ( ) ) ; }
Executes active action

@param Request  $request
@param Response $response Response returned by passive actions execution
@return mixed|Response
@throws ActionNotFoundException if requested action can't be found in dev mode
@throws ActionForbiddenException if requested action is partial, passive or belongs to ErrorController in dev mode
Executes active action