| @@ 10-27 (lines=18) @@ | ||
| 7 | */ |
|
| 8 | namespace Venus\lib\Request; |
|
| 9 | ||
| 10 | class Cookies implements RequestInterface |
|
| 11 | { |
|
| 12 | /** |
|
| 13 | * get parameter |
|
| 14 | * @param string $name |
|
| 15 | * @param string $default |
|
| 16 | * @return string |
|
| 17 | */ |
|
| 18 | public function get(string $name, string $default = null) : string |
|
| 19 | { |
|
| 20 | if (isset($_COOKIE[$name]) && $_COOKIE[$name] != '') { |
|
| 21 | return $_COOKIE[$name]; |
|
| 22 | } else if ($default !== null) { |
|
| 23 | return $default; |
|
| 24 | } |
|
| 25 | } |
|
| 26 | } |
|
| 27 | ||
| @@ 10-27 (lines=18) @@ | ||
| 7 | */ |
|
| 8 | namespace Venus\lib\Request; |
|
| 9 | ||
| 10 | class Files implements RequestInterface |
|
| 11 | { |
|
| 12 | /** |
|
| 13 | * get parameter |
|
| 14 | * @param string $name |
|
| 15 | * @param string $default |
|
| 16 | * @return string |
|
| 17 | */ |
|
| 18 | public function get(string $name, string $default = null) : string |
|
| 19 | { |
|
| 20 | if (isset($_FILES[$name]) && $_FILES[$name] != '') { |
|
| 21 | return $_FILES[$name]; |
|
| 22 | } |
|
| 23 | else if ($default !== null) { |
|
| 24 | return $default; |
|
| 25 | } |
|
| 26 | } |
|
| 27 | } |
|
| 28 | ||
| @@ 10-27 (lines=18) @@ | ||
| 7 | */ |
|
| 8 | namespace Venus\lib\Request; |
|
| 9 | ||
| 10 | class Query implements RequestInterface |
|
| 11 | { |
|
| 12 | /** |
|
| 13 | * get parameter |
|
| 14 | * @param string $name |
|
| 15 | * @param string $default |
|
| 16 | * @return string |
|
| 17 | */ |
|
| 18 | public function get(string $name, string $default = null) : string |
|
| 19 | { |
|
| 20 | if (isset($_GET[$name]) && $_GET[$name] != '') { |
|
| 21 | return $_GET[$name]; |
|
| 22 | } else if ($default !== null) { |
|
| 23 | return $default; |
|
| 24 | } |
|
| 25 | } |
|
| 26 | } |
|
| 27 | ||
| @@ 10-27 (lines=18) @@ | ||
| 7 | */ |
|
| 8 | namespace Venus\lib\Request; |
|
| 9 | ||
| 10 | class Request implements RequestInterface |
|
| 11 | { |
|
| 12 | /** |
|
| 13 | * get parameter |
|
| 14 | * @param string $name |
|
| 15 | * @param string $default |
|
| 16 | * @return string |
|
| 17 | */ |
|
| 18 | public function get(string $name, string $default = null) : string |
|
| 19 | { |
|
| 20 | if (isset($_POST[$name]) && $_POST[$name] != '') { |
|
| 21 | return $_POST[$name]; |
|
| 22 | } else if ($default !== null) { |
|
| 23 | return $default; |
|
| 24 | } |
|
| 25 | } |
|
| 26 | } |
|
| 27 | ||
| @@ 10-27 (lines=18) @@ | ||
| 7 | */ |
|
| 8 | namespace Venus\lib\Request; |
|
| 9 | ||
| 10 | class Server implements RequestInterface |
|
| 11 | { |
|
| 12 | /** |
|
| 13 | * get parameter |
|
| 14 | * @param string $name |
|
| 15 | * @param string $default |
|
| 16 | * @return string |
|
| 17 | */ |
|
| 18 | public function get(string $name, string $default = null) : string |
|
| 19 | { |
|
| 20 | if (isset($_SERVER[$name]) && $_SERVER[$name] != '') { |
|
| 21 | return $_SERVER[$name]; |
|
| 22 | } else if ($default !== null) { |
|
| 23 | return $default; |
|
| 24 | } |
|
| 25 | } |
|
| 26 | } |
|
| 27 | ||