1 | <?php |
||
15 | trait converter { |
||
16 | |||
17 | protected static function error($message) { |
||
20 | |||
21 | protected static function _validate_array_input($input) { |
||
45 | |||
46 | public static function _validate_hex_input($input) { |
||
58 | |||
59 | protected static function _validate_hex_input_str(string $input) :string { |
||
70 | |||
71 | protected static function _expand_hex_str(string $input) : string { |
||
77 | |||
78 | /** |
||
79 | * Color delta algorithm |
||
80 | * |
||
81 | * @param float $rgb The R, G, or B value |
||
82 | * @param float $max The max RGB value |
||
83 | * @param float $delta The delta value ($max - $min) |
||
84 | * @return float The color delta |
||
85 | */ |
||
86 | protected static function _rgbhsl_delta_rgb(float $rgb, float $max, float $delta) { |
||
89 | |||
90 | /** |
||
91 | * Calculate the hue as a percentage from RGB |
||
92 | * |
||
93 | * @param float &$h The variable to modify as hue |
||
94 | * @param float $r The red value as a percentage |
||
95 | * @param float $g The green value as a percentage |
||
96 | * @param float $b The blue value as a percentage |
||
97 | * @param float $max The max RGB value |
||
98 | * @param float $delta The delta value ($max - $min) |
||
99 | * @return void |
||
100 | */ |
||
101 | protected static function _rgbhsl_hue(float &$h, float $r, float $g, float $b, float $max, float $delta) { |
||
116 | |||
117 | /** |
||
118 | * Handle low hue values |
||
119 | * |
||
120 | * @param float &$r The red value to modify |
||
121 | * @param float &$g The green value to modify |
||
122 | * @param float &$b The blue value to modify |
||
123 | * @param float $c Potential R, G, or B value |
||
124 | * @param float $x Potential R, G, or B value |
||
125 | * @param float $h The hue |
||
126 | * @return void |
||
127 | */ |
||
128 | protected static function _hslrgb_low(float &$r, float &$g, float &$b, float $c, float $x, float $h) { |
||
143 | |||
144 | /** |
||
145 | * Handle high hue values |
||
146 | * |
||
147 | * @param float &$r The red value to modify |
||
148 | * @param float &$g The green value to modify |
||
149 | * @param float &$b The blue value to modify |
||
150 | * @param float $c Potential R, G, or B value |
||
151 | * @param float $x Potential R, G, or B value |
||
152 | * @param float $h The hue |
||
153 | * @return void |
||
154 | */ |
||
155 | protected static function _hslrgb_high(float &$r, float &$g, float &$b, float $c, float $x, float $h) { |
||
166 | } |
||
167 |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@return
annotation as described here.