forked from symfony/symfony
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[routing] Added negotiation to UrlMatcher.
- Loading branch information
Showing
4 changed files
with
114 additions
and
2 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
src/Symfony/Component/Routing/Exception/NotAcceptableException.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,35 @@ | ||
<?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\Exception; | ||
|
||
use Symfony\Component\Routing\RequestAcceptance; | ||
|
||
/** | ||
* The resource was found but the Accept-* header does not match requirement. | ||
* | ||
* This exception should trigger an HTTP 405 response in your application code. | ||
* | ||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com> | ||
*/ | ||
class NotAcceptableException extends \RuntimeException implements ExceptionInterface | ||
{ | ||
protected $acceptance; | ||
protected $requirement; | ||
|
||
public function __construct(RequestAcceptance $acceptance, $requirement, $message = null, $code = 0, \Exception $previous = null) | ||
{ | ||
$this->acceptance = $acceptance; | ||
$this->requirement = $requirement; | ||
$message = sprintf('None of the accepted values "%s" match route requirement "%s".', implode(', ', $acceptance->getValues()), $requirement); | ||
parent::__construct($message, $code, $previous); | ||
} | ||
} |
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