public function run(Request $request = null) { if (null === $request) { $request = Request::createFromGlobals(); } $method = $request->getMethod(); $uri = $request->getUri(); foreach ($this->routes as $route) { if ($route->match($method, $uri)) { return $this->process($route, $request); } } throw new HttpException(404, 'Page Not Found'); }
public function run(Request $request = null) { //Remplacer par $method = $request->getMethode(); //$method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : self::GET; //$uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/'; if (null === $request) { $request = Request::createFromGlobals(); } $uri = $request->getURI(); $method = $request->getMethod(); foreach ($this->routes as $route) { if ($route->match($method, $uri)) { return $this->process($route, $request); } } throw new HttpException(404, 'Page Not Found'); }