/** * Find a Route that matches current request */ protected function findRoute() { // Loop accept headers $routeFound = null; foreach ($this->_request->accept as $format) { // Loop through routes foreach (self::$_routes as $route) { if ($route->Match($this->_request, $format, $routeVars) == true) { $routeFound = $route; break; } } // Found something? if (!is_null($routeFound)) { break; } } // Found nothing? if (is_null($routeFound)) { // 404 ChickenWire::Send404(); die; } // Store it $this->_urlVariables = $routeVars; $this->_activeRoute = $routeFound; // Activate controller $this->callController(); }