Total Complexity | 11 |
Total Lines | 57 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 2 |
1 | <?php |
||
5 | class Request |
||
6 | { |
||
7 | private $alto_match; |
||
8 | private $query_parameters; |
||
9 | private $params; |
||
10 | |||
11 | public function __construct(array $match) |
||
12 | { |
||
13 | $this->alto_match = $match; |
||
14 | $this->query_parameters = $_GET; |
||
15 | $this->params = array_merge($this->alto_match['params'], $this->query_parameters); |
||
16 | } |
||
17 | |||
18 | // DEPRECATED |
||
19 | public function target() |
||
22 | } |
||
23 | |||
24 | public function name() |
||
25 | { |
||
26 | return $this->alto_match['name']; |
||
27 | } |
||
28 | |||
29 | // @return array of all GET params if $name is null |
||
30 | // @return null if $name is not an index |
||
31 | // @return return urldecoded string |
||
32 | public function params($name = null) |
||
33 | { |
||
34 | if(is_null($name)){ |
||
35 | return $this->params; |
||
36 | } |
||
37 | |||
38 | if (!isset($this->params[$name])) { |
||
39 | return null; |
||
40 | } |
||
41 | |||
42 | if (is_string($this->params[$name])) { |
||
43 | return urldecode($this->params[$name]); |
||
44 | } |
||
45 | |||
46 | return $this->params[$name]; |
||
47 | } |
||
48 | |||
49 | public function submitted($name = null) |
||
56 | } |
||
57 | |||
58 | public function payload(): ?string |
||
65 |