public function MockPathMatcher::matchRequestPartial

Matches a request against multiple routes.

Parameters

Request $request: A Request object against which to match.

Return value

RouteCollection A RouteCollection of matched routes.

Overrides InitialMatcherInterface::matchRequestPartial

File

drupal/core/modules/system/lib/Drupal/system/Tests/Routing/MockPathMatcher.php, line 42

Class

MockPathMatcher
Provides a mock path matcher.

Namespace

Drupal\system\Tests\Routing

Code

public function matchRequestPartial(Request $request) {

  // For now for testing we'll just do a straight string match.
  $path = $request
    ->getPathInfo();
  $return = new RouteCollection();
  foreach ($this->routes as $name => $route) {
    if ($route
      ->getPattern() == $path) {
      $return
        ->add($name, $route);
    }
  }
  return $return;
}