Passed
Push — master ( 5153e5...af085a )
by Sebastian
05:42 queued 30s
created
src/RGBAColor.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      * @see RGBAColor::ERROR_INVALID_COLOR_COMPONENT
72 72
      * @see RGBAColor::ERROR_INVALID_PERCENTAGE_VALUE
73 73
      */
74
-    public function __construct(float $red, float $green, float $blue, float $alpha=100)
74
+    public function __construct(float $red, float $green, float $blue, float $alpha = 100)
75 75
     {
76 76
         $this->setColorPercentage(self::COMPONENT_RED, $red);
77 77
         $this->setColorPercentage(self:: COMPONENT_GREEN, $green);
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      */
163 163
     public function setTransparency(float $transparency) : RGBAColor
164 164
     {
165
-        return $this->setColorPercentage(self::COMPONENT_ALPHA, 100-$transparency);
165
+        return $this->setColorPercentage(self::COMPONENT_ALPHA, 100 - $transparency);
166 166
     }
167 167
 
168 168
     /**
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
     {
283 283
         $this->requireValidComponent($name);
284 284
 
285
-        if($percentage >= 0 && $percentage <= 100)
285
+        if ($percentage >= 0 && $percentage <= 100)
286 286
         {
287 287
             $this->color[$name] = $percentage;
288 288
             return $this;
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
     {
313 313
         $this->requireValidComponent($name);
314 314
 
315
-        if($value >= 0 && $value <= 255)
315
+        if ($value >= 0 && $value <= 255)
316 316
         {
317 317
             // Convert the value to a percentage for the internal storage.
318 318
             $percentage = $value * 100 / 255;
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
      */
338 338
     private function requireValidComponent(string $name) : void
339 339
     {
340
-        if(in_array($name, self::COLOR_COMPONENTS))
340
+        if (in_array($name, self::COLOR_COMPONENTS))
341 341
         {
342 342
             return;
343 343
         }
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
     {
400 400
         $key = strval($offset);
401 401
 
402
-        if(isset($this->color[$key]))
402
+        if (isset($this->color[$key]))
403 403
         {
404 404
             return $this->color[$key];
405 405
         }
Please login to merge, or discard this patch.
src/ConvertHelper/ThrowableInfo.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      */
69 69
     protected function __construct($subject)
70 70
     {
71
-        if(is_array($subject))
71
+        if (is_array($subject))
72 72
         {
73 73
             $this->parseSerialized($subject);
74 74
         }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     */
127 127
     public function getPrevious() : ConvertHelper_ThrowableInfo
128 128
     {
129
-        if(isset($this->previous)) {
129
+        if (isset($this->previous)) {
130 130
             return $this->previous;
131 131
         }
132 132
         
@@ -151,18 +151,18 @@  discard block
 block discarded – undo
151 151
         
152 152
         $string = 'Exception';
153 153
         
154
-        if($this->hasCode()) {
154
+        if ($this->hasCode()) {
155 155
             $string .= ' #'.$this->code;
156 156
         }
157 157
         
158 158
         $string .= ': '.$this->getMessage().PHP_EOL;
159 159
         
160
-        foreach($calls as $call) 
160
+        foreach ($calls as $call) 
161 161
         {
162 162
             $string .= $call->toString().PHP_EOL;
163 163
         }
164 164
         
165
-        if($this->hasPrevious())
165
+        if ($this->hasPrevious())
166 166
         {
167 167
             $string .= PHP_EOL.PHP_EOL.
168 168
             'Previous error:'.PHP_EOL.PHP_EOL.
@@ -253,11 +253,11 @@  discard block
 block discarded – undo
253 253
             'previous' => null,
254 254
         );
255 255
         
256
-        if($this->hasPrevious()) {
257
-            $result['previous'] =  $this->previous->serialize();
256
+        if ($this->hasPrevious()) {
257
+            $result['previous'] = $this->previous->serialize();
258 258
         }
259 259
         
260
-        foreach($this->calls as $call)
260
+        foreach ($this->calls as $call)
261 261
         {
262 262
             $result['calls'][] = $call->serialize(); 
263 263
         }
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
     public function getFolderDepth() : int
287 287
     {
288 288
         $depth = $this->getOption('folder-depth');
289
-        if(!empty($depth)) {
289
+        if (!empty($depth)) {
290 290
             return $depth;
291 291
         }
292 292
         
@@ -340,12 +340,12 @@  discard block
 block discarded – undo
340 340
         
341 341
         $this->setOptions($serialized['options']);
342 342
         
343
-        if(!empty($serialized['previous']))
343
+        if (!empty($serialized['previous']))
344 344
         {
345 345
             $this->previous = ConvertHelper_ThrowableInfo::fromSerialized($serialized['previous']);
346 346
         }
347 347
         
348
-        foreach($serialized['calls'] as $def)
348
+        foreach ($serialized['calls'] as $def)
349 349
         {
350 350
             $this->calls[] = ConvertHelper_ThrowableInfo_Call::fromSerialized($this, $def);
351 351
         }
@@ -357,16 +357,16 @@  discard block
 block discarded – undo
357 357
         $this->message = $e->getMessage();
358 358
         $this->code = $e->getCode();
359 359
         
360
-        if(!isset($_REQUEST['REQUEST_URI'])) {
360
+        if (!isset($_REQUEST['REQUEST_URI'])) {
361 361
             $this->context = self::CONTEXT_COMMAND_LINE;
362 362
         }
363 363
         
364 364
         $previous = $e->getPrevious();
365
-        if(!empty($previous)) {
365
+        if (!empty($previous)) {
366 366
             $this->previous = ConvertHelper::throwable2info($previous);
367 367
         }
368 368
         
369
-        if(isset($_SERVER['REQUEST_URI'])) {
369
+        if (isset($_SERVER['REQUEST_URI'])) {
370 370
             $this->referer = $_SERVER['REQUEST_URI'];
371 371
         }
372 372
         
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
         
381 381
         $idx = 1;
382 382
         
383
-        foreach($trace as $entry)
383
+        foreach ($trace as $entry)
384 384
         {
385 385
             $this->calls[] = ConvertHelper_ThrowableInfo_Call::fromTrace($this, $idx, $entry);
386 386
             
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
      * @return string
416 416
      * @throws ConvertHelper_Exception
417 417
      */
418
-    public function renderErrorMessage(bool $withDeveloperInfo=false) : string
418
+    public function renderErrorMessage(bool $withDeveloperInfo = false) : string
419 419
     {
420 420
         $finalCall = $this->getFinalCall();
421 421
 
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
             ->t('Message:')
428 428
             ->add($this->getMessage());
429 429
 
430
-        if($withDeveloperInfo)
430
+        if ($withDeveloperInfo)
431 431
         {
432 432
             $message
433 433
             ->eol()
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
             ->add($finalCall->toString());
436 436
         }
437 437
 
438
-        if($withDeveloperInfo && $this->hasDetails())
438
+        if ($withDeveloperInfo && $this->hasDetails())
439 439
         {
440 440
             $message
441 441
                 ->t('Developer details:')
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 
446 446
         $previous = $this->getPrevious();
447 447
 
448
-        if($previous !== null)
448
+        if ($previous !== null)
449 449
         {
450 450
             $message
451 451
                 ->eol()
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 
461 461
     public function getDetails() : string
462 462
     {
463
-        if($this->exception instanceof BaseException)
463
+        if ($this->exception instanceof BaseException)
464 464
         {
465 465
             return $this->exception->getDetails();
466 466
         }
Please login to merge, or discard this patch.
src/OperationResult.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     * @param string $message Should not contain a date, just the system specific info.
145 145
     * @return OperationResult
146 146
     */
147
-    public function makeSuccess(string $message, int $code=0) : OperationResult
147
+    public function makeSuccess(string $message, int $code = 0) : OperationResult
148 148
     {
149 149
         return $this->setMessage(self::TYPE_SUCCESS, $message, $code, true);
150 150
     }
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     * @param string $message Should be as detailed as possible.
156 156
     * @return OperationResult
157 157
     */
158
-    public function makeError(string $message, int $code=0) : OperationResult
158
+    public function makeError(string $message, int $code = 0) : OperationResult
159 159
     {
160 160
         return $this->setMessage(self::TYPE_ERROR, $message, $code, false);
161 161
     }
@@ -235,11 +235,11 @@  discard block
 block discarded – undo
235 235
         return $this->code;
236 236
     }
237 237
     
238
-    public function getMessage(string $type='') : string
238
+    public function getMessage(string $type = '') : string
239 239
     {
240
-        if(!empty($type))
240
+        if (!empty($type))
241 241
         {
242
-            if($this->type === $type)
242
+            if ($this->type === $type)
243 243
             {
244 244
                 return $this->message;
245 245
             }
@@ -263,11 +263,11 @@  discard block
 block discarded – undo
263 263
      *
264 264
      * @throws ConvertHelper_Exception
265 265
      */
266
-    public function makeException(Throwable $e, int $code=0, bool $withDeveloperInfo=false) : OperationResult
266
+    public function makeException(Throwable $e, int $code = 0, bool $withDeveloperInfo = false) : OperationResult
267 267
     {
268 268
         $info = parseThrowable($e);
269 269
 
270
-        if($code === 0)
270
+        if ($code === 0)
271 271
         {
272 272
             $code = $info->getCode();
273 273
         }
Please login to merge, or discard this patch.
src/RGBAColor/Factory.php 1 patch
Spacing   +8 added lines, -8 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() : RGBAColor_PresetsManager
40 40
     {
41
-        if(!isset(self::$presets))
41
+        if (!isset(self::$presets))
42 42
         {
43 43
             self::$presets = new RGBAColor_PresetsManager();
44 44
         }
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public static function createAuto($subject) : RGBAColor
62 62
     {
63
-        if($subject instanceof RGBAColor)
63
+        if ($subject instanceof RGBAColor)
64 64
         {
65 65
             return $subject;
66 66
         }
67 67
 
68
-        if(is_array($subject))
68
+        if (is_array($subject))
69 69
         {
70
-            if(RGBAColor_Converter::isColorArray($subject))
70
+            if (RGBAColor_Converter::isColorArray($subject))
71 71
             {
72 72
                 return self::createFromColor($subject);
73 73
             }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
             return self::createFromIndexedColor($subject);
76 76
         }
77 77
 
78
-        if(is_string($subject))
78
+        if (is_string($subject))
79 79
         {
80 80
             return self::createFromHEX($subject);
81 81
         }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      */
117 117
     public static function createFromColor(array $color) : RGBAColor
118 118
     {
119
-        if(!isset($color[RGBAColor::COMPONENT_ALPHA]))
119
+        if (!isset($color[RGBAColor::COMPONENT_ALPHA]))
120 120
         {
121 121
             $color[RGBAColor::COMPONENT_ALPHA] = 255;
122 122
         }
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         $values = array_values($color);
164 164
         $amountKeys = count($values);
165 165
 
166
-        if($amountKeys === 3)
166
+        if ($amountKeys === 3)
167 167
         {
168 168
             return self::createFromColor(array(
169 169
                 RGBAColor::COMPONENT_RED => $color[0],
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
             ));
173 173
         }
174 174
 
175
-        if($amountKeys === 4)
175
+        if ($amountKeys === 4)
176 176
         {
177 177
             return self::createFromColor(array(
178 178
                 RGBAColor::COMPONENT_RED => $color[0],
Please login to merge, or discard this patch.
src/RGBAColor/Comparator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,9 +39,9 @@
 block discarded – undo
39 39
     {
40 40
         $parts = array(RGBAColor::COMPONENT_RED, RGBAColor::COMPONENT_GREEN, RGBAColor::COMPONENT_BLUE);
41 41
 
42
-        foreach($parts as $part)
42
+        foreach ($parts as $part)
43 43
         {
44
-            if($sourceColor->getColorValue($part) !== $targetColor->getColorValue($part))
44
+            if ($sourceColor->getColorValue($part) !== $targetColor->getColorValue($part))
45 45
             {
46 46
                 return false;
47 47
             }
Please login to merge, or discard this patch.
src/RGBAColor/PresetsManager.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
      */
61 61
     private function init() : void
62 62
     {
63
-        if(self::$initialized === true)
63
+        if (self::$initialized === true)
64 64
         {
65 65
             return;
66 66
         }
67 67
 
68 68
         $this
69 69
             ->registerGlobalPreset(self::COLOR_WHITE, 255, 255, 255, 255)
70
-            ->registerGlobalPreset(self::COLOR_BLACK, 0,0,0, 255)
70
+            ->registerGlobalPreset(self::COLOR_BLACK, 0, 0, 0, 255)
71 71
             ->registerGlobalPreset(self::COLOR_TRANSPARENT, 0, 0, 0, 0);
72 72
     }
73 73
 
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function getPreset(string $name) : array
82 82
     {
83
-        if(isset($this->customPresets[$name]))
83
+        if (isset($this->customPresets[$name]))
84 84
         {
85 85
             return $this->customPresets[$name];
86 86
         }
87 87
 
88
-        if(isset(self::$globalPresets[$name]))
88
+        if (isset(self::$globalPresets[$name]))
89 89
         {
90 90
             return self::$globalPresets[$name];
91 91
         }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     {
114 114
         $this->requireNotGlobal($name);
115 115
 
116
-        if(!isset(self::$globalPresets[$name]))
116
+        if (!isset(self::$globalPresets[$name]))
117 117
         {
118 118
             self::$globalPresets[$name] = array(
119 119
                 RGBAColor::COMPONENT_RED => $red,
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         );
136 136
     }
137 137
 
138
-    public function registerPreset(string $name, int $red, int $green, int $blue, int $alpha=255) : RGBAColor_PresetsManager
138
+    public function registerPreset(string $name, int $red, int $green, int $blue, int $alpha = 255) : RGBAColor_PresetsManager
139 139
     {
140 140
         $this->requireNotGlobal($name);
141 141
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 
152 152
     private function requireNotGlobal(string $name) : void
153 153
     {
154
-        if(!isset(self::$globalPresets[$name]))
154
+        if (!isset(self::$globalPresets[$name]))
155 155
         {
156 156
             return;
157 157
         }
Please login to merge, or discard this patch.
src/RGBAColor/Converter.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      */
49 49
     public static function requireValidColorArray(array $color) : void
50 50
     {
51
-        if(self::isColorArray($color))
51
+        if (self::isColorArray($color))
52 52
         {
53 53
             return;
54 54
         }
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
             RGBAColor::COMPONENT_BLUE
81 81
         );
82 82
 
83
-        foreach($keys as $key)
83
+        foreach ($keys as $key)
84 84
         {
85
-            if(!isset($color[$key]))
85
+            if (!isset($color[$key]))
86 86
             {
87 87
                 return false;
88 88
             }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             self::int2hex($color[RGBAColor::COMPONENT_GREEN]).
105 105
             self::int2hex($color[RGBAColor::COMPONENT_BLUE]);
106 106
 
107
-        if(isset($color[RGBAColor::COMPONENT_ALPHA]) && $color[RGBAColor::COMPONENT_ALPHA] < 255)
107
+        if (isset($color[RGBAColor::COMPONENT_ALPHA]) && $color[RGBAColor::COMPONENT_ALPHA] < 255)
108 108
         {
109 109
             $hex .= self::int2hex($color[RGBAColor::COMPONENT_ALPHA]);
110 110
         }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     private static function int2hex(int $int) : string
125 125
     {
126 126
         $str = dechex($int);
127
-        if(strlen($str) === 1)
127
+        if (strlen($str) === 1)
128 128
         {
129 129
             $str = $str.$str;
130 130
         }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
      */
144 144
     public static function color2readable(RGBAColor $color) : string
145 145
     {
146
-        if($color->hasTransparency())
146
+        if ($color->hasTransparency())
147 147
         {
148 148
             return sprintf(
149 149
                 'RGBA(%s %s %s %s)',
@@ -207,11 +207,11 @@  discard block
 block discarded – undo
207 207
         $hex = strtoupper($hex);
208 208
         $length = strlen($hex);
209 209
 
210
-        if($length === 3)
210
+        if ($length === 3)
211 211
         {
212 212
             return self::parseHEX3($hex);
213 213
         }
214
-        else if($length === 6)
214
+        else if ($length === 6)
215 215
         {
216 216
             return self::parseHEX6($hex);
217 217
         }
Please login to merge, or discard this patch.