private function constructAction($action, array $arguments = []): bool
    {
        if (is_callable($action)) {
            $this->pendingAction = $action;

            return true;
        } elseif (is_string($action)) {
            $actionParts = explode('@', $action);

            $controllerName = 'App\\Http\\Controllers\\' . $actionParts[0];
            $methodName = $actionParts[1];

            if (!class_exists($controllerName)) {
                throw new HTTPException('Not found', 404);
            }

            $controller = $this->container->get($controllerName);

            if (!method_exists($controller, $methodName)) {
                throw new HTTPException('Not found', 404);
            }

            $this->pendingAction = [
                'controller' => $controllerName,
                'method' => $methodName,
                'arguments' => $arguments,
            ];

            return true;
        }

        return false;
    }
private function constructAction($action, array $arguments = []): bool
    {
        if (is_callable($action)) {
            $this->pendingAction = $action;

            return true;
        } elseif (is_string($action)) {
            $actionParts = explode('@', $action);

            $controllerName = 'App\\Http\\Controllers\\' . $actionParts[0];
            $methodName = $actionParts[1];

            if (!class_exists($controllerName)) {
                throw new HTTPException('Not found', 404);
            }

            $controller = $this->container->get($controllerName);

            if (!method_exists($controller, $methodName)) {
                throw new HTTPException('Not found', 404);
            }

            $this->pendingAction = [
                'controller' => $controllerName,
                'method' => $methodName,
                'arguments' => $arguments,
            ];

            return true;
        }

        return false;
    }
private function constructAction ( $ action , array $ arguments = [ ] ) : bool { if ( is_callable ( $ action ) ) { $ this -> pendingAction = $ action ; return true ; } elseif ( is_string ( $ action ) ) { $ actionParts = explode ( '@' , $ action ) ; $ controllerName = 'App\\Http\\Controllers\\' . $ actionParts [ 0 ] ; $ methodName = $ actionParts [ 1 ] ; if ( ! class_exists ( $ controllerName ) ) { throw new HTTPException ( 'Not found' , 404 ) ; } $ controller = $ this -> container -> get ( $ controllerName ) ; if ( ! method_exists ( $ controller , $ methodName ) ) { throw new HTTPException ( 'Not found' , 404 ) ; } $ this -> pendingAction = [ 'controller' => $ controllerName , 'method' => $ methodName , 'arguments' => $ arguments , ] ; return true ; } return false ; }
Construct action before running it.

@param $action
@param array $arguments

@throws \Shorty\Framework\Routing\Exceptions\HTTPException

@return bool
Construct action before running it .