1 | <?php |
||
13 | class MethodNotAllowedException extends Exception implements RouterExceptionInterface |
||
14 | { |
||
15 | // as per RFC2616 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.6) |
||
16 | // we must specify a comma separated list of allowed methods if we return |
||
17 | // a 405 response |
||
18 | private $allowedMethods; |
||
19 | |||
20 | /** |
||
21 | * Constructor for the method. |
||
22 | * @param string $message The error message string. |
||
23 | * @param array $allowedMethods The array of methods that are allowed. |
||
24 | */ |
||
25 | 1 | public function __construct($message, $allowedMethods) |
|
30 | |||
31 | /** |
||
32 | * Returns the associated status code with the exception. By default, most exceptions correspond |
||
33 | * to a server error (HTTP 500). Override this method if you want your exception to generate a |
||
34 | * different status code. |
||
35 | * @return The associated status code. |
||
36 | */ |
||
37 | 1 | public function getAssociatedStatusCode() |
|
44 | } |
||
45 |
If you suppress an error, we recommend checking for the error condition explicitly: