Return / Render the view

@param            $path
@param array      $data
@return $this
432630
protected function view($path, $data = [])
    {
        $view = $this->baseViewPath . $path;
        // if view has package name (dont prefix)
        //if(strpos($path, "::") !== false) {
        //    $view = $path;
        //}

        // explode on package prefix
        // format view path
        $pieces = explode("::", $path);
        if (count($pieces) >= 2) {
            $view = $pieces[0] . "::";
            $view .= $this->baseViewPath . $pieces[1];
        }

        return view($view, $data)
            ->with('image', $this->getImage())
            ->with('title', $this->getTitle())
            ->with('description', $this->getDescription())
            ->with('pageTitle', $this->getPageTitle())
            ->with('page', $this->page)//->with('navigation', $this->navigation)
            ->with('activeParents', $this->urlParentPages)
            ->with('breadcrumbItems', $this->breadcrumbItems)
            ->with('navigation', $this->navigation);
    }
503194
protected function _render($story, $paths, $data)
    {
        settype($paths, 'array');

        foreach ($paths as $path) {
            if ($this->_template->findFile($path)) {
                return $this->_template->loadFile($path, $data)->render();
            }
        }

        try {
            return $this->_template->loadTemplate($story->name, $data)->render();
        } catch (Exception $e) {
            print '<small>file missing :'.$path.'</small>';
        }
    }
892989
public function renderParticle($fileName, $data = [], $path = "")
    {
        ob_start();
        ob_implicit_flush(false);
        $viewFile = $this->getViewPath() . '/' . $fileName . '.php';
        if ($path) {
            $viewFile = $path . '/' . $fileName . '.php';
        }
        unset($fileName);
        extract($data);
        unset($data);
        if (substr($viewFile, -9) == 'blade.php') {
            //blade 需要解析模板
            $tmp = X::app()->runtimePath . '/views/' . md5($viewFile) . '.php';
            //当编译文件不存在，或者模板文件修改过，则生成编译文件
            if (!file_exists($tmp) || filemtime($tmp) < filemtime($viewFile) || X_DEBUG) {
                //引入模板解析类
                $parser = new TemplateParser($viewFile);
                $parser->compile($tmp);
            }
            require $tmp;
        } else {
            require($viewFile);
        }
        return ob_get_clean();
    }
64888
public function appendAtPath(string $path, array $data): ElasticSearchQueryBuilder
    {
        $this->request->appendAtPath($path, $data);

        return $this;
    }
1022129
public function render($file, $data = [])
    {
        $file = pathinfo($file, PATHINFO_EXTENSION) === 'twig' ? $file : $file . '.twig';

        $this->extensions = array_merge($this->extensions, (array) $this->config->get('extensions', []));

        return $this->getEngine()->render($file, $data);
    }
1299147
public function renderView($name, $data = array(), $return = FALSE)
    {
        $file = $this->getViewPath($name);
        return $this->loadView($file, $data, $return);
    }
600731
public static function renderView($path, $dataName = '', $data = '')
    {
        $view = new self();
        if (!empty($dataName)) {
            $view->with($dataName, $data);
        }

        return $view->render($path, false);
    }
110815
private function doRender($path, array $data = [], $class = null)
    {
        $status = $this->status();
        if ($status === self::STATUS_IDLE) {
            $this->statusTransitions();
        } elseif ($status & self::STATUS_IDLE) {
            $this->status = self::STATUS_IN_LAYOUT;
        }
        $template = $this->stack()->factory($path, $this, $class);
        $this->events->fire('f.template.render', $template, $data);
        $output = $template->render($data);
        $this->events->fire('f.template.renderered', $template, $output, $this->status);

        return $output;
    }
1026332
public static function md($path, $data = [])
		{
			// find file
			$abspath = preg_match('%^(/|[a-z]:)%i', $path) === 1
				? $path
				: \View::getFinder()->find($path);

			// get contents
			$contents = file_get_contents($abspath);

			// update values
			$data['route'] = app(SketchpadConfig::class)->route;
			foreach ($data as $key => $value)
			{
				$contents = preg_replace('/\{\{\s*' .$key. '\s*\}\}/', $value, $contents);
			}

			// return
			return '<div data-format="markdown">' .$contents. '</div>';
		}
688130
public function renderFile($path)
    {
        set_error_handler(array($this, 'error'));

        try {
            ob_start();
            include $path;
            $content = ob_get_clean();
        } catch (\Exception $ex) {
            restore_error_handler();
            ob_end_clean();
            throw new ViewRendererException(
                'In : "' . realpath($path) . '" ' . $ex->getMessage() . ' Line ' . $ex->getLine()
            );
        }

        restore_error_handler();

        return $content;
    }
197478
public function renderView($viewPath, array $data = null)
    {
        $this->setView($viewPath);

        !$data or extract($data);
        ob_start();

        if (file_exists(rtrim(
                $this->getViewPath(), $this->getFileExt()
            ) . $this->getFileExt())) {

            /** @noinspection PhpIncludeInspection */
            include rtrim(
                    $this->getViewPath(), $this->getFileExt()
                ) . $this->getFileExt();

        } elseif (file_exists(rtrim(
                $this->getViewFallbackPath(), $this->getFileExt()
            ) . $this->getFileExt())) {

            /** @noinspection PhpIncludeInspection */
            include rtrim(
                    $this->getViewFallbackPath(), $this->getFileExt()
                ) . $this->getFileExt();

        } else {
            throw new ViewNotFoundException('View ' . rtrim(
                    $this->getViewPath(), $this->getFileExt()
                ) . $this->getFileExt() . ' not found');
        }

        $rendered = ob_get_contents();
        ob_end_clean();

        return $rendered;
    }
227081
protected function renderLayoutView($view, $path, $params)
    {
        $layout = $this->container->get('app.path').DS.$path.$this->layout.'.view.php';

        $data['yield'] = $this->output->renderView($view, $params);
        $output = $this->output->renderView($layout, array_merge($data, $params));
        $this['__content__'] = $output;

        if (method_exists($this->viewShared, 'rendered')) {
            $this->viewShared->rendered($this);
        }

        return $this;
    }
304245
public function append($path, $data)
	{
		if ($this->exists($path))
		{
			return $this->write($path, $this->read($path) . $data);
		}

		return $this->write($path, $data);
	}
829686
private function getView(string $name, array $data = [])
    {
        $filesystemLoader = new FilesystemLoader(__DIR__.'/views/%name%');
        $templating = new PhpEngine(new TemplateNameParser(), $filesystemLoader);
        return $templating->render($name . '.phtml', $data);
    }
36048
public static function to($path, array $data = null )
	{
		//compose query string if data was set
		($data !== null) ? self::with($data) : '';

		//compose full url
		$path = (self::$query_string === null) ?  Url::link($path) : Url::link($path) . '?' . self::$query_string;

		//redirect to path
		header('Location: ' . $path);

		//stop any further html output
		exit();

	}
1155443
protected function wrapAndRecurse($path, $data)
    {
        // strict comparison is very important as PHP casts zero
        // and '0' to false, and at the same time, arrays are zero based
        // which means that a path like "helloworld.0" would be considered
        // as simply "helloworld"
        if ($path === '') {
            return $data;
        }

        // more hops to go, so we recurse
        $source = DataSource::make($data);

        return $source[$path];
    }
1334968
public function append($path, $data)
	{
		return $this->put($path, $this->get($path).PHP_EOL.$data);
	}