src/Router.php
public static function findRoute($uri) {
		if(self::$routes === array())
			self::load();

		$count = count($uri);

		$position = &self::$routes;
		for($i = 0; $i < $count; $i++) {
			if($i == $count - 1) {
				if(isset($position[$uri[$i]]) && isset($position[$uri[$i]]["route"])) {
					return $position[$uri[$i]]["route"];
				} else if(isset($position["*"]) && isset($position["*"]["route"])) {
					return $position["*"]["route"];
				} else {
					throw new ValidRouteNotFoundException;
				}
			} else {
				if(isset($position[$uri[$i]])) {
					$position = &$position[$uri[$i]]["children"];
				} elseif(isset($position["*"])) {
					$position = &$position["*"]["children"];
				} else {
					throw new ValidRouteNotFoundException;
				}
			}
		}

		throw new ValidRouteNotFoundException;
	}
public static function findRoute($uri) {
		if(self::$routes === array())
			self::load();

		$count = count($uri);

		$position = &self::$routes;
		for($i = 0; $i < $count; $i++) {
			if($i == $count - 1) {
				if(isset($position[$uri[$i]]) && isset($position[$uri[$i]]["route"])) {
					return $position[$uri[$i]]["route"];
				} else if(isset($position["*"]) && isset($position["*"]["route"])) {
					return $position["*"]["route"];
				} else {
					throw new ValidRouteNotFoundException;
				}
			} else {
				if(isset($position[$uri[$i]])) {
					$position = &$position[$uri[$i]]["children"];
				} elseif(isset($position["*"])) {
					$position = &$position["*"]["children"];
				} else {
					throw new ValidRouteNotFoundException;
				}
			}
		}

		throw new ValidRouteNotFoundException;
	}
public static function findRoute ( $ uri ) { if ( self :: $ routes === array ( ) ) self :: load ( ) ; $ count = count ( $ uri ) ; $ position = & self :: $ routes ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { if ( $ i == $ count - 1 ) { if ( isset ( $ position [ $ uri [ $ i ] ] ) && isset ( $ position [ $ uri [ $ i ] ] [ "route" ] ) ) { return $ position [ $ uri [ $ i ] ] [ "route" ] ; } else if ( isset ( $ position [ "*" ] ) && isset ( $ position [ "*" ] [ "route" ] ) ) { return $ position [ "*" ] [ "route" ] ; } else { throw new ValidRouteNotFoundException ; } } else { if ( isset ( $ position [ $ uri [ $ i ] ] ) ) { $ position = & $ position [ $ uri [ $ i ] ] [ "children" ] ; } elseif ( isset ( $ position [ "*" ] ) ) { $ position = & $ position [ "*" ] [ "children" ] ; } else { throw new ValidRouteNotFoundException ; } } } throw new ValidRouteNotFoundException ; }
Find and process a valid route from the uri
@internal
@param  array $uri Array of uri parts (split by /)
@throws ValidRouteNotFoundException
@return array
Find and process a valid route from the uri