Example #1
0
 /**
  * @param string $pattern
  * @param null $matches
  * @param null $methods
  * @return Route
  * @throws Exception
  * @throws \Dez\EventDispatcher\Exception
  */
 public function add($pattern = '', $matches = null, $methods = null)
 {
     $this->getEventDispatcher()->dispatch(EventRouter::BEFORE_ROUTE_ADD, new EventRouter($this));
     $route = new Route($pattern, $matches, $methods);
     $route->setDi($this->getDi());
     $this->routes[] = $route;
     $this->getEventDispatcher()->dispatch(EventRouter::AFTER_ROUTE_ADD, new EventRouter($this));
     return $route;
 }