4 * This file is part of the Symfony CMF package.
6 * (c) 2011-2015 Symfony CMF
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Cmf\Component\Routing\NestedMatcher;
14 use Symfony\Component\Routing\RouteCollection;
15 use Symfony\Component\Routing\Exception\ResourceNotFoundException;
16 use Symfony\Component\HttpFoundation\Request;
19 * A RouteFilter takes a RouteCollection and returns a filtered subset.
21 * It is not implemented as a filter iterator because we want to allow
22 * router filters to handle their own empty-case handling, usually by throwing
23 * an appropriate exception if no routes match the object's rules.
25 * @author Larry Garfield
26 * @author David Buchmann
28 interface RouteFilterInterface
31 * Filters the route collection against a request and returns all matching
34 * @param RouteCollection $collection The collection against which to match.
35 * @param Request $request A Request object against which to match.
37 * @return RouteCollection A non-empty RouteCollection of matched routes.
39 * @throws ResourceNotFoundException if none of the routes in $collection
40 * matches $request. This is a performance
41 * optimization to not continue the match
42 * process when a match will no longer be
45 public function filter(RouteCollection $collection, Request $request);