Passed
Push — master ( ba00c7...bfa3fc )
by Sebastian
08:42
created
src/Request.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     {
94 94
         $value = $_REQUEST[$name] ?? $default;
95 95
 
96
-        if(isset($this->knownParams[$name])) {
96
+        if (isset($this->knownParams[$name])) {
97 97
             $value = $this->knownParams[$name]->validate($value);
98 98
         }
99 99
         
@@ -190,13 +190,13 @@  discard block
 block discarded – undo
190 190
      * @param string $dispatcher Relative path to script to use for the URL. Append trailing slash if needed.
191 191
      * @return string
192 192
      */
193
-    public function buildURL(array $params = array(), string $dispatcher='') : string
193
+    public function buildURL(array $params = array(), string $dispatcher = '') : string
194 194
     {
195
-        $url = rtrim($this->getBaseURL(), '/') . '/' . $dispatcher;
195
+        $url = rtrim($this->getBaseURL(), '/').'/'.$dispatcher;
196 196
         
197 197
         // append any leftover parameters to the end of the URL
198 198
         if (!empty($params)) {
199
-            $url .= '?' . http_build_query($params, '', '&');
199
+            $url .= '?'.http_build_query($params, '', '&');
200 200
         }
201 201
         
202 202
         return $url;
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
      */
228 228
     public function registerParam(string $name) : RequestParam
229 229
     {
230
-        if(!isset($this->knownParams[$name])) {
230
+        if (!isset($this->knownParams[$name])) {
231 231
             $param = new RequestParam($this, $name);
232 232
             $this->knownParams[$name] = $param;
233 233
         }
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
     */
245 245
     public function getRegisteredParam(string $name) : RequestParam
246 246
     {
247
-        if(isset($this->knownParams[$name])) {
247
+        if (isset($this->knownParams[$name])) {
248 248
             return $this->knownParams[$name];
249 249
         }
250 250
         
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
     {
305 305
         static $accept;
306 306
         
307
-        if(!isset($accept)) {
307
+        if (!isset($accept)) {
308 308
             $accept = new Request_AcceptHeaders();
309 309
         }
310 310
         
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
     {
324 324
         $_REQUEST[$name] = $value;
325 325
         
326
-        if(isset($this->knownParams[$name])) {
326
+        if (isset($this->knownParams[$name])) {
327 327
             unset($this->knownParams[$name]);
328 328
         }
329 329
         
@@ -353,11 +353,11 @@  discard block
 block discarded – undo
353 353
     */
354 354
     public function removeParam(string $name) : Request
355 355
     {
356
-        if(isset($_REQUEST[$name])) {
356
+        if (isset($_REQUEST[$name])) {
357 357
             unset($_REQUEST[$name]);
358 358
         }
359 359
         
360
-        if(isset($this->knownParams[$name])) {
360
+        if (isset($this->knownParams[$name])) {
361 361
             unset($this->knownParams[$name]);
362 362
         }
363 363
         
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
     */
373 373
     public function removeParams(array $names) : Request
374 374
     {
375
-        foreach($names as $name) {
375
+        foreach ($names as $name) {
376 376
             $this->removeParam($name);
377 377
         }
378 378
         
@@ -390,11 +390,11 @@  discard block
 block discarded – undo
390 390
      * @return bool
391 391
      * @throws ConvertHelper_Exception
392 392
      */
393
-    public function getBool(string $name, bool $default=false) : bool
393
+    public function getBool(string $name, bool $default = false) : bool
394 394
     {
395 395
         $value = $this->getParam($name, $default);
396 396
 
397
-        if(ConvertHelper::isBoolean($value)) {
397
+        if (ConvertHelper::isBoolean($value)) {
398 398
             return ConvertHelper::string2bool($value);
399 399
         }
400 400
         
@@ -403,11 +403,11 @@  discard block
 block discarded – undo
403 403
     
404 404
     public function validate() : void
405 405
     {
406
-        foreach($this->knownParams as $param) 
406
+        foreach ($this->knownParams as $param) 
407 407
         {
408 408
             $name = $param->getName();
409 409
             
410
-            if($param->isRequired() && !$this->hasParam($name)) 
410
+            if ($param->isRequired() && !$this->hasParam($name)) 
411 411
             {
412 412
                 throw new Request_Exception(
413 413
                     'Missing request parameter '.$name,
@@ -429,26 +429,26 @@  discard block
 block discarded – undo
429 429
      * @param mixed $default
430 430
      * @return mixed
431 431
      */
432
-    public function getFilteredParam(string $name, $default=null)
432
+    public function getFilteredParam(string $name, $default = null)
433 433
     {
434 434
         $val = $this->getParam($name, $default);
435 435
 
436
-        if(is_string($val))
436
+        if (is_string($val))
437 437
         {
438 438
             return htmlspecialchars(trim(strip_tags($val)), ENT_QUOTES, 'UTF-8');
439 439
         }
440 440
 
441
-        if(is_bool($val))
441
+        if (is_bool($val))
442 442
         {
443 443
             return ConvertHelper::boolStrict2string($val);
444 444
         }
445 445
 
446
-        if(is_numeric($val))
446
+        if (is_numeric($val))
447 447
         {
448 448
             return (string)$val;
449 449
         }
450 450
 
451
-        if(is_null($val))
451
+        if (is_null($val))
452 452
         {
453 453
             return '';
454 454
         }
@@ -468,24 +468,24 @@  discard block
 block discarded – undo
468 468
      * @see Request::getJSONObject()
469 469
      * @see Request::getJSONAssoc()
470 470
      */
471
-    public function getJSON(string $name, bool $assoc=true)
471
+    public function getJSON(string $name, bool $assoc = true)
472 472
     {
473 473
         $value = $this->getParam($name);
474 474
         
475
-        if(!empty($value) && is_string($value)) 
475
+        if (!empty($value) && is_string($value)) 
476 476
         {
477 477
             $value = JSONConverter::json2varSilent($value, $assoc);
478 478
 
479
-            if($assoc && is_array($value)) {
479
+            if ($assoc && is_array($value)) {
480 480
                 return $value;
481 481
             }
482 482
             
483
-            if(is_object($value)) {
483
+            if (is_object($value)) {
484 484
                 return $value;
485 485
             }
486 486
         }
487 487
         
488
-        if($assoc) {
488
+        if ($assoc) {
489 489
             return array();
490 490
         }
491 491
         
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
     public function getJSONAssoc(string $name) : array
503 503
     {
504 504
         $result = $this->getJSON($name);
505
-        if(is_array($result)) {
505
+        if (is_array($result)) {
506 506
             return $result;
507 507
         }
508 508
         
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
     public function getJSONObject(string $name) : object
520 520
     {
521 521
         $result = $this->getJSON($name, false);
522
-        if(is_object($result)) {
522
+        if (is_object($result)) {
523 523
             return $result;
524 524
         }
525 525
         
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
     {
537 537
         $payload = $data;
538 538
 
539
-        if(!is_string($payload)) {
539
+        if (!is_string($payload)) {
540 540
             $payload = JSONConverter::var2json($payload);
541 541
         }
542 542
         
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
     * @param string[] $limitParams Whether to limit the comparison to these specific parameter names (if present)
594 594
     * @return Request_URLComparer
595 595
     */
596
-    public function createURLComparer(string $sourceURL, string $targetURL, array $limitParams=array()) : Request_URLComparer
596
+    public function createURLComparer(string $sourceURL, string $targetURL, array $limitParams = array()) : Request_URLComparer
597 597
     {
598 598
         $comparer = new Request_URLComparer($this, $sourceURL, $targetURL);
599 599
         $comparer->addLimitParams($limitParams);
Please login to merge, or discard this patch.
src/ImageHelper/ImageTrimmer.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      * @param RGBAColor|null $trimColor
38 38
      * @throws ImageHelper_Exception
39 39
      */
40
-    public function __construct(ImageHelper $helper, $sourceImage, ?RGBAColor $trimColor=null)
40
+    public function __construct(ImageHelper $helper, $sourceImage, ?RGBAColor $trimColor = null)
41 41
     {
42 42
         ImageHelper::requireResource($sourceImage);
43 43
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     {
51 51
         $targetColor = ColorFactory::createAuto($trimColor);
52 52
 
53
-        if($targetColor !== null)
53
+        if ($targetColor !== null)
54 54
         {
55 55
             return $targetColor;
56 56
         }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             )
80 80
         );
81 81
 
82
-        if($img !== false) {
82
+        if ($img !== false) {
83 83
             return $img;
84 84
         }
85 85
 
@@ -99,16 +99,16 @@  discard block
 block discarded – undo
99 99
         $ymax = null;
100 100
 
101 101
         // Start scanning for the edges.
102
-        for ($iy=0; $iy<$imh; $iy++)
102
+        for ($iy = 0; $iy < $imh; $iy++)
103 103
         {
104 104
             $first = true;
105 105
 
106
-            for ($ix=0; $ix<$imw; $ix++)
106
+            for ($ix = 0; $ix < $imw; $ix++)
107 107
             {
108 108
                 $ndx = imagecolorat($this->sourceImage, $ix, $iy);
109 109
                 $colors = $this->helper->getIndexedColors($this->sourceImage, $ndx);
110 110
 
111
-                if(!$colors->matchesAlpha($this->trimColor))
111
+                if (!$colors->matchesAlpha($this->trimColor))
112 112
                 {
113 113
                     if ($xmin > $ix) { $xmin = $ix; }
114 114
                     if ($xmax < $ix) { $xmax = $ix; }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 
117 117
                     $ymax = $iy;
118 118
 
119
-                    if($first)
119
+                    if ($first)
120 120
                     {
121 121
                         $ix = $xmax;
122 122
                         $first = false;
@@ -126,18 +126,18 @@  discard block
 block discarded – undo
126 126
         }
127 127
 
128 128
         // no trimming border found
129
-        if($ymax === null) {
129
+        if ($ymax === null) {
130 130
             return $this->sourceImage;
131 131
         }
132 132
 
133 133
         // The new width and height of the image.
134
-        $imw = 1+$xmax-$xmin; // Image width in pixels
135
-        $imh = 1+$ymax-$ymin; // Image height in pixels
134
+        $imw = 1 + $xmax - $xmin; // Image width in pixels
135
+        $imh = 1 + $ymax - $ymin; // Image height in pixels
136 136
 
137 137
         // Make another image to place the trimmed version in.
138 138
         $im2 = $this->helper->createNewImage($imw, $imh);
139 139
 
140
-        if($this->trimColor->hasTransparency())
140
+        if ($this->trimColor->hasTransparency())
141 141
         {
142 142
             $bg2 = imagecolorallocatealpha(
143 143
                 $im2,
Please login to merge, or discard this patch.
src/AttributeCollection.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function setAttributes(array $attributes) : AttributeCollection
79 79
     {
80
-        foreach($attributes as $name => $value)
80
+        foreach ($attributes as $name => $value)
81 81
         {
82 82
             $this->attr($name, $value);
83 83
         }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         return $this;
86 86
     }
87 87
 
88
-    public function getAttribute(string $name, string $default='') : string
88
+    public function getAttribute(string $name, string $default = '') : string
89 89
     {
90 90
         return $this->attributes[$name] ?? $default;
91 91
     }
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
      * @param array<string,string|number|bool|NULL|Interface_Stringable|StringBuilder_Interface> $attributes
95 95
      * @return AttributeCollection
96 96
      */
97
-    public static function create(array $attributes=array()) : AttributeCollection
97
+    public static function create(array $attributes = array()) : AttributeCollection
98 98
     {
99 99
         return new AttributeCollection($attributes);
100 100
     }
101 101
 
102
-    public function prop(string $name, bool $enabled=true) : AttributeCollection
102
+    public function prop(string $name, bool $enabled = true) : AttributeCollection
103 103
     {
104
-        if($enabled)
104
+        if ($enabled)
105 105
         {
106 106
             return $this->attr($name, $name);
107 107
         }
@@ -118,23 +118,23 @@  discard block
 block discarded – undo
118 118
     {
119 119
         $string = Filtering::value2string($value);
120 120
 
121
-        if($name === 'class')
121
+        if ($name === 'class')
122 122
         {
123 123
             return $this->addClasses(ConvertHelper::explodeTrim(' ', $string));
124 124
         }
125 125
 
126
-        if($name === 'style')
126
+        if ($name === 'style')
127 127
         {
128 128
             $this->styles->parseStylesString($string);
129 129
             return $this;
130 130
         }
131 131
 
132
-        if($string !== '')
132
+        if ($string !== '')
133 133
         {
134 134
             $this->attributes[$name] = $string;
135 135
 
136 136
             // remove it from the empty stack if it was empty before.
137
-            if(in_array($name, $this->empty, true)) {
137
+            if (in_array($name, $this->empty, true)) {
138 138
                 $this->empty = array_remove_values($this->empty, array($name));
139 139
             }
140 140
         }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
     {
160 160
         $this->attr($name, $value);
161 161
 
162
-        if(isset($this->attributes[$name]))
162
+        if (isset($this->attributes[$name]))
163 163
         {
164 164
             $this->attributes[$name] = Filtering::quotes($this->attributes[$name]);
165 165
         }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 
175 175
     public function remove(string $name) : AttributeCollection
176 176
     {
177
-        if(isset($this->attributes[$name]))
177
+        if (isset($this->attributes[$name]))
178 178
         {
179 179
             unset($this->attributes[$name]);
180 180
         }
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 
197 197
     private function getRenderer() : AttributesRenderer
198 198
     {
199
-        if(isset($this->renderer))
199
+        if (isset($this->renderer))
200 200
         {
201 201
             return $this->renderer;
202 202
         }
@@ -230,12 +230,12 @@  discard block
 block discarded – undo
230 230
         $attributes = $this->attributes;
231 231
 
232 232
         // Are there any empty attributes to keep?
233
-        if(!empty($this->keepEmpty))
233
+        if (!empty($this->keepEmpty))
234 234
         {
235 235
             $names = array_keys($this->keepEmpty);
236 236
 
237
-            foreach($names as $name) {
238
-                if(in_array($name, $this->empty, true)) {
237
+            foreach ($names as $name) {
238
+                if (in_array($name, $this->empty, true)) {
239 239
                     $attributes[$name] = '';
240 240
                 }
241 241
             }
@@ -244,13 +244,13 @@  discard block
 block discarded – undo
244 244
         return $attributes;
245 245
     }
246 246
 
247
-    public function setKeepIfEmpty(string $name, bool $keep=true) : self
247
+    public function setKeepIfEmpty(string $name, bool $keep = true) : self
248 248
     {
249
-        if($keep === true)
249
+        if ($keep === true)
250 250
         {
251 251
             $this->keepEmpty[$name] = true;
252 252
         }
253
-        else if(isset($this->keepEmpty[$name]))
253
+        else if (isset($this->keepEmpty[$name]))
254 254
         {
255 255
             unset($this->keepEmpty[$name]);
256 256
         }
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 
300 300
     public const TARGET_BLANK = '_blank';
301 301
 
302
-    public function target(string $value=self::TARGET_BLANK) : AttributeCollection
302
+    public function target(string $value = self::TARGET_BLANK) : AttributeCollection
303 303
     {
304 304
         return $this->attr('target', $value);
305 305
     }
Please login to merge, or discard this patch.
src/HTMLTag.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      * @param bool $selfClosing
55 55
      * @return $this
56 56
      */
57
-    public function setSelfClosing(bool $selfClosing=true) : self
57
+    public function setSelfClosing(bool $selfClosing = true) : self
58 58
     {
59 59
         $this->selfClosing = $selfClosing;
60 60
         return $this;
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      * @param bool $allowed
70 70
      * @return $this
71 71
      */
72
-    public function setEmptyAllowed(bool $allowed=true) : self
72
+    public function setEmptyAllowed(bool $allowed = true) : self
73 73
     {
74 74
         $this->allowEmpty = $allowed;
75 75
         return $this;
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
     public function isEmptyAllowed() : bool
79 79
     {
80
-        if($this->isSelfClosing())
80
+        if ($this->isSelfClosing())
81 81
         {
82 82
             return true;
83 83
         }
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
         return $this->allowEmpty;
86 86
     }
87 87
 
88
-    public static function create(string $name, ?AttributeCollection $attributes=null) : HTMLTag
88
+    public static function create(string $name, ?AttributeCollection $attributes = null) : HTMLTag
89 89
     {
90
-        if($attributes === null)
90
+        if ($attributes === null)
91 91
         {
92 92
             $attributes = AttributeCollection::create();
93 93
         }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
     public function render() : string
115 115
     {
116
-        if(!$this->isEmptyAllowed() && $this->isEmpty())
116
+        if (!$this->isEmptyAllowed() && $this->isEmpty())
117 117
         {
118 118
             return '';
119 119
         }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
     public static function getGlobalOptions() : GlobalOptions
128 128
     {
129
-        if(!isset(self::$globalOptions))
129
+        if (!isset(self::$globalOptions))
130 130
         {
131 131
             self::$globalOptions = new GlobalOptions();
132 132
         }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
     public function getSelfClosingChar() : string
138 138
     {
139
-        if($this->selfClosing && self::getGlobalOptions()->getSelfCloseStyle() === self::SELF_CLOSE_STYLE_SLASH)
139
+        if ($this->selfClosing && self::getGlobalOptions()->getSelfCloseStyle() === self::SELF_CLOSE_STYLE_SLASH)
140 140
         {
141 141
             return '/';
142 142
         }
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
     public function renderClose() : string
158 158
     {
159
-        if($this->selfClosing)
159
+        if ($this->selfClosing)
160 160
         {
161 161
             return '';
162 162
         }
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 
201 201
     public function renderContent() : string
202 202
     {
203
-        if($this->selfClosing)
203
+        if ($this->selfClosing)
204 204
         {
205 205
             return '';
206 206
         }
@@ -219,11 +219,11 @@  discard block
 block discarded – undo
219 219
      * @param bool $keepIfEmpty
220 220
      * @return $this
221 221
      */
222
-    public function attr(string $name, string $value, bool $keepIfEmpty=false) : self
222
+    public function attr(string $name, string $value, bool $keepIfEmpty = false) : self
223 223
     {
224 224
         $this->attributes->attr($name, $value);
225 225
 
226
-        if($keepIfEmpty) {
226
+        if ($keepIfEmpty) {
227 227
             $this->attributes->setKeepIfEmpty($name);
228 228
         }
229 229
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      * @param bool $enabled
236 236
      * @return $this
237 237
      */
238
-    public function prop(string $name, bool $enabled=true) : self
238
+    public function prop(string $name, bool $enabled = true) : self
239 239
     {
240 240
         $this->attributes->prop($name, $enabled);
241 241
         return $this;
Please login to merge, or discard this patch.
src/functions.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
  * @param bool $forceNew
13 13
  * @return NumberInfo
14 14
  */
15
-function parseNumber($value, bool $forceNew=false)
15
+function parseNumber($value, bool $forceNew = false)
16 16
 {
17
-    if($value instanceof NumberInfo && $forceNew !== true) {
17
+    if ($value instanceof NumberInfo && $forceNew !== true) {
18 18
         return $value;
19 19
     }
20 20
     
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     $args = func_get_args();
110 110
     
111 111
     // is the localization package installed?
112
-    if(function_exists('\AppLocalize\t'))
112
+    if (function_exists('\AppLocalize\t'))
113 113
     {
114 114
         return call_user_func_array('\AppLocalize\t', $args);
115 115
     }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
  * @param bool $initial The initial boolean value to use.
125 125
  * @return Value_Bool
126 126
  */
127
-function valBool(bool $initial=false) : Value_Bool
127
+function valBool(bool $initial = false) : Value_Bool
128 128
 {
129 129
     return new Value_Bool($initial);
130 130
 }
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
  * @param bool $initial
138 138
  * @return Value_Bool_True
139 139
  */
140
-function valBoolTrue(bool $initial=false) : Value_Bool_True
140
+function valBoolTrue(bool $initial = false) : Value_Bool_True
141 141
 {
142 142
     return new Value_Bool_True($initial);
143 143
 }
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
  * @param bool $initial
151 151
  * @return Value_Bool_False
152 152
  */
153
-function valBoolFalse(bool $initial=true) : Value_Bool_False
153
+function valBoolFalse(bool $initial = true) : Value_Bool_False
154 154
 {
155 155
     return new Value_Bool_False($initial);
156 156
 }
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
  * @param bool $strict
183 183
  * @return array<mixed>
184 184
  */
185
-function array_remove_values(array $haystack, array $values, bool $strict=true) : array
185
+function array_remove_values(array $haystack, array $values, bool $strict = true) : array
186 186
 {
187 187
     return array_filter(
188 188
         $haystack,
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
  */
198 198
 function init() : void
199 199
 {
200
-    if(!class_exists('\AppLocalize\Localization')) {
200
+    if (!class_exists('\AppLocalize\Localization')) {
201 201
         return;
202 202
     }
203 203
     
Please login to merge, or discard this patch.
src/AttributeCollection/AttributesRenderer.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
 
25 25
         $attributes = $this->compileAttributes();
26 26
 
27
-        if(empty($attributes))
27
+        if (empty($attributes))
28 28
         {
29 29
             return '';
30 30
         }
31 31
 
32
-        foreach($attributes as $name => $value)
32
+        foreach ($attributes as $name => $value)
33 33
         {
34
-            if($value === '' && !$this->collection->isKeepIfEmpty($name))
34
+            if ($value === '' && !$this->collection->isKeepIfEmpty($name))
35 35
             {
36 36
                 continue;
37 37
             }
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
     {
54 54
         $attributes = $this->collection->getRawAttributes();
55 55
 
56
-        if($this->collection->hasClasses())
56
+        if ($this->collection->hasClasses())
57 57
         {
58 58
             $attributes['class'] = $this->collection->classesToString();
59 59
         }
60 60
 
61
-        if($this->collection->hasStyles())
61
+        if ($this->collection->hasStyles())
62 62
         {
63 63
             $attributes['style'] = $this->collection->getStyles()
64 64
                 ->configureForInline()
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
     private function renderAttribute(string $name, string $value) : string
72 72
     {
73
-        if($name === $value)
73
+        if ($name === $value)
74 74
         {
75 75
             return $name;
76 76
         }
Please login to merge, or discard this patch.
src/Microtime/ParseResult.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
     public function __construct(string $datetime, DateTimeZone $timeZone)
42 42
     {
43
-        if(stripos($datetime, 'T') !== false) {
43
+        if (stripos($datetime, 'T') !== false) {
44 44
             $datetime = $this->parseISO8601($datetime);
45 45
         }
46 46
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     {
53 53
         preg_match('/([0-9]{4}-[0-9]{2}-[0-9]{2})T([0-9]{2}:[0-9]{2}:[0-9]{2})\.([0-9]+)Z/', $datetime, $matches);
54 54
 
55
-        if(!empty($matches[0])) {
55
+        if (!empty($matches[0])) {
56 56
             return sprintf(
57 57
                 '%s %s.%s',
58 58
                 $matches[1],
Please login to merge, or discard this patch.
src/Microtime.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
      * @see Microtime::createFromString()
52 52
      * @see Microtime::createNow()
53 53
      */
54
-    public function __construct($datetime=self::DATETIME_NOW, ?DateTimeZone $timeZone=null)
54
+    public function __construct($datetime = self::DATETIME_NOW, ?DateTimeZone $timeZone = null)
55 55
     {
56
-        if($datetime instanceof Microtime_ParseResult)
56
+        if ($datetime instanceof Microtime_ParseResult)
57 57
         {
58 58
             $parsed = $datetime;
59 59
         }
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
      * @return Microtime_ParseResult
87 87
      * @throws Microtime_Exception
88 88
      */
89
-    private function parseDate($datetime, ?DateTimeZone $timeZone=null) : Microtime_ParseResult
89
+    private function parseDate($datetime, ?DateTimeZone $timeZone = null) : Microtime_ParseResult
90 90
     {
91
-        if($datetime instanceof self)
91
+        if ($datetime instanceof self)
92 92
         {
93 93
             return new Microtime_ParseResult(
94 94
                 $datetime->getISODate(),
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
             );
97 97
         }
98 98
 
99
-        if($datetime instanceof DateTime)
99
+        if ($datetime instanceof DateTime)
100 100
         {
101 101
             return new Microtime_ParseResult(
102 102
                 $datetime->format(self::FORMAT_ISO),
@@ -104,17 +104,17 @@  discard block
 block discarded – undo
104 104
             );
105 105
         }
106 106
 
107
-        if($timeZone === null)
107
+        if ($timeZone === null)
108 108
         {
109 109
             $timeZone = new DateTimeZone(date_default_timezone_get());
110 110
         }
111 111
 
112
-        if(empty($datetime) || $datetime === self::DATETIME_NOW)
112
+        if (empty($datetime) || $datetime === self::DATETIME_NOW)
113 113
         {
114 114
             return self::parseNow($timeZone);
115 115
         }
116 116
 
117
-        if(is_string($datetime))
117
+        if (is_string($datetime))
118 118
         {
119 119
             return new Microtime_ParseResult(
120 120
                 $datetime,
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     {
142 142
         $dateObj = DateTime::createFromFormat('0.u00 U', microtime(), new DateTimeZone('America/Denver'));
143 143
 
144
-        if($dateObj !== false)
144
+        if ($dateObj !== false)
145 145
         {
146 146
             $dateObj->setTimezone($timeZone);
147 147
 
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
      * @return Microtime
166 166
      * @throws Microtime_Exception
167 167
      */
168
-    public static function createNow(?DateTimeZone $timeZone=null) : Microtime
168
+    public static function createNow(?DateTimeZone $timeZone = null) : Microtime
169 169
     {
170
-        if($timeZone === null)
170
+        if ($timeZone === null)
171 171
         {
172 172
             $timeZone = new DateTimeZone(date_default_timezone_get());
173 173
         }
@@ -184,9 +184,9 @@  discard block
 block discarded – undo
184 184
      * @return Microtime
185 185
      * @throws Microtime_Exception
186 186
      */
187
-    public static function createFromString(string $date, ?DateTimeZone $timeZone=null) : Microtime
187
+    public static function createFromString(string $date, ?DateTimeZone $timeZone = null) : Microtime
188 188
     {
189
-        if($timeZone === null)
189
+        if ($timeZone === null)
190 190
         {
191 191
             $timeZone = new DateTimeZone(date_default_timezone_get());
192 192
         }
Please login to merge, or discard this patch.
src/URLInfo/URIParser.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
         $result = parse_url($this->url);
111 111
         $this->info = array();
112 112
 
113
-        if(!is_array($result))
113
+        if (!is_array($result))
114 114
         {
115 115
             $this->fixBrokenURL();
116 116
             $result = parse_url($this->url);
117 117
         }
118 118
 
119
-        if(is_array($result))
119
+        if (is_array($result))
120 120
         {
121 121
             $this->info = $result;
122 122
         }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
         // if the URL contains any URL characters, and we
127 127
         // do not want them URL encoded, restore them.
128
-        if(!$this->encodeUTF && !empty($this->unicodeChars))
128
+        if (!$this->encodeUTF && !empty($this->unicodeChars))
129 129
         {
130 130
             $this->info = $this->restoreUnicodeChars($this->info);
131 131
         }
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      */
138 138
     private function fixBrokenURL() : void
139 139
     {
140
-        if(strpos($this->url, ':') === false) {
140
+        if (strpos($this->url, ':') === false) {
141 141
             return;
142 142
         }
143 143
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         // else, as unlikely as it may be.
146 146
         $parts = explode(':', $this->url);
147 147
 
148
-        while(strpos($parts[1], '///') === 0)
148
+        while (strpos($parts[1], '///') === 0)
149 149
         {
150 150
             $parts[1] = str_replace('///', '//', $parts[1]);
151 151
         }
@@ -164,13 +164,13 @@  discard block
 block discarded – undo
164 164
         
165 165
         $keep = array();
166 166
         
167
-        foreach($chars as $char)
167
+        foreach ($chars as $char)
168 168
         {
169
-            if(preg_match('/\p{L}/uix', $char))
169
+            if (preg_match('/\p{L}/uix', $char))
170 170
             {
171 171
                 $encoded = rawurlencode($char);
172 172
                 
173
-                if($encoded !== $char)
173
+                if ($encoded !== $char)
174 174
                 {
175 175
                     $this->unicodeChars[$encoded] = $char;
176 176
                     $char = $encoded;
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 
186 186
     protected function detectType() : bool
187 187
     {
188
-        foreach(self::$detectorClasses as $className)
188
+        foreach (self::$detectorClasses as $className)
189 189
         {
190 190
             $detector = ClassHelper::requireObjectInstanceOf(
191 191
                 BaseURLTypeDetector::class,
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
             // Use the adjusted data
198 198
             $this->info = $detector->getInfo();
199 199
 
200
-            if($detected) {
200
+            if ($detected) {
201 201
                 $this->isValid = true;
202 202
                 return true;
203 203
             }
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 
209 209
     protected function validate() : void
210 210
     {
211
-        foreach(self::$validatorClasses as $validatorClass)
211
+        foreach (self::$validatorClasses as $validatorClass)
212 212
         {
213 213
             $validator = ClassHelper::requireObjectInstanceOf(
214 214
                 BaseURLValidator::class,
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 
220 220
             $this->info = $validator->getInfo();
221 221
 
222
-            if($result !== true) {
222
+            if ($result !== true) {
223 223
                 $this->isValid = false;
224 224
                 return;
225 225
             }
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
     {
250 250
         $result = array();
251 251
         
252
-        foreach($subject as $key => $val)
252
+        foreach ($subject as $key => $val)
253 253
         {
254
-            if(is_array($val))
254
+            if (is_array($val))
255 255
             {
256 256
                 $val = $this->restoreUnicodeChars($val);
257 257
             }
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
     */
278 278
     protected function restoreUnicodeChar(string $string) : string
279 279
     {
280
-        if(strpos($string, '%') !== false)
280
+        if (strpos($string, '%') !== false)
281 281
         {
282 282
             return str_replace(array_keys($this->unicodeChars), array_values($this->unicodeChars), $string);
283 283
         }
Please login to merge, or discard this patch.