protected function processAuth(string $actionName, array $actionArgs): void
    {
        // Lambda
        $callAction = function (string $actionName, array $actionArgs) {
            if (empty($actionArgs)) {
                $this->ctrl->{$actionName}();
            } else {
                (new \ReflectionMethod($this->ctrl, $actionName))
                    ->invokeArgs($this->ctrl, $actionArgs);
            }
        };

        if (class_exists('\extensions\core\Auth')) {
            $auth = new \extensions\core\Auth($this->ctrl->getRequest());
            $auth->run();
            if ($auth->isValid()) {
                $callAction($actionName, $actionArgs);
            } else {
                $auth->onFail();
            }
        } else {
            $callAction($actionName, $actionArgs);
        }
    }
protected function processAuth(string $actionName, array $actionArgs): void
    {
        // Lambda
        $callAction = function (string $actionName, array $actionArgs) {
            if (empty($actionArgs)) {
                $this->ctrl->{$actionName}();
            } else {
                (new \ReflectionMethod($this->ctrl, $actionName))
                    ->invokeArgs($this->ctrl, $actionArgs);
            }
        };

        if (class_exists('\extensions\core\Auth')) {
            $auth = new \extensions\core\Auth($this->ctrl->getRequest());
            $auth->run();
            if ($auth->isValid()) {
                $callAction($actionName, $actionArgs);
            } else {
                $auth->onFail();
            }
        } else {
            $callAction($actionName, $actionArgs);
        }
    }
protected function processAuth ( string $ actionName , array $ actionArgs ) : void { // Lambda $ callAction = function ( string $ actionName , array $ actionArgs ) { if ( empty ( $ actionArgs ) ) { $ this -> ctrl -> { $ actionName } ( ) ; } else { ( new \ ReflectionMethod ( $ this -> ctrl , $ actionName ) ) -> invokeArgs ( $ this -> ctrl , $ actionArgs ) ; } } ; if ( class_exists ( '\extensions\core\Auth' ) ) { $ auth = new \ extensions \ core \ Auth ( $ this -> ctrl -> getRequest ( ) ) ; $ auth -> run ( ) ; if ( $ auth -> isValid ( ) ) { $ callAction ( $ actionName , $ actionArgs ) ; } else { $ auth -> onFail ( ) ; } } else { $ callAction ( $ actionName , $ actionArgs ) ; } }
The method calls user auth checking, on successful complition of which
it invokes the target controller and the onFail method of Auth class in
other case.
@param string $actionName The action name of target controller.
@param mixed[] $actionArgs The action parameters.
The method calls user auth checking on successful complition of which it invokes the target controller and the onFail method of Auth class in other case .