public function addRoute(Route $route) {

	    $id = $route->getRouteId();

	    if(array_key_exists($id, $this->routes)) {

	        throw new \InvalidArgumentException(sprintf("Route with id '%s' already exists.", $id));
        }

        $this->routes[$id] = $route;

    }
public function addRoute(Route $route) {

	    $id = $route->getRouteId();

	    if(array_key_exists($id, $this->routes)) {

	        throw new \InvalidArgumentException(sprintf("Route with id '%s' already exists.", $id));
        }

        $this->routes[$id] = $route;

    }
public function addRoute ( Route $ route ) { $ id = $ route -> getRouteId ( ) ; if ( array_key_exists ( $ id , $ this -> routes ) ) { throw new \ InvalidArgumentException ( sprintf ( "Route with id '%s' already exists." , $ id ) ) ; } $ this -> routes [ $ id ] = $ route ; }
add a single route to router
throws an exception when route has already been assigned

@param Route $route
add a single route to router throws an exception when route has already been assigned