示例#1
0
 public function add_routes()
 {
     $routes = func_get_args();
     \_u::each($routes, function ($route, $index) {
         $method = key($route);
         $items = $route[$method];
         if (!Method::has_method(strtolower($method))) {
             continue;
         }
         $route = new Route($items);
         $route->method = new Method($method);
         if (isset($items['headers']) && is_array($items['headers'])) {
             $route->headers = Headers::set_for_route($items['headers']);
         }
         $this->routes[] = $route;
     });
 }