/** * Runs through all the registered routes and returns a single match * @param boolean $matchVerb - Whether you want to match the route using the request HTTP verb * @throws NoMatchException if no routes are found * @throws MultipleRoutesException If there are multiple matches * @return RouteMetaData $route */ protected function getMatchedRoute($matchVerb = true) { // Inject any route base Paths that have been registered if ($this->config->hasRouteBasePaths()) { $this->router->setRouteBasePaths($this->config->getRouteBasePaths()); } $matchedRoutes = $this->router->getMatchedRoutes($this->getRequest(), (bool) $matchVerb); if (sizeof($matchedRoutes) == 0) { throw NoMatchException::noMatchedRoutes(); } elseif (sizeof($matchedRoutes) > 1) { throw MultipleRoutesException::multipleRoutesFound($matchedRoutes); } return $matchedRoutes[0]; }