Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Routing][HttpKernel] Add RequestMatcherInterface.
While UrlMatcherInterface is only for matching URLs with routes, add RequestMatcherInterface, that allows to match against whole requests.
- Loading branch information
Showing
4 changed files
with
85 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Routing\Matcher; | ||
|
||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\Routing\RequestContextAwareInterface; | ||
use Symfony\Component\Routing\Exception\ResourceNotFoundException; | ||
use Symfony\Component\Routing\Exception\MethodNotAllowedException; | ||
|
||
/** | ||
* UrlMatcherInterface is the interface that all URL matcher classes must implement. | ||
* | ||
* @author Fabien Potencier <fabien@symfony.com> | ||
*/ | ||
interface RequestMatcherInterface extends RequestContextAwareInterface | ||
{ | ||
/** | ||
* Tries to match a request with a set of routes. | ||
* | ||
* If the matcher can not find information, it must throw one of the exceptions documented | ||
* below. | ||
* | ||
* @param Request $request The request to match | ||
* | ||
* @return array An array of parameters | ||
* | ||
* @throws ResourceNotFoundException If no matching resource could be found | ||
* @throws MethodNotAllowedException If a matching resource was found but the request method is not allowed | ||
*/ | ||
function matchRequest(Request $request); | ||
} |