Ejemplo n.º 1
0
 /**
  * @param Route $route
  * @throws RouteAlreadyDefined
  * @return $this
  */
 public function addRoute(Route $route)
 {
     $path = str_replace('?', '', $route->getPath());
     if (!isset($this->paths[$path])) {
         $this->paths[$path] = [];
     }
     $method = $route->getHttpMethod();
     if (isset($this->paths[$path][$method])) {
         throw new RouteAlreadyDefined('Route ' . $method . ' ' . $path . ' is already defined.');
     }
     $this->paths[$path][$method] = $route->toSwagger($this);
     return $this;
 }
Ejemplo n.º 2
0
 /**
  * @param string $summary
  * @return RouteMutator
  */
 public function summary(string $summary) : RouteMutator
 {
     return $this->route->summary($summary);
 }