1 | <?php |
||
10 | trait Input |
||
11 | { |
||
12 | /** |
||
13 | * Get request, set for controller |
||
14 | * |
||
15 | * @return ServerRequestInterface |
||
16 | */ |
||
17 | abstract public function getRequest(); |
||
18 | |||
19 | |||
20 | /** |
||
21 | * Get the request query parameters. |
||
22 | * |
||
23 | * <code> |
||
24 | * // Get all parameters |
||
25 | * $params = $this->getQueryParams(); |
||
26 | * |
||
27 | * // Get specific parameters, specifying defaults for 'bar' and 'zoo' |
||
28 | * list($foo, $bar, $zoo) = $this->getQueryParams(['foo', 'bar' => 10, 'zoo' => 'monkey']); |
||
29 | * </code> |
||
30 | * |
||
31 | * @param array $list |
||
32 | * @return array |
||
33 | */ |
||
34 | 30 | public function getQueryParams(array $list = null) |
|
40 | |||
41 | /** |
||
42 | * Apply list to query params |
||
43 | * |
||
44 | * @param array $list |
||
45 | * @return array |
||
46 | */ |
||
47 | 4 | protected function listQueryParams(array $list) |
|
63 | |||
64 | /** |
||
65 | * Check if the request has a query parameter |
||
66 | * |
||
67 | * @param array $param |
||
68 | * @return boolean |
||
69 | */ |
||
70 | 1 | public function hasQueryParam($param) |
|
76 | |||
77 | /** |
||
78 | * Get a query parameter. |
||
79 | * |
||
80 | * Optionally apply filtering to the value. |
||
81 | * @link http://php.net/manual/en/filter.filters.php |
||
82 | * |
||
83 | * @param array $param |
||
84 | * @param string $default |
||
85 | * @param int $filter |
||
86 | * @param mixed $filterOptions |
||
87 | * @return mixed |
||
88 | */ |
||
89 | 21 | public function getQueryParam($param, $default = null, $filter = null, $filterOptions = null) |
|
100 | |||
101 | |||
102 | /** |
||
103 | * Get parsed body and uploaded files as input |
||
104 | * |
||
105 | * @return array|mixed |
||
106 | */ |
||
107 | 11 | public function getInput() |
|
118 | } |
||
119 |