Skip to content
Snippets Groups Projects
Commit 0e4b90e0 authored by Larry Garfield's avatar Larry Garfield Committed by Alex Bronstein
Browse files

Add a base class for partial matchers.

parent 329fde3f
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -4,19 +4,12 @@
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.
......
<?php
namespace Drupal\Core\Routing;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\RouteCollection;
/**
* Utility base class for partial matchers.
*/
abstract class PartialMatcher implements PartialMatcherInterface {
/**
* The RouteCollection this matcher should match against.
*
* @var RouteCollection
*/
protected $routes;
/**
* Sets the route collection this matcher should use.
*
* @param RouteCollection $collection
* The collection against which to match.
*
* @return PartialMatcherInterface
* The current matcher.
*/
public function setCollection(RouteCollection $collection) {
$this->routes = $collection;
return $this;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment