Passed
Push — master ( a18c2c...41ea3f )
by Sebastian
02:50
created
src/StyleCollection/StyleBuilder.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
      */
22 22
     private $collection;
23 23
 
24
-    private function __construct(?StyleCollection $collection=null)
24
+    private function __construct(?StyleCollection $collection = null)
25 25
     {
26
-        if($collection === null)
26
+        if ($collection === null)
27 27
         {
28 28
             $collection = StyleCollection::create();
29 29
         }
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         $this->collection = $collection;
32 32
     }
33 33
 
34
-    public static function create(?StyleCollection $collection=null) : StyleBuilder
34
+    public static function create(?StyleCollection $collection = null) : StyleBuilder
35 35
     {
36 36
         return new StyleBuilder($collection);
37 37
     }
Please login to merge, or discard this patch.
src/RGBAColor/FormatsConverter.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
     public static function color2HEX(RGBAColor $color) : string
41 41
     {
42 42
         $hex =
43
-            UnitsConverter::int2hex($color->getRed()->get8Bit()) .
44
-            UnitsConverter::int2hex($color->getGreen()->get8Bit()) .
43
+            UnitsConverter::int2hex($color->getRed()->get8Bit()).
44
+            UnitsConverter::int2hex($color->getGreen()->get8Bit()).
45 45
             UnitsConverter::int2hex($color->getBlue()->get8Bit());
46 46
 
47
-        if($color->hasTransparency())
47
+        if ($color->hasTransparency())
48 48
         {
49 49
             $hex .= UnitsConverter::int2hex($color->getOpacity()->get8Bit());
50 50
         }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public static function color2CSS(RGBAColor $color) : string
62 62
     {
63
-        if($color->hasTransparency())
63
+        if ($color->hasTransparency())
64 64
         {
65 65
             return sprintf(
66 66
                 'rgba(%s, %s, %s, %s)',
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
      */
96 96
     public static function requireValidColorArray(array $color) : void
97 97
     {
98
-        if(self::isColorArray($color))
98
+        if (self::isColorArray($color))
99 99
         {
100 100
             return;
101 101
         }
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
             RGBAColor::CHANNEL_BLUE
128 128
         );
129 129
 
130
-        foreach($keys as $key)
130
+        foreach ($keys as $key)
131 131
         {
132
-            if(!isset($color[$key]))
132
+            if (!isset($color[$key]))
133 133
             {
134 134
                 return false;
135 135
             }
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      */
149 149
     public static function color2readable(RGBAColor $color) : string
150 150
     {
151
-        if($color->hasTransparency())
151
+        if ($color->hasTransparency())
152 152
         {
153 153
             return sprintf(
154 154
                 'RGBA(%s %s %s %s)',
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
      * @throws ColorException
192 192
      * @see RGBAColor::ERROR_INVALID_HEX_LENGTH
193 193
      */
194
-    public static function hex2color(string $hex, string $name='') : RGBAColor
194
+    public static function hex2color(string $hex, string $name = '') : RGBAColor
195 195
     {
196
-        if(!isset(self::$hexParser))
196
+        if (!isset(self::$hexParser))
197 197
         {
198 198
             self::$hexParser = new HEXParser();
199 199
         }
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     {
246 246
         // If one associative key is present, we assume
247 247
         // that the color array is already correct.
248
-        if(isset($color[RGBAColor::CHANNEL_RED]))
248
+        if (isset($color[RGBAColor::CHANNEL_RED]))
249 249
         {
250 250
             return $color;
251 251
         }
@@ -253,15 +253,15 @@  discard block
 block discarded – undo
253 253
         $values = array_values($color);
254 254
         $result = array();
255 255
 
256
-        foreach(self::$keys as $idx => $def)
256
+        foreach (self::$keys as $idx => $def)
257 257
         {
258
-            if(isset($values[$idx]))
258
+            if (isset($values[$idx]))
259 259
             {
260 260
                 $result[$def['key']] = $values[$idx];
261 261
                 continue;
262 262
             }
263 263
 
264
-            if(!$def['mandatory'])
264
+            if (!$def['mandatory'])
265 265
             {
266 266
                 continue;
267 267
             }
Please login to merge, or discard this patch.
src/RGBAColor/UnitsConverter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
 
99 99
     public static function percent2Float(float $percent) : float
100 100
     {
101
-        return round($percent/100, self::$floatPrecision);
101
+        return round($percent / 100, self::$floatPrecision);
102 102
     }
103 103
 
104 104
     public static function float2percent(float $value) : float
Please login to merge, or discard this patch.
src/RGBAColor/ColorComparator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,9 +41,9 @@
 block discarded – undo
41 41
     {
42 42
         $parts = array(RGBAColor::CHANNEL_RED, RGBAColor::CHANNEL_GREEN, RGBAColor::CHANNEL_BLUE);
43 43
 
44
-        foreach($parts as $part)
44
+        foreach ($parts as $part)
45 45
         {
46
-            if($sourceColor->getColor($part)->get8Bit() !== $targetColor->getColor($part)->get8Bit())
46
+            if ($sourceColor->getColor($part)->get8Bit() !== $targetColor->getColor($part)->get8Bit())
47 47
             {
48 48
                 return false;
49 49
             }
Please login to merge, or discard this patch.
src/RGBAColor/FormatsConverter/HEXParser.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,18 +21,18 @@
 block discarded – undo
21 21
      * @throws ColorException
22 22
      * @see RGBAColor::ERROR_INVALID_HEX_LENGTH
23 23
      */
24
-    public function parse(string $hex, string $name='') : RGBAColor
24
+    public function parse(string $hex, string $name = '') : RGBAColor
25 25
     {
26 26
         $hex = ltrim($hex, '#'); // Remove the hash if present
27 27
         $hex = strtoupper($hex);
28 28
         $length = strlen($hex);
29 29
 
30
-        if($length === 3)
30
+        if ($length === 3)
31 31
         {
32 32
             return $this->parseHEX3($hex, $name);
33 33
         }
34 34
 
35
-        if($length === 6)
35
+        if ($length === 6)
36 36
         {
37 37
             return $this->parseHEX6($hex, $name);
38 38
         }
Please login to merge, or discard this patch.
examples/htdocs/prepend.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@
 block discarded – undo
9 9
 
10 10
 declare(strict_types=1);
11 11
 
12
-$autoload = __DIR__ . '/../vendor/autoload.php';
12
+$autoload = __DIR__.'/../vendor/autoload.php';
13 13
 
14
-if(!file_exists($autoload))
14
+if (!file_exists($autoload))
15 15
 {
16 16
     die('<b>ERROR:</b> Autoloader not present. Please run composer install first.');
17 17
 }
Please login to merge, or discard this patch.
examples/htdocs/URLInfo/highlighting.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
 		<br>
43 43
         <?php
44 44
         
45
-            foreach($urls as $url)
45
+            foreach ($urls as $url)
46 46
             {
47 47
                 $info = parseURL($url);
48 48
                 
Please login to merge, or discard this patch.
src/RGBAColor/ColorFactory.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      */
39 39
     public static function getPresetsManager() : PresetsManager
40 40
     {
41
-        if(!isset(self::$presets))
41
+        if (!isset(self::$presets))
42 42
         {
43 43
             self::$presets = new PresetsManager();
44 44
         }
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
      * @param string $name
55 55
      * @return RGBAColor
56 56
      */
57
-    public static function create(ColorChannel $red, ColorChannel $green, ColorChannel $blue, ?ColorChannel $opacity=null, string $name='') : RGBAColor
57
+    public static function create(ColorChannel $red, ColorChannel $green, ColorChannel $blue, ?ColorChannel $opacity = null, string $name = '') : RGBAColor
58 58
     {
59
-        if($opacity === null)
59
+        if ($opacity === null)
60 60
         {
61 61
             $opacity = ColorChannel::eightBit(255);
62 62
         }
@@ -83,31 +83,31 @@  discard block
 block discarded – undo
83 83
      */
84 84
     public static function createAuto($subject) : ?RGBAColor
85 85
     {
86
-        if($subject instanceof RGBAColor)
86
+        if ($subject instanceof RGBAColor)
87 87
         {
88 88
             return $subject;
89 89
         }
90 90
 
91
-        if(is_array($subject))
91
+        if (is_array($subject))
92 92
         {
93 93
             return self::createFrom8BitArray($subject);
94 94
         }
95 95
 
96 96
         $hexOrPreset = (string)$subject;
97 97
 
98
-        if($hexOrPreset === '')
98
+        if ($hexOrPreset === '')
99 99
         {
100 100
             return null;
101 101
         }
102 102
 
103 103
         $manager = self::getPresetsManager();
104 104
 
105
-        if($manager->hasPreset($hexOrPreset))
105
+        if ($manager->hasPreset($hexOrPreset))
106 106
         {
107 107
             return $manager->getPreset($hexOrPreset);
108 108
         }
109 109
 
110
-        if(preg_match('/[a-f0-9]{3,8}/i', $hexOrPreset))
110
+        if (preg_match('/[a-f0-9]{3,8}/i', $hexOrPreset))
111 111
         {
112 112
             return self::createFromHEX($hexOrPreset);
113 113
         }
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     {
156 156
         $color = FormatsConverter::array2associative($color);
157 157
 
158
-        if(!isset($color[RGBAColor::CHANNEL_ALPHA]))
158
+        if (!isset($color[RGBAColor::CHANNEL_ALPHA]))
159 159
         {
160 160
             $color[RGBAColor::CHANNEL_ALPHA] = 255;
161 161
         }
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
      * @see RGBAColor::ERROR_INVALID_COLOR_COMPONENT
181 181
      * @see RGBAColor::ERROR_INVALID_PERCENTAGE_VALUE
182 182
      */
183
-    public static function createFromHEX(string $hex, string $name='') : RGBAColor
183
+    public static function createFromHEX(string $hex, string $name = '') : RGBAColor
184 184
     {
185 185
         return FormatsConverter::hex2color($hex, $name);
186 186
     }
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      * @param string $name
206 206
      * @return RGBAColor
207 207
      */
208
-    public static function createPercent(float $red, float $green, float $blue, float $opacity=100, string $name='') : RGBAColor
208
+    public static function createPercent(float $red, float $green, float $blue, float $opacity = 100, string $name = '') : RGBAColor
209 209
     {
210 210
         return new RGBAColor(
211 211
             ColorChannel::percent($red),
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
      * @param string $name
228 228
      * @return RGBAColor
229 229
      */
230
-    public static function createCSS(int $red, int $green, int $blue, float $opacity=1, string $name='') : RGBAColor
230
+    public static function createCSS(int $red, int $green, int $blue, float $opacity = 1, string $name = '') : RGBAColor
231 231
     {
232 232
         return self::create(
233 233
             ColorChannel::eightBit($red),
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
      * @param string $name
249 249
      * @return RGBAColor
250 250
      */
251
-    public static function create8Bit(int $red, int $green, int $blue, int $opacity=255, string $name='') : RGBAColor
251
+    public static function create8Bit(int $red, int $green, int $blue, int $opacity = 255, string $name = '') : RGBAColor
252 252
     {
253 253
         return self::create(
254 254
             ColorChannel::eightBit($red),
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
      * @param string $name
272 272
      * @return RGBAColor
273 273
      */
274
-    public static function createGD(int $red, int $green, int $blue, int $opacity=127, string $name='') : RGBAColor
274
+    public static function createGD(int $red, int $green, int $blue, int $opacity = 127, string $name = '') : RGBAColor
275 275
     {
276 276
         return self::create(
277 277
             ColorChannel::eightBit($red),
Please login to merge, or discard this patch.
src/RGBAColor/ColorChannel/EightBitChannel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,6 +41,6 @@
 block discarded – undo
41 41
 
42 42
     public function invert() : EightBitChannel
43 43
     {
44
-        return ColorChannel::eightBit(255-$this->value);
44
+        return ColorChannel::eightBit(255 - $this->value);
45 45
     }
46 46
 }
Please login to merge, or discard this patch.