public static function request($request, &$httpStatus, &$urlParams) {

			// We will look for a best match
			$status = 404;
			$foundRoute = null;
			$foundParams = null;

			// Loop through routes
			foreach (self::$_routes as $route) {

				// Already done?
				if ($route->checked) continue;

				// Do the regex!
				preg_match_all($route->_regexPattern, $request->uri, $matches);

				// Set flag that this route has been matched
				$route->checked = true;

				// Does the route match?
				if (count($matches[0]) == 1) {

					// Is the method correct as well?
					if (Arry::Contains($request->method, $route->methods, false)) {

						//@TODO Check SSL config

						// We have a method and path match!
						$foundRoute = $route;
						$status = 200;

						// Get parameters
						$foundParams = array();
						if (count($matches) > 1) {
							for ($q = 1; $q < count($matches); $q++) {
								$foundParams[] = $matches[$q][0];
							}
						}
						

						// That's all we need
						break;

					} else {

						// Wrong method; is this the best yet?
						if (is_null($foundRoute) || $status !== 200) {

							// This is the best yet...
							$foundRoute = $route;
							$status = 405;

						}

					}

				}

			}

			// Parse params
			if (sizeof($foundParams) > 0) {

				// Look up the param names in the route
				$urlParams = array();
				foreach ($route->_patternVariables as $index =>$varName) {

					// #'ed param?
					$value = $foundParams[$index];
					if (substr($varName, 0, 1) == '#') {
						$value = intval($value);
						$varName = substr($varName, 1);
					}

					// *'ed param?
					if (substr($varName, 0, 1) == '*') {
						$varName = substr($varName, 1);
					}

					$urlParams[$varName] = $value;
				}

			} else {
				$urlParams = array();
			}

			// Store it!
			$httpStatus = $status;
			self::$_currentRoute = $foundRoute;
			return $foundRoute;

		}
public static function request($request, &$httpStatus, &$urlParams) {

			// We will look for a best match
			$status = 404;
			$foundRoute = null;
			$foundParams = null;

			// Loop through routes
			foreach (self::$_routes as $route) {

				// Already done?
				if ($route->checked) continue;

				// Do the regex!
				preg_match_all($route->_regexPattern, $request->uri, $matches);

				// Set flag that this route has been matched
				$route->checked = true;

				// Does the route match?
				if (count($matches[0]) == 1) {

					// Is the method correct as well?
					if (Arry::Contains($request->method, $route->methods, false)) {

						//@TODO Check SSL config

						// We have a method and path match!
						$foundRoute = $route;
						$status = 200;

						// Get parameters
						$foundParams = array();
						if (count($matches) > 1) {
							for ($q = 1; $q < count($matches); $q++) {
								$foundParams[] = $matches[$q][0];
							}
						}
						

						// That's all we need
						break;

					} else {

						// Wrong method; is this the best yet?
						if (is_null($foundRoute) || $status !== 200) {

							// This is the best yet...
							$foundRoute = $route;
							$status = 405;

						}

					}

				}

			}

			// Parse params
			if (sizeof($foundParams) > 0) {

				// Look up the param names in the route
				$urlParams = array();
				foreach ($route->_patternVariables as $index =>$varName) {

					// #'ed param?
					$value = $foundParams[$index];
					if (substr($varName, 0, 1) == '#') {
						$value = intval($value);
						$varName = substr($varName, 1);
					}

					// *'ed param?
					if (substr($varName, 0, 1) == '*') {
						$varName = substr($varName, 1);
					}

					$urlParams[$varName] = $value;
				}

			} else {
				$urlParams = array();
			}

			// Store it!
			$httpStatus = $status;
			self::$_currentRoute = $foundRoute;
			return $foundRoute;

		}
public static function request ( $ request , & $ httpStatus , & $ urlParams ) { // We will look for a best match $ status = 404 ; $ foundRoute = null ; $ foundParams = null ; // Loop through routes foreach ( self :: $ _routes as $ route ) { // Already done? if ( $ route -> checked ) continue ; // Do the regex! preg_match_all ( $ route -> _regexPattern , $ request -> uri , $ matches ) ; // Set flag that this route has been matched $ route -> checked = true ; // Does the route match? if ( count ( $ matches [ 0 ] ) == 1 ) { // Is the method correct as well? if ( Arry :: Contains ( $ request -> method , $ route -> methods , false ) ) { //@TODO Check SSL config // We have a method and path match! $ foundRoute = $ route ; $ status = 200 ; // Get parameters $ foundParams = array ( ) ; if ( count ( $ matches ) > 1 ) { for ( $ q = 1 ; $ q < count ( $ matches ) ; $ q ++ ) { $ foundParams [ ] = $ matches [ $ q ] [ 0 ] ; } } // That's all we need break ; } else { // Wrong method; is this the best yet? if ( is_null ( $ foundRoute ) || $ status !== 200 ) { // This is the best yet... $ foundRoute = $ route ; $ status = 405 ; } } } } // Parse params if ( sizeof ( $ foundParams ) > 0 ) { // Look up the param names in the route $ urlParams = array ( ) ; foreach ( $ route -> _patternVariables as $ index => $ varName ) { // #'ed param? $ value = $ foundParams [ $ index ] ; if ( substr ( $ varName , 0 , 1 ) == '#' ) { $ value = intval ( $ value ) ; $ varName = substr ( $ varName , 1 ) ; } // *'ed param? if ( substr ( $ varName , 0 , 1 ) == '*' ) { $ varName = substr ( $ varName , 1 ) ; } $ urlParams [ $ varName ] = $ value ; } } else { $ urlParams = array ( ) ; } // Store it! $ httpStatus = $ status ; self :: $ _currentRoute = $ foundRoute ; return $ foundRoute ; }
Match the given request on all configured routes and return first match
@param  ChickenWire\Request $request The request to match
@param  Number &$httpStatus This param will be filled with the resulting HTTP status code
@param  Array  &$urlParams	This will be an array containing the matched URL parameters
@return Route|number          The matched, orfalse when no match was found
Match the given request on all configured routes and return first match