From 0e4b90e09bf4727cda870eef01c488be25348c95 Mon Sep 17 00:00:00 2001 From: Larry Garfield Date: Tue, 3 Jul 2012 20:42:09 -0500 Subject: [PATCH] Add a base class for partial matchers. --- .../Drupal/Core/Routing/HttpMethodMatcher.php | 11 ++---- .../Drupal/Core/Routing/PartialMatcher.php | 35 +++++++++++++++++++ 2 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 core/lib/Drupal/Core/Routing/PartialMatcher.php diff --git a/core/lib/Drupal/Core/Routing/HttpMethodMatcher.php b/core/lib/Drupal/Core/Routing/HttpMethodMatcher.php index 458b70c83d7..60ab36922eb 100644 --- a/core/lib/Drupal/Core/Routing/HttpMethodMatcher.php +++ b/core/lib/Drupal/Core/Routing/HttpMethodMatcher.php @@ -4,19 +4,12 @@ namespace Drupal\Core\Routing; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\RouteCollection; +use Symfony\Component\Routing\Exception\MethodNotAllowedException; /** * This class filters routes based on their HTTP Method. */ -class HttpMethodMatcher implements PartialMatcherInterface { - - protected $routes; - - public function setCollection(RouteCollection $routes) { - $this->routes = $routes; - - return $this; - } +class HttpMethodMatcher extends PartialMatcher { /** * Matches a request against multiple routes. diff --git a/core/lib/Drupal/Core/Routing/PartialMatcher.php b/core/lib/Drupal/Core/Routing/PartialMatcher.php new file mode 100644 index 00000000000..775bb3a89fb --- /dev/null +++ b/core/lib/Drupal/Core/Routing/PartialMatcher.php @@ -0,0 +1,35 @@ +routes = $collection; + + return $this; + } + +}