Parse the request path to extract the path and template elements.

@param string $path The complet server path

@return array Array of 'template' and 'path' portions of the URL
5297
private function parsePath($path)
    {
        $parts = array(
            'template' => null,
            'path' => null,
        );

        // strip out any query params
        if (preg_match('/^\/?(.*?)\/(.*)/', $path, $matches)) {
            $parts['template'] = $matches[1];
            $parts['path'] = $matches[2];
        }

        return $parts;
    }
781209
public function parse($path)
    {
        libxml_use_internal_errors(true);

        $data = simplexml_load_file($path, null, LIBXML_NOERROR);

        if ($data === false) {
            $errors      = libxml_get_errors();
            $latestError = array_pop($errors);
            $error       = array(
                'message' => $latestError->message,
                'type'    => $latestError->level,
                'code'    => $latestError->code,
                'file'    => $latestError->file,
                'line'    => $latestError->line,
            );
            throw new ParseException($error);
        }

        $data = json_decode(json_encode($data), true);

        return $data;
    }
752423
public function parse(string $path): ?ViewPath
    {
        $this->validatePath($path);

        //Cutting extra symbols (see Twig)
        $filename = preg_replace(
            '#/{2,}#',
            '/',
            str_replace('\\', '/', (string)$path)
        );

        $namespace = $this->defaultNamespace;
        if (strpos($filename, '.') === false) {
            //Force default extension
            $filename .= '.' . $this->extension;
        } elseif (!$this->match($filename)) {
            return null;
        }

        if (strpos($filename, LoaderInterface::NS_SEPARATOR) !== false) {
            list($namespace, $filename) = explode(LoaderInterface::NS_SEPARATOR, $filename);
        }

        //Twig like namespaces
        if (isset($filename[0]) && $filename[0] == '@') {
            $separator = strpos($filename, '/');
            if ($separator === false) {
                throw new PathException(sprintf('Malformed view path"%s" (expecting "@namespace/name").', $path));
            }

            $namespace = substr($filename, 1, $separator - 1);
            $filename = substr($filename, $separator + 1);
        }

        return new ViewPath(
            $namespace,
            $this->fetchName($filename),
            $filename
        );
    }
91685
public function findUrls($path)
    {
        $session = $this->sessionManager->getSession();
        $queryManager = $session->getWorkspace()->getQueryManager();

        $qomFactory = $queryManager->getQOMFactory();
        $queryBuilder = new QueryBuilder($qomFactory);

        $queryBuilder->addSelect('a', 'domainParts', 'domainParts')
            ->addSelect('a', 'baseDomain', 'baseDomain');

        $queryBuilder->from(
            $queryBuilder->qomf()->selector('a', 'nt:unstructured')
        );

        $queryBuilder->where(
            $queryBuilder->qomf()->comparison(
                $queryBuilder->qomf()->propertyValue('a', 'jcr:mixinTypes'),
                QueryObjectModelConstantsInterface::JCR_OPERATOR_EQUAL_TO,
                $queryBuilder->qomf()->literal('sulu:custom_url')
            )
        );
        $queryBuilder->andWhere(
            $queryBuilder->qomf()->descendantNode('a', $path)
        );

        $query = $queryBuilder->getQuery();
        $result = $query->execute();

        return array_map(
            function(Row $item) {
                return $this->generator->generate(
                    $item->getValue('a.baseDomain'),
                    json_decode($item->getValue('a.domainParts'), true)
                );
            },
            iterator_to_array($result->getRows())
        );
    }
942980
public function read($path)
    {
        $location = $this->applyPathPrefix($path);
        return [
            'contents' => $this->ossClient->getObject($this->bucket, $location)
        ];
    }
165742
protected function extractClassFromFile($path)
    {
        $fileContent = file_get_contents($path);
        $matches = [];
        $pattern = '/Cms\S+_\S+Class/';
        preg_match($pattern, $fileContent, $matches);

        if (!empty($matches[0])) {
            return $matches[0];
        }

        return null;
    }
622443
public static function extractPath($path)
    {
        $explodePath = explode(DIRECTORY_SEPARATOR, $path);
        $realPath = array();
        for ($i = 0, $parts = count($explodePath) - 1; $i < $parts; $i++) {
            $realPath[] = $explodePath[$i];
        }
        return implode(DIRECTORY_SEPARATOR, $realPath);
    }
1370445
private function parsePath($path)
    {
        $info = pathinfo($path);
        $basename = $info['basename'];
        $dirname = $info['dirname'];

        foreach ($this->sizes as $prefix => $paths) {
            if (strpos($basename, $prefix) !== 0) {
                continue;
            }

            foreach ($paths as $path => $transform) {
                $needle = $path === '' ? '' : substr($dirname, -strlen($path));

                if ($path === $needle) {
                    return [Utils\Helpers::joinPath($dirname, substr($basename, strlen($prefix))), $transform];
                }
            }
        }

        return false;
    }
48939
public function Path($Path = NULL) {
      if (is_string($Path)) {
         $Result = $this->_ParsedRequestElement('Path', $Path);
      } else {
         $Result = $this->_ParsedRequestElement('Path');
         if ($Path === TRUE) {
            // Encode the path.
            $Parts = explode('/', $Result);
            $Parts = array_map('urlencode', $Parts);
            $Result = implode('/', $Parts);
         }
      }
      
      return $Result;
   }
820961
public static function parsePath($path){
		//strip prefix
		$path = str_replace(self::getPrefix(),'',$path);
		//break off the query string if we can
		if(strpos($path,'?') !== false){
			$query = substr($path,strpos($path,'?'));
			$path = substr($path,0,(strlen($path)-strlen($query)));
			//remove the questionmark
			$query = str_replace('?','',$query);
		}
		//setup opts
		$opts['path'] = $path;
		$opts['params'] = array();
		if(isset($query)) parse_str($query,$opts['params']);
		return $opts;
	}
1287948
public function parse($path)
	{
		$data = @parse_ini_file($path, true);

		if (!$data)
		{
			$error = error_get_last();

			throw new ParseException($error);
		}

		return $data;
	}
30403
protected function parseThemeNameFromPath($path)
    {
        $path = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $path);
        $path = explode(DIRECTORY_SEPARATOR, $path);

        return array_pop($path);
    }
1028655
protected function parsePath($path)
    {
        $path = parse_url(substr(strstr(";" . $path, ";" . $this->basepath), strlen(";" . $this->basepath)), PHP_URL_PATH);

        if ($path === false) {
            throw new Exception("Seriously malformed URL passed to route matcher.");
        }

        return $path;
    }
1218785
public function extract($path) {

        if (empty($path)) {
            return $this->props;
        }
        // Simple paths.
        if (!preg_match('/[{\[]/', $path)) {
            return (array)$this->get($path);
        }
        if (strpos($path, '[') === false) {
            $tokens = explode('/', $path);
        } else {
            $tokens = $this->_tokenize($path, '/', '[', ']');
        }
        $_key = '__set_item__';
        $context = array($_key => array($this->props));
        foreach ($tokens as $token) {
            $next = array();
            list($token, $conditions) = $this->_splitConditions($token);
            foreach ($context[$_key] as $item) {
                foreach ((array)$item as $k => $v) {
                    if ($this->_matchToken($k, $token)) {
                        $next[] = $v;
                    }
                }
            }
            // Filter for attributes.
            if ($conditions) {
                $filter = array();
                foreach ($next as $item) {
                    if (is_array($item) && $this->_matches($item, $conditions)) {
                        $filter[] = $item;
                    }
                }
                $next = $filter;
            }
            $context = array($_key => $next);
        }
        return $context[$_key];
    }
76761
protected function extractParameterNames($path) {
        $names = [];
        $matches = [];
        preg_match_all('#\{([a-zA-Z0-9?]+)\}#', $path, $matches);

        foreach (array_get($matches, 1, []) as $name) {
            $names[] = str_replace('?', '', $name);
        }

        return $names;
    }
579780
public function parse($path)
    {
        try {
            $data = YamlParser::parse(file_get_contents($path), YamlParser::PARSE_CONSTANT);
        } catch (Exception $exception) {
            throw new ParseException(
                array(
                    'message'   => 'Error parsing YAML file',
                    'exception' => $exception,
                )
            );
        }

        return $data;
    }
1294703
private function buildPath($path)
    {
        $result = [];
        foreach (explode('/', $path) as $value) {
            if (!empty($value)) {
                $result[] = (int) $value;
            }
        }
        return $result;
    }