Total Complexity | 5 |
Total Lines | 55 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
7 | final class Request |
||
8 | { |
||
9 | public const METHOD_CONNECT = 'CONNECT'; |
||
10 | public const METHOD_DELETE = 'DELETE'; |
||
11 | public const METHOD_GET = 'GET'; |
||
12 | public const METHOD_HEAD = 'HEAD'; |
||
13 | public const METHOD_OPTIONS = 'OPTIONS'; |
||
14 | public const METHOD_PATCH = 'PATCH'; |
||
15 | public const METHOD_POST = 'POST'; |
||
16 | public const METHOD_PUT = 'PUT'; |
||
17 | public const METHOD_TRACE = 'TRACE'; |
||
18 | public const ALL_METHODS = [ |
||
19 | self::METHOD_CONNECT, |
||
20 | self::METHOD_DELETE, |
||
21 | self::METHOD_GET, |
||
22 | self::METHOD_HEAD, |
||
23 | self::METHOD_OPTIONS, |
||
24 | self::METHOD_PATCH, |
||
25 | self::METHOD_POST, |
||
26 | self::METHOD_PUT, |
||
27 | self::METHOD_TRACE, |
||
28 | ]; |
||
29 | |||
30 | 74 | private function __construct( |
|
31 | private array $query, |
||
32 | private array $request, |
||
33 | private array $server, |
||
34 | ) { |
||
35 | 74 | } |
|
36 | |||
37 | 74 | public static function fromGlobals(): self |
|
38 | { |
||
39 | 74 | return new self($_GET, $_POST, $_SERVER); |
|
40 | } |
||
41 | |||
42 | 73 | public function isMethod(string $method): bool |
|
46 | } |
||
47 | |||
48 | 67 | public function path(): string |
|
54 | 67 | ); |
|
55 | } |
||
56 | |||
57 | 1 | public function get(string $key): mixed |
|
64 |