Passed
Push — master ( 689ec5...45f08c )
by Sebastian
05:26
created
src/StringBuilder.php 3 patches
Indentation   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -37,24 +37,24 @@  discard block
 block discarded – undo
37 37
 {
38 38
     public const ERROR_CALLABLE_THREW_ERROR = 99601;
39 39
 
40
-   /**
41
-    * @var string
42
-    */
40
+    /**
41
+     * @var string
42
+     */
43 43
     protected $separator = ' ';
44 44
 
45
-   /**
46
-    * @var string[]
47
-    */
45
+    /**
46
+     * @var string[]
47
+     */
48 48
     protected $strings = array();
49 49
 
50
-   /**
51
-    * @var string
52
-    */
50
+    /**
51
+     * @var string
52
+     */
53 53
     protected $mode = 'html';
54 54
 
55
-   /**
56
-    * @var string
57
-    */
55
+    /**
56
+     * @var string
57
+     */
58 58
     protected $noSpace = '§!§';
59 59
     
60 60
     public function __construct()
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
         
63 63
     }
64 64
     
65
-   /**
66
-    * Adds a subject as a string. Is ignored if empty.
67
-    * 
68
-    * @param string|number|Interface_Stringable|NULL $string
69
-    * @return $this
70
-    */
65
+    /**
66
+     * Adds a subject as a string. Is ignored if empty.
67
+     * 
68
+     * @param string|number|Interface_Stringable|NULL $string
69
+     * @return $this
70
+     */
71 71
     public function add($string) : StringBuilder
72 72
     {
73 73
         $string = (string)$string;
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
         return $this;
81 81
     }
82 82
     
83
-   /**
84
-    * Adds a string without appending an automatic space.
85
-    * 
86
-    * @param string|number|Interface_Stringable|NULL $string
87
-    * @return $this
88
-    */
83
+    /**
84
+     * Adds a string without appending an automatic space.
85
+     * 
86
+     * @param string|number|Interface_Stringable|NULL $string
87
+     * @return $this
88
+     */
89 89
     public function nospace($string) : StringBuilder
90 90
     {
91 91
         $flattened = (string)$string;
@@ -98,46 +98,46 @@  discard block
 block discarded – undo
98 98
         return $this;
99 99
     }
100 100
     
101
-   /**
102
-    * Adds raw HTML code. Does not add an automatic space.
103
-    * 
104
-    * @param string|number|Interface_Stringable $html
105
-    * @return $this
106
-    */
101
+    /**
102
+     * Adds raw HTML code. Does not add an automatic space.
103
+     * 
104
+     * @param string|number|Interface_Stringable $html
105
+     * @return $this
106
+     */
107 107
     public function html($html) : StringBuilder
108 108
     {
109 109
         return $this->nospace($html);
110 110
     }
111 111
     
112
-   /**
113
-    * Adds an unordered list with the specified items.
114
-    * 
115
-    * @param array<int,string|number|Interface_Stringable> $items
116
-    * @return $this
117
-    */
112
+    /**
113
+     * Adds an unordered list with the specified items.
114
+     * 
115
+     * @param array<int,string|number|Interface_Stringable> $items
116
+     * @return $this
117
+     */
118 118
     public function ul(array $items) : StringBuilder
119 119
     {
120 120
         return $this->list('ul', $items);
121 121
     }
122 122
     
123
-   /**
124
-    * Adds an ordered list with the specified items.
125
-    * 
126
-    * @param array<int,string|number|Interface_Stringable> $items
127
-    * @return $this
128
-    */
123
+    /**
124
+     * Adds an ordered list with the specified items.
125
+     * 
126
+     * @param array<int,string|number|Interface_Stringable> $items
127
+     * @return $this
128
+     */
129 129
     public function ol(array $items) : StringBuilder
130 130
     {
131 131
         return $this->list('ol', $items);
132 132
     }
133 133
     
134
-   /**
135
-    * Creates a list tag with the items list.
136
-    * 
137
-    * @param string $type The list type, `ol` or `ul`.
138
-    * @param array<int,string|number|Interface_Stringable> $items
139
-    * @return $this
140
-    */
134
+    /**
135
+     * Creates a list tag with the items list.
136
+     * 
137
+     * @param string $type The list type, `ol` or `ul`.
138
+     * @param array<int,string|number|Interface_Stringable> $items
139
+     * @return $this
140
+     */
141 141
     protected function list(string $type, array $items) : StringBuilder
142 142
     {
143 143
         return $this->html(sprintf(
@@ -147,13 +147,13 @@  discard block
 block discarded – undo
147 147
         ));
148 148
     }
149 149
     
150
-   /**
151
-    * Add a translated string.
152
-    * 
153
-    * @param string $format The native string to translate.
154
-    * @param array<int,mixed> $arguments The variables to inject into the translated string, if any.
155
-    * @return $this
156
-    */
150
+    /**
151
+     * Add a translated string.
152
+     * 
153
+     * @param string $format The native string to translate.
154
+     * @param array<int,mixed> $arguments The variables to inject into the translated string, if any.
155
+     * @return $this
156
+     */
157 157
     public function t(string $format, ...$arguments) : StringBuilder
158 158
     {
159 159
         if(!class_exists('\AppLocalize\Localization'))
@@ -206,36 +206,36 @@  discard block
 block discarded – undo
206 206
         return $this->add(ConvertHelper::duration2string($since));
207 207
     }
208 208
     
209
-   /**
210
-    * Adds HTML double quotes around the string.
211
-    * 
212
-    * @param string|number|Interface_Stringable $string
213
-    * @return $this
214
-    */
209
+    /**
210
+     * Adds HTML double quotes around the string.
211
+     * 
212
+     * @param string|number|Interface_Stringable $string
213
+     * @return $this
214
+     */
215 215
     public function quote($string) : StringBuilder
216 216
     {
217 217
         return $this->sf('&quot;%s&quot;', (string)$string);
218 218
     }
219 219
     
220
-   /**
221
-    * Adds a text that is meant as a reference to a UI element,
222
-    * like a menu item, button, etc.
223
-    * 
224
-    * @param string|number|Interface_Stringable $string 
225
-    * @return $this
226
-    */
220
+    /**
221
+     * Adds a text that is meant as a reference to a UI element,
222
+     * like a menu item, button, etc.
223
+     * 
224
+     * @param string|number|Interface_Stringable $string 
225
+     * @return $this
226
+     */
227 227
     public function reference($string) : StringBuilder
228 228
     {
229 229
         return $this->sf('"%s"', $string);
230 230
     }
231 231
 
232
-   /**
233
-    * Add a string using the `sprintf` method.
234
-    * 
235
-    * @param string $format The format string
236
-    * @param string|number|Interface_Stringable ...$arguments The variables to inject
237
-    * @return $this
238
-    */
232
+    /**
233
+     * Add a string using the `sprintf` method.
234
+     * 
235
+     * @param string $format The format string
236
+     * @param string|number|Interface_Stringable ...$arguments The variables to inject
237
+     * @return $this
238
+     */
239 239
     public function sf(string $format, ...$arguments) : StringBuilder
240 240
     {
241 241
         array_unshift($arguments, $format);
@@ -243,12 +243,12 @@  discard block
 block discarded – undo
243 243
         return $this->add(sprintf(...$arguments));
244 244
     }
245 245
     
246
-   /**
247
-    * Adds a bold string.
248
-    * 
249
-    * @param string|number|Interface_Stringable $string
250
-    * @return $this
251
-    */
246
+    /**
247
+     * Adds a bold string.
248
+     * 
249
+     * @param string|number|Interface_Stringable $string
250
+     * @return $this
251
+     */
252 252
     public function bold($string) : StringBuilder
253 253
     {
254 254
         return $this->sf(
@@ -257,15 +257,15 @@  discard block
 block discarded – undo
257 257
         );
258 258
     }
259 259
     
260
-   /**
261
-    * Adds an HTML `<br>` tag.
262
-    *
263
-    * Note: for adding a newline character instead,
264
-    * use {@see StringBuilder::eol()}.
265
-    * 
266
-    * @return $this
267
-    * @see StringBuilder::eol()
268
-    */
260
+    /**
261
+     * Adds an HTML `<br>` tag.
262
+     *
263
+     * Note: for adding a newline character instead,
264
+     * use {@see StringBuilder::eol()}.
265
+     * 
266
+     * @return $this
267
+     * @see StringBuilder::eol()
268
+     */
269 269
     public function nl() : StringBuilder
270 270
     {
271 271
         return $this->html('<br>');
@@ -282,42 +282,42 @@  discard block
 block discarded – undo
282 282
         return $this->nospace(PHP_EOL);
283 283
     }
284 284
     
285
-   /**
286
-    * Adds the current time, in the format <code>H:i:s</code>.
287
-    * 
288
-    * @return $this
289
-    */
285
+    /**
286
+     * Adds the current time, in the format <code>H:i:s</code>.
287
+     * 
288
+     * @return $this
289
+     */
290 290
     public function time() : StringBuilder
291 291
     {
292 292
         return $this->add(date('H:i:s'));
293 293
     }
294 294
     
295
-   /**
296
-    * Adds the "Note:" text.
297
-    * 
298
-    * @return $this
299
-    */
295
+    /**
296
+     * Adds the "Note:" text.
297
+     * 
298
+     * @return $this
299
+     */
300 300
     public function note() : StringBuilder
301 301
     {
302 302
         return $this->t('Note:');
303 303
     }
304 304
     
305
-   /**
306
-    * Like {@see StringBuilder::note()}, but as bold text.
307
-    * 
308
-    * @return $this
309
-    */
305
+    /**
306
+     * Like {@see StringBuilder::note()}, but as bold text.
307
+     * 
308
+     * @return $this
309
+     */
310 310
     public function noteBold() : StringBuilder
311 311
     {
312 312
         return $this->bold(sb()->note());
313 313
     }
314 314
     
315
-   /**
316
-    * Adds the "Hint:" text.
317
-    * 
318
-    * @return $this
319
-    * @see StringBuilder::hintBold()
320
-    */
315
+    /**
316
+     * Adds the "Hint:" text.
317
+     * 
318
+     * @return $this
319
+     * @see StringBuilder::hintBold()
320
+     */
321 321
     public function hint() : StringBuilder
322 322
     {
323 323
         return $this->t('Hint:');
@@ -333,12 +333,12 @@  discard block
 block discarded – undo
333 333
         return $this->bold(sb()->hint());
334 334
     }
335 335
 
336
-   /**
337
-    * Adds two linebreaks.
338
-    *
339
-    * @param StringBuilder_Interface|string|NULL $content
340
-    * @return $this
341
-    */
336
+    /**
337
+     * Adds two linebreaks.
338
+     *
339
+     * @param StringBuilder_Interface|string|NULL $content
340
+     * @return $this
341
+     */
342 342
     public function para($content=null) : StringBuilder
343 343
     {
344 344
         if($content !== null) {
@@ -390,12 +390,12 @@  discard block
 block discarded – undo
390 390
         return $this->html(HTMLTag::create('a')->renderClose());
391 391
     }
392 392
 
393
-   /**
394
-    * Wraps the string in a `code` tag.
395
-    * 
396
-    * @param string|number|Interface_Stringable $string
397
-    * @return $this
398
-    */
393
+    /**
394
+     * Wraps the string in a `code` tag.
395
+     * 
396
+     * @param string|number|Interface_Stringable $string
397
+     * @return $this
398
+     */
399 399
     public function code($string) : StringBuilder
400 400
     {
401 401
         return $this->sf(
@@ -404,24 +404,24 @@  discard block
 block discarded – undo
404 404
         );
405 405
     }
406 406
     
407
-   /**
408
-    * Wraps the string in a `pre` tag.
409
-    * 
410
-    * @param string|number|Interface_Stringable $string
411
-    * @return $this
412
-    */
407
+    /**
408
+     * Wraps the string in a `pre` tag.
409
+     * 
410
+     * @param string|number|Interface_Stringable $string
411
+     * @return $this
412
+     */
413 413
     public function pre($string) : StringBuilder
414 414
     {
415 415
         return $this->sf('<pre>%s</pre>', (string)$string);
416 416
     }
417 417
     
418
-   /**
419
-    * Wraps the text in a `span` tag with the specified classes.
420
-    * 
421
-    * @param string|number|Interface_Stringable $string
422
-    * @param string|string[] $classes
423
-    * @return $this
424
-    */
418
+    /**
419
+     * Wraps the text in a `span` tag with the specified classes.
420
+     * 
421
+     * @param string|number|Interface_Stringable $string
422
+     * @param string|string[] $classes
423
+     * @return $this
424
+     */
425 425
     public function spanned($string, $classes) : StringBuilder
426 426
     {
427 427
         if(!is_array($classes)) 
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     {
73 73
         $string = (string)$string;
74 74
         
75
-        if(!empty($string)) 
75
+        if (!empty($string)) 
76 76
         {
77 77
             $this->strings[] = $string;
78 78
         }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     {
91 91
         $flattened = (string)$string;
92 92
 
93
-        if($flattened !== "")
93
+        if ($flattened !== "")
94 94
         {
95 95
             $this->add($this->noSpace.$flattened);
96 96
         }
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     */
157 157
     public function t(string $format, ...$arguments) : StringBuilder
158 158
     {
159
-        if(!class_exists('\AppLocalize\Localization'))
159
+        if (!class_exists('\AppLocalize\Localization'))
160 160
         {
161 161
             array_unshift($arguments, $format);
162 162
             return $this->sf(...$arguments);
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
     {
182 182
         unset($context); // Only used by the localization parser.
183 183
 
184
-        if(!class_exists('\AppLocalize\Localization'))
184
+        if (!class_exists('\AppLocalize\Localization'))
185 185
         {
186 186
             array_unshift($arguments, $format);
187 187
             return $this->sf(...$arguments);
@@ -339,9 +339,9 @@  discard block
 block discarded – undo
339 339
     * @param StringBuilder_Interface|string|NULL $content
340 340
     * @return $this
341 341
     */
342
-    public function para($content=null) : StringBuilder
342
+    public function para($content = null) : StringBuilder
343 343
     {
344
-        if($content !== null) {
344
+        if ($content !== null) {
345 345
             return $this->html('<p>')->nospace($content)->html('</p>');
346 346
         }
347 347
 
@@ -357,21 +357,21 @@  discard block
 block discarded – undo
357 357
      * @param AttributeCollection|null $attributes
358 358
      * @return $this
359 359
      */
360
-    public function link(string $label, string $url, bool $newTab=false, ?AttributeCollection $attributes=null) : StringBuilder
360
+    public function link(string $label, string $url, bool $newTab = false, ?AttributeCollection $attributes = null) : StringBuilder
361 361
     {
362 362
         return $this->add($this->createLink($label, $url, $newTab, $attributes));
363 363
     }
364 364
 
365
-    private function createLink(string $label, string $url, bool $newTab=false, ?AttributeCollection $attributes=null) : HTMLTag
365
+    private function createLink(string $label, string $url, bool $newTab = false, ?AttributeCollection $attributes = null) : HTMLTag
366 366
     {
367
-        if($attributes === null)
367
+        if ($attributes === null)
368 368
         {
369 369
             $attributes = AttributeCollection::create();
370 370
         }
371 371
 
372 372
         $attributes->href($url);
373 373
 
374
-        if($newTab)
374
+        if ($newTab)
375 375
         {
376 376
             $attributes->target();
377 377
         }
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
             ->addText($label);
381 381
     }
382 382
 
383
-    public function linkOpen(string $url, bool $newTab=false, ?AttributeCollection $attributes=null) : StringBuilder
383
+    public function linkOpen(string $url, bool $newTab = false, ?AttributeCollection $attributes = null) : StringBuilder
384 384
     {
385 385
         return $this->html($this->createLink('', $url, $newTab, $attributes)->renderOpen());
386 386
     }
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
     */
425 425
     public function spanned($string, $classes) : StringBuilder
426 426
     {
427
-        if(!is_array($classes)) 
427
+        if (!is_array($classes)) 
428 428
         {
429 429
             $classes = array((string)$classes);
430 430
         }
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
      */
451 451
     public function ifTrue(bool $condition, $content) : StringBuilder
452 452
     {
453
-        if($condition === true)
453
+        if ($condition === true)
454 454
         {
455 455
             $this->add($this->renderContent($content));
456 456
         }
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
      */
473 473
     public function ifFalse(bool $condition, $string) : StringBuilder
474 474
     {
475
-        if($condition === false)
475
+        if ($condition === false)
476 476
         {
477 477
             $this->add($this->renderContent($string));
478 478
         }
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
      */
557 557
     public function ifOr(bool $condition, $ifTrue, $ifFalse) : StringBuilder
558 558
     {
559
-        if($condition === true)
559
+        if ($condition === true)
560 560
         {
561 561
             return $this->add($this->renderContent($ifTrue));
562 562
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -500,8 +500,7 @@
 block discarded – undo
500 500
         try
501 501
         {
502 502
             return $content();
503
-        }
504
-        catch (Exception $e)
503
+        } catch (Exception $e)
505 504
         {
506 505
             throw new StringBuilder_Exception(
507 506
                 'The callable has thrown an error.',
Please login to merge, or discard this patch.
src/AttributeCollection.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public function setAttributes(array $attributes) : AttributeCollection
65 65
     {
66
-        foreach($attributes as $name => $value)
66
+        foreach ($attributes as $name => $value)
67 67
         {
68 68
             $this->attr($name, $value);
69 69
         }
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         return $this;
72 72
     }
73 73
 
74
-    public function getAttribute(string $name, string $default='') : string
74
+    public function getAttribute(string $name, string $default = '') : string
75 75
     {
76 76
         return $this->attributes[$name] ?? $default;
77 77
     }
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
      * @param array<string,string|number> $attributes
81 81
      * @return AttributeCollection
82 82
      */
83
-    public static function create(array $attributes=array()) : AttributeCollection
83
+    public static function create(array $attributes = array()) : AttributeCollection
84 84
     {
85 85
         return new AttributeCollection($attributes);
86 86
     }
87 87
 
88
-    public function prop(string $name, bool $enabled=true) : AttributeCollection
88
+    public function prop(string $name, bool $enabled = true) : AttributeCollection
89 89
     {
90
-        if($enabled)
90
+        if ($enabled)
91 91
         {
92 92
             return $this->attr($name, $name);
93 93
         }
@@ -104,18 +104,18 @@  discard block
 block discarded – undo
104 104
     {
105 105
         $string = Filtering::value2string($value);
106 106
 
107
-        if($name === 'class')
107
+        if ($name === 'class')
108 108
         {
109 109
             return $this->addClasses(ConvertHelper::explodeTrim(' ', $string));
110 110
         }
111 111
 
112
-        if($name === 'style')
112
+        if ($name === 'style')
113 113
         {
114 114
             $this->styles->parseStylesString($string);
115 115
             return $this;
116 116
         }
117 117
 
118
-        if($string !== '')
118
+        if ($string !== '')
119 119
         {
120 120
             $this->attributes[$name] = $string;
121 121
         }
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     {
135 135
         $this->attr($name, $value);
136 136
 
137
-        if(isset($this->attributes[$name]))
137
+        if (isset($this->attributes[$name]))
138 138
         {
139 139
             $this->attributes[$name] = Filtering::quotes($this->attributes[$name]);
140 140
         }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
     public function remove(string $name) : AttributeCollection
151 151
     {
152
-        if(isset($this->attributes[$name]))
152
+        if (isset($this->attributes[$name]))
153 153
         {
154 154
             unset($this->attributes[$name]);
155 155
         }
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
     private function getRenderer() : AttributesRenderer
178 178
     {
179
-        if(!isset($this->renderer))
179
+        if (!isset($this->renderer))
180 180
         {
181 181
             $this->renderer = new AttributesRenderer($this);
182 182
         }
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 
238 238
     public const TARGET_BLANK = '_blank';
239 239
 
240
-    public function target(string $value=self::TARGET_BLANK) : AttributeCollection
240
+    public function target(string $value = self::TARGET_BLANK) : AttributeCollection
241 241
     {
242 242
         return $this->attr('target', $value);
243 243
     }
Please login to merge, or discard this patch.
src/StyleCollection.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     /**
34 34
      * @param array<string,string|number|NumberInfo|Interface_Stringable|NULL> $styles
35 35
      */
36
-    public function __construct(array $styles=array())
36
+    public function __construct(array $styles = array())
37 37
     {
38 38
         $this->options = new StyleOptions();
39 39
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      * @param array<string,string|number|NumberInfo|Interface_Stringable|NULL> $styles
45 45
      * @return StyleCollection
46 46
      */
47
-    public static function create(array $styles=array()) : StyleCollection
47
+    public static function create(array $styles = array()) : StyleCollection
48 48
     {
49 49
         return new StyleCollection($styles);
50 50
     }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     {
69 69
         $lines = explode(';', $string);
70 70
 
71
-        foreach($lines as $line)
71
+        foreach ($lines as $line)
72 72
         {
73 73
             $parts = explode(':', $line);
74 74
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function setStyles(array $styles) : StyleCollection
91 91
     {
92
-        foreach($styles as $name => $value)
92
+        foreach ($styles as $name => $value)
93 93
         {
94 94
             $this->styleAuto($name, $value);
95 95
         }
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
      * @param bool $important
106 106
      * @return $this
107 107
      */
108
-    public function style(string $name, string $value, bool $important=false) : StyleCollection
108
+    public function style(string $name, string $value, bool $important = false) : StyleCollection
109 109
     {
110
-        if($value === '')
110
+        if ($value === '')
111 111
         {
112 112
             return $this;
113 113
         }
114 114
 
115
-        if($important && stripos($value, '!important') === false)
115
+        if ($important && stripos($value, '!important') === false)
116 116
         {
117 117
             $value .= ' !important';
118 118
         }
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
      * @param bool $important
131 131
      * @return $this
132 132
      */
133
-    public function styleAuto(string $name, $value, bool $important=false) : StyleCollection
133
+    public function styleAuto(string $name, $value, bool $important = false) : StyleCollection
134 134
     {
135
-        if($value instanceof NumberInfo)
135
+        if ($value instanceof NumberInfo)
136 136
         {
137 137
             return $this->style($name, $value->toCSS(), $important);
138 138
         }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         return $this->style($name, (string)$value, $important);
141 141
     }
142 142
 
143
-    public function stylePX(string $name, int $px, bool $important=false) : StyleCollection
143
+    public function stylePX(string $name, int $px, bool $important = false) : StyleCollection
144 144
     {
145 145
         return $this->style($name, $px.'px', $important);
146 146
     }
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      * @param bool $important
170 170
      * @return $this
171 171
      */
172
-    public function styleParseNumber(string $name, $value, bool $important=false) : StyleCollection
172
+    public function styleParseNumber(string $name, $value, bool $important = false) : StyleCollection
173 173
     {
174 174
         return $this->styleNumber($name, parseNumber($value), $important);
175 175
     }
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
      * @param bool $important
183 183
      * @return $this
184 184
      */
185
-    public function styleNumber(string $name, NumberInfo $info, bool $important=false) : StyleCollection
185
+    public function styleNumber(string $name, NumberInfo $info, bool $important = false) : StyleCollection
186 186
     {
187 187
         $this->style($name, $info->toCSS(), $important);
188 188
         return $this;
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 
191 191
     public function remove(string $name) : StyleCollection
192 192
     {
193
-        if(isset($this->styles[$name]))
193
+        if (isset($this->styles[$name]))
194 194
         {
195 195
             unset($this->styles[$name]);
196 196
         }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     {
227 227
         $all = self::create();
228 228
 
229
-        foreach($collections as $collection)
229
+        foreach ($collections as $collection)
230 230
         {
231 231
             $all->mergeWith($collection);
232 232
         }
Please login to merge, or discard this patch.
src/RGBAColor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -339,7 +339,7 @@
 block discarded – undo
339 339
      */
340 340
     private function requireValidComponent(string $name) : void
341 341
     {
342
-        if(in_array($name, self::COLOR_COMPONENTS))
342
+        if (in_array($name, self::COLOR_COMPONENTS))
343 343
         {
344 344
             return;
345 345
         }
Please login to merge, or discard this patch.
src/Traits/Attributable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
      * @param bool $enabled
53 53
      * @return $this
54 54
      */
55
-    public function prop(string $name, bool $enabled=true)
55
+    public function prop(string $name, bool $enabled = true)
56 56
     {
57 57
         $this->getAttributes()->prop($name, $enabled);
58 58
         return $this;
Please login to merge, or discard this patch.
src/AttributeCollection/Filtering.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,11 +56,11 @@
 block discarded – undo
56 56
      */
57 57
     public static function value2string($value) : string
58 58
     {
59
-        if($value === true)
59
+        if ($value === true)
60 60
         {
61 61
             return 'true';
62 62
         }
63
-        else if($value === false)
63
+        else if ($value === false)
64 64
         {
65 65
             return 'false';
66 66
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,8 +59,7 @@
 block discarded – undo
59 59
         if($value === true)
60 60
         {
61 61
             return 'true';
62
-        }
63
-        else if($value === false)
62
+        } else if($value === false)
64 63
         {
65 64
             return 'false';
66 65
         }
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 === '')
34
+            if ($value === '')
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/StyleCollection/StylesRenderer.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
     public function render() : string
28 28
     {
29
-        if($this->collection->hasStyles())
29
+        if ($this->collection->hasStyles())
30 30
         {
31 31
             return implode(
32 32
                 $this->resolveSeparator(),
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
     private function resolveSuffix() : string
41 41
     {
42
-        if($this->options->isTrailingSemicolonEnabled())
42
+        if ($this->options->isTrailingSemicolonEnabled())
43 43
         {
44 44
             return ';';
45 45
         }
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
     private function resolveSeparator() : string
51 51
     {
52
-        if($this->options->isNewlineEnabled())
52
+        if ($this->options->isNewlineEnabled())
53 53
         {
54 54
             return ';'.PHP_EOL;
55 55
         }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     {
62 62
         $indentLevel = $this->options->getIndentLevel();
63 63
 
64
-        if($indentLevel > 0)
64
+        if ($indentLevel > 0)
65 65
         {
66 66
             return str_repeat($this->options->getIndentChar(), $indentLevel);
67 67
         }
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
     private function resolveValueSpace() : string
73 73
     {
74
-        if($this->options->isSpaceBeforeValueEnabled())
74
+        if ($this->options->isSpaceBeforeValueEnabled())
75 75
         {
76 76
             return ' ';
77 77
         }
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
         $indent = $this->resolveIndent();
87 87
         $valueSpace = $this->resolveValueSpace();
88 88
 
89
-        if($this->options->isSortingEnabled())
89
+        if ($this->options->isSortingEnabled())
90 90
         {
91 91
             ksort($styles);
92 92
         }
93 93
 
94
-        foreach($styles as $name => $value)
94
+        foreach ($styles as $name => $value)
95 95
         {
96 96
             $lines[] = sprintf(
97 97
                 '%s%s:%s%s',
Please login to merge, or discard this patch.
src/StyleCollection/StyleOptions.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
         );
32 32
     }
33 33
 
34
-    public function enableSorting(bool $enabled=true) : StyleOptions
34
+    public function enableSorting(bool $enabled = true) : StyleOptions
35 35
     {
36 36
         return $this->setOption(self::OPTION_SORTING, $enabled);
37 37
     }
38 38
 
39
-    public function enableSpaceBeforeValue(bool $enabled=true) : StyleOptions
39
+    public function enableSpaceBeforeValue(bool $enabled = true) : StyleOptions
40 40
     {
41 41
         return $this->setOption(self::OPTION_SPACE_BEFORE_VALUE, $enabled);
42 42
     }
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      * @param bool $enabled
46 46
      * @return $this
47 47
      */
48
-    public function enableNewline(bool $enabled=true) : StyleOptions
48
+    public function enableNewline(bool $enabled = true) : StyleOptions
49 49
     {
50 50
         return $this->setOption(self::OPTION_NEWLINES, $enabled);
51 51
     }
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
         return $this->getStringOption(self::OPTION_INDENT_CHAR);
119 119
     }
120 120
 
121
-    public function enableTrailingSemicolon(bool $enabled=true) : StyleOptions
121
+    public function enableTrailingSemicolon(bool $enabled = true) : StyleOptions
122 122
     {
123 123
         return $this->setOption(self::OPTION_TRAILING_SEMICOLON, $enabled);
124 124
     }
Please login to merge, or discard this patch.