@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | * @param float $hue The hue (to be converted to an RGB value) For red, add 1/3 to the hue, green |
| 128 | 128 | * leave it alone, and blue you subtract 1/3 from the hue. |
| 129 | 129 | * |
| 130 | - * @return mixed |
|
| 130 | + * @return double |
|
| 131 | 131 | */ |
| 132 | 132 | private static function hueToRgb($p, $q, $hue): float |
| 133 | 133 | { |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | /** |
| 404 | - * @param $percentage |
|
| 404 | + * @param integer $percentage |
|
| 405 | 405 | * |
| 406 | 406 | * @return Color |
| 407 | 407 | */ |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | /** |
| 419 | - * @param $percentage |
|
| 419 | + * @param integer $percentage |
|
| 420 | 420 | * |
| 421 | 421 | * @return Color |
| 422 | 422 | */ |
@@ -108,9 +108,9 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | return [ |
| 111 | - 'r' => (int)hexdec(substr($color, 0, 2)), |
|
| 112 | - 'g' => (int)hexdec(substr($color, 2, 2)), |
|
| 113 | - 'b' => (int)hexdec(substr($color, 4, 2)), |
|
| 111 | + 'r' => (int) hexdec(substr($color, 0, 2)), |
|
| 112 | + 'g' => (int) hexdec(substr($color, 2, 2)), |
|
| 113 | + 'b' => (int) hexdec(substr($color, 4, 2)), |
|
| 114 | 114 | ]; |
| 115 | 115 | } |
| 116 | 116 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | // If saturation is 0, the given color is grey and only |
| 171 | 171 | // lightness is relevant. |
| 172 | 172 | if ($saturation == 0) { |
| 173 | - $lightness = (int)ceil($lightness * 255); |
|
| 173 | + $lightness = (int) ceil($lightness * 255); |
|
| 174 | 174 | |
| 175 | 175 | return ['r' => $lightness, 'g' => $lightness, 'b' => $lightness]; |
| 176 | 176 | } |
@@ -190,9 +190,9 @@ discard block |
||
| 190 | 190 | $blue = self::hueToRgb($p, $q, $hue - 1 / 3); |
| 191 | 191 | |
| 192 | 192 | return [ |
| 193 | - 'r' => (int)round($red * 255, 2), |
|
| 194 | - 'g' => (int)round(round($green, 2) * 255), |
|
| 195 | - 'b' => (int)round($blue * 255, 2), |
|
| 193 | + 'r' => (int) round($red * 255, 2), |
|
| 194 | + 'g' => (int) round(round($green, 2) * 255), |
|
| 195 | + 'b' => (int) round($blue * 255, 2), |
|
| 196 | 196 | ]; |
| 197 | 197 | } |
| 198 | 198 | |
@@ -258,9 +258,9 @@ discard block |
||
| 258 | 258 | { |
| 259 | 259 | $color2 = $color->getRgb(); |
| 260 | 260 | |
| 261 | - return (int)abs($this->colors['r'] - $color2['r']) |
|
| 262 | - + (int)abs($this->colors['g'] - $color2['g']) |
|
| 263 | - + (int)abs($this->colors['b'] - $color2['b']); |
|
| 261 | + return (int) abs($this->colors['r'] - $color2['r']) |
|
| 262 | + + (int) abs($this->colors['g'] - $color2['g']) |
|
| 263 | + + (int) abs($this->colors['b'] - $color2['b']); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | /** |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | public static function isValidRgb(int $red, int $green, int $blue) : bool |
| 28 | 28 | { |
| 29 | 29 | // Check to see the values are between 0 and 255 and return false if any are outside the bounds |
| 30 | - return array_reduce([$red, $green, $blue], function ($carry, $color) { |
|
| 30 | + return array_reduce([$red, $green, $blue], function($carry, $color) { |
|
| 31 | 31 | return max(min(intval($color), 255), 0) === $color && $carry === true; |
| 32 | 32 | }, true); |
| 33 | 33 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | public static function isValidHsl($hue, $saturation, $lightness) : bool |
| 44 | 44 | { |
| 45 | 45 | // Check to see the values are between 0 and 1 and return false if any are outside the bounds |
| 46 | - return array_reduce([$hue, $saturation, $lightness], function ($carry, $color) { |
|
| 46 | + return array_reduce([$hue, $saturation, $lightness], function($carry, $color) { |
|
| 47 | 47 | return $color >= 0 && $color <= 1 && $carry === true; |
| 48 | 48 | }, true); |
| 49 | 49 | } |