Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
28.57% |
2 / 7 |
CRAP | |
46.15% |
6 / 13 |
| Request | |
0.00% |
0 / 1 |
|
28.57% |
2 / 7 |
17.99 | |
46.15% |
6 / 13 |
| __construct | |
100.00% |
1 / 1 |
1 | |
100.00% |
5 / 5 |
|||
| getServerInfo | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 1 |
|||
| getQuery | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 1 |
|||
| getPost | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 1 |
|||
| getFiles | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 1 |
|||
| getRequestUriPath | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| getRequestMethod | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 3 |
|||
| <?php | |
| namespace Luxian\Http; | |
| class Request | |
| { | |
| protected $server; | |
| protected $get; | |
| protected $post; | |
| protected $files; | |
| public function __construct( | |
| array $server, | |
| array $get = [], | |
| array $post = [], | |
| array $files = [] | |
| ) | |
| { | |
| $this->server = $server; | |
| $this->get = $get; | |
| $this->post = $post; | |
| $this->files = $files; | |
| } | |
| public function getServerInfo() | |
| { | |
| return $this->server; | |
| } | |
| public function getQuery() | |
| { | |
| return $this->get; | |
| } | |
| public function getPost() | |
| { | |
| return $this->post; | |
| } | |
| public function getFiles() | |
| { | |
| return $this->files; | |
| } | |
| public function getRequestUriPath() | |
| { | |
| return $this->server['REQUEST_URI'] ?? '/'; | |
| } | |
| public function getRequestMethod() | |
| { | |
| if (isset($this->server['REQUEST_METHOD'])) { | |
| return strtoupper($this->server['REQUEST_METHOD']); | |
| } | |
| return 'GET'; | |
| } | |
| } |