src/Core/Controller/AbstractController.php
public function renderView($view, $layout = 'default', $engine = 'php', array $data = [])
    {
        $viewObject = $view;

        if (\is_string($view)) {
            $viewObject = class_exists($view)
                ? $this->container->createSharedObject($view)
                : $this->getView($view, 'html', $engine);
        }

        $this->setConfig($this->config);

        // Set data into View
        foreach ($data as $key => $value) {
            $viewObject[$key] = $value;
        }

        if ($layout !== null && $viewObject instanceof LayoutRenderableInterface) {
            $viewObject->setLayout($layout);
        }

        return $viewObject->render();
    }
public function renderView($view, $layout = 'default', $engine = 'php', array $data = [])
    {
        $viewObject = $view;

        if (\is_string($view)) {
            $viewObject = class_exists($view)
                ? $this->container->createSharedObject($view)
                : $this->getView($view, 'html', $engine);
        }

        $this->setConfig($this->config);

        // Set data into View
        foreach ($data as $key => $value) {
            $viewObject[$key] = $value;
        }

        if ($layout !== null && $viewObject instanceof LayoutRenderableInterface) {
            $viewObject->setLayout($layout);
        }

        return $viewObject->render();
    }
public function renderView ( $ view , $ layout = 'default' , $ engine = 'php' , array $ data = [ ] ) { $ viewObject = $ view ; if ( \ is_string ( $ view ) ) { $ viewObject = class_exists ( $ view ) ? $ this -> container -> createSharedObject ( $ view ) : $ this -> getView ( $ view , 'html' , $ engine ) ; } $ this -> setConfig ( $ this -> config ) ; // Set data into View foreach ( $ data as $ key => $ value ) { $ viewObject [ $ key ] = $ value ; } if ( $ layout !== null && $ viewObject instanceof LayoutRenderableInterface ) { $ viewObject -> setLayout ( $ layout ) ; } return $ viewObject -> render ( ) ; }
Method to easily render view.

@param LayoutRenderableInterface|string $view   The view name or object.
@param string                           $layout The layout to render.
@param string                           $engine The engine of template.
@param array                            $data   The data to set in view.

@return string
@throws \LogicException
@throws \Exception
Method to easily render view .