/**
  * @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;
 }