Example #1
0
 /**
  *
  */
 private function addStaticRoute($routeData, Route $route)
 {
     $handler = $route->getHandler();
     $routeStr = $routeData[0];
     foreach ($route->getMethod() as $method) {
         if (isset($this->staticRoutes[$method][$routeStr])) {
             throw new Exception("Cannot register two routes matching \"{$routeStr}\" for method \"{$method}\"");
         }
         if (isset($this->dynamicRoutes[$method])) {
             foreach ($this->dynamicRoutes[$method] as $route) {
                 if ($route->matches($routeStr)) {
                     throw new Exception("Static route \"{$routeStr}\" is shadowed by previously defined variable route \"{$route->getPath()}\" for method \"{$method}\"");
                 }
             }
         }
         $this->staticRoutes[$method][$routeStr] = $handler;
     }
 }
Example #2
0
 public function testGetHandler()
 {
     $this->assertSame($this->handler, $this->route->getHandler());
 }