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();
    }