1 | <?php |
||
19 | class MethodNotAllowedException extends HttpExceptionAbstract |
||
20 | { |
||
21 | |||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | |||
26 | protected $requestedMethod; |
||
27 | |||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | |||
32 | protected $requestedUri; |
||
33 | |||
34 | /** |
||
35 | * @var string[] |
||
36 | */ |
||
37 | |||
38 | protected $allowedMethods; |
||
39 | |||
40 | /** |
||
41 | * MethodNotAllowedException constructor. |
||
42 | * |
||
43 | * @param string $requestedMethod |
||
44 | * @param string $requestedUri |
||
45 | * @param string[] $allowedMethods |
||
46 | */ |
||
47 | |||
48 | 5 | public function __construct($requestedMethod, $requestedUri, array $allowedMethods) |
|
56 | |||
57 | /** |
||
58 | * Verify if the given HTTP method is allowed for the request. |
||
59 | * |
||
60 | * @param string $method An HTTP method |
||
61 | * @return bool |
||
62 | */ |
||
63 | |||
64 | 1 | public function can($method) |
|
68 | |||
69 | /** |
||
70 | * The HTTP specification requires that a 405 Method Not Allowed response include the |
||
71 | * Allow: header to detail available methods for the requested resource. |
||
72 | * |
||
73 | * @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html section 14.7 |
||
74 | * @return string |
||
75 | */ |
||
76 | |||
77 | 1 | public function allowed() |
|
81 | |||
82 | } |
||
83 |