public function run($controller = null, $action = null, $args = [])
    {
        $this->router = $this->router->boot($this);

        if (is_null($controller ?? null) and is_null($action ?? null)) {
            $this->router->parseGets();
            $controller = $this->router->controller;
            $action = $this->router->action;
            $namespace = $this->router->namespace;
        }

        $loader = new Loader($this->baseClass);

        $Controller = $loader->loadController($controller, $namespace ?? '\\');
        $response = [];

        if (method_exists($Controller, 'start')) {
            $response[] = ['start', []];
        }

        if (method_exists($Controller, 'init')) {
            $response[] = ['init', []];
        }

        if (method_exists($Controller, $action) or is_callable([$Controller, $action])) {
            $response[] = [$action, $args];
        }

        if (method_exists($Controller, 'end')) {
            $response[] = ['end', []];
        }

        foreach ($response as $key => $data) {
            $run = call_user_func_array([$Controller, $data[0]], $data[1]);
            if ($run instanceof Response) {
                if (isset($this->debug)) {
                    $this->debug->addHeader(['X-DF-Debug-Controller' => $controller]);
                    $this->debug->addHeader(['X-DF-Debug-Method' => $action]);

                    $run->headers($this->debug->getHeader());
                }

                return $run->display();
            }
        }


        return true;
    }
public function run($controller = null, $action = null, $args = [])
    {
        $this->router = $this->router->boot($this);

        if (is_null($controller ?? null) and is_null($action ?? null)) {
            $this->router->parseGets();
            $controller = $this->router->controller;
            $action = $this->router->action;
            $namespace = $this->router->namespace;
        }

        $loader = new Loader($this->baseClass);

        $Controller = $loader->loadController($controller, $namespace ?? '\\');
        $response = [];

        if (method_exists($Controller, 'start')) {
            $response[] = ['start', []];
        }

        if (method_exists($Controller, 'init')) {
            $response[] = ['init', []];
        }

        if (method_exists($Controller, $action) or is_callable([$Controller, $action])) {
            $response[] = [$action, $args];
        }

        if (method_exists($Controller, 'end')) {
            $response[] = ['end', []];
        }

        foreach ($response as $key => $data) {
            $run = call_user_func_array([$Controller, $data[0]], $data[1]);
            if ($run instanceof Response) {
                if (isset($this->debug)) {
                    $this->debug->addHeader(['X-DF-Debug-Controller' => $controller]);
                    $this->debug->addHeader(['X-DF-Debug-Method' => $action]);

                    $run->headers($this->debug->getHeader());
                }

                return $run->display();
            }
        }


        return true;
    }
public function run ( $ controller = null , $ action = null , $ args = [ ] ) { $ this -> router = $ this -> router -> boot ( $ this ) ; if ( is_null ( $ controller ?? null ) and is_null ( $ action ?? null ) ) { $ this -> router -> parseGets ( ) ; $ controller = $ this -> router -> controller ; $ action = $ this -> router -> action ; $ namespace = $ this -> router -> namespace ; } $ loader = new Loader ( $ this -> baseClass ) ; $ Controller = $ loader -> loadController ( $ controller , $ namespace ?? '\\' ) ; $ response = [ ] ; if ( method_exists ( $ Controller , 'start' ) ) { $ response [ ] = [ 'start' , [ ] ] ; } if ( method_exists ( $ Controller , 'init' ) ) { $ response [ ] = [ 'init' , [ ] ] ; } if ( method_exists ( $ Controller , $ action ) or is_callable ( [ $ Controller , $ action ] ) ) { $ response [ ] = [ $ action , $ args ] ; } if ( method_exists ( $ Controller , 'end' ) ) { $ response [ ] = [ 'end' , [ ] ] ; } foreach ( $ response as $ key => $ data ) { $ run = call_user_func_array ( [ $ Controller , $ data [ 0 ] ] , $ data [ 1 ] ) ; if ( $ run instanceof Response ) { if ( isset ( $ this -> debug ) ) { $ this -> debug -> addHeader ( [ 'X-DF-Debug-Controller' => $ controller ] ) ; $ this -> debug -> addHeader ( [ 'X-DF-Debug-Method' => $ action ] ) ; $ run -> headers ( $ this -> debug -> getHeader ( ) ) ; } return $ run -> display ( ) ; } } return true ; }
Display Controller result

@param null  $controller
@param null  $action
@param array $args

@return mixed
Display Controller result