| @@ 13-22 (lines=10) @@ | ||
| 10 | * @param mized $color The color in question |
|
| 11 | * @return string The color type as a string, returns 'error' if $color is invalid |
|
| 12 | */ |
|
| 13 | public static function get($color) :string { |
|
| 14 | if (is_array($color)) { |
|
| 15 | return static::_array($color); |
|
| 16 | } elseif (is_string($color)) { |
|
| 17 | return static::_string($color); |
|
| 18 | } elseif (is_int($color)) { |
|
| 19 | return 'int'; |
|
| 20 | } |
|
| 21 | return 'error'; |
|
| 22 | } |
|
| 23 | ||
| 24 | public static function _string(string $color) { |
|
| 25 | $color = strtolower(str_replace(array(' ', "\t", "\n", "\r", "\0", "\x0B"), '', $color)); |
|
| @@ 110-120 (lines=11) @@ | ||
| 107 | * @param mized $color The color in question |
|
| 108 | * @return string The color type as a string, returns 'error' if $color is invalid |
|
| 109 | */ |
|
| 110 | public static function get_type($color) :string { |
|
| 111 | if (is_array($color)) { |
|
| 112 | return static::_get_array_type($color); |
|
| 113 | } elseif (is_string($color)) { |
|
| 114 | // return static::_get_str_type($color); |
|
| 115 | return 'str'; |
|
| 116 | } elseif (is_int($color)) { |
|
| 117 | return 'int'; |
|
| 118 | } |
|
| 119 | return 'error'; |
|
| 120 | } |
|
| 121 | ||
| 122 | protected function _get_str_type(string $color) { |
|
| 123 | $color = strtolower(str_replace(array(' ', "\t", "\n", "\r", "\0", "\x0B"), '', $color)); |
|