public function run(): void
    {
        try {
            /** @var \Ffcms\Core\Arch\Controller $callClass */
            $callClass = $this->getCallbackClass();
            $callMethod = 'action' . self::$Request->getAction();
            $arguments = self::$Request->getArguments();

            // check if callback method (action) is exist in class object
            if (!method_exists($callClass, $callMethod)) {
                throw new NotFoundException('Method "' . App::$Security->strip_tags($callMethod) . '()" not founded in "' . get_class($callClass) . '"');
            }

            // check if method arguments counts equals passed count
            $requiredArgCount = $this->getMethodRequiredArgCount($callClass, $callMethod);

            // compare method arg count with passed
            if (count($arguments) < $requiredArgCount) {
                throw new NotFoundException(__('Arguments for method %method% is not enough. Expected: %required%, got: %current%.', [
                    'method' => $callMethod,
                    'required' => $requiredArgCount,
                    'current' => count($arguments)
                ]));
            }

            // make callback call to action in controller and get response
            $response = call_user_func_array([$callClass, $callMethod], $arguments);

            // if no response - throw 404 not found
            if (!$response) {
                throw new NotFoundException('Page not found: 404 error');
            }
        } catch (\Exception $e) {
            // check if exception is system-based throw
            if ($e instanceof TemplateException) {
                $response = $e->display();
            } else { // or hook exception to system based :)))
                if (App::$Debug) {
                    $msg = $e->getMessage() . $e->getTraceAsString();
                    $response = (new NativeException($msg))->display();
                } else {
                    $response = (new NativeException($e->getMessage()))->display();
                }
            }
        }

        // set full rendered content to response builder
        self::$Response->setContent($response);
        // echo full response to user via symfony http foundation
        self::$Response->send();
    }
public function run(): void
    {
        try {
            /** @var \Ffcms\Core\Arch\Controller $callClass */
            $callClass = $this->getCallbackClass();
            $callMethod = 'action' . self::$Request->getAction();
            $arguments = self::$Request->getArguments();

            // check if callback method (action) is exist in class object
            if (!method_exists($callClass, $callMethod)) {
                throw new NotFoundException('Method "' . App::$Security->strip_tags($callMethod) . '()" not founded in "' . get_class($callClass) . '"');
            }

            // check if method arguments counts equals passed count
            $requiredArgCount = $this->getMethodRequiredArgCount($callClass, $callMethod);

            // compare method arg count with passed
            if (count($arguments) < $requiredArgCount) {
                throw new NotFoundException(__('Arguments for method %method% is not enough. Expected: %required%, got: %current%.', [
                    'method' => $callMethod,
                    'required' => $requiredArgCount,
                    'current' => count($arguments)
                ]));
            }

            // make callback call to action in controller and get response
            $response = call_user_func_array([$callClass, $callMethod], $arguments);

            // if no response - throw 404 not found
            if (!$response) {
                throw new NotFoundException('Page not found: 404 error');
            }
        } catch (\Exception $e) {
            // check if exception is system-based throw
            if ($e instanceof TemplateException) {
                $response = $e->display();
            } else { // or hook exception to system based :)))
                if (App::$Debug) {
                    $msg = $e->getMessage() . $e->getTraceAsString();
                    $response = (new NativeException($msg))->display();
                } else {
                    $response = (new NativeException($e->getMessage()))->display();
                }
            }
        }

        // set full rendered content to response builder
        self::$Response->setContent($response);
        // echo full response to user via symfony http foundation
        self::$Response->send();
    }
public function run ( ) : void { try { /** @var \Ffcms\Core\Arch\Controller $callClass */ $ callClass = $ this -> getCallbackClass ( ) ; $ callMethod = 'action' . self :: $ Request -> getAction ( ) ; $ arguments = self :: $ Request -> getArguments ( ) ; // check if callback method (action) is exist in class object if ( ! method_exists ( $ callClass , $ callMethod ) ) { throw new NotFoundException ( 'Method "' . App :: $ Security -> strip_tags ( $ callMethod ) . '()" not founded in "' . get_class ( $ callClass ) . '"' ) ; } // check if method arguments counts equals passed count $ requiredArgCount = $ this -> getMethodRequiredArgCount ( $ callClass , $ callMethod ) ; // compare method arg count with passed if ( count ( $ arguments ) < $ requiredArgCount ) { throw new NotFoundException ( __ ( 'Arguments for method %method% is not enough. Expected: %required%, got: %current%.' , [ 'method' => $ callMethod , 'required' => $ requiredArgCount , 'current' => count ( $ arguments ) ] ) ) ; } // make callback call to action in controller and get response $ response = call_user_func_array ( [ $ callClass , $ callMethod ] , $ arguments ) ; // if no response - throw 404 not found if ( ! $ response ) { throw new NotFoundException ( 'Page not found: 404 error' ) ; } } catch ( \ Exception $ e ) { // check if exception is system-based throw if ( $ e instanceof TemplateException ) { $ response = $ e -> display ( ) ; } else { // or hook exception to system based :))) if ( App :: $ Debug ) { $ msg = $ e -> getMessage ( ) . $ e -> getTraceAsString ( ) ; $ response = ( new NativeException ( $ msg ) ) -> display ( ) ; } else { $ response = ( new NativeException ( $ e -> getMessage ( ) ) ) -> display ( ) ; } } } // set full rendered content to response builder self :: $ Response -> setContent ( $ response ) ; // echo full response to user via symfony http foundation self :: $ Response -> send ( ) ; }
Run applications and display output. Main entry point of system.
@return void
Run applications and display output . Main entry point of system .