@@ -58,7 +58,7 @@ |
||
| 58 | 58 | * Simply triggers a E_USER_WARNING error with $message |
| 59 | 59 | * |
| 60 | 60 | * @param string $message The message describing the error |
| 61 | - * @return void |
|
| 61 | + * @return boolean |
|
| 62 | 62 | */ |
| 63 | 63 | protected static function trigger(string $message) { |
| 64 | 64 | return trigger_error($message, E_USER_WARNING); |
@@ -88,9 +88,9 @@ discard block |
||
| 88 | 88 | /** |
| 89 | 89 | * Convert a RGB array to a HSL array |
| 90 | 90 | * |
| 91 | - * @param float $r The red value (0 - 255) |
|
| 92 | - * @param float $g The green value (0 - 255) |
|
| 93 | - * @param float $b The blue value (0 - 255) |
|
| 91 | + * @param integer $r The red value (0 - 255) |
|
| 92 | + * @param integer $g The green value (0 - 255) |
|
| 93 | + * @param integer $b The blue value (0 - 255) |
|
| 94 | 94 | * @return array The resulting HSL array |
| 95 | 95 | */ |
| 96 | 96 | public static function rgb_to_hsl(int $r = 0, int $g = 0, int $b = 0, $accuracy = 2) :array { |
@@ -274,7 +274,6 @@ discard block |
||
| 274 | 274 | * |
| 275 | 275 | * @param float $h The hue value (0 - 360) |
| 276 | 276 | * @param float $s The saturation value (0 - 100) |
| 277 | - * @param float $b The brightness value (0 - 100) |
|
| 278 | 277 | * @return array The resulting RGB array |
| 279 | 278 | */ |
| 280 | 279 | public static function hsb_to_rgb(float $h = 0.0, float $s = 0.0, float $v = 0.0, int $accuracy = 3) :array { |
@@ -72,12 +72,12 @@ |
||
| 72 | 72 | /** |
| 73 | 73 | * Generate a random HSL color |
| 74 | 74 | * |
| 75 | - * @param int $min_r The min hue to allow |
|
| 76 | - * @param int $max_r The max hue to allow |
|
| 77 | - * @param int $min_g The min saturation to allow |
|
| 78 | - * @param int $max_g The max saturation to allow |
|
| 79 | - * @param int $min_b The min light to allow |
|
| 80 | - * @param int $max_b The max light to allow |
|
| 75 | + * @param int $min_h The min hue to allow |
|
| 76 | + * @param int $max_h The max hue to allow |
|
| 77 | + * @param int $min_h The min saturation to allow |
|
| 78 | + * @param int $max_h The max saturation to allow |
|
| 79 | + * @param int $min_h The min light to allow |
|
| 80 | + * @param int $max_h The max light to allow |
|
| 81 | 81 | * @return array The resulting color as a HSL array |
| 82 | 82 | */ |
| 83 | 83 | public static function hsl_rand(int $min_h = 0, int $max_h = 359, int $min_s = 0, int $max_s = 100, int $min_l = 0, int $max_l = 100) :array { |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @param string $offset The offset to set |
| 80 | 80 | * @param mixed $value The value to set it to |
| 81 | - * @return mixed The result |
|
| 81 | + * @return double|null The result |
|
| 82 | 82 | */ |
| 83 | 83 | public function offsetSet($offset, $value) { |
| 84 | 84 | if ($this->offsetExists($offset)) { |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * Reset an offset to 0 |
| 96 | 96 | * |
| 97 | 97 | * @param string $offset The offset to unset |
| 98 | - * @return mixed The result |
|
| 98 | + * @return double|null The result |
|
| 99 | 99 | */ |
| 100 | 100 | public function offsetUnset($offset) { |
| 101 | 101 | if ($this->offsetExists($offset)) { |
@@ -51,6 +51,9 @@ |
||
| 51 | 51 | return $this->color->jsonSerialize(); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | + /** |
|
| 55 | + * @param scheme $scheme_class |
|
| 56 | + */ |
|
| 54 | 57 | protected function get_scheme(string $scheme_name, string $return_type = 'hex', $scheme_class) :array { |
| 55 | 58 | if (!is_null($cached = $this->cache->get(get_class($scheme_class).'_'.$scheme_name.'_'.$return_type, $this->hex()))) { |
| 56 | 59 | return $cached; |
@@ -181,7 +181,7 @@ |
||
| 181 | 181 | * '000000' |
| 182 | 182 | * |
| 183 | 183 | * @param string &$hex_str The hex string to modify |
| 184 | - * @return void |
|
| 184 | + * @return boolean |
|
| 185 | 185 | */ |
| 186 | 186 | public static function _validate_hex_str(string &$hex_str, bool $check_only = FALSE) :bool { |
| 187 | 187 | if (preg_match('/\A#?(?:[0-9a-f]{3}|[0-9a-f]{6})\Z/i', $hex_str)) { |
@@ -17,10 +17,16 @@ discard block |
||
| 17 | 17 | // protected static $valid_keys = array(); |
| 18 | 18 | // protected static $default_value; |
| 19 | 19 | |
| 20 | + /** |
|
| 21 | + * @param string $message |
|
| 22 | + */ |
|
| 20 | 23 | protected static function error($message) { |
| 21 | 24 | return \projectcleverweb\color\error::call($message); |
| 22 | 25 | } |
| 23 | 26 | |
| 27 | + /** |
|
| 28 | + * @return double |
|
| 29 | + */ |
|
| 24 | 30 | protected static function _validate_array_input($input) { |
| 25 | 31 | if (!is_array($input)) { |
| 26 | 32 | static::error(sprintf( |
@@ -46,6 +52,9 @@ discard block |
||
| 46 | 52 | return $array; |
| 47 | 53 | } |
| 48 | 54 | |
| 55 | + /** |
|
| 56 | + * @return string |
|
| 57 | + */ |
|
| 49 | 58 | public static function _validate_hex_input($input) { |
| 50 | 59 | if (is_int($input)) { |
| 51 | 60 | return str_pad(dechex($input % 16777216), 6, '0', STR_PAD_LEFT); |