@@ -500,8 +500,7 @@ |
||
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.', |
@@ -37,19 +37,19 @@ discard block |
||
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 $noSeparator = '§!§'; |
54 | 54 | |
55 | 55 | public function __construct() |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | return $this; |
64 | 64 | } |
65 | 65 | |
66 | - /** |
|
67 | - * Adds a subject as a string. Is ignored if empty. |
|
68 | - * |
|
69 | - * @param string|number|Interface_Stringable|NULL $string |
|
70 | - * @return $this |
|
71 | - */ |
|
66 | + /** |
|
67 | + * Adds a subject as a string. Is ignored if empty. |
|
68 | + * |
|
69 | + * @param string|number|Interface_Stringable|NULL $string |
|
70 | + * @return $this |
|
71 | + */ |
|
72 | 72 | public function add($string) : StringBuilder |
73 | 73 | { |
74 | 74 | $string = (string)$string; |
@@ -81,12 +81,12 @@ discard block |
||
81 | 81 | return $this; |
82 | 82 | } |
83 | 83 | |
84 | - /** |
|
85 | - * Adds a string without appending an automatic space. |
|
86 | - * |
|
87 | - * @param string|number|Interface_Stringable|NULL $string |
|
88 | - * @return $this |
|
89 | - */ |
|
84 | + /** |
|
85 | + * Adds a string without appending an automatic space. |
|
86 | + * |
|
87 | + * @param string|number|Interface_Stringable|NULL $string |
|
88 | + * @return $this |
|
89 | + */ |
|
90 | 90 | public function nospace($string) : StringBuilder |
91 | 91 | { |
92 | 92 | $flattened = (string)$string; |
@@ -99,46 +99,46 @@ discard block |
||
99 | 99 | return $this; |
100 | 100 | } |
101 | 101 | |
102 | - /** |
|
103 | - * Adds raw HTML code. Does not add an automatic space. |
|
104 | - * |
|
105 | - * @param string|number|Interface_Stringable $html |
|
106 | - * @return $this |
|
107 | - */ |
|
102 | + /** |
|
103 | + * Adds raw HTML code. Does not add an automatic space. |
|
104 | + * |
|
105 | + * @param string|number|Interface_Stringable $html |
|
106 | + * @return $this |
|
107 | + */ |
|
108 | 108 | public function html($html) : StringBuilder |
109 | 109 | { |
110 | 110 | return $this->nospace($html); |
111 | 111 | } |
112 | 112 | |
113 | - /** |
|
114 | - * Adds an unordered list with the specified items. |
|
115 | - * |
|
116 | - * @param array<int,string|number|Interface_Stringable> $items |
|
117 | - * @return $this |
|
118 | - */ |
|
113 | + /** |
|
114 | + * Adds an unordered list with the specified items. |
|
115 | + * |
|
116 | + * @param array<int,string|number|Interface_Stringable> $items |
|
117 | + * @return $this |
|
118 | + */ |
|
119 | 119 | public function ul(array $items) : StringBuilder |
120 | 120 | { |
121 | 121 | return $this->list('ul', $items); |
122 | 122 | } |
123 | 123 | |
124 | - /** |
|
125 | - * Adds an ordered list with the specified items. |
|
126 | - * |
|
127 | - * @param array<int,string|number|Interface_Stringable> $items |
|
128 | - * @return $this |
|
129 | - */ |
|
124 | + /** |
|
125 | + * Adds an ordered list with the specified items. |
|
126 | + * |
|
127 | + * @param array<int,string|number|Interface_Stringable> $items |
|
128 | + * @return $this |
|
129 | + */ |
|
130 | 130 | public function ol(array $items) : StringBuilder |
131 | 131 | { |
132 | 132 | return $this->list('ol', $items); |
133 | 133 | } |
134 | 134 | |
135 | - /** |
|
136 | - * Creates a list tag with the items list. |
|
137 | - * |
|
138 | - * @param string $type The list type, `ol` or `ul`. |
|
139 | - * @param array<int,string|number|Interface_Stringable> $items |
|
140 | - * @return $this |
|
141 | - */ |
|
135 | + /** |
|
136 | + * Creates a list tag with the items list. |
|
137 | + * |
|
138 | + * @param string $type The list type, `ol` or `ul`. |
|
139 | + * @param array<int,string|number|Interface_Stringable> $items |
|
140 | + * @return $this |
|
141 | + */ |
|
142 | 142 | protected function list(string $type, array $items) : StringBuilder |
143 | 143 | { |
144 | 144 | return $this->html(sprintf( |
@@ -148,13 +148,13 @@ discard block |
||
148 | 148 | )); |
149 | 149 | } |
150 | 150 | |
151 | - /** |
|
152 | - * Add a translated string. |
|
153 | - * |
|
154 | - * @param string $format The native string to translate. |
|
155 | - * @param array<int,mixed> $arguments The variables to inject into the translated string, if any. |
|
156 | - * @return $this |
|
157 | - */ |
|
151 | + /** |
|
152 | + * Add a translated string. |
|
153 | + * |
|
154 | + * @param string $format The native string to translate. |
|
155 | + * @param array<int,mixed> $arguments The variables to inject into the translated string, if any. |
|
156 | + * @return $this |
|
157 | + */ |
|
158 | 158 | public function t(string $format, ...$arguments) : StringBuilder |
159 | 159 | { |
160 | 160 | if(!class_exists('\AppLocalize\Localization')) |
@@ -207,36 +207,36 @@ discard block |
||
207 | 207 | return $this->add(ConvertHelper::duration2string($since)); |
208 | 208 | } |
209 | 209 | |
210 | - /** |
|
211 | - * Adds HTML double quotes around the string. |
|
212 | - * |
|
213 | - * @param string|number|Interface_Stringable $string |
|
214 | - * @return $this |
|
215 | - */ |
|
210 | + /** |
|
211 | + * Adds HTML double quotes around the string. |
|
212 | + * |
|
213 | + * @param string|number|Interface_Stringable $string |
|
214 | + * @return $this |
|
215 | + */ |
|
216 | 216 | public function quote($string) : StringBuilder |
217 | 217 | { |
218 | 218 | return $this->sf('"%s"', (string)$string); |
219 | 219 | } |
220 | 220 | |
221 | - /** |
|
222 | - * Adds a text that is meant as a reference to a UI element, |
|
223 | - * like a menu item, button, etc. |
|
224 | - * |
|
225 | - * @param string|number|Interface_Stringable $string |
|
226 | - * @return $this |
|
227 | - */ |
|
221 | + /** |
|
222 | + * Adds a text that is meant as a reference to a UI element, |
|
223 | + * like a menu item, button, etc. |
|
224 | + * |
|
225 | + * @param string|number|Interface_Stringable $string |
|
226 | + * @return $this |
|
227 | + */ |
|
228 | 228 | public function reference($string) : StringBuilder |
229 | 229 | { |
230 | 230 | return $this->sf('"%s"', $string); |
231 | 231 | } |
232 | 232 | |
233 | - /** |
|
234 | - * Add a string using the `sprintf` method. |
|
235 | - * |
|
236 | - * @param string $format The format string |
|
237 | - * @param string|number|Interface_Stringable ...$arguments The variables to inject |
|
238 | - * @return $this |
|
239 | - */ |
|
233 | + /** |
|
234 | + * Add a string using the `sprintf` method. |
|
235 | + * |
|
236 | + * @param string $format The format string |
|
237 | + * @param string|number|Interface_Stringable ...$arguments The variables to inject |
|
238 | + * @return $this |
|
239 | + */ |
|
240 | 240 | public function sf(string $format, ...$arguments) : StringBuilder |
241 | 241 | { |
242 | 242 | array_unshift($arguments, $format); |
@@ -244,12 +244,12 @@ discard block |
||
244 | 244 | return $this->add(sprintf(...$arguments)); |
245 | 245 | } |
246 | 246 | |
247 | - /** |
|
248 | - * Adds a bold string. |
|
249 | - * |
|
250 | - * @param string|number|Interface_Stringable $string |
|
251 | - * @return $this |
|
252 | - */ |
|
247 | + /** |
|
248 | + * Adds a bold string. |
|
249 | + * |
|
250 | + * @param string|number|Interface_Stringable $string |
|
251 | + * @return $this |
|
252 | + */ |
|
253 | 253 | public function bold($string) : StringBuilder |
254 | 254 | { |
255 | 255 | return $this->sf( |
@@ -258,15 +258,15 @@ discard block |
||
258 | 258 | ); |
259 | 259 | } |
260 | 260 | |
261 | - /** |
|
262 | - * Adds an HTML `<br>` tag. |
|
263 | - * |
|
264 | - * Note: for adding a newline character instead, |
|
265 | - * use {@see StringBuilder::eol()}. |
|
266 | - * |
|
267 | - * @return $this |
|
268 | - * @see StringBuilder::eol() |
|
269 | - */ |
|
261 | + /** |
|
262 | + * Adds an HTML `<br>` tag. |
|
263 | + * |
|
264 | + * Note: for adding a newline character instead, |
|
265 | + * use {@see StringBuilder::eol()}. |
|
266 | + * |
|
267 | + * @return $this |
|
268 | + * @see StringBuilder::eol() |
|
269 | + */ |
|
270 | 270 | public function nl() : StringBuilder |
271 | 271 | { |
272 | 272 | return $this->html('<br>'); |
@@ -283,42 +283,42 @@ discard block |
||
283 | 283 | return $this->nospace(PHP_EOL); |
284 | 284 | } |
285 | 285 | |
286 | - /** |
|
287 | - * Adds the current time, in the format <code>H:i:s</code>. |
|
288 | - * |
|
289 | - * @return $this |
|
290 | - */ |
|
286 | + /** |
|
287 | + * Adds the current time, in the format <code>H:i:s</code>. |
|
288 | + * |
|
289 | + * @return $this |
|
290 | + */ |
|
291 | 291 | public function time() : StringBuilder |
292 | 292 | { |
293 | 293 | return $this->add(date('H:i:s')); |
294 | 294 | } |
295 | 295 | |
296 | - /** |
|
297 | - * Adds the "Note:" text. |
|
298 | - * |
|
299 | - * @return $this |
|
300 | - */ |
|
296 | + /** |
|
297 | + * Adds the "Note:" text. |
|
298 | + * |
|
299 | + * @return $this |
|
300 | + */ |
|
301 | 301 | public function note() : StringBuilder |
302 | 302 | { |
303 | 303 | return $this->t('Note:'); |
304 | 304 | } |
305 | 305 | |
306 | - /** |
|
307 | - * Like {@see StringBuilder::note()}, but as bold text. |
|
308 | - * |
|
309 | - * @return $this |
|
310 | - */ |
|
306 | + /** |
|
307 | + * Like {@see StringBuilder::note()}, but as bold text. |
|
308 | + * |
|
309 | + * @return $this |
|
310 | + */ |
|
311 | 311 | public function noteBold() : StringBuilder |
312 | 312 | { |
313 | 313 | return $this->bold(sb()->note()); |
314 | 314 | } |
315 | 315 | |
316 | - /** |
|
317 | - * Adds the "Hint:" text. |
|
318 | - * |
|
319 | - * @return $this |
|
320 | - * @see StringBuilder::hintBold() |
|
321 | - */ |
|
316 | + /** |
|
317 | + * Adds the "Hint:" text. |
|
318 | + * |
|
319 | + * @return $this |
|
320 | + * @see StringBuilder::hintBold() |
|
321 | + */ |
|
322 | 322 | public function hint() : StringBuilder |
323 | 323 | { |
324 | 324 | return $this->t('Hint:'); |
@@ -334,12 +334,12 @@ discard block |
||
334 | 334 | return $this->bold(sb()->hint()); |
335 | 335 | } |
336 | 336 | |
337 | - /** |
|
338 | - * Adds two linebreaks. |
|
339 | - * |
|
340 | - * @param StringBuilder_Interface|string|NULL $content |
|
341 | - * @return $this |
|
342 | - */ |
|
337 | + /** |
|
338 | + * Adds two linebreaks. |
|
339 | + * |
|
340 | + * @param StringBuilder_Interface|string|NULL $content |
|
341 | + * @return $this |
|
342 | + */ |
|
343 | 343 | public function para($content=null) : StringBuilder |
344 | 344 | { |
345 | 345 | if($content !== null) { |
@@ -391,12 +391,12 @@ discard block |
||
391 | 391 | return $this->html(HTMLTag::create('a')->renderClose()); |
392 | 392 | } |
393 | 393 | |
394 | - /** |
|
395 | - * Wraps the string in a `code` tag. |
|
396 | - * |
|
397 | - * @param string|number|Interface_Stringable $string |
|
398 | - * @return $this |
|
399 | - */ |
|
394 | + /** |
|
395 | + * Wraps the string in a `code` tag. |
|
396 | + * |
|
397 | + * @param string|number|Interface_Stringable $string |
|
398 | + * @return $this |
|
399 | + */ |
|
400 | 400 | public function code($string) : StringBuilder |
401 | 401 | { |
402 | 402 | return $this->sf( |
@@ -405,24 +405,24 @@ discard block |
||
405 | 405 | ); |
406 | 406 | } |
407 | 407 | |
408 | - /** |
|
409 | - * Wraps the string in a `pre` tag. |
|
410 | - * |
|
411 | - * @param string|number|Interface_Stringable $string |
|
412 | - * @return $this |
|
413 | - */ |
|
408 | + /** |
|
409 | + * Wraps the string in a `pre` tag. |
|
410 | + * |
|
411 | + * @param string|number|Interface_Stringable $string |
|
412 | + * @return $this |
|
413 | + */ |
|
414 | 414 | public function pre($string) : StringBuilder |
415 | 415 | { |
416 | 416 | return $this->sf('<pre>%s</pre>', (string)$string); |
417 | 417 | } |
418 | 418 | |
419 | - /** |
|
420 | - * Wraps the text in a `span` tag with the specified classes. |
|
421 | - * |
|
422 | - * @param string|number|Interface_Stringable $string |
|
423 | - * @param string|string[] $classes |
|
424 | - * @return $this |
|
425 | - */ |
|
419 | + /** |
|
420 | + * Wraps the text in a `span` tag with the specified classes. |
|
421 | + * |
|
422 | + * @param string|number|Interface_Stringable $string |
|
423 | + * @param string|string[] $classes |
|
424 | + * @return $this |
|
425 | + */ |
|
426 | 426 | public function spanned($string, $classes) : StringBuilder |
427 | 427 | { |
428 | 428 | if(!is_array($classes)) |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | $string = (string)$string; |
75 | 75 | |
76 | - if(!empty($string)) |
|
76 | + if (!empty($string)) |
|
77 | 77 | { |
78 | 78 | $this->strings[] = $string; |
79 | 79 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | { |
92 | 92 | $flattened = (string)$string; |
93 | 93 | |
94 | - if($flattened !== "") |
|
94 | + if ($flattened !== "") |
|
95 | 95 | { |
96 | 96 | $this->add($this->noSeparator.$flattened); |
97 | 97 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function t(string $format, ...$arguments) : StringBuilder |
159 | 159 | { |
160 | - if(!class_exists('\AppLocalize\Localization')) |
|
160 | + if (!class_exists('\AppLocalize\Localization')) |
|
161 | 161 | { |
162 | 162 | array_unshift($arguments, $format); |
163 | 163 | return $this->sf(...$arguments); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | { |
183 | 183 | unset($context); // Only used by the localization parser. |
184 | 184 | |
185 | - if(!class_exists('\AppLocalize\Localization')) |
|
185 | + if (!class_exists('\AppLocalize\Localization')) |
|
186 | 186 | { |
187 | 187 | array_unshift($arguments, $format); |
188 | 188 | return $this->sf(...$arguments); |
@@ -340,9 +340,9 @@ discard block |
||
340 | 340 | * @param StringBuilder_Interface|string|NULL $content |
341 | 341 | * @return $this |
342 | 342 | */ |
343 | - public function para($content=null) : StringBuilder |
|
343 | + public function para($content = null) : StringBuilder |
|
344 | 344 | { |
345 | - if($content !== null) { |
|
345 | + if ($content !== null) { |
|
346 | 346 | return $this->html('<p>')->nospace($content)->html('</p>'); |
347 | 347 | } |
348 | 348 | |
@@ -358,21 +358,21 @@ discard block |
||
358 | 358 | * @param AttributeCollection|null $attributes |
359 | 359 | * @return $this |
360 | 360 | */ |
361 | - public function link(string $label, string $url, bool $newTab=false, ?AttributeCollection $attributes=null) : StringBuilder |
|
361 | + public function link(string $label, string $url, bool $newTab = false, ?AttributeCollection $attributes = null) : StringBuilder |
|
362 | 362 | { |
363 | 363 | return $this->add($this->createLink($label, $url, $newTab, $attributes)); |
364 | 364 | } |
365 | 365 | |
366 | - private function createLink(string $label, string $url, bool $newTab=false, ?AttributeCollection $attributes=null) : HTMLTag |
|
366 | + private function createLink(string $label, string $url, bool $newTab = false, ?AttributeCollection $attributes = null) : HTMLTag |
|
367 | 367 | { |
368 | - if($attributes === null) |
|
368 | + if ($attributes === null) |
|
369 | 369 | { |
370 | 370 | $attributes = AttributeCollection::create(); |
371 | 371 | } |
372 | 372 | |
373 | 373 | $attributes->href($url); |
374 | 374 | |
375 | - if($newTab) |
|
375 | + if ($newTab) |
|
376 | 376 | { |
377 | 377 | $attributes->target(); |
378 | 378 | } |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | ->addText($label); |
382 | 382 | } |
383 | 383 | |
384 | - public function linkOpen(string $url, bool $newTab=false, ?AttributeCollection $attributes=null) : StringBuilder |
|
384 | + public function linkOpen(string $url, bool $newTab = false, ?AttributeCollection $attributes = null) : StringBuilder |
|
385 | 385 | { |
386 | 386 | return $this->html($this->createLink('', $url, $newTab, $attributes)->renderOpen()); |
387 | 387 | } |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | */ |
426 | 426 | public function spanned($string, $classes) : StringBuilder |
427 | 427 | { |
428 | - if(!is_array($classes)) |
|
428 | + if (!is_array($classes)) |
|
429 | 429 | { |
430 | 430 | $classes = array((string)$classes); |
431 | 431 | } |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | * @return $this |
444 | 444 | * @throws ConvertHelper_Exception |
445 | 445 | */ |
446 | - public function bool($value, bool $yesNo=false) : StringBuilder |
|
446 | + public function bool($value, bool $yesNo = false) : StringBuilder |
|
447 | 447 | { |
448 | 448 | return $this->add(ConvertHelper::bool2string($value, $yesNo)); |
449 | 449 | } |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | */ |
463 | 463 | public function ifTrue(bool $condition, $content) : StringBuilder |
464 | 464 | { |
465 | - if($condition === true) |
|
465 | + if ($condition === true) |
|
466 | 466 | { |
467 | 467 | $this->add($this->renderContent($content)); |
468 | 468 | } |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | */ |
485 | 485 | public function ifFalse(bool $condition, $string) : StringBuilder |
486 | 486 | { |
487 | - if($condition === false) |
|
487 | + if ($condition === false) |
|
488 | 488 | { |
489 | 489 | $this->add($this->renderContent($string)); |
490 | 490 | } |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | */ |
569 | 569 | public function ifOr(bool $condition, $ifTrue, $ifFalse) : StringBuilder |
570 | 570 | { |
571 | - if($condition === true) |
|
571 | + if ($condition === true) |
|
572 | 572 | { |
573 | 573 | return $this->add($this->renderContent($ifTrue)); |
574 | 574 | } |
@@ -339,7 +339,7 @@ |
||
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 | } |
@@ -24,14 +24,14 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -26,7 +26,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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', |
@@ -31,12 +31,12 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -24,27 +24,27 @@ |
||
24 | 24 | * @param bool $important |
25 | 25 | * @return StyleBuilder |
26 | 26 | */ |
27 | - public function custom(string $value, bool $important=false) : StyleBuilder |
|
27 | + public function custom(string $value, bool $important = false) : StyleBuilder |
|
28 | 28 | { |
29 | 29 | return $this->setStyle($value, $important); |
30 | 30 | } |
31 | 31 | |
32 | - public function block(bool $important=false) : StyleBuilder |
|
32 | + public function block(bool $important = false) : StyleBuilder |
|
33 | 33 | { |
34 | 34 | return $this->setStyle('block', $important); |
35 | 35 | } |
36 | 36 | |
37 | - public function none(bool $important=false) : StyleBuilder |
|
37 | + public function none(bool $important = false) : StyleBuilder |
|
38 | 38 | { |
39 | 39 | return $this->setStyle('none', $important); |
40 | 40 | } |
41 | 41 | |
42 | - public function inline(bool $important=false) : StyleBuilder |
|
42 | + public function inline(bool $important = false) : StyleBuilder |
|
43 | 43 | { |
44 | 44 | return $this->setStyle('inline', $important); |
45 | 45 | } |
46 | 46 | |
47 | - public function inlineBlock(bool $important=false) : StyleBuilder |
|
47 | + public function inlineBlock(bool $important = false) : StyleBuilder |
|
48 | 48 | { |
49 | 49 | return $this->setStyle('inline-block', $important); |
50 | 50 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | return 'width'; |
15 | 15 | } |
16 | 16 | |
17 | - public function auto(bool $important=false) : StyleBuilder |
|
17 | + public function auto(bool $important = false) : StyleBuilder |
|
18 | 18 | { |
19 | 19 | return $this->setStyle('auto', $important); |
20 | 20 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @param bool $important |
37 | 37 | * @return StyleBuilder |
38 | 38 | */ |
39 | - public function thin(bool $important=false) : StyleBuilder |
|
39 | + public function thin(bool $important = false) : StyleBuilder |
|
40 | 40 | { |
41 | 41 | return $this->customNumber(self::WEIGHT_THIN, $important); |
42 | 42 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @param bool $important |
47 | 47 | * @return StyleBuilder |
48 | 48 | */ |
49 | - public function extraLight(bool $important=false) : StyleBuilder |
|
49 | + public function extraLight(bool $important = false) : StyleBuilder |
|
50 | 50 | { |
51 | 51 | return $this->customNumber(self::WEIGHT_EXTRA_LIGHT, $important); |
52 | 52 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @param bool $important |
57 | 57 | * @return StyleBuilder |
58 | 58 | */ |
59 | - public function light(bool $important=false) : StyleBuilder |
|
59 | + public function light(bool $important = false) : StyleBuilder |
|
60 | 60 | { |
61 | 61 | return $this->customNumber(self::WEIGHT_LIGHT, $important); |
62 | 62 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @param bool $important |
67 | 67 | * @return StyleBuilder |
68 | 68 | */ |
69 | - public function normal(bool $important=false) : StyleBuilder |
|
69 | + public function normal(bool $important = false) : StyleBuilder |
|
70 | 70 | { |
71 | 71 | return $this->customNumber(self::WEIGHT_NORMAL, $important); |
72 | 72 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @param bool $important |
77 | 77 | * @return StyleBuilder |
78 | 78 | */ |
79 | - public function medium(bool $important=false) : StyleBuilder |
|
79 | + public function medium(bool $important = false) : StyleBuilder |
|
80 | 80 | { |
81 | 81 | return $this->customNumber(self::WEIGHT_MEDIUM, $important); |
82 | 82 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param bool $important |
87 | 87 | * @return StyleBuilder |
88 | 88 | */ |
89 | - public function semiBold(bool $important=false) : StyleBuilder |
|
89 | + public function semiBold(bool $important = false) : StyleBuilder |
|
90 | 90 | { |
91 | 91 | return $this->customNumber(self::WEIGHT_SEMI_BOLD, $important); |
92 | 92 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @param bool $important |
97 | 97 | * @return StyleBuilder |
98 | 98 | */ |
99 | - public function bold(bool $important=false) : StyleBuilder |
|
99 | + public function bold(bool $important = false) : StyleBuilder |
|
100 | 100 | { |
101 | 101 | return $this->customNumber(self::WEIGHT_BOLD, $important); |
102 | 102 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * @param bool $important |
107 | 107 | * @return StyleBuilder |
108 | 108 | */ |
109 | - public function extraBold(bool $important=false) : StyleBuilder |
|
109 | + public function extraBold(bool $important = false) : StyleBuilder |
|
110 | 110 | { |
111 | 111 | return $this->customNumber(self::WEIGHT_EXTRA_BOLD, $important); |
112 | 112 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @param bool $important |
117 | 117 | * @return StyleBuilder |
118 | 118 | */ |
119 | - public function black(bool $important=false) : StyleBuilder |
|
119 | + public function black(bool $important = false) : StyleBuilder |
|
120 | 120 | { |
121 | 121 | return $this->customNumber(self::WEIGHT_BLACK, $important); |
122 | 122 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @param bool $important |
131 | 131 | * @return StyleBuilder |
132 | 132 | */ |
133 | - public function namedBold(bool $important=false) : StyleBuilder |
|
133 | + public function namedBold(bool $important = false) : StyleBuilder |
|
134 | 134 | { |
135 | 135 | return $this->setStyle('bold', $important); |
136 | 136 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @param bool $important |
141 | 141 | * @return StyleBuilder |
142 | 142 | */ |
143 | - public function namedNormal(bool $important=false) : StyleBuilder |
|
143 | + public function namedNormal(bool $important = false) : StyleBuilder |
|
144 | 144 | { |
145 | 145 | return $this->setStyle('normal', $important); |
146 | 146 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @param bool $important |
151 | 151 | * @return StyleBuilder |
152 | 152 | */ |
153 | - public function relativeLighter(bool $important=false) : StyleBuilder |
|
153 | + public function relativeLighter(bool $important = false) : StyleBuilder |
|
154 | 154 | { |
155 | 155 | return $this->setStyle('lighter', $important); |
156 | 156 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @param bool $important |
161 | 161 | * @return StyleBuilder |
162 | 162 | */ |
163 | - public function relativeBolder(bool $important=false) : StyleBuilder |
|
163 | + public function relativeBolder(bool $important = false) : StyleBuilder |
|
164 | 164 | { |
165 | 165 | return $this->setStyle('bolder', $important); |
166 | 166 | } |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | $fonts[] = $fallback; |
44 | 44 | $keep = array(); |
45 | 45 | |
46 | - foreach($fonts as $font) |
|
46 | + foreach ($fonts as $font) |
|
47 | 47 | { |
48 | - if(strpos($font, ' ') !== false) |
|
48 | + if (strpos($font, ' ') !== false) |
|
49 | 49 | { |
50 | 50 | $font = "'".$font."'"; |
51 | 51 | } |
@@ -64,27 +64,27 @@ discard block |
||
64 | 64 | public const FALLBACK_CURSIVE = 'cursive'; |
65 | 65 | public const FALLBACK_FANTASY = 'fantasy'; |
66 | 66 | |
67 | - public function serif(bool $important=false) : StyleBuilder |
|
67 | + public function serif(bool $important = false) : StyleBuilder |
|
68 | 68 | { |
69 | 69 | return $this->compileStyle(self::FALLBACK_SERIF, $important); |
70 | 70 | } |
71 | 71 | |
72 | - public function sansSerif(bool $important=false) : StyleBuilder |
|
72 | + public function sansSerif(bool $important = false) : StyleBuilder |
|
73 | 73 | { |
74 | 74 | return $this->compileStyle(self::FALLBACK_SANS_SERIF, $important); |
75 | 75 | } |
76 | 76 | |
77 | - public function cursive(bool $important=false) : StyleBuilder |
|
77 | + public function cursive(bool $important = false) : StyleBuilder |
|
78 | 78 | { |
79 | 79 | return $this->compileStyle(self::FALLBACK_CURSIVE, $important); |
80 | 80 | } |
81 | 81 | |
82 | - public function monospace(bool $important=false) : StyleBuilder |
|
82 | + public function monospace(bool $important = false) : StyleBuilder |
|
83 | 83 | { |
84 | 84 | return $this->compileStyle(self::FALLBACK_MONOSPACE, $important); |
85 | 85 | } |
86 | 86 | |
87 | - public function fantasy(bool $important=false) : StyleBuilder |
|
87 | + public function fantasy(bool $important = false) : StyleBuilder |
|
88 | 88 | { |
89 | 89 | return $this->compileStyle(self::FALLBACK_FANTASY, $important); |
90 | 90 | } |