Completed
Push — master ( 947034...d4f455 )
by Mike
03:10
created
src/Validator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Color.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
471 471
     }
472 472
 
473 473
     /**
474
-     * @return array
474
+     * @return integer[]
475 475
      */
476 476
     public function jsonSerialize()
477 477
     {
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      *
61 61
      * @return Color
62 62
      */
63
-    public static function fromRgb( $red,  $green,  $blue)
63
+    public static function fromRgb($red, $green, $blue)
64 64
     {
65 65
         if (!Validator::isValidRgb($red, $green, $blue)) {
66 66
             throw new InvalidColorException('Invalid RGB values');
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
         }
113 113
 
114 114
         return [
115
-            'r' => (int)hexdec(substr($color, 0, 2)),
116
-            'g' => (int)hexdec(substr($color, 2, 2)),
117
-            'b' => (int)hexdec(substr($color, 4, 2)),
115
+            'r' => (int) hexdec(substr($color, 0, 2)),
116
+            'g' => (int) hexdec(substr($color, 2, 2)),
117
+            'b' => (int) hexdec(substr($color, 4, 2)),
118 118
         ];
119 119
     }
120 120
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
         // If saturation is 0, the given color is grey and only
175 175
         // lightness is relevant.
176 176
         if ($saturation == 0) {
177
-            $lightness = (int)ceil($lightness * 255);
177
+            $lightness = (int) ceil($lightness * 255);
178 178
 
179 179
             return ['r' => $lightness, 'g' => $lightness, 'b' => $lightness];
180 180
         }
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
         $blue  = self::hueToRgb($p, $q, $hue - 1 / 3);
195 195
 
196 196
         return [
197
-            'r' => (int)round($red * 255, 2),
198
-            'g' => (int)round(round($green, 2) * 255),
199
-            'b' => (int)round($blue * 255, 2),
197
+            'r' => (int) round($red * 255, 2),
198
+            'g' => (int) round(round($green, 2) * 255),
199
+            'b' => (int) round($blue * 255, 2),
200 200
         ];
201 201
     }
202 202
 
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
     {
263 263
         $color2 = $color->getRgb();
264 264
 
265
-        return (int)abs($this->colors['r'] - $color2['r'])
266
-            + (int)abs($this->colors['g'] - $color2['g'])
267
-            + (int)abs($this->colors['b'] - $color2['b']);
265
+        return (int) abs($this->colors['r'] - $color2['r'])
266
+            + (int) abs($this->colors['g'] - $color2['g'])
267
+            + (int) abs($this->colors['b'] - $color2['b']);
268 268
     }
269 269
 
270 270
     /**
Please login to merge, or discard this patch.