Ejemplo n.º 1
0
 public static function addRoute(Route $route, $forceReplace = false)
 {
     if (!is_string($route->getName()) && !is_int($route->getName())) {
         throw new \Exception('Route name must be string or integer');
     }
     if (method_exists(self::$_routes, $route->getName())) {
         if (!$forceReplace) {
             throw new \Exception('Route : "' . $route->getName() . '" already defined');
         }
         Logger::getInstance()->debug('Route : "' . $route->getName() . '" already defined, was overloaded');
     }
     if (!is_object(self::$_routes)) {
         self::$_routes = new \stdClass();
     }
     $name = $route->getName();
     self::$_routes->{$name} = $route;
 }