/** * Searches a matching route for the given uri * * @param string $uri * @return bool|\Calma\Mf\Routing\Route */ public function search($uri) { foreach ($this->routes as $route) { if ($route->check($uri)) { $this->app->coreLogger()->addNotice("Found matching route {name}", array('name' => $route->getName())); return $route; } $this->app->coreLogger()->addDebug("Route {name} does't match.", array('name' => $route->getName())); } return false; }
/** * Redirects the request to the given route. Internal redirect only. * * @param string $route * @param array $options * @return bool */ public function redirect($route, $options = array()) { $url = Router::getInstance()->generateRoute($route, $options); $this->app->coreLogger()->notice("Redirecting current request to route {route}", ['route' => $route]); ob_clean(); ob_start(); header("HTTP/1.1 " . self::STATUS_FOUND); header("Location: " . $url); ob_end_flush(); return self::TYPE_EXIT; }