Example #1
0
 /**
  * Store a route and a handling function to be executed when accessed using one of the specified methods
  *
  * @param string $methods Allowed methods, | delimited
  * @param string $pattern A route pattern such as /about/system
  * @param mixed $fn The handling function to be executed
  * @return Route
  */
 public function match($methods, $pattern, $fn)
 {
     $pattern = $this->baseroute . '/' . trim($pattern, '/');
     $pattern = $this->baseroute ? rtrim($pattern, '/') : $pattern;
     $route = new Route($pattern);
     $route->setFunction($fn);
     $route->setModule($this->module);
     foreach (explode('|', $methods) as $method) {
         $this->routes[$method][] = $route;
     }
     return $route;
 }