Passed
Push — master ( f8e3f7...025a78 )
by Sebastian
03:51
created
src/FileHelper/PHPClassInfo/Class.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     {
106 106
         $name = $this->getName();
107 107
         
108
-        if($this->info->hasNamespace()) {
108
+        if ($this->info->hasNamespace()) {
109 109
             $name = $this->info->getNamespace().'\\'.$this->name;
110 110
         }
111 111
         
@@ -160,12 +160,12 @@  discard block
 block discarded – undo
160 160
         $parts[] = 'class';
161 161
         $parts[] = $this->getName();
162 162
         
163
-        if(!empty($this->extends)) {
163
+        if (!empty($this->extends)) {
164 164
             $parts[] = 'extends';
165 165
             $parts[] = $this->extends;
166 166
         }
167 167
         
168
-        if(!empty($this->implements)) {
168
+        if (!empty($this->implements)) {
169 169
             $parts[] = 'implements';
170 170
             $parts[] = implode(', ', $this->implements);
171 171
         }
@@ -184,9 +184,9 @@  discard block
 block discarded – undo
184 184
     
185 185
     protected function analyzeCode() : void
186 186
     {
187
-        if($this->keyword == 'abstract') {
187
+        if ($this->keyword == 'abstract') {
188 188
             $this->abstract = true;
189
-        } else if($this->keyword == 'final') {
189
+        } else if ($this->keyword == 'final') {
190 190
             $this->final = true;
191 191
         }
192 192
         
@@ -203,16 +203,16 @@  discard block
 block discarded – undo
203 203
         
204 204
         $tokenName = 'none';
205 205
         
206
-        foreach($parts as $part)
206
+        foreach ($parts as $part)
207 207
         {
208 208
             $part = str_replace(',', '', $part);
209 209
             $part = trim($part);
210
-            if(empty($part)) {
210
+            if (empty($part)) {
211 211
                 continue;
212 212
             }
213 213
             
214 214
             $name = strtolower($part);
215
-            if($name == 'extends' || $name == 'implements') {
215
+            if ($name == 'extends' || $name == 'implements') {
216 216
                 $tokenName = $name;
217 217
                 continue;
218 218
             }
@@ -222,13 +222,13 @@  discard block
 block discarded – undo
222 222
         
223 223
         $this->implements = $tokens['implements'];
224 224
         
225
-        if(!empty($this->implements)) {
225
+        if (!empty($this->implements)) {
226 226
             usort($this->implements, function(string $a, string $b) {
227 227
                 return strnatcasecmp($a, $b);
228 228
             });
229 229
         }
230 230
         
231
-        if(!empty($tokens['extends'])) {
231
+        if (!empty($tokens['extends'])) {
232 232
             $this->extends = $tokens['extends'][0];
233 233
         }
234 234
     }
Please login to merge, or discard this patch.
src/NamedClosure.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
      */
105 105
     public static function fromClosure(Closure $closure, $origin) : NamedClosure
106 106
     {
107
-        if(is_object($origin))
107
+        if (is_object($origin))
108 108
         {
109 109
             $description = get_class($origin);
110 110
         }
111
-        else if(is_array($origin))
111
+        else if (is_array($origin))
112 112
         {
113 113
             $description = ConvertHelper::callback2string($origin);
114 114
         }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      * @param string|object $origin Optional origin. If not specified, the object and method name are used instead.
127 127
      * @return NamedClosure
128 128
      */
129
-    public static function fromObject(object $object, string $method, $origin='') : NamedClosure
129
+    public static function fromObject(object $object, string $method, $origin = '') : NamedClosure
130 130
     {
131 131
         return self::fromArray(array($object, $method), $origin);
132 132
     }
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
      * @param string|object $origin
137 137
      * @return NamedClosure
138 138
      */
139
-    public static function fromArray(array $callback, $origin='') : NamedClosure
139
+    public static function fromArray(array $callback, $origin = '') : NamedClosure
140 140
     {
141
-        if(empty($origin)) {
141
+        if (empty($origin)) {
142 142
             $origin = ConvertHelper::callback2string($callback);
143
-        } else if(is_object($origin)) {
143
+        } else if (is_object($origin)) {
144 144
             $origin = get_class($origin);
145 145
         }
146 146
 
Please login to merge, or discard this patch.
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/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.
src/OperationResult/Collection.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      * @param int $code
37 37
      * @return $this
38 38
      */
39
-    public function makeError(string $message, int $code=0) : OperationResult
39
+    public function makeError(string $message, int $code = 0) : OperationResult
40 40
     {
41 41
         return $this->add('makeError', $message, $code);
42 42
     }
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      * @param int $code
47 47
      * @return $this
48 48
      */
49
-    public function makeSuccess(string $message, int $code=0) : OperationResult
49
+    public function makeSuccess(string $message, int $code = 0) : OperationResult
50 50
     {
51 51
         return $this->add('makeSuccess', $message, $code);
52 52
     }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      * @param int $code
57 57
      * @return $this
58 58
      */
59
-    public function makeWarning(string $message, int $code=0) : OperationResult
59
+    public function makeWarning(string $message, int $code = 0) : OperationResult
60 60
     {
61 61
         return $this->add('makeWarning', $message, $code);
62 62
     }
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      * @param int $code
67 67
      * @return $this
68 68
      */
69
-    public function makeNotice(string $message, int $code=0) : OperationResult
69
+    public function makeNotice(string $message, int $code = 0) : OperationResult
70 70
     {
71 71
         return $this->add('makeNotice', $message, $code);
72 72
     }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      * @param int $code
78 78
      * @return $this
79 79
      */
80
-    protected function add(string $method, string $message, int $code=0) : OperationResult
80
+    protected function add(string $method, string $message, int $code = 0) : OperationResult
81 81
     {
82 82
         $result = new OperationResult($this->subject);
83 83
         $result->$method($message, $code);
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
      */
96 96
     public function addResult(OperationResult $result) : OperationResult_Collection
97 97
     {
98
-        if($result instanceof OperationResult_Collection)
98
+        if ($result instanceof OperationResult_Collection)
99 99
         {
100 100
             return $this->importCollection($result);
101 101
         }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     {
116 116
         $results = $collection->getResults();
117 117
         
118
-        foreach($results as $result)
118
+        foreach ($results as $result)
119 119
         {
120 120
             $this->addResult($result);
121 121
         }
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
     
134 134
     public function isValid() : bool
135 135
     {
136
-        foreach($this->results as $result)
136
+        foreach ($this->results as $result)
137 137
         {
138
-            if(!$result->isValid())
138
+            if (!$result->isValid())
139 139
             {
140 140
                 return false;
141 141
             }
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
     
147 147
     public function hasCode() : bool
148 148
     {
149
-        foreach($this->results as $result)
149
+        foreach ($this->results as $result)
150 150
         {
151
-            if($result->hasCode())
151
+            if ($result->hasCode())
152 152
             {
153 153
                 return true;
154 154
             }
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
     
160 160
     public function getCode() : int
161 161
     {
162
-        foreach($this->results as $result)
162
+        foreach ($this->results as $result)
163 163
         {
164
-            if($result->hasCode())
164
+            if ($result->hasCode())
165 165
             {
166 166
                 return $result->getCode();
167 167
             }
@@ -170,13 +170,13 @@  discard block
 block discarded – undo
170 170
         return 0;
171 171
     }
172 172
     
173
-    public function getMessage(string $type='') : string
173
+    public function getMessage(string $type = '') : string
174 174
     {
175
-        foreach($this->results as $result)
175
+        foreach ($this->results as $result)
176 176
         {
177 177
             $msg = $result->getMessage($type);
178 178
             
179
-            if(!empty($msg))
179
+            if (!empty($msg))
180 180
             {
181 181
                 return $msg;
182 182
             }
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
     
188 188
     public function containsCode(int $code) : bool
189 189
     {
190
-        foreach($this->results as $result)
190
+        foreach ($this->results as $result)
191 191
         {
192
-            if($result->getCode() === $code)
192
+            if ($result->getCode() === $code)
193 193
             {
194 194
                 return true;
195 195
             }
@@ -222,9 +222,9 @@  discard block
 block discarded – undo
222 222
     {
223 223
         $amount = 0;
224 224
         
225
-        foreach($this->results as $result)
225
+        foreach ($this->results as $result)
226 226
         {
227
-            if($result->isType($type))
227
+            if ($result->isType($type))
228 228
             {
229 229
                 $amount++;
230 230
             }
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
     {
263 263
         $results = array();
264 264
         
265
-        foreach($this->results as $result)
265
+        foreach ($this->results as $result)
266 266
         {
267
-            if($result->isType($type))
267
+            if ($result->isType($type))
268 268
             {
269 269
                 $results[] = $result;
270 270
             }
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
     
276 276
     public function isType(string $type) : bool
277 277
     {
278
-        foreach($this->results as $result)
278
+        foreach ($this->results as $result)
279 279
         {
280
-            if($result->isType($type))
280
+            if ($result->isType($type))
281 281
             {
282 282
                 return true;
283 283
             }
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
         $lines[] = 'Collection #'.$this->getID();
294 294
         $lines[] = 'Subject: '.get_class($this->subject);
295 295
         
296
-        foreach($this->results as $result)
296
+        foreach ($this->results as $result)
297 297
         {
298 298
             $lines[] = ' - '.$result->getType().' #'.$result->getCode().' "'.$result->getMessage($result->getType()).'"';
299 299
         }
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 $this
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 $this
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
     }
@@ -252,11 +252,11 @@  discard block
 block discarded – undo
252 252
         return $this->code;
253 253
     }
254 254
     
255
-    public function getMessage(string $type='') : string
255
+    public function getMessage(string $type = '') : string
256 256
     {
257
-        if(!empty($type))
257
+        if (!empty($type))
258 258
         {
259
-            if($this->type === $type)
259
+            if ($this->type === $type)
260 260
             {
261 261
                 return $this->message;
262 262
             }
@@ -280,11 +280,11 @@  discard block
 block discarded – undo
280 280
      *
281 281
      * @throws ConvertHelper_Exception
282 282
      */
283
-    public function makeException(Throwable $e, int $code=0, bool $withDeveloperInfo=false) : OperationResult
283
+    public function makeException(Throwable $e, int $code = 0, bool $withDeveloperInfo = false) : OperationResult
284 284
     {
285 285
         $info = parseThrowable($e);
286 286
 
287
-        if($code === 0)
287
+        if ($code === 0)
288 288
         {
289 289
             $code = $info->getCode();
290 290
         }
Please login to merge, or discard this patch.