@@ -41,9 +41,9 @@ |
||
| 41 | 41 | * @param mixed $mContent content to translate |
| 42 | 42 | * @return mixed |
| 43 | 43 | */ |
| 44 | - public static function translate($mContent) |
|
| 45 | - { |
|
| 46 | - return json_encode(ObjectOperation::objectToArray($mContent)); |
|
| 47 | - } |
|
| 44 | + public static function translate($mContent) |
|
| 45 | + { |
|
| 46 | + return json_encode(ObjectOperation::objectToArray($mContent)); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | 49 | } |
@@ -32,26 +32,26 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | class Redis extends RealRedis implements CacheInterface |
| 34 | 34 | { |
| 35 | - /** |
|
| 36 | - * constructor with the connection to Redis |
|
| 37 | - * |
|
| 38 | - * @access public |
|
| 39 | - * @param string $sName name of the session |
|
| 40 | - * @param int $iFlags flags |
|
| 41 | - * @param int $iTimeout expiration of cache |
|
| 42 | - * @return mixed |
|
| 43 | - * @throws \Exception |
|
| 44 | - */ |
|
| 45 | - public function __construct($oConf) |
|
| 46 | - { |
|
| 47 | - if (!$this->connect($oConf->host, $oConf->port)) { |
|
| 35 | + /** |
|
| 36 | + * constructor with the connection to Redis |
|
| 37 | + * |
|
| 38 | + * @access public |
|
| 39 | + * @param string $sName name of the session |
|
| 40 | + * @param int $iFlags flags |
|
| 41 | + * @param int $iTimeout expiration of cache |
|
| 42 | + * @return mixed |
|
| 43 | + * @throws \Exception |
|
| 44 | + */ |
|
| 45 | + public function __construct($oConf) |
|
| 46 | + { |
|
| 47 | + if (!$this->connect($oConf->host, $oConf->port)) { |
|
| 48 | 48 | |
| 49 | - throw new \Exception('Redis server unavailable'); |
|
| 50 | - } |
|
| 49 | + throw new \Exception('Redis server unavailable'); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - // Select the REDIS db index |
|
| 53 | - $this->select($oConf->index); |
|
| 54 | - } |
|
| 52 | + // Select the REDIS db index |
|
| 53 | + $this->select($oConf->index); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * get a value |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public function get(string $sName, int &$iFlags = null, int $iTimeout = 0) |
| 66 | 66 | { |
| 67 | - return parent::get($sName); |
|
| 67 | + return parent::get($sName); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -9,11 +9,11 @@ |
||
| 9 | 9 | |
| 10 | 10 | interface RequestInterface |
| 11 | 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; |
|
| 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 | 19 | } |
@@ -9,19 +9,19 @@ |
||
| 9 | 9 | |
| 10 | 10 | class Files implements RequestInterface |
| 11 | 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 | - } |
|
| 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 | 27 | } |
@@ -9,19 +9,19 @@ |
||
| 9 | 9 | |
| 10 | 10 | class Server implements RequestInterface |
| 11 | 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 | - } |
|
| 23 | - else if ($default !== null) { |
|
| 24 | - return $default; |
|
| 25 | - } |
|
| 26 | - } |
|
| 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 | + } |
|
| 23 | + else if ($default !== null) { |
|
| 24 | + return $default; |
|
| 25 | + } |
|
| 26 | + } |
|
| 27 | 27 | } |
@@ -9,19 +9,19 @@ |
||
| 9 | 9 | |
| 10 | 10 | class Request implements RequestInterface |
| 11 | 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 | - } |
|
| 23 | - else if ($default !== null) { |
|
| 24 | - return $default; |
|
| 25 | - } |
|
| 26 | - } |
|
| 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 | + } |
|
| 23 | + else if ($default !== null) { |
|
| 24 | + return $default; |
|
| 25 | + } |
|
| 26 | + } |
|
| 27 | 27 | } |
@@ -9,19 +9,19 @@ |
||
| 9 | 9 | |
| 10 | 10 | class Query implements RequestInterface |
| 11 | 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 | - } |
|
| 23 | - else if ($default !== null) { |
|
| 24 | - return $default; |
|
| 25 | - } |
|
| 26 | - } |
|
| 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 | + } |
|
| 23 | + else if ($default !== null) { |
|
| 24 | + return $default; |
|
| 25 | + } |
|
| 26 | + } |
|
| 27 | 27 | } |
@@ -9,19 +9,19 @@ |
||
| 9 | 9 | |
| 10 | 10 | class Cookies implements RequestInterface |
| 11 | 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 | - } |
|
| 23 | - else if ($default !== null) { |
|
| 24 | - return $default; |
|
| 25 | - } |
|
| 26 | - } |
|
| 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 | + } |
|
| 23 | + else if ($default !== null) { |
|
| 24 | + return $default; |
|
| 25 | + } |
|
| 26 | + } |
|
| 27 | 27 | } |
@@ -9,37 +9,37 @@ |
||
| 9 | 9 | |
| 10 | 10 | class Headers implements RequestInterface |
| 11 | 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(apache_request_headers()[$name]) && apache_request_headers()[$name] != '') { |
|
| 21 | - return apache_request_headers()[$name]; |
|
| 22 | - } |
|
| 23 | - else if ($default !== null) { |
|
| 24 | - return $default; |
|
| 25 | - } |
|
| 26 | - } |
|
| 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(apache_request_headers()[$name]) && apache_request_headers()[$name] != '') { |
|
| 21 | + return apache_request_headers()[$name]; |
|
| 22 | + } |
|
| 23 | + else if ($default !== null) { |
|
| 24 | + return $default; |
|
| 25 | + } |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * set a new header |
|
| 30 | - * @param string $name |
|
| 31 | - * @param string $value |
|
| 32 | - * @return string|Headers |
|
| 33 | - */ |
|
| 34 | - public function set(string $name, string $value = null) : Headers |
|
| 35 | - { |
|
| 36 | - if ($value !== null) { |
|
| 37 | - header($name . ': ' . $value); |
|
| 38 | - } |
|
| 39 | - else { |
|
| 40 | - header($name); |
|
| 41 | - } |
|
| 28 | + /** |
|
| 29 | + * set a new header |
|
| 30 | + * @param string $name |
|
| 31 | + * @param string $value |
|
| 32 | + * @return string|Headers |
|
| 33 | + */ |
|
| 34 | + public function set(string $name, string $value = null) : Headers |
|
| 35 | + { |
|
| 36 | + if ($value !== null) { |
|
| 37 | + header($name . ': ' . $value); |
|
| 38 | + } |
|
| 39 | + else { |
|
| 40 | + header($name); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - return $this; |
|
| 44 | - } |
|
| 43 | + return $this; |
|
| 44 | + } |
|
| 45 | 45 | } |