public function outputController(): self
    {
        // Do nothing
        if (!$this->controller) {
            return $this;
        }

        /**
         * @var Controller $controller
         */

        // We init every Controller only once
        if (!isset(self::$controllers[$this->controller])) {
            if (!class_exists($this->controller)) {
                $this->controller = str_replace('_', '', $this->controller);
            }

            $controller = new $this->controller($this);
            // Set up shared data
            // Using autowiring for DI
            $reflector = new ReflectionClass($controller);
            // Get arguments
            $controller_arguments = $reflector->getMethod('__construct')->getParameters();
            foreach ($controller_arguments as $argumentIndex => $constructorArgument) {
                // TODO autowire and create dependency container to get classes
                $argument_class_hint = $constructorArgument->getType();
            }

            $controller->setUp();
            self::$controllers[$this->controller] = $controller;
        }
        $method = $this->method;

        if (!method_exists(self::$controllers[$this->controller], $method)) {
            dump('Method "'. $method .'" in class "'. $this->controller .'" not found.');
        }

        // Execute controller method
        $data = self::$controllers[$this->controller]->$method($this->getModifiers());

        // Require file with data
        $method_file = DIR_FRONT_CONTROLLERS . $this->getComponentName() . '.' . $method . '.php';
        if (is_file($method_file)) {
            require_once $method_file;
        }
        // Require file with data in sub folder
        $method_file = DIR_FRONT_CONTROLLERS . $this->getComponentName() . '/' . $method . '.php';
        if (is_file($method_file)) {
            require_once $method_file;
        }

        // Merge returned data
        if ($data) {
            $this->data += $data;
        }

        return $this;
    }
public function outputController(): self
    {
        // Do nothing
        if (!$this->controller) {
            return $this;
        }

        /**
         * @var Controller $controller
         */

        // We init every Controller only once
        if (!isset(self::$controllers[$this->controller])) {
            if (!class_exists($this->controller)) {
                $this->controller = str_replace('_', '', $this->controller);
            }

            $controller = new $this->controller($this);
            // Set up shared data
            // Using autowiring for DI
            $reflector = new ReflectionClass($controller);
            // Get arguments
            $controller_arguments = $reflector->getMethod('__construct')->getParameters();
            foreach ($controller_arguments as $argumentIndex => $constructorArgument) {
                // TODO autowire and create dependency container to get classes
                $argument_class_hint = $constructorArgument->getType();
            }

            $controller->setUp();
            self::$controllers[$this->controller] = $controller;
        }
        $method = $this->method;

        if (!method_exists(self::$controllers[$this->controller], $method)) {
            dump('Method "'. $method .'" in class "'. $this->controller .'" not found.');
        }

        // Execute controller method
        $data = self::$controllers[$this->controller]->$method($this->getModifiers());

        // Require file with data
        $method_file = DIR_FRONT_CONTROLLERS . $this->getComponentName() . '.' . $method . '.php';
        if (is_file($method_file)) {
            require_once $method_file;
        }
        // Require file with data in sub folder
        $method_file = DIR_FRONT_CONTROLLERS . $this->getComponentName() . '/' . $method . '.php';
        if (is_file($method_file)) {
            require_once $method_file;
        }

        // Merge returned data
        if ($data) {
            $this->data += $data;
        }

        return $this;
    }
public function outputController ( ) : self { // Do nothing if ( ! $ this -> controller ) { return $ this ; } /**
         * @var Controller $controller
         */ // We init every Controller only once if ( ! isset ( self :: $ controllers [ $ this -> controller ] ) ) { if ( ! class_exists ( $ this -> controller ) ) { $ this -> controller = str_replace ( '_' , '' , $ this -> controller ) ; } $ controller = new $ this -> controller ( $ this ) ; // Set up shared data // Using autowiring for DI $ reflector = new ReflectionClass ( $ controller ) ; // Get arguments $ controller_arguments = $ reflector -> getMethod ( '__construct' ) -> getParameters ( ) ; foreach ( $ controller_arguments as $ argumentIndex => $ constructorArgument ) { // TODO autowire and create dependency container to get classes $ argument_class_hint = $ constructorArgument -> getType ( ) ; } $ controller -> setUp ( ) ; self :: $ controllers [ $ this -> controller ] = $ controller ; } $ method = $ this -> method ; if ( ! method_exists ( self :: $ controllers [ $ this -> controller ] , $ method ) ) { dump ( 'Method "' . $ method . '" in class "' . $ this -> controller . '" not found.' ) ; } // Execute controller method $ data = self :: $ controllers [ $ this -> controller ] -> $ method ( $ this -> getModifiers ( ) ) ; // Require file with data $ method_file = DIR_FRONT_CONTROLLERS . $ this -> getComponentName ( ) . '.' . $ method . '.php' ; if ( is_file ( $ method_file ) ) { require_once $ method_file ; } // Require file with data in sub folder $ method_file = DIR_FRONT_CONTROLLERS . $ this -> getComponentName ( ) . '/' . $ method . '.php' ; if ( is_file ( $ method_file ) ) { require_once $ method_file ; } // Merge returned data if ( $ data ) { $ this -> data += $ data ; } return $ this ; }
Get data from controller

@return $this
Get data from controller