Exemple #1
0
 public function add($name, $pattern, $methods = [])
 {
     if ($this->routes->has($name)) {
         throw new \Exception(sprintf('Route %s already exists', $name));
     }
     $this->routes->set($name, new Route($name, $pattern, $methods));
     return $this;
 }
 /**
  * Remove a route from the collection.
  *
  * @param Route $route
  */
 public function removeRoute($route)
 {
     $this->routes->removeElement($route);
 }
Exemple #3
0
 /**
  * Add a route to the underlying route collection.
  *
  * @param array|string          $methods
  * @param string                $uri
  * @param \Closure|array|string $action
  *
  * @return Route
  */
 protected function addRoute($methods, $uri, $action)
 {
     return $this->routes->add(new Route($methods, $uri, $action));
 }