src/Router.php
public function normalize($route)
	{
		//make sure that all urls have the same structure
		/* Fix trailling shash */
		if (mb_substr($route, -1, 1) == "/") {
			$route = substr($route, 0, -1);
		}

		$result    = explode("/", $route);
		$result[0] = $this->baseUri;
		$ret       = [];

		//check for dynamic and optional parameters
		foreach ($result as $v) {

			if (!$v) {
				continue;
			}
			if (($v[0]) === "?{") {
				$ret[] = [
					"name" => explode("?}", mb_substr($v, 1))[0],
					"use"  => "?"
				];
			} else if (($v[0]) === "{") {
				$ret[] = [
					"name" => explode("}", mb_substr($v, 1))[0],
					"use"  => "*"
				];
			} else {
				$ret[] = [
					"name" => $v,
					"use"  => $v
				];
			}
		}

		return $ret;
	}
public function normalize($route)
	{
		//make sure that all urls have the same structure
		/* Fix trailling shash */
		if (mb_substr($route, -1, 1) == "/") {
			$route = substr($route, 0, -1);
		}

		$result    = explode("/", $route);
		$result[0] = $this->baseUri;
		$ret       = [];

		//check for dynamic and optional parameters
		foreach ($result as $v) {

			if (!$v) {
				continue;
			}
			if (($v[0]) === "?{") {
				$ret[] = [
					"name" => explode("?}", mb_substr($v, 1))[0],
					"use"  => "?"
				];
			} else if (($v[0]) === "{") {
				$ret[] = [
					"name" => explode("}", mb_substr($v, 1))[0],
					"use"  => "*"
				];
			} else {
				$ret[] = [
					"name" => $v,
					"use"  => $v
				];
			}
		}

		return $ret;
	}
public function normalize ( $ route ) { //make sure that all urls have the same structure /* Fix trailling shash */ if ( mb_substr ( $ route , - 1 , 1 ) == "/" ) { $ route = substr ( $ route , 0 , - 1 ) ; } $ result = explode ( "/" , $ route ) ; $ result [ 0 ] = $ this -> baseUri ; $ ret = [ ] ; //check for dynamic and optional parameters foreach ( $ result as $ v ) { if ( ! $ v ) { continue ; } if ( ( $ v [ 0 ] ) === "?{" ) { $ ret [ ] = [ "name" => explode ( "?}" , mb_substr ( $ v , 1 ) ) [ 0 ] , "use" => "?" ] ; } else if ( ( $ v [ 0 ] ) === "{" ) { $ ret [ ] = [ "name" => explode ( "}" , mb_substr ( $ v , 1 ) ) [ 0 ] , "use" => "*" ] ; } else { $ ret [ ] = [ "name" => $ v , "use" => $ v ] ; } } return $ ret ; }
Normalize route structure and extract dynamic and optional parts

@param $route
@return array
Normalize route structure and extract dynamic and optional parts