src/Router.php
private function parse_request_path(string $path) {

		# route path and request path is the same
		if ($path == $this->request_path)
			return [];

		# generate parser
		$parser = $this->path_parser($path);
		if (!$parser[1])
			return false;

		# parse request
		$pattern = '!^' . $parser[0] . '$!';
		$matched = preg_match_all(
			$pattern, $this->request_path,
			$result, PREG_SET_ORDER);
		if (!$matched)
			return false;

		unset($result[0][0]);
		return array_combine($parser[1], $result[0]);
	}
private function parse_request_path(string $path) {

		# route path and request path is the same
		if ($path == $this->request_path)
			return [];

		# generate parser
		$parser = $this->path_parser($path);
		if (!$parser[1])
			return false;

		# parse request
		$pattern = '!^' . $parser[0] . '$!';
		$matched = preg_match_all(
			$pattern, $this->request_path,
			$result, PREG_SET_ORDER);
		if (!$matched)
			return false;

		unset($result[0][0]);
		return array_combine($parser[1], $result[0]);
	}
private function parse_request_path ( string $ path ) { # route path and request path is the same if ( $ path == $ this -> request_path ) return [ ] ; # generate parser $ parser = $ this -> path_parser ( $ path ) ; if ( ! $ parser [ 1 ] ) return false ; # parse request $ pattern = '!^' . $ parser [ 0 ] . '$!' ; $ matched = preg_match_all ( $ pattern , $ this -> request_path , $ result , PREG_SET_ORDER ) ; if ( ! $ matched ) return false ; unset ( $ result [ 0 ] [ 0 ] ) ; return array_combine ( $ parser [ 1 ] , $ result [ 0 ] ) ; }
Parse request path.

This generates path parser from route path to use against
request path.

@param string $path Route path.
@return array|bool False if current request URI doesn't match,
a dict otherwise. The dict will be assigned to
$args['params'] of router callback, which is empty in case
of non-compound route path.
Parse request path .