public function route($url) {
		if (!isset($this->routes[$this->getHttpMethod()])) {
			throw new RouterException("REQUEST_METHOD does not exist : url = $url");
		}

		foreach ($this->routes[$this->getHttpMethod()] as $route) {
			$matches = $route->match($url);

			if (is_array($matches)) {
				return $route->execute($matches);
			}
		}

		throw new RouterException("No route matches the URL $url");
	}
public function route($url) {
		if (!isset($this->routes[$this->getHttpMethod()])) {
			throw new RouterException("REQUEST_METHOD does not exist : url = $url");
		}

		foreach ($this->routes[$this->getHttpMethod()] as $route) {
			$matches = $route->match($url);

			if (is_array($matches)) {
				return $route->execute($matches);
			}
		}

		throw new RouterException("No route matches the URL $url");
	}
public function route ( $ url ) { if ( ! isset ( $ this -> routes [ $ this -> getHttpMethod ( ) ] ) ) { throw new RouterException ( "REQUEST_METHOD does not exist : url = $url" ) ; } foreach ( $ this -> routes [ $ this -> getHttpMethod ( ) ] as $ route ) { $ matches = $ route -> match ( $ url ) ; if ( is_array ( $ matches ) ) { return $ route -> execute ( $ matches ) ; } } throw new RouterException ( "No route matches the URL $url" ) ; }
Execute a callable of route that matchs the URL

@param string $url HTTP request URL

@throws RouterException When HTTP method doesn't exists or no route found

@return mixed
Execute a callable of route that matchs the URL