Version 1
[yaffs-website] / vendor / symfony-cmf / routing / NestedMatcher / RouteFilterInterface.php
1 <?php
2
3 /*
4  * This file is part of the Symfony CMF package.
5  *
6  * (c) 2011-2015 Symfony CMF
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Cmf\Component\Routing\NestedMatcher;
13
14 use Symfony\Component\Routing\RouteCollection;
15 use Symfony\Component\Routing\Exception\ResourceNotFoundException;
16 use Symfony\Component\HttpFoundation\Request;
17
18 /**
19  * A RouteFilter takes a RouteCollection and returns a filtered subset.
20  *
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.
24  *
25  * @author Larry Garfield
26  * @author David Buchmann
27  */
28 interface RouteFilterInterface
29 {
30     /**
31      * Filters the route collection against a request and returns all matching
32      * routes.
33      *
34      * @param RouteCollection $collection The collection against which to match.
35      * @param Request         $request    A Request object against which to match.
36      *
37      * @return RouteCollection A non-empty RouteCollection of matched routes.
38      *
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
43      *                                   possible.
44      */
45     public function filter(RouteCollection $collection, Request $request);
46 }