1 | <?php |
||
11 | class HttpMethod |
||
12 | { |
||
13 | /** @var string The HTTP GET request method */ |
||
14 | public const GET = 'GET'; |
||
15 | |||
16 | /** @var string The HTTP HEAD request method */ |
||
17 | public const HEAD = 'HEAD'; |
||
18 | |||
19 | /** @var string The HTTP POST request method */ |
||
20 | public const POST = 'POST'; |
||
21 | |||
22 | /** @var string The HTTP PUT request method */ |
||
23 | public const PUT = 'PUT'; |
||
24 | |||
25 | /** @var string The HTTP DELETE request method */ |
||
26 | public const DELETE = 'DELETE'; |
||
27 | |||
28 | /** @var string The HTTP CONNECT request method */ |
||
29 | public const CONNECT = 'CONNECT'; |
||
30 | |||
31 | /** @var string The HTTP OPTIONS request method */ |
||
32 | public const OPTIONS = 'OPTIONS'; |
||
33 | |||
34 | /** @var string The HTTP TRACE request method */ |
||
35 | public const TRACE = 'TRACE'; |
||
36 | |||
37 | /** @var string The HTTP PATCH request method */ |
||
38 | public const PATCH = 'PATCH'; |
||
39 | |||
40 | /** |
||
41 | * Tells if the given string is a valid HTTP request method. |
||
42 | * @param string $method The string to test |
||
43 | * @return bool True if it is a valid HTTP request method, false if not |
||
44 | */ |
||
45 | 26 | public static function isValid(string $method): bool |
|
49 | |||
50 | /** |
||
51 | * Returns list of all valid HTTP request methods. |
||
52 | * @return array List of all valid HTTP request methods |
||
53 | */ |
||
54 | 26 | public static function getAll(): array |
|
68 | } |
||
69 |