Parse the given view name or array.

@param  string|array  $view
@return array

@throws \InvalidArgumentException
350535
protected function parseView($view)
	{
		if (is_string($view)) return [$view, null, null];

		// If the given view is an array with numeric keys, we will just assume that
		// both a "pretty" and "plain" view were provided, so we will return this
		// array as is, since must should contain both views with numeric keys.
		if (is_array($view) && isset($view[0]))
		{
			return [$view[0], $view[1], null];
		}

		// If the view is an array, but doesn't contain numeric keys, we will assume
		// the the views are being explicitly specified and will extract them via
		// named keys instead, allowing the developers to use one or the other.
		elseif (is_array($view))
		{
			return [
				array_get($view, 'html'),
				array_get($view, 'text'),
				array_get($view, 'raw'),
			];
		}

		throw new InvalidArgumentException("Invalid view.");
	}
1225352
protected function loadView($view, $values = [])
    {


        if (isset($this->application[$view])) {
            return $this->application[$view];
        }

        $instance = $this->application->createInstance($view, [$values, $this->response, $this->getHandler()]);

        //Otherwise return an instance of Controller;
        return $this->application->shareInstance($instance, $view);
    }
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;
    }
563433
private function getViewFile($view)
    {
        $calledClass = $this->path;

        // Calculate path to view
        if (0 === strpos($calledClass, 'App')) {
            $path = (new KernelInjector)->build()->getAppDir();
        } else {
            $path = Autoload::getAlias('Micro');
        }

        $cl = strtolower(dirname(str_replace('\\', '/', $calledClass)));
        $cl = substr($cl, strpos($cl, '/'));

        if ($this->asWidget) {
            $path .= $cl.'/views/'.$view.'.php';
        } else {
            $className = str_replace('controller', '',
                strtolower(basename(str_replace('\\', '/', '/'.$this->path))));
            $path .= dirname($cl).'/views/'.$className.'/'.$view.'.php';
        }

        $path = str_replace('//', '/', $path);

        if (!file_exists($path)) {
            throw new Exception('View path `'.$path.'` not exists.');
        }

        return $path;
    }
740310
public function setView($view, array $data = [])
    {
        $this->view = $view;

        $this->data = $data;

        return $this;
    }
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];
	}
917396
protected function initViewVars($view)
    {
        $view->set('controller', $this->getName());
        $view->set('action', $this->getAction());

        if (method_exists($view, 'setRequest')) {
            $view->setRequest($this->getRequest());
        }

        return $view;
    }
570416
private function load($view) {

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

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

			extract($data['var']);

			require $data['file'];
		}
	}
300555
public function parse($content)
    {
        if (!$content || strpos($content, '@view') === false) {
            return [];
        }
        $ret = [];

        if (preg_match(self::VIEW_RENDER, $content, $match)) {
            $ret[0] = array_pop($match);
        } else {
            $ret[0] = null;
        }

        if (preg_match(self::VIEW_TEMPLATE_FILE, $content, $match)) {
            $ret[1] = array_pop($match);
        } else {
            $ret[1] = null;
        }

        if (preg_match_all(self::VIEW_PARAMETERS, $content, $match, PREG_SET_ORDER)) {
            $set = [];
            // "all" is excluded
            foreach ($match as $position => $group) {
                $set[$group[1]] = $group[2];
            }

            if ($set){
                $ret[] = $set;
            }

        }

        return $ret;
    }
65196
public function find($view)
    {
        /** @var ViewFinderInterface $viewFinder */
        foreach ($this->viewFinders as $viewFinder) {
            try {
                return $viewFinder->find($view);
            } catch (\Exception $e) {
            }
        }

        throw new InvalidArgumentException("View [$view] not found in any registered viewfinder.");
    }
904647
public function setView($view)
    {
        $view   = parent::setView($view);
        $format = $this->getRequest()->getFormat();

        if ($view instanceof KObjectIdentifier && $view->getPackage() != 'activities' && $format  !== 'html')
        {
            $manager = $this->getObject('manager');

            // Set the view identifier as an alias of the component view.
            if (!$manager->getClass($view, false))
            {
                $identifier = $view->toArray();
                $identifier['package'] = 'activities';
                unset($identifier['domain']);

                $manager->registerAlias($identifier, $view);
            }
        }

        return $view;
    }
1098695
public static function parse($string)
    {
        if (static::isJSON($string)) {
            $result = static::jsonDecode($string);
        } elseif (static::isXML($string)) {
            $result = static::xmlDecode($string);
        } else {
            throw new \InvalidArgumentException(sprintf('Unable to parse: %s', (string) $string));
        }

        return (array) $result;
    }
295971
private function compile_arrays( $view )
	{	
		$tokens = token_get_all( $view );

		$tags = array( 0 => '' );
		$tag_index = 0;
		$in_tag = false;

		// parse all php tags out of the view
		foreach ( $tokens as $token ) 
		{
			if ( is_array( $token ) ) 
			{
				if ( $token[0] === T_OPEN_TAG )
				{
					$in_tag = true;
				}

				if ( $in_tag && !in_array( $token[0], array( T_INLINE_HTML ) ) ) 
				{				
					$tags[$tag_index] .= $token[1];
				}

				if ( $token[0] === T_CLOSE_TAG )
				{
					$in_tag = false;
					$tag_index++;
				}
			}
			else 
			{
				if ( $in_tag )
				{
					$tags[$tag_index] .= $token;
				}
			}
		}

		// lets make the tags search keys
		$tags = array_flip( $tags );

		// now search and replace var in the php sections
		foreach( $tags as $search => &$replace )
		{
			$replace = preg_replace_callback('/(\$[a-zA-Z0-9\_\.\-\>\;]+)/s', function( $match )
			{ 
				$var = $match[1];

				if ( strpos( $var, '.' ) !== false )
				{
					$buffer = '';
					$length = strlen( $var );
					$inside_arr = false;

					for( $i=0;$i<$length;$i++ )
					{
						$char = $var[$i];

						if ( $char == '.' && !$inside_arr  )
						{
							$buffer .= "['";
							$inside_arr = true;
						}
						else
						{
							if ( $inside_arr && in_array( $char, array( ';', '-', ',' ) ) )
							{
								$buffer .= "']";
								$inside_arr = false;
							}

							if ( $char == '.' )
							{
								$buffer .= "']['";
								$inside_arr = true;
							}
							else
							{
								$buffer .= $char;
							}
						}
					}

					if ( $inside_arr )
					{
						$buffer .= "']";
					}

					$var = $buffer;
				}

				return $var;

			}, $search );
		}

		return CCStr::replace( $view, $tags );
	}
91050
public function parseOne($val)
    {
        if ($val === null || $val === '') {
            if ($this->allowNull()) {
                return null;
            } else {
                throw new InvalidArgumentException(
                    'Value can not be NULL (not allowed)'
                );
            }
        }

        if (!is_array($val)) {
            $val = json_decode($val, true);
        }

        return $val;
    }
911602
public function load($view, $args = array())
    {
        $view = ltrim($view, '/');

        $segments = explode('/', str_replace('.', '/', $view));

        // Pop file from segments.
        $view = array_pop($segments);

        // Custom directory path.
        $pathOfView = app('path.base').'/'.implode('/', $segments);

        // Add temporary path with a hint type.
        $this->view->addNamespace('custom', $pathOfView);

        return $this->of('custom::'.$view, $args);
    }
521505
protected function makeView($view)
    {
        if( Auth::check() ) {
            $this->addParameter( 'activeUser', Auth::user() );
        }

        return View::make( $view, $this->parameters );
    }
1188900
protected static function parseView($view)
    {
        if (is_string($view)) {
            return array($view, null);
        }

        // If the given view is an array with numeric keys, we will just assume that
        // both a "pretty" and "plain" view were provided, so we will return this
        // array as is, since must should contain both views with numeric keys.
        if (is_array($view) && (isset($view[0]) || isset($view[1]))) {
            return array(
                isset($view[0]) ? $view[0] : null,
                isset($view[1]) ? $view[1] : null,
            );
        }

        // If the view is an array, but doesn't contain numeric keys, we will assume
        // the the views are being explicitly specified and will extract them via
        // named keys instead, allowing the developers to use one or the other.
        elseif (is_array($view)) {
            return array(
                isset($view['html']) ? $view['html'] : null,
                isset($view['text']) ? $view['text'] : null,
            );
        }

        throw new \RuntimeException("Invalid view.");
    }