Exemplo n.º 1
0
 public function getRoute(RequestReader $request)
 {
     $url = (string) $request->getUrl();
     $method = $request->getHttpMethod();
     if (substr($url, 0, 1) === '@') {
         $key = substr($url, 1);
         return $this->getRouteByKey($key);
     }
     foreach ($this->routes as $route) {
         if ($route->match($request)) {
             return $route;
         }
     }
     throw new RouteException("Route Not Found");
 }
Exemplo n.º 2
0
 public function match(RequestReader $req)
 {
     return in_array($req->getHttpMethod(), $this->getMethods());
 }
Exemplo n.º 3
0
 public function getFoo(RequestReader $req, PathParam $id, GetParam $type = null)
 {
     return array('method' => $req->getHttpMethod(), 'id' => $id->get(), 'type' => $type == null ? null : $type->get());
 }