@@ -9,18 +9,18 @@ |
||
| 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 | - } else if ($default !== null) { |
|
| 23 | - return $default; |
|
| 24 | - } |
|
| 25 | - } |
|
| 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 | 26 | } |
@@ -9,18 +9,18 @@ |
||
| 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 | - } else if ($default !== null) { |
|
| 23 | - return $default; |
|
| 24 | - } |
|
| 25 | - } |
|
| 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 | 26 | } |
@@ -9,18 +9,18 @@ |
||
| 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 | - } else if ($default !== null) { |
|
| 23 | - return $default; |
|
| 24 | - } |
|
| 25 | - } |
|
| 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 | 26 | } |
@@ -9,18 +9,18 @@ |
||
| 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 | - } else if ($default !== null) { |
|
| 23 | - return $default; |
|
| 24 | - } |
|
| 25 | - } |
|
| 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 | 26 | } |
@@ -9,35 +9,35 @@ |
||
| 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 | - } else if ($default !== null) { |
|
| 23 | - return $default; |
|
| 24 | - } |
|
| 25 | - } |
|
| 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 | + } else if ($default !== null) { |
|
| 23 | + return $default; |
|
| 24 | + } |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * set a new header |
|
| 29 | - * @param string $name |
|
| 30 | - * @param string $value |
|
| 31 | - * @return string|Headers |
|
| 32 | - */ |
|
| 33 | - public function set(string $name, string $value = null) : Headers |
|
| 34 | - { |
|
| 35 | - if ($value !== null) { |
|
| 36 | - header($name . ': ' . $value); |
|
| 37 | - } else { |
|
| 38 | - header($name); |
|
| 39 | - } |
|
| 27 | + /** |
|
| 28 | + * set a new header |
|
| 29 | + * @param string $name |
|
| 30 | + * @param string $value |
|
| 31 | + * @return string|Headers |
|
| 32 | + */ |
|
| 33 | + public function set(string $name, string $value = null) : Headers |
|
| 34 | + { |
|
| 35 | + if ($value !== null) { |
|
| 36 | + header($name . ': ' . $value); |
|
| 37 | + } else { |
|
| 38 | + header($name); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - return $this; |
|
| 42 | - } |
|
| 41 | + return $this; |
|
| 42 | + } |
|
| 43 | 43 | } |
@@ -32,109 +32,109 @@ |
||
| 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 $oConf |
|
| 40 | - * @throws \Exception |
|
| 41 | - * @internal param string $sName name of the session |
|
| 42 | - * @internal param int $iFlags flags |
|
| 43 | - * @internal param int $iTimeout expiration of cache |
|
| 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 $oConf |
|
| 40 | + * @throws \Exception |
|
| 41 | + * @internal param string $sName name of the session |
|
| 42 | + * @internal param int $iFlags flags |
|
| 43 | + * @internal param int $iTimeout expiration of cache |
|
| 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 | - /** |
|
| 57 | - * get a value |
|
| 58 | - * |
|
| 59 | - * @access public |
|
| 60 | - * @param string $sName name of the session |
|
| 61 | - * @param int $iFlags flags |
|
| 62 | - * @param int $iTimeout expiration of cache |
|
| 63 | - * @return mixed |
|
| 64 | - */ |
|
| 65 | - public function get(string $sName, int &$iFlags = null, int $iTimeout = 0) |
|
| 66 | - { |
|
| 67 | - return parent::get($sName); |
|
| 68 | - } |
|
| 56 | + /** |
|
| 57 | + * get a value |
|
| 58 | + * |
|
| 59 | + * @access public |
|
| 60 | + * @param string $sName name of the session |
|
| 61 | + * @param int $iFlags flags |
|
| 62 | + * @param int $iTimeout expiration of cache |
|
| 63 | + * @return mixed |
|
| 64 | + */ |
|
| 65 | + public function get(string $sName, int &$iFlags = null, int $iTimeout = 0) |
|
| 66 | + { |
|
| 67 | + return parent::get($sName); |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * set a value |
|
| 72 | - * |
|
| 73 | - * @access public |
|
| 74 | - * @param string $sName name of the session |
|
| 75 | - * @param mixed $mValue value of this sesion var |
|
| 76 | - * @param int $iFlag unused |
|
| 77 | - * @param int $iExpire expiration of cache |
|
| 78 | - * @return \Venus\lib\Cache\Apc |
|
| 79 | - */ |
|
| 80 | - public function set(string $sName, $mValue, int $iFlag = 0, int $iExpire = false) |
|
| 81 | - { |
|
| 82 | - if ($iExpire === false) { |
|
| 70 | + /** |
|
| 71 | + * set a value |
|
| 72 | + * |
|
| 73 | + * @access public |
|
| 74 | + * @param string $sName name of the session |
|
| 75 | + * @param mixed $mValue value of this sesion var |
|
| 76 | + * @param int $iFlag unused |
|
| 77 | + * @param int $iExpire expiration of cache |
|
| 78 | + * @return \Venus\lib\Cache\Apc |
|
| 79 | + */ |
|
| 80 | + public function set(string $sName, $mValue, int $iFlag = 0, int $iExpire = false) |
|
| 81 | + { |
|
| 82 | + if ($iExpire === false) { |
|
| 83 | 83 | |
| 84 | - return parent::set($sName, $mValue); |
|
| 85 | - } |
|
| 86 | - else { |
|
| 84 | + return parent::set($sName, $mValue); |
|
| 85 | + } |
|
| 86 | + else { |
|
| 87 | 87 | |
| 88 | - return parent::setex($sName, $iExpire, $mValue); |
|
| 89 | - } |
|
| 90 | - } |
|
| 88 | + return parent::setex($sName, $iExpire, $mValue); |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * flush the cache |
|
| 94 | - * |
|
| 95 | - * @access public |
|
| 96 | - * @return mixed |
|
| 97 | - */ |
|
| 98 | - public function flush() |
|
| 99 | - { |
|
| 100 | - return false; |
|
| 101 | - } |
|
| 92 | + /** |
|
| 93 | + * flush the cache |
|
| 94 | + * |
|
| 95 | + * @access public |
|
| 96 | + * @return mixed |
|
| 97 | + */ |
|
| 98 | + public function flush() |
|
| 99 | + { |
|
| 100 | + return false; |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | - /** |
|
| 104 | - * delete a value |
|
| 105 | - * |
|
| 106 | - * @access public |
|
| 107 | - * @param string $sName name of the session |
|
| 108 | - * @return mixed |
|
| 109 | - */ |
|
| 110 | - public function delete(string $sName) |
|
| 111 | - { |
|
| 112 | - return $this->del($sName); |
|
| 113 | - } |
|
| 103 | + /** |
|
| 104 | + * delete a value |
|
| 105 | + * |
|
| 106 | + * @access public |
|
| 107 | + * @param string $sName name of the session |
|
| 108 | + * @return mixed |
|
| 109 | + */ |
|
| 110 | + public function delete(string $sName) |
|
| 111 | + { |
|
| 112 | + return $this->del($sName); |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | - /** |
|
| 116 | - * close the redis connecction |
|
| 117 | - * |
|
| 118 | - * @access public |
|
| 119 | - * @return mixed |
|
| 120 | - */ |
|
| 121 | - public function __sleep() |
|
| 122 | - { |
|
| 123 | - $this->close(); |
|
| 124 | - } |
|
| 115 | + /** |
|
| 116 | + * close the redis connecction |
|
| 117 | + * |
|
| 118 | + * @access public |
|
| 119 | + * @return mixed |
|
| 120 | + */ |
|
| 121 | + public function __sleep() |
|
| 122 | + { |
|
| 123 | + $this->close(); |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | - /** |
|
| 127 | - * add |
|
| 128 | - * |
|
| 129 | - * @access public |
|
| 130 | - * @param string $sName name of the session |
|
| 131 | - * @param mixed $mValue value of this sesion var |
|
| 132 | - * @param int $iFlag unused |
|
| 133 | - * @param int $iExpire expiration of cache |
|
| 134 | - * @return mixed |
|
| 135 | - */ |
|
| 136 | - public function add(string $sName, $mValue, int $iExpire = false) |
|
| 137 | - { |
|
| 138 | - return $this->set($sName, $mValue, 0, $iExpire); |
|
| 139 | - } |
|
| 126 | + /** |
|
| 127 | + * add |
|
| 128 | + * |
|
| 129 | + * @access public |
|
| 130 | + * @param string $sName name of the session |
|
| 131 | + * @param mixed $mValue value of this sesion var |
|
| 132 | + * @param int $iFlag unused |
|
| 133 | + * @param int $iExpire expiration of cache |
|
| 134 | + * @return mixed |
|
| 135 | + */ |
|
| 136 | + public function add(string $sName, $mValue, int $iExpire = false) |
|
| 137 | + { |
|
| 138 | + return $this->set($sName, $mValue, 0, $iExpire); |
|
| 139 | + } |
|
| 140 | 140 | } |
@@ -28,126 +28,126 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | class Bash |
| 30 | 30 | { |
| 31 | - /** |
|
| 32 | - * color of the text in the bash |
|
| 33 | - * |
|
| 34 | - * @access public |
|
| 35 | - * @var array |
|
| 36 | - */ |
|
| 37 | - public static $_aColorCodes = array( |
|
| 38 | - 'default' => 39, |
|
| 39 | - 'black' => 30, |
|
| 40 | - 'red' => 31, |
|
| 41 | - 'green' => 32, |
|
| 42 | - 'yellow' => 33, |
|
| 43 | - 'blue' => 34, |
|
| 44 | - 'magenta' => 35, |
|
| 45 | - 'cyan' => 36, |
|
| 46 | - 'light gray' => 37, |
|
| 47 | - 'dark gray' => 90, |
|
| 48 | - 'light red' => 91, |
|
| 49 | - 'light green' => 92, |
|
| 50 | - 'light yellow' => 93, |
|
| 51 | - 'light blue' => 94, |
|
| 52 | - 'light magenta' => 95, |
|
| 53 | - 'light cyan' => 96, |
|
| 54 | - 'white' => 97 |
|
| 55 | - ); |
|
| 31 | + /** |
|
| 32 | + * color of the text in the bash |
|
| 33 | + * |
|
| 34 | + * @access public |
|
| 35 | + * @var array |
|
| 36 | + */ |
|
| 37 | + public static $_aColorCodes = array( |
|
| 38 | + 'default' => 39, |
|
| 39 | + 'black' => 30, |
|
| 40 | + 'red' => 31, |
|
| 41 | + 'green' => 32, |
|
| 42 | + 'yellow' => 33, |
|
| 43 | + 'blue' => 34, |
|
| 44 | + 'magenta' => 35, |
|
| 45 | + 'cyan' => 36, |
|
| 46 | + 'light gray' => 37, |
|
| 47 | + 'dark gray' => 90, |
|
| 48 | + 'light red' => 91, |
|
| 49 | + 'light green' => 92, |
|
| 50 | + 'light yellow' => 93, |
|
| 51 | + 'light blue' => 94, |
|
| 52 | + 'light magenta' => 95, |
|
| 53 | + 'light cyan' => 96, |
|
| 54 | + 'white' => 97 |
|
| 55 | + ); |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * color of the background in the bash |
|
| 59 | - * |
|
| 60 | - * @access public |
|
| 61 | - * @var array |
|
| 62 | - */ |
|
| 63 | - public static $_aBackgroundCodes = array( |
|
| 64 | - 'default' => 49, |
|
| 65 | - 'black' => 40, |
|
| 66 | - 'red' => 41, |
|
| 67 | - 'green' => 42, |
|
| 68 | - 'yellow' => 43, |
|
| 69 | - 'blue' => 44, |
|
| 70 | - 'magenta' => 45, |
|
| 71 | - 'cyan' => 46, |
|
| 72 | - 'light gray' => 47, |
|
| 73 | - 'dark gray' => 100, |
|
| 74 | - 'light red' => 101, |
|
| 75 | - 'light green' => 102, |
|
| 76 | - 'light yellow' => 103, |
|
| 77 | - 'light blue' => 104, |
|
| 78 | - 'light magenta' => 105, |
|
| 79 | - 'light cyan' => 106, |
|
| 80 | - 'white' => 107 |
|
| 81 | - ); |
|
| 57 | + /** |
|
| 58 | + * color of the background in the bash |
|
| 59 | + * |
|
| 60 | + * @access public |
|
| 61 | + * @var array |
|
| 62 | + */ |
|
| 63 | + public static $_aBackgroundCodes = array( |
|
| 64 | + 'default' => 49, |
|
| 65 | + 'black' => 40, |
|
| 66 | + 'red' => 41, |
|
| 67 | + 'green' => 42, |
|
| 68 | + 'yellow' => 43, |
|
| 69 | + 'blue' => 44, |
|
| 70 | + 'magenta' => 45, |
|
| 71 | + 'cyan' => 46, |
|
| 72 | + 'light gray' => 47, |
|
| 73 | + 'dark gray' => 100, |
|
| 74 | + 'light red' => 101, |
|
| 75 | + 'light green' => 102, |
|
| 76 | + 'light yellow' => 103, |
|
| 77 | + 'light blue' => 104, |
|
| 78 | + 'light magenta' => 105, |
|
| 79 | + 'light cyan' => 106, |
|
| 80 | + 'white' => 107 |
|
| 81 | + ); |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * color of the decoration code in the bash |
|
| 85 | - * |
|
| 86 | - * @access public |
|
| 87 | - * @var array |
|
| 88 | - */ |
|
| 89 | - public static $_aDecorationCodes = array( |
|
| 90 | - 'bold' => '1', |
|
| 91 | - 'dim' => '2', |
|
| 92 | - 'underline' => '4', |
|
| 93 | - 'blink' => '5', |
|
| 94 | - 'reverse' => '7', |
|
| 95 | - 'hidden' => '8' |
|
| 96 | - ); |
|
| 83 | + /** |
|
| 84 | + * color of the decoration code in the bash |
|
| 85 | + * |
|
| 86 | + * @access public |
|
| 87 | + * @var array |
|
| 88 | + */ |
|
| 89 | + public static $_aDecorationCodes = array( |
|
| 90 | + 'bold' => '1', |
|
| 91 | + 'dim' => '2', |
|
| 92 | + 'underline' => '4', |
|
| 93 | + 'blink' => '5', |
|
| 94 | + 'reverse' => '7', |
|
| 95 | + 'hidden' => '8' |
|
| 96 | + ); |
|
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * set a decoration of the text |
|
| 100 | - * |
|
| 101 | - * @access public |
|
| 102 | - * @param string $sContent content to around by the style |
|
| 103 | - * @param string $sStyleName the name of the style |
|
| 104 | - * @return string |
|
| 105 | - */ |
|
| 106 | - public static function setDecoration(string $sContent, string $sStyleName) : string |
|
| 107 | - { |
|
| 108 | - return self::_applyCode($sContent, self::$_aBackgroundCodes[$sStyleName]); |
|
| 109 | - } |
|
| 98 | + /** |
|
| 99 | + * set a decoration of the text |
|
| 100 | + * |
|
| 101 | + * @access public |
|
| 102 | + * @param string $sContent content to around by the style |
|
| 103 | + * @param string $sStyleName the name of the style |
|
| 104 | + * @return string |
|
| 105 | + */ |
|
| 106 | + public static function setDecoration(string $sContent, string $sStyleName) : string |
|
| 107 | + { |
|
| 108 | + return self::_applyCode($sContent, self::$_aBackgroundCodes[$sStyleName]); |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | - /** |
|
| 112 | - * set a color of the background |
|
| 113 | - * |
|
| 114 | - * @access public |
|
| 115 | - * @param string $sContent content to around by the style |
|
| 116 | - * @param string $sColorName the name of the color |
|
| 117 | - * @return string |
|
| 118 | - */ |
|
| 119 | - public static function setBackground(string $sContent, string $sColorName) : string |
|
| 120 | - { |
|
| 121 | - if (!isset(self::$_aBackgroundCodes[$sColorName])) { $sColorName = 'black'; } |
|
| 111 | + /** |
|
| 112 | + * set a color of the background |
|
| 113 | + * |
|
| 114 | + * @access public |
|
| 115 | + * @param string $sContent content to around by the style |
|
| 116 | + * @param string $sColorName the name of the color |
|
| 117 | + * @return string |
|
| 118 | + */ |
|
| 119 | + public static function setBackground(string $sContent, string $sColorName) : string |
|
| 120 | + { |
|
| 121 | + if (!isset(self::$_aBackgroundCodes[$sColorName])) { $sColorName = 'black'; } |
|
| 122 | 122 | |
| 123 | - return self::_applyCode($sContent, self::$_aBackgroundCodes[$sColorName]); |
|
| 124 | - } |
|
| 123 | + return self::_applyCode($sContent, self::$_aBackgroundCodes[$sColorName]); |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | - /** |
|
| 127 | - * set a color of the text |
|
| 128 | - * |
|
| 129 | - * @access public |
|
| 130 | - * @param string $sContent content to around by the style |
|
| 131 | - * @param string $sColorName the name of the color |
|
| 132 | - * @return string |
|
| 133 | - */ |
|
| 134 | - public static function setColor(string $sContent, string $sColorName) : string |
|
| 135 | - { |
|
| 136 | - if (!isset(self::$_aBackgroundCodes[$sColorName])) { $sColorName = 'white'; } |
|
| 126 | + /** |
|
| 127 | + * set a color of the text |
|
| 128 | + * |
|
| 129 | + * @access public |
|
| 130 | + * @param string $sContent content to around by the style |
|
| 131 | + * @param string $sColorName the name of the color |
|
| 132 | + * @return string |
|
| 133 | + */ |
|
| 134 | + public static function setColor(string $sContent, string $sColorName) : string |
|
| 135 | + { |
|
| 136 | + if (!isset(self::$_aBackgroundCodes[$sColorName])) { $sColorName = 'white'; } |
|
| 137 | 137 | |
| 138 | - return self::_applyCode($sContent, self::$_aBackgroundCodes[$sColorName]); |
|
| 139 | - } |
|
| 138 | + return self::_applyCode($sContent, self::$_aBackgroundCodes[$sColorName]); |
|
| 139 | + } |
|
| 140 | 140 | |
| 141 | - /** |
|
| 142 | - * around the text by a color |
|
| 143 | - * |
|
| 144 | - * @access private |
|
| 145 | - * @param string $sContent content to around by the style |
|
| 146 | - * @param string $sCode the name of the code (color or decoration) |
|
| 147 | - * @return string |
|
| 148 | - */ |
|
| 149 | - private static function _applyCode(string $sContent, string $sCode) : string |
|
| 150 | - { |
|
| 151 | - return "\033[" . $sCode . "m" . $sContent . "\033[0m\n"; |
|
| 152 | - } |
|
| 141 | + /** |
|
| 142 | + * around the text by a color |
|
| 143 | + * |
|
| 144 | + * @access private |
|
| 145 | + * @param string $sContent content to around by the style |
|
| 146 | + * @param string $sCode the name of the code (color or decoration) |
|
| 147 | + * @return string |
|
| 148 | + */ |
|
| 149 | + private static function _applyCode(string $sContent, string $sCode) : string |
|
| 150 | + { |
|
| 151 | + return "\033[" . $sCode . "m" . $sContent . "\033[0m\n"; |
|
| 152 | + } |
|
| 153 | 153 | } |
@@ -129,7 +129,7 @@ |
||
| 129 | 129 | * @param mixed $mOffset |
| 130 | 130 | * @return boolean |
| 131 | 131 | */ |
| 132 | - public function offsetExists($mOffset) |
|
| 132 | + public function offsetExists($mOffset) |
|
| 133 | 133 | { |
| 134 | 134 | return $this->__isset($mOffset); |
| 135 | 135 | } |
@@ -30,162 +30,162 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | class Input extends Common |
| 32 | 32 | { |
| 33 | - /** |
|
| 34 | - * the name of element |
|
| 35 | - * |
|
| 36 | - * @access private |
|
| 37 | - * @var string |
|
| 38 | - */ |
|
| 39 | - private $_sType = null; |
|
| 40 | - |
|
| 41 | - /** |
|
| 42 | - * the label of element |
|
| 43 | - * |
|
| 44 | - * @access private |
|
| 45 | - * @var string |
|
| 46 | - */ |
|
| 47 | - private $_sLabel = null; |
|
| 48 | - |
|
| 49 | - /** |
|
| 50 | - * the value of element |
|
| 51 | - * |
|
| 52 | - * @access private |
|
| 53 | - * @var string |
|
| 54 | - */ |
|
| 55 | - private $_sValue = null; |
|
| 56 | - |
|
| 57 | - /** |
|
| 58 | - * constructor that it increment (static) for all use |
|
| 59 | - * |
|
| 60 | - * @access public |
|
| 61 | - * @param string $sName name |
|
| 62 | - * @param string $sType type of input |
|
| 63 | - * @param string $sLabel label of input |
|
| 64 | - * @param string $sValue value of input |
|
| 65 | - */ |
|
| 66 | - public function __construct(string $sName, string $sType, string $sLabel = null, string $sValue = null) |
|
| 67 | - { |
|
| 68 | - $this->setName($sName); |
|
| 69 | - $this->setType($sType); |
|
| 70 | - $this->setValue($sValue); |
|
| 71 | - |
|
| 72 | - if ($sLabel !== null) { $this->setLabel($sLabel); } else { $this->setLabel($sName); } |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - /** |
|
| 76 | - * get the type |
|
| 77 | - * |
|
| 78 | - * @access public |
|
| 79 | - * @return string |
|
| 80 | - */ |
|
| 81 | - public function getType() : string |
|
| 82 | - { |
|
| 83 | - return $this->_sType; |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - /** |
|
| 87 | - * set the type |
|
| 88 | - * |
|
| 89 | - * @access public |
|
| 90 | - * @param string $sType type of input; |
|
| 91 | - * @return \Venus\lib\Form\Input |
|
| 92 | - */ |
|
| 93 | - public function setType(string $sType) : Input |
|
| 94 | - { |
|
| 95 | - $this->_sType = $sType; |
|
| 96 | - return $this; |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - /** |
|
| 100 | - * get the Value |
|
| 101 | - * |
|
| 102 | - * @access public |
|
| 103 | - * @return string |
|
| 104 | - */ |
|
| 105 | - public function getValue() : string |
|
| 106 | - { |
|
| 107 | - return $this->_sValue; |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - /** |
|
| 111 | - * set the Value |
|
| 112 | - * |
|
| 113 | - * @access public |
|
| 114 | - * @param string $sValue Value of input; |
|
| 115 | - * @return \Venus\lib\Form\Input |
|
| 116 | - */ |
|
| 117 | - public function setValue(string $sValue) : Input |
|
| 118 | - { |
|
| 119 | - $this->_sValue = $sValue; |
|
| 120 | - return $this; |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * get the Label |
|
| 125 | - * |
|
| 126 | - * @access public |
|
| 127 | - * @return string |
|
| 128 | - */ |
|
| 129 | - public function getLabel() : string |
|
| 130 | - { |
|
| 131 | - return $this->_sLabel; |
|
| 132 | - } |
|
| 133 | - |
|
| 134 | - /** |
|
| 135 | - * set the Label |
|
| 136 | - * |
|
| 137 | - * @access public |
|
| 138 | - * @param string $sLabel Label of input; |
|
| 139 | - * @return \Venus\lib\Form\Input |
|
| 140 | - */ |
|
| 141 | - public function setLabel(string $sLabel) : Input |
|
| 142 | - { |
|
| 143 | - $this->_sLabel = $sLabel; |
|
| 144 | - return $this; |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - /** |
|
| 148 | - * if the button is clicked |
|
| 149 | - * |
|
| 150 | - * @access public |
|
| 151 | - * @param string $sType type of input; |
|
| 152 | - * @return boolean |
|
| 153 | - */ |
|
| 154 | - public function isClicked(string $sType) : bool |
|
| 155 | - { |
|
| 156 | - if ($this->getType() === 'submit' || $this->getType() === 'button') { |
|
| 157 | - |
|
| 158 | - if (isset($_POST[$this->getName()])) { return true; } |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - return false; |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - /** |
|
| 165 | - * get the <html> |
|
| 166 | - * |
|
| 167 | - * @access public |
|
| 168 | - * @return string |
|
| 169 | - */ |
|
| 170 | - public function fetch() : string |
|
| 171 | - { |
|
| 172 | - $sContent = ''; |
|
| 173 | - |
|
| 174 | - if ($this->getType() === 'text' || $this->getType() === 'password' || $this->getType() === 'file' |
|
| 175 | - || $this->getType() === 'tel' || $this->getType() === 'url' || $this->getType() === 'email' |
|
| 176 | - || $this->getType() === 'search' || $this->getType() === 'date' || $this->getType() === 'time' |
|
| 177 | - || $this->getType() === 'datetime' || $this->getType() === 'month' || $this->getType() === 'week' |
|
| 178 | - || $this->getType() === 'number' || $this->getType() === 'range' || $this->getType() === 'color') { |
|
| 179 | - |
|
| 180 | - $sContent .= '<label>'.$this->getLabel().'</label> '; |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - $sContent .= '<input type="'.$this->getType().'" name="'.$this->getName().'"'; |
|
| 184 | - |
|
| 185 | - if ($this->getValue() !== null) { $sContent .= ' value="'.$this->getValue().'"'; } |
|
| 186 | - |
|
| 187 | - $sContent .= '/>'; |
|
| 188 | - |
|
| 189 | - return $sContent; |
|
| 190 | - } |
|
| 33 | + /** |
|
| 34 | + * the name of element |
|
| 35 | + * |
|
| 36 | + * @access private |
|
| 37 | + * @var string |
|
| 38 | + */ |
|
| 39 | + private $_sType = null; |
|
| 40 | + |
|
| 41 | + /** |
|
| 42 | + * the label of element |
|
| 43 | + * |
|
| 44 | + * @access private |
|
| 45 | + * @var string |
|
| 46 | + */ |
|
| 47 | + private $_sLabel = null; |
|
| 48 | + |
|
| 49 | + /** |
|
| 50 | + * the value of element |
|
| 51 | + * |
|
| 52 | + * @access private |
|
| 53 | + * @var string |
|
| 54 | + */ |
|
| 55 | + private $_sValue = null; |
|
| 56 | + |
|
| 57 | + /** |
|
| 58 | + * constructor that it increment (static) for all use |
|
| 59 | + * |
|
| 60 | + * @access public |
|
| 61 | + * @param string $sName name |
|
| 62 | + * @param string $sType type of input |
|
| 63 | + * @param string $sLabel label of input |
|
| 64 | + * @param string $sValue value of input |
|
| 65 | + */ |
|
| 66 | + public function __construct(string $sName, string $sType, string $sLabel = null, string $sValue = null) |
|
| 67 | + { |
|
| 68 | + $this->setName($sName); |
|
| 69 | + $this->setType($sType); |
|
| 70 | + $this->setValue($sValue); |
|
| 71 | + |
|
| 72 | + if ($sLabel !== null) { $this->setLabel($sLabel); } else { $this->setLabel($sName); } |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + /** |
|
| 76 | + * get the type |
|
| 77 | + * |
|
| 78 | + * @access public |
|
| 79 | + * @return string |
|
| 80 | + */ |
|
| 81 | + public function getType() : string |
|
| 82 | + { |
|
| 83 | + return $this->_sType; |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + /** |
|
| 87 | + * set the type |
|
| 88 | + * |
|
| 89 | + * @access public |
|
| 90 | + * @param string $sType type of input; |
|
| 91 | + * @return \Venus\lib\Form\Input |
|
| 92 | + */ |
|
| 93 | + public function setType(string $sType) : Input |
|
| 94 | + { |
|
| 95 | + $this->_sType = $sType; |
|
| 96 | + return $this; |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + /** |
|
| 100 | + * get the Value |
|
| 101 | + * |
|
| 102 | + * @access public |
|
| 103 | + * @return string |
|
| 104 | + */ |
|
| 105 | + public function getValue() : string |
|
| 106 | + { |
|
| 107 | + return $this->_sValue; |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + /** |
|
| 111 | + * set the Value |
|
| 112 | + * |
|
| 113 | + * @access public |
|
| 114 | + * @param string $sValue Value of input; |
|
| 115 | + * @return \Venus\lib\Form\Input |
|
| 116 | + */ |
|
| 117 | + public function setValue(string $sValue) : Input |
|
| 118 | + { |
|
| 119 | + $this->_sValue = $sValue; |
|
| 120 | + return $this; |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * get the Label |
|
| 125 | + * |
|
| 126 | + * @access public |
|
| 127 | + * @return string |
|
| 128 | + */ |
|
| 129 | + public function getLabel() : string |
|
| 130 | + { |
|
| 131 | + return $this->_sLabel; |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + /** |
|
| 135 | + * set the Label |
|
| 136 | + * |
|
| 137 | + * @access public |
|
| 138 | + * @param string $sLabel Label of input; |
|
| 139 | + * @return \Venus\lib\Form\Input |
|
| 140 | + */ |
|
| 141 | + public function setLabel(string $sLabel) : Input |
|
| 142 | + { |
|
| 143 | + $this->_sLabel = $sLabel; |
|
| 144 | + return $this; |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + /** |
|
| 148 | + * if the button is clicked |
|
| 149 | + * |
|
| 150 | + * @access public |
|
| 151 | + * @param string $sType type of input; |
|
| 152 | + * @return boolean |
|
| 153 | + */ |
|
| 154 | + public function isClicked(string $sType) : bool |
|
| 155 | + { |
|
| 156 | + if ($this->getType() === 'submit' || $this->getType() === 'button') { |
|
| 157 | + |
|
| 158 | + if (isset($_POST[$this->getName()])) { return true; } |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + return false; |
|
| 162 | + } |
|
| 163 | + |
|
| 164 | + /** |
|
| 165 | + * get the <html> |
|
| 166 | + * |
|
| 167 | + * @access public |
|
| 168 | + * @return string |
|
| 169 | + */ |
|
| 170 | + public function fetch() : string |
|
| 171 | + { |
|
| 172 | + $sContent = ''; |
|
| 173 | + |
|
| 174 | + if ($this->getType() === 'text' || $this->getType() === 'password' || $this->getType() === 'file' |
|
| 175 | + || $this->getType() === 'tel' || $this->getType() === 'url' || $this->getType() === 'email' |
|
| 176 | + || $this->getType() === 'search' || $this->getType() === 'date' || $this->getType() === 'time' |
|
| 177 | + || $this->getType() === 'datetime' || $this->getType() === 'month' || $this->getType() === 'week' |
|
| 178 | + || $this->getType() === 'number' || $this->getType() === 'range' || $this->getType() === 'color') { |
|
| 179 | + |
|
| 180 | + $sContent .= '<label>'.$this->getLabel().'</label> '; |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + $sContent .= '<input type="'.$this->getType().'" name="'.$this->getName().'"'; |
|
| 184 | + |
|
| 185 | + if ($this->getValue() !== null) { $sContent .= ' value="'.$this->getValue().'"'; } |
|
| 186 | + |
|
| 187 | + $sContent .= '/>'; |
|
| 188 | + |
|
| 189 | + return $sContent; |
|
| 190 | + } |
|
| 191 | 191 | } |