Beispiel #1
0
 public static function multipleRoutes(array $controllers)
 {
     $routes = [];
     foreach ($controllers as $method => $controller) {
         $route = new Route();
         $route->handler($controller);
         $route->allows(strtoupper($method));
         $routes[] = $route;
     }
     return new static($routes);
 }
Beispiel #2
0
 private function prepareRoute(Route $route, string $path) : Route
 {
     if (!$route->allows) {
         $route->allows('GET');
     }
     $route->path($path);
     return $route;
 }