Get a valid view path save it.

@param $view
970776
protected function setPath($view)
    {
        $this->viewModel = new ViewModel([], $this->layout->getName());

        if ($view == null) {
            $view = $this->findView();
        }

        $this->viewModel->view = $view;

        viewResolver()->collectDetails($this->viewModel);

        $this->path = $view;
    }
369859
private function getPath($view)
    {
        $tmp = explode(':', $view);
        $bundlePath = $this->kernel->getBundle($tmp[0])->getPath();

        return $bundlePath . '/Resources/views/' . $tmp[1] . '/' . $tmp[2];
    }
1019761
private function getViewUrl(View $view)
    {
        if (!method_exists($view, 'getUrl')) {
            return $this->generateUrl('victoire_business_template_show', ['id' => $view->getId()]);
        }

        /** @var ViewReference $viewReference */
        $viewReference = $this->container->get('victoire_view_reference.repository')
            ->getOneReferenceByParameters(['viewId' => $view->getId()]);

        $view->setReference($viewReference);

        return $this->generateUrl('victoire_core_page_show', ['url' => $viewReference->getUrl()]);
    }
794949
public function addView(View $view)
    {
        $name = $view->getName();
        $path = $view->getPath();

        if (!is_object($path)) {
            if ($path) {
                $path = ltrim(str_replace(base_path(), '', realpath($path)), '/');
            }

            if (substr($path, -10) == '.blade.php') {
                $type = 'blade';
            } else {
                $type = pathinfo($path, PATHINFO_EXTENSION);
            }
        } else {
            $type = get_class($view);
            $path = '';
        }

        if (!$this->collect_data) {
            $params = array_keys($view->getData());
        } else {
            $data = [];
            foreach ($view->getData() as $key => $value) {
                $data[$key] = $this->exporter->exportValue($value);
            }
            $params = $data;
        }

        $this->templates[] = [
            'name'        => $path ? sprintf('%s (%s)', $name, $path) : $name,
            'param_count' => count($params),
            'params'      => $params,
            'type'        => $type,
        ];
    }
759078
public function setView($view)
    {
        if (!($view instanceof LibBaseViewAbstract)) {
            if (is_string($view) && strpos($view, '.') === false) {
                $identifier = clone $this->getIdentifier();
                $identifier->path = array('view', $view);
                $identifier->name = 'html';
            } else {
                $identifier = $this->getIdentifier($view);
            }

            if ($identifier->path[0] != 'view') {
                throw new LibBaseTemplateException('Identifier: '.$identifier.' is not a view identifier');
            }

            $view = $identifier;
        }

        $this->_view = $view;

        return $this;
    }
41582
protected function view( $view ) {
		if ( preg_match( '/\.\w+$/', $view, $matches ) && in_array( $matches[0], $this->extensions() ) ) {
			return str_replace( '.', '/', preg_replace( '/' . $matches[0] . '$/', '', $view ) ) . $matches[0];
		}

		return $this->extension( str_replace( '.', '/', $view ) );
	}
570416
private function load($view) {

		$data = $this->data($view);

		if(file_exists($data['file'])) {

			extract($data['var']);

			require $data['file'];
		}
	}
547501
protected function extension( $view ) {
		$extensions = $this->extensions();

		// Return if a valid extension exists in the template string.
		$ext_reg = '/(' . implode( '|', $extensions ) . ')+$/';
		if ( preg_match( $ext_reg, $view ) ) {
			return $template;
		}

		// Add extension to template string if it don't exists.
		return substr( $view, -strlen( $extensions[0] ) ) === $extensions[0]
			? $view : $view . $extensions[0];
	}
1084897
public function compose(View $view)
    {
        if ($this->overwriteDisabled($view)) {
            return $view;
        }

        $this->currentPath = collect(explode('/views/', $view->getPath()))->last();

        if (\View::exists($this->getNewView())) {
            $view->setPath($this->getNewPath());
        }

        return $view;
    }
610617
public function find($view)
    {
        $view = str_replace('.', DIRECTORY_SEPARATOR, $view) . '.php';

        foreach ($this->locations as $location)
        {
            if (is_file($path = $location.'/'.$view)) {
                return $path;
            }
        }

        return false;
    }
919191
public function includeFunc( View $view)
	{
		if( $this->isFunc() )
		{
			Helper::includeFile( $this->getFuncFilePath(), ["view" => $view], false, true );
		}
		return $this;
	}
362771
private static function find($path)
    {
        $view_path = null;
        foreach (self::$directories as $directory) {
            $formatted_path = self::formatPath($directory . '/' . $path);
            if (self::isValidPath($formatted_path)) {
                $view_path = $formatted_path;
                break;
            }
        }
        
        if (empty($view_path)) {
            if (self::$report_errors) {
                die('View not found: ' . $view_path);
            }
            return null;
        }
        
        return $view_path;
    }
915890
public function getView($view)
    {
        if (Template::exists('Form/' . $view)) {
            return Template::getAdminTemplate('Form/' . $view);
        }

        return new View($view, B8_PATH . 'Form/View/');
    }
499793
public function has(string $view): bool
    {
        $path      = $this->get($view);
        $real      = $this->flow->native()->path($view . $this->flow->ext());
        $directory = \dirname($path);

        if (empty($this->paths[$view]) && ($this->flow->debugMode() || !File::exists($path)))
        {
            Dir::make($directory);

            return false;
        }

        return \filemtime($path) > \filemtime($real);
    }
1295900
private function deriveView($view)
    {
        // Check if the view already exists as specified
        if(self::exists($view))
        {
            // It does so just return it
            return $view;
        }

        // Check if there are any namespaces yet
        if($this->namespaces === NULL)
        {
            // There aren't so grab the namespace information from the configuration file
            $this->namespaces = config('layout-view.namespaces');
        }

        // Check if the selected layout has been set
        if($this->selected_layout === NULL)
        {
            // It hasn't been, so set it based on the config values
            $this->selected_layout = config('layout-view.layout.selected');
        }

        // Check if the fallback layout has been set
        if($this->fallback_layout === NULL)
        {
            // It hasn't been, so set it based on the config values
            $this->fallback_layout = config('layout-view.layout.fallback');
        }

        // The view that will be rendered
        $target = NULL;

        // Cycle through all of the namespaces
        foreach($this->namespaces as $namespace)
        {
            // Does the namespace have the colons in it?
            if($namespace != '' && stripos($namespace, '::') === FALSE)
            {
                // Didn't exist, so append it
                $namespace .= '::';
            }

            // Derive the base view
            $derived = $namespace . (is_null($this->selected_layout) ? '' :  $this->selected_layout . '.') . $view;

            // Look to see if the view exists
            if(self::exists($derived))
            {
                // It does, so render it
                $target = $derived;
            }
            else
            {
                // It didn't so try in the fallback
                $derived = $namespace . (is_null($this->fallback_layout) ? '' : $this->fallback_layout .  '.') . $view;

                // Check if the fallback view exists
                if(self::exists($derived))
                {
                    $target = $derived;
                }
            }

            // Check if we found a match
            if($target !== NULL)
            {
                // We did, so no sense looping
                break;
            }
        }

        // Return the name of the view we found.
        return $target === NULL ? $view : $target;
    }
832498
public function getValue($key, $view)
    {
        if (is_scalar($view)) {
            return '';
        }

        if (strpos($key, '.')) {
            return $this->getDotValue($key, $view);
        }

        if (is_object($view)) {
            if (method_exists($view, $key)) {
                return call_user_func([$view, $key]);
            } elseif (isset($view->$key)) {
                return $view->$key;
            }
            return '';
        }
        if (isset($view[$key])) {
            if (is_callable($view[$key]) && $this->isValidCallback($view[$key])) {
                return call_user_func($view[$key]);
            }
            return $view[$key];
        }
        return '';
    }
1050763
public function resolve($template, $view = null)
    {
        if (!$template) {
            return '';
        }

        $segments = explode('/', $template);
        $page = end($segments);

        foreach ($this->baseDirectories as $dirs) {
            foreach ($dirs as $dir) {
                if ($t = $this->tryTemplate($dir, $template, $view)) {
                    return $t;
                }

                if ($t = $this->tryTemplate($dir, $template.$this->extension, $view)) {
                    return $t;
                }
            }
        }

        if ($template[0] !== '_') {

            foreach ($this->baseDirectories as $dirs) {
                foreach ($dirs as $dir) {
                    if ($t = $this->tryTemplate($dir, 'shared'.DIRECTORY_SEPARATOR.$page, $view)) {
                        return $t;
                    }

                    if ($t = $this->tryTemplate($dir, 'shared'.DIRECTORY_SEPARATOR.$page.$this->extension, $view)) {
                        return $t;
                    }
                }
            }

        }

    }