| @@ 7-19 (lines=13) @@ | ||
| 4 | ||
| 5 | namespace Tomaj\NetteApi\Params; |
|
| 6 | ||
| 7 | class GetInputParam extends InputParam |
|
| 8 | { |
|
| 9 | protected $type = self::TYPE_GET; |
|
| 10 | ||
| 11 | public function getValue() |
|
| 12 | { |
|
| 13 | if (!filter_has_var(INPUT_GET, $this->key) && isset($_GET[$this->key])) { |
|
| 14 | return $_GET[$this->key]; |
|
| 15 | } |
|
| 16 | $value = $this->isMulti() ? filter_input(INPUT_GET, $this->key, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY) : filter_input(INPUT_GET, $this->key); |
|
| 17 | return $value !== null ? $value : $this->default; |
|
| 18 | } |
|
| 19 | } |
|
| 20 | ||
| @@ 7-19 (lines=13) @@ | ||
| 4 | ||
| 5 | namespace Tomaj\NetteApi\Params; |
|
| 6 | ||
| 7 | class PostInputParam extends InputParam |
|
| 8 | { |
|
| 9 | protected $type = self::TYPE_POST; |
|
| 10 | ||
| 11 | public function getValue() |
|
| 12 | { |
|
| 13 | if (!filter_has_var(INPUT_POST, $this->key) && isset($_POST[$this->key])) { |
|
| 14 | return $_POST[$this->key]; |
|
| 15 | } |
|
| 16 | $value = $this->isMulti() ? filter_input(INPUT_POST, $this->key, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY) : filter_input(INPUT_POST, $this->key); |
|
| 17 | return $value !== null ? $value : $this->default; |
|
| 18 | } |
|
| 19 | } |
|
| 20 | ||