@@ -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 | /** |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | * @param float $hue The hue (to be converted to an RGB value) For red, add 1/3 to the hue, green |
| 132 | 132 | * leave it alone, and blue you subtract 1/3 from the hue. |
| 133 | 133 | * |
| 134 | - * @return mixed |
|
| 134 | + * @return double |
|
| 135 | 135 | */ |
| 136 | 136 | private static function hueToRgb($p, $q, $hue) |
| 137 | 137 | { |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | /** |
| 474 | - * @return array |
|
| 474 | + * @return integer[] |
|
| 475 | 475 | */ |
| 476 | 476 | public function jsonSerialize() |
| 477 | 477 | { |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | public static function isValidRgb($red, $green, $blue) |
| 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) |
| 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 | } |