1 | <?php |
||
13 | class Request |
||
14 | { |
||
15 | |||
16 | /** |
||
17 | * @var string Request method |
||
18 | */ |
||
19 | protected $method; |
||
20 | |||
21 | /** |
||
22 | * @var string Full URL |
||
23 | */ |
||
24 | protected $url; |
||
25 | |||
26 | /** |
||
27 | * @var array Request headers |
||
28 | */ |
||
29 | protected $headers; |
||
30 | |||
31 | /** |
||
32 | * @var Cookie Cookie |
||
33 | */ |
||
34 | protected $cookie; |
||
35 | |||
36 | /** |
||
37 | * @var array POST data |
||
38 | */ |
||
39 | public $post; |
||
40 | |||
41 | /** |
||
42 | * Request constructor. |
||
43 | * |
||
44 | * @param array $server |
||
45 | * @param array $post |
||
46 | * @param Cookie $cookie |
||
47 | */ |
||
48 | public function __construct(Cookie $cookie, array $server = [], array $post = []) |
||
56 | |||
57 | public function getMethod(): string |
||
61 | |||
62 | /** |
||
63 | * Get request URL path |
||
64 | * |
||
65 | * @return string URL path |
||
66 | */ |
||
67 | public function getPath(): string |
||
77 | |||
78 | public function getAcceptHeader(): string |
||
82 | |||
83 | public function getAuthorizationHeader(): string |
||
87 | |||
88 | /** |
||
89 | * Get cookie |
||
90 | * |
||
91 | * @return Cookie |
||
92 | */ |
||
93 | public function getCookie(): Cookie |
||
97 | |||
98 | /** |
||
99 | * Get request POST data |
||
100 | * |
||
101 | * @return array POST data |
||
102 | */ |
||
103 | public function getPost(): array |
||
107 | |||
108 | /** |
||
109 | * Create URL from _SERVER array |
||
110 | * |
||
111 | * @param array $server _SERVER array |
||
112 | * @param bool $secure |
||
113 | * |
||
114 | * @return string URL |
||
115 | */ |
||
116 | protected function createUrlFromServerArray(array $server, bool $secure = true): string |
||
126 | |||
127 | protected function parseHeaders(array $server): array |
||
146 | } |
||
147 |