Back to ApiRouter class

Method getMatchingRoutes

public \Joomla\Router\Route[]
getMatchingRoutes
()
Extract routes matching current route from all known routes.
Returns
  • \Joomla\Router\Route[]
Since
  • 4.0.0
Class: ApiRouter
Project: Joomla

Method getMatchingRoutes - Source code

/**
 * Extract routes matching current route from all known routes.
 *
 * @return \Joomla\Router\Route[]
 *
 * @since 4.0.0
 */
public function getMatchingRoutes()
{
    $routePath = $this->getRoutePath();
    // Extract routes matching $routePath from all known routes.
    return array_filter($this->routes, function ($route) use($routePath) {
        return preg_match($route->getRegex(), ltrim($routePath, '/')) === 1;
    });
}