Passed
Push — master ( 80e6cc...b083ab )
by Sebastian
03:06
created
src/Transliteration.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      * @param bool $lowercase
62 62
      * @return Transliteration
63 63
      */
64
-    public function setLowercase(bool $lowercase=true) : Transliteration
64
+    public function setLowercase(bool $lowercase = true) : Transliteration
65 65
     {
66 66
         $this->setOption(self::OPTION_LOWER_CASE, $lowercase);
67 67
 
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 
100 100
         $result = implode('', $keep);
101 101
 
102
-        while (strpos($result, $space . $space) !== false) {
103
-            $result = str_replace($space . $space, $space, $result);
102
+        while (strpos($result, $space.$space) !== false) {
103
+            $result = str_replace($space.$space, $space, $result);
104 104
         }
105 105
 
106 106
         $result = trim($result, $space);
Please login to merge, or discard this patch.
src/XMLHelper.php 2 patches
Indentation   +172 added lines, -172 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 {
29 29
     public const ERROR_CANNOT_APPEND_FRAGMENT = 491001; 
30 30
 
31
-   /**
32
-    * @var boolean
33
-    */
31
+    /**
32
+     * @var boolean
33
+     */
34 34
     private static $simulation = false;
35 35
 
36 36
     /**
@@ -38,11 +38,11 @@  discard block
 block discarded – undo
38 38
      */
39 39
     private $dom;
40 40
     
41
-   /**
42
-    * Creates a new XMLHelper instance.
43
-    * 
44
-    * @return XMLHelper
45
-    */
41
+    /**
42
+     * Creates a new XMLHelper instance.
43
+     * 
44
+     * @return XMLHelper
45
+     */
46 46
     public static function create() : XMLHelper
47 47
     {
48 48
         $dom = new DOMDocument('1.0', 'UTF-8');
@@ -51,72 +51,72 @@  discard block
 block discarded – undo
51 51
         return new XMLHelper($dom);
52 52
     }
53 53
     
54
-   /**
55
-    * Creates a converter instance from an XML file.
56
-    * @param string $xmlFile
57
-    * @return XMLHelper_Converter
58
-    */
54
+    /**
55
+     * Creates a converter instance from an XML file.
56
+     * @param string $xmlFile
57
+     * @return XMLHelper_Converter
58
+     */
59 59
     public static function convertFile(string $xmlFile) : XMLHelper_Converter
60 60
     {
61 61
         return XMLHelper_Converter::fromFile($xmlFile);
62 62
     }
63 63
     
64
-   /**
65
-    * Creates a converter from an XML string.
66
-    * @param string $xmlString
67
-    * @return XMLHelper_Converter
68
-    */
64
+    /**
65
+     * Creates a converter from an XML string.
66
+     * @param string $xmlString
67
+     * @return XMLHelper_Converter
68
+     */
69 69
     public static function convertString(string $xmlString) : XMLHelper_Converter
70 70
     {
71 71
         return XMLHelper_Converter::fromString($xmlString);
72 72
     }
73 73
 
74
-   /**
75
-    * Creates a converter from a SimpleXMLElement instance.
76
-    * @param SimpleXMLElement $element
77
-    * @return XMLHelper_Converter
78
-    */
74
+    /**
75
+     * Creates a converter from a SimpleXMLElement instance.
76
+     * @param SimpleXMLElement $element
77
+     * @return XMLHelper_Converter
78
+     */
79 79
     public static function convertElement(SimpleXMLElement $element) : XMLHelper_Converter
80 80
     {
81 81
         return XMLHelper_Converter::fromElement($element);
82 82
     }
83 83
    
84
-   /**
85
-    * Creates a converter from a DOMElement instance.
86
-    * @param DOMElement $element
87
-    * @return XMLHelper_Converter
88
-    */
84
+    /**
85
+     * Creates a converter from a DOMElement instance.
86
+     * @param DOMElement $element
87
+     * @return XMLHelper_Converter
88
+     */
89 89
     public static function convertDOMElement(DOMElement $element) : XMLHelper_Converter
90 90
     {
91 91
         return XMLHelper_Converter::fromDOMElement($element);
92 92
     }
93 93
 
94
-   /**
95
-    * Creates a new helper using an existing DOMDocument object.
96
-    * @param DOMDocument $dom
97
-    */
94
+    /**
95
+     * Creates a new helper using an existing DOMDocument object.
96
+     * @param DOMDocument $dom
97
+     */
98 98
     public function __construct(DOMDocument $dom)
99 99
     {
100 100
         $this->dom = $dom;
101 101
     }
102 102
 
103
-   /**
104
-    * @return DOMDocument
105
-    */
103
+    /**
104
+     * @return DOMDocument
105
+     */
106 106
     public function getDOM() : DOMDocument
107 107
     {
108 108
         return $this->dom;
109 109
     }
110 110
 
111
-   /**
112
-    * Adds an attribute to an existing tag with
113
-    * the specified value.
114
-    *
115
-    * @param DOMNode $parent
116
-    * @param string $name
117
-    * @param mixed $value
118
-    * @return DOMNode
119
-    */
111
+    /**
112
+     * Adds an attribute to an existing tag with
113
+     * the specified value.
114
+     *
115
+     * @param DOMNode $parent
116
+     * @param string $name
117
+     * @param mixed $value
118
+     * @return DOMNode
119
+     */
120 120
     public function addAttribute(DOMNode $parent, string $name, $value)
121 121
     {
122 122
         $node = $this->dom->createAttribute($name);
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
         return $parent->appendChild($node);
127 127
     }
128 128
 
129
-   /**
130
-    * Adds several attributes to the target node.
131
-    * 
132
-    * @param DOMNode $parent
133
-    * @param array<string,mixed> $attributes
134
-    */
129
+    /**
130
+     * Adds several attributes to the target node.
131
+     * 
132
+     * @param DOMNode $parent
133
+     * @param array<string,mixed> $attributes
134
+     */
135 135
     public function addAttributes(DOMNode $parent, array $attributes) : void
136 136
     {
137 137
         foreach ($attributes as $name => $value) {
@@ -139,14 +139,14 @@  discard block
 block discarded – undo
139 139
         }
140 140
     }
141 141
 
142
-   /**
143
-    * Adds a tag without content.
144
-    *
145
-    * @param DOMNode $parent
146
-    * @param string $name
147
-    * @param integer $indent
148
-    * @return DOMNode
149
-    */
142
+    /**
143
+     * Adds a tag without content.
144
+     *
145
+     * @param DOMNode $parent
146
+     * @param string $name
147
+     * @param integer $indent
148
+     * @return DOMNode
149
+     */
150 150
     public function addTag(DOMNode $parent, string $name, int $indent = 0) : DOMNode
151 151
     {
152 152
         if ($indent > 0) {
@@ -168,17 +168,17 @@  discard block
 block discarded – undo
168 168
         $parent->appendChild($this->dom->createTextNode(str_repeat("\t", $amount)));
169 169
     }
170 170
 
171
-   /**
172
-    * Adds a tag with textual content, like:
173
-    *
174
-    * <tagname>text</tagname>
175
-    *
176
-    * @param DOMNode $parent
177
-    * @param string $name
178
-    * @param string $text
179
-    * @param integer $indent
180
-    * @return DOMNode
181
-    */
171
+    /**
172
+     * Adds a tag with textual content, like:
173
+     *
174
+     * <tagname>text</tagname>
175
+     *
176
+     * @param DOMNode $parent
177
+     * @param string $name
178
+     * @param string $text
179
+     * @param integer $indent
180
+     * @return DOMNode
181
+     */
182 182
     public function addTextTag(DOMNode $parent, string $name, string $text, int $indent = 0) : DOMNode
183 183
     {
184 184
         if ($indent > 0) {
@@ -192,19 +192,19 @@  discard block
 block discarded – undo
192 192
         return $parent->appendChild($tag);
193 193
     }
194 194
 
195
-   /**
196
-    * Adds a tag with textual content, like:
197
-    *
198
-    * <tagname>text</tagname>
199
-    *
200
-    * and removes <p> tags
201
-    *
202
-    * @param DOMNode $parent
203
-    * @param string $name
204
-    * @param string $text
205
-    * @param integer $indent
206
-    * @return DOMNode
207
-    */
195
+    /**
196
+     * Adds a tag with textual content, like:
197
+     *
198
+     * <tagname>text</tagname>
199
+     *
200
+     * and removes <p> tags
201
+     *
202
+     * @param DOMNode $parent
203
+     * @param string $name
204
+     * @param string $text
205
+     * @param integer $indent
206
+     * @return DOMNode
207
+     */
208 208
     public function addEscapedTag(DOMNode $parent, string $name, string $text, int $indent = 0)
209 209
     {
210 210
         if ($indent > 0) {
@@ -220,19 +220,19 @@  discard block
 block discarded – undo
220 220
         return $parent->appendChild($tag);
221 221
     }
222 222
 
223
-   /**
224
-    * Adds a tag with HTML content, like:
225
-    *
226
-    * <tagname><i>text</i></tagname>
227
-    *
228
-    * Tags will not be escaped.
229
-    *
230
-    * @param DOMNode $parent
231
-    * @param string $name
232
-    * @param string $text
233
-    * @param integer $indent
234
-    * @return DOMNode
235
-    */
223
+    /**
224
+     * Adds a tag with HTML content, like:
225
+     *
226
+     * <tagname><i>text</i></tagname>
227
+     *
228
+     * Tags will not be escaped.
229
+     *
230
+     * @param DOMNode $parent
231
+     * @param string $name
232
+     * @param string $text
233
+     * @param integer $indent
234
+     * @return DOMNode
235
+     */
236 236
     public function addFragmentTag(DOMNode $parent, string $name, string $text, int $indent = 0)
237 237
     {
238 238
         if ($indent > 0) {
@@ -260,16 +260,16 @@  discard block
 block discarded – undo
260 260
         return $parent->appendChild($tag);
261 261
     }
262 262
 
263
-   /**
264
-    * Adds a tag with CDATA content, like:
265
-    *
266
-    * <tagname><![CDATA[value]]></tagname>
267
-    *
268
-    * @param DOMNode $parent
269
-    * @param string $name
270
-    * @param string $content
271
-    * @return DOMNode
272
-    */
263
+    /**
264
+     * Adds a tag with CDATA content, like:
265
+     *
266
+     * <tagname><![CDATA[value]]></tagname>
267
+     *
268
+     * @param DOMNode $parent
269
+     * @param string $name
270
+     * @param string $content
271
+     * @return DOMNode
272
+     */
273 273
     public function addCDATATag(DOMNode $parent, string $name, string $content) : DOMNode
274 274
     {
275 275
         $tag = $this->dom->createElement($name);
@@ -279,12 +279,12 @@  discard block
 block discarded – undo
279 279
         return $parent->appendChild($tag);
280 280
     }
281 281
 
282
-   /**
283
-    * Creates the root element of the document.
284
-    * @param string $name
285
-    * @param array<string,mixed> $attributes
286
-    * @return DOMNode
287
-    */
282
+    /**
283
+     * Creates the root element of the document.
284
+     * @param string $name
285
+     * @param array<string,mixed> $attributes
286
+     * @return DOMNode
287
+     */
288 288
     public function createRoot(string $name, array $attributes=array())
289 289
     {
290 290
         $root = $this->dom->appendChild($this->dom->createElement($name));
@@ -292,12 +292,12 @@  discard block
 block discarded – undo
292 292
         return $root;
293 293
     }
294 294
 
295
-   /**
296
-    * Escaped the string for use in XML.
297
-    * 
298
-    * @param string $string
299
-    * @return string
300
-    */
295
+    /**
296
+     * Escaped the string for use in XML.
297
+     * 
298
+     * @param string $string
299
+     * @return string
300
+     */
301 301
     public function escape(string $string) : string
302 302
     {
303 303
         $string = preg_replace('#<p>(.*)</p>#isUm', '$1', $string);
@@ -317,18 +317,18 @@  discard block
 block discarded – undo
317 317
         return $string;
318 318
     }
319 319
 
320
-   /**
321
-    * Sends the specified XML string to the browser with
322
-    * the correct headers to trigger a download of the XML
323
-    * to a local file.
324
-    * 
325
-    * NOTE: Ensure calling exit after this is done, and to
326
-    * not send additional content, which would corrupt the 
327
-    * download.
328
-    *
329
-    * @param string $xml
330
-    * @param string $filename
331
-    */
320
+    /**
321
+     * Sends the specified XML string to the browser with
322
+     * the correct headers to trigger a download of the XML
323
+     * to a local file.
324
+     * 
325
+     * NOTE: Ensure calling exit after this is done, and to
326
+     * not send additional content, which would corrupt the 
327
+     * download.
328
+     *
329
+     * @param string $xml
330
+     * @param string $filename
331
+     */
332 332
     public static function downloadXML(string $xml, string $filename = 'download.xml') : void
333 333
     {
334 334
         if(!headers_sent() && !self::$simulation) 
@@ -339,12 +339,12 @@  discard block
 block discarded – undo
339 339
         echo $xml;
340 340
     }
341 341
 
342
-   /**
343
-    * Sends the specified XML string to the browser with
344
-    * the correct headers and terminates the request.
345
-    *
346
-    * @param string $xml
347
-    */
342
+    /**
343
+     * Sends the specified XML string to the browser with
344
+     * the correct headers and terminates the request.
345
+     *
346
+     * @param string $xml
347
+     */
348 348
     public static function displayXML(string $xml) : void
349 349
     {
350 350
         if(!headers_sent() && !self::$simulation) 
@@ -411,23 +411,23 @@  discard block
 block discarded – undo
411 411
         return $xml->saveXML();
412 412
     }
413 413
 
414
-   /**
415
-    * Creates XML markup to describe an application error
416
-    * when using XML services. Creates XML with the
417
-    * following structure:
418
-    *
419
-    * <error>
420
-    *     <id>99</id>
421
-    *     <message>Full error message text</message>
422
-    *     <title>Short error label</title>
423
-    * </error>
424
-    *
425
-    * @param string|number $code
426
-    * @param string $message
427
-    * @param string $title
428
-    * @param array<string,string> $customInfo
429
-    * @return string
430
-    */
414
+    /**
415
+     * Creates XML markup to describe an application error
416
+     * when using XML services. Creates XML with the
417
+     * following structure:
418
+     *
419
+     * <error>
420
+     *     <id>99</id>
421
+     *     <message>Full error message text</message>
422
+     *     <title>Short error label</title>
423
+     * </error>
424
+     *
425
+     * @param string|number $code
426
+     * @param string $message
427
+     * @param string $title
428
+     * @param array<string,string> $customInfo
429
+     * @return string
430
+     */
431 431
     public static function buildErrorXML($code, string $message, string $title, array $customInfo=array())
432 432
     {
433 433
         $xml = new DOMDocument('1.0', 'UTF-8');
@@ -460,31 +460,31 @@  discard block
 block discarded – undo
460 460
         return $this->dom->saveXML();
461 461
     }
462 462
     
463
-   /**
464
-    * Creates a new SimpleXML helper instance: this
465
-    * object is useful to work with loading XML strings
466
-    * and files with easy access to any errors that 
467
-    * may occurr, since the simplexml functions can be
468
-    * somewhat cryptic.
469
-    * 
470
-    * @return XMLHelper_SimpleXML
471
-    */
463
+    /**
464
+     * Creates a new SimpleXML helper instance: this
465
+     * object is useful to work with loading XML strings
466
+     * and files with easy access to any errors that 
467
+     * may occurr, since the simplexml functions can be
468
+     * somewhat cryptic.
469
+     * 
470
+     * @return XMLHelper_SimpleXML
471
+     */
472 472
     public static function createSimplexml() : XMLHelper_SimpleXML
473 473
     {
474 474
         return new XMLHelper_SimpleXML();
475 475
     }
476 476
     
477
-   /**
478
-    * Converts a string to valid XML: can be a text only string
479
-    * or an HTML string. Returns valid XML code.
480
-    * 
481
-    * NOTE: The string may contain custom tags, which are 
482
-    * preserved.
483
-    * 
484
-    * @param string $string
485
-    * @throws XMLHelper_Exception
486
-    * @return string
487
-    */
477
+    /**
478
+     * Converts a string to valid XML: can be a text only string
479
+     * or an HTML string. Returns valid XML code.
480
+     * 
481
+     * NOTE: The string may contain custom tags, which are 
482
+     * preserved.
483
+     * 
484
+     * @param string $string
485
+     * @throws XMLHelper_Exception
486
+     * @return string
487
+     */
488 488
     public static function string2xml(string $string) : string
489 489
     {
490 490
         return XMLHelper_HTMLLoader::loadFragment($string)->fragmentToXML();
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 
161 161
     public function removeTag(DOMElement $tag) : void
162 162
     {
163
-        if(isset($tag->parentNode))
163
+        if (isset($tag->parentNode))
164 164
         {
165 165
             $tag->parentNode->removeChild($tag);
166 166
         }
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 
247 247
         if (!empty($text)) {
248 248
             $fragment = $this->dom->createDocumentFragment();
249
-            if(!@$fragment->appendXML($text)) {
249
+            if (!@$fragment->appendXML($text)) {
250 250
                 throw new XMLHelper_Exception(
251 251
                     'Cannot append XML fragment',
252 252
                     sprintf(
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
     * @param array<string,mixed> $attributes
289 289
     * @return DOMNode
290 290
     */
291
-    public function createRoot(string $name, array $attributes=array())
291
+    public function createRoot(string $name, array $attributes = array())
292 292
     {
293 293
         $root = $this->dom->appendChild($this->dom->createElement($name));
294 294
         $this->addAttributes($root, $attributes);
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
         $string = str_replace('&lt;', 'LT_ESCAPE', $string);
315 315
         $string = str_replace('&gt;', 'GT_ESCAPE', $string);
316 316
 
317
-        $string = str_replace('&nbsp;',' ',  $string);
318
-        $string = str_replace('&','&amp;',  $string);
317
+        $string = str_replace('&nbsp;', ' ', $string);
318
+        $string = str_replace('&', '&amp;', $string);
319 319
 
320 320
         return $string;
321 321
     }
@@ -334,9 +334,9 @@  discard block
 block discarded – undo
334 334
     */
335 335
     public static function downloadXML(string $xml, string $filename = 'download.xml') : void
336 336
     {
337
-        if(!headers_sent() && !self::$simulation) 
337
+        if (!headers_sent() && !self::$simulation) 
338 338
         {
339
-            header('Content-Disposition: attachment; filename="' . $filename . '"');
339
+            header('Content-Disposition: attachment; filename="'.$filename.'"');
340 340
         }
341 341
         
342 342
         echo $xml;
@@ -350,12 +350,12 @@  discard block
 block discarded – undo
350 350
     */
351 351
     public static function displayXML(string $xml) : void
352 352
     {
353
-        if(!headers_sent() && !self::$simulation) 
353
+        if (!headers_sent() && !self::$simulation) 
354 354
         {
355 355
             header('Content-Type:text/xml; charset=utf-8');
356 356
         }
357 357
         
358
-        if(self::$simulation) 
358
+        if (self::$simulation) 
359 359
         {
360 360
             $xml = '<pre>'.htmlspecialchars($xml).'</pre>';
361 361
         }
@@ -373,16 +373,16 @@  discard block
 block discarded – undo
373 373
      * @param array<string,string> $customInfo Associative array with name => value pairs for custom tags to add to the output xml
374 374
      * @see buildErrorXML()
375 375
      */
376
-    public static function displayErrorXML($code, string $message, string $title, array $customInfo=array())
376
+    public static function displayErrorXML($code, string $message, string $title, array $customInfo = array())
377 377
     {
378
-        if(!headers_sent() && !self::$simulation) {
379
-            header('HTTP/1.1 400 Bad Request: ' . $title, true, 400);
378
+        if (!headers_sent() && !self::$simulation) {
379
+            header('HTTP/1.1 400 Bad Request: '.$title, true, 400);
380 380
         }
381 381
 
382 382
         self::displayXML(self::buildErrorXML($code, $message, $title, $customInfo));
383 383
     }
384 384
     
385
-    public static function setSimulation(bool $simulate=true) : void
385
+    public static function setSimulation(bool $simulate = true) : void
386 386
     {
387 387
         self::$simulation = $simulate;
388 388
     }
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
     * @param array<string,string> $customInfo
432 432
     * @return string
433 433
     */
434
-    public static function buildErrorXML($code, string $message, string $title, array $customInfo=array())
434
+    public static function buildErrorXML($code, string $message, string $title, array $customInfo = array())
435 435
     {
436 436
         $xml = new DOMDocument('1.0', 'UTF-8');
437 437
         $xml->formatOutput = true;
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
         $helper->addTextTag($root, 'title', $title);
446 446
         $helper->addTextTag($root, 'request_uri', $_SERVER['REQUEST_URI']);
447 447
         
448
-        foreach($customInfo as $name => $value) {
448
+        foreach ($customInfo as $name => $value) {
449 449
             $helper->addTextTag($root, $name, $value);
450 450
         }
451 451
 
Please login to merge, or discard this patch.
src/HTMLTag/CannedTags.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      * @param string|number|StringBuilder_Interface|NULL $content
30 30
      * @return HTMLTag
31 31
      */
32
-    public static function anchor(string $url, $content=null) : HTMLTag
32
+    public static function anchor(string $url, $content = null) : HTMLTag
33 33
     {
34 34
         return HTMLTag::create('a')
35 35
             ->href($url)
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      * @param string|number|StringBuilder_Interface|NULL $content
47 47
      * @return HTMLTag
48 48
      */
49
-    public static function div($content=null) : HTMLTag
49
+    public static function div($content = null) : HTMLTag
50 50
     {
51 51
         return HTMLTag::create('div')->setContent($content);
52 52
     }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      * @param string|number|StringBuilder_Interface|NULL $content
56 56
      * @return HTMLTag
57 57
      */
58
-    public static function p($content=null) : HTMLTag
58
+    public static function p($content = null) : HTMLTag
59 59
     {
60 60
         return HTMLTag::create('p')->setContent($content);
61 61
     }
Please login to merge, or discard this patch.
src/ConvertHelper/IntervalConverter.php 2 patches
Indentation   +38 added lines, -39 removed lines patch added patch discarded remove patch
@@ -17,21 +17,20 @@  discard block
 block discarded – undo
17 17
  * @package Application Utils
18 18
  * @subpackage ConvertHelper
19 19
  * @author Sebastian Mordziol <[email protected]>
20
-
21 20
  * @see ConvertHelper::interval2string()
22 21
  */
23 22
 class ConvertHelper_IntervalConverter
24 23
 {
25 24
     public const ERROR_MISSING_TRANSLATION = 43501;
26 25
     
27
-   /**
28
-    * @var array<string,string>|NULL
29
-    */
26
+    /**
27
+     * @var array<string,string>|NULL
28
+     */
30 29
     protected static $texts = null;
31 30
     
32
-   /**
33
-    * @var string[]
34
-    */
31
+    /**
32
+     * @var string[]
33
+     */
35 34
     protected $tokens = array('y', 'm', 'd', 'h', 'i', 's');
36 35
     
37 36
     public function __construct()
@@ -41,25 +40,25 @@  discard block
 block discarded – undo
41 40
         }
42 41
     }
43 42
     
44
-   /**
45
-    * Called whenever the application locale has changed,
46
-    * to reset the internal translation cache.
47
-    */
43
+    /**
44
+     * Called whenever the application locale has changed,
45
+     * to reset the internal translation cache.
46
+     */
48 47
     public function handle_localeChanged() : void
49 48
     {
50 49
         self::$texts = null;
51 50
     }
52 51
     
53
-   /**
54
-    * Converts the specified interval to a human-readable
55
-    * string, e.g. "2 hours and 4 minutes".
56
-    * 
57
-    * @param \DateInterval $interval
58
-    * @return string
59
-    * @throws ConvertHelper_Exception
60
-    * 
61
-    * @see ConvertHelper_IntervalConverter::ERROR_MISSING_TRANSLATION
62
-    */
52
+    /**
53
+     * Converts the specified interval to a human-readable
54
+     * string, e.g. "2 hours and 4 minutes".
55
+     * 
56
+     * @param \DateInterval $interval
57
+     * @return string
58
+     * @throws ConvertHelper_Exception
59
+     * 
60
+     * @see ConvertHelper_IntervalConverter::ERROR_MISSING_TRANSLATION
61
+     */
63 62
     public function toString(\DateInterval $interval) : string
64 63
     {
65 64
         $this->initTexts();
@@ -88,14 +87,14 @@  discard block
 block discarded – undo
88 87
         return t('%1$s and %2$s', implode(', ', $parts), $last);
89 88
     }
90 89
     
91
-   /**
92
-    * Translates the selected time token, e.g. "y" (for year).
93
-    * 
94
-    * @param string $token
95
-    * @param ConvertHelper_DateInterval $interval
96
-    * @throws ConvertHelper_Exception
97
-    * @return string
98
-    */
90
+    /**
91
+     * Translates the selected time token, e.g. "y" (for year).
92
+     * 
93
+     * @param string $token
94
+     * @param ConvertHelper_DateInterval $interval
95
+     * @throws ConvertHelper_Exception
96
+     * @return string
97
+     */
99 98
     protected function translateToken(string $token, ConvertHelper_DateInterval $interval) : string
100 99
     {
101 100
         $value = $interval->getToken($token);
@@ -123,13 +122,13 @@  discard block
 block discarded – undo
123 122
         );
124 123
     }
125 124
     
126
-   /**
127
-    * Resolves all time tokens that need to be translated in
128
-    * the subject interval, depending on its length.
129
-    * 
130
-    * @param ConvertHelper_DateInterval $interval
131
-    * @return string[]
132
-    */
125
+    /**
126
+     * Resolves all time tokens that need to be translated in
127
+     * the subject interval, depending on its length.
128
+     * 
129
+     * @param ConvertHelper_DateInterval $interval
130
+     * @return string[]
131
+     */
133 132
     protected function resolveTokens(ConvertHelper_DateInterval $interval) : array
134 133
     {
135 134
         $offset = 0;
@@ -147,9 +146,9 @@  discard block
 block discarded – undo
147 146
         return array();
148 147
     }
149 148
     
150
-   /**
151
-    * Initializes the translateable strings.
152
-    */
149
+    /**
150
+     * Initializes the translateable strings.
151
+     */
153 152
     protected function initTexts() : void
154 153
     {
155 154
         if(isset(self::$texts)) {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     
37 37
     public function __construct()
38 38
     {
39
-        if(class_exists('\AppLocalize\Localization')) {
39
+        if (class_exists('\AppLocalize\Localization')) {
40 40
             \AppLocalize\Localization::onLocaleChanged(array($this, 'handle_localeChanged'));
41 41
         }
42 42
     }
@@ -69,17 +69,17 @@  discard block
 block discarded – undo
69 69
         $keep = $this->resolveTokens($interval);
70 70
 
71 71
         $parts = array();
72
-        foreach($keep as $token)
72
+        foreach ($keep as $token)
73 73
         {
74 74
             $value = $interval->getToken($token);
75
-            if($value <= 0) {
75
+            if ($value <= 0) {
76 76
                 continue;
77 77
             }
78 78
             
79 79
             $parts[] = $this->translateToken($token, $interval);
80 80
         }
81 81
         
82
-        if(count($parts) == 1) {
82
+        if (count($parts) == 1) {
83 83
             return $parts[0];
84 84
         }
85 85
         
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
         $value = $interval->getToken($token);
102 102
         
103 103
         $suffix = 'p';
104
-        if($value == 1) { $suffix = 's'; }
104
+        if ($value == 1) { $suffix = 's'; }
105 105
         $token .= $suffix;
106 106
         
107
-        if(!isset(self::$texts[$token]))
107
+        if (!isset(self::$texts[$token]))
108 108
         {
109 109
             throw new ConvertHelper_Exception(
110 110
                 'Missing interval translation',
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
     {
135 135
         $offset = 0;
136 136
         
137
-        foreach($this->tokens as $token) 
137
+        foreach ($this->tokens as $token) 
138 138
         {
139
-            if($interval->getToken($token) > 0) 
139
+            if ($interval->getToken($token) > 0) 
140 140
             {
141 141
                 return array_slice($this->tokens, $offset);
142 142
             }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
     */
153 153
     protected function initTexts() : void
154 154
     {
155
-        if(isset(self::$texts)) {
155
+        if (isset(self::$texts)) {
156 156
             return;
157 157
         }
158 158
         
Please login to merge, or discard this patch.
src/XMLHelper/Converter.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
 {
47 47
     public const ERROR_FAILED_CONVERTING_TO_JSON = 37901;
48 48
     
49
-   /**
50
-    * @var SimpleXMLElement
51
-    */
49
+    /**
50
+     * @var SimpleXMLElement
51
+     */
52 52
     protected $xml;
53 53
     
54
-   /**
55
-    * @var string|NULL
56
-    */
54
+    /**
55
+     * @var string|NULL
56
+     */
57 57
     protected $json;
58 58
     
59 59
     protected function __construct(SimpleXMLElement $element)
@@ -86,34 +86,34 @@  discard block
 block discarded – undo
86 86
         return self::fromElement(new SimpleXMLElement($xmlString));
87 87
     }
88 88
     
89
-   /**
90
-    * Factory method: creates a converter from an existing SimpleXMLElement instance.
91
-    * 
92
-    * @param SimpleXMLElement $element
93
-    * @return XMLHelper_Converter
94
-    */
89
+    /**
90
+     * Factory method: creates a converter from an existing SimpleXMLElement instance.
91
+     * 
92
+     * @param SimpleXMLElement $element
93
+     * @return XMLHelper_Converter
94
+     */
95 95
     public static function fromElement(SimpleXMLElement $element) : XMLHelper_Converter
96 96
     {
97 97
         return new XMLHelper_Converter($element);
98 98
     }
99 99
 
100
-   /**
101
-    * Factory method: creates a converter from an existing SimpleXMLElement instance.
102
-    *
103
-    * @param DOMElement $element
104
-    * @return XMLHelper_Converter
105
-    */
100
+    /**
101
+     * Factory method: creates a converter from an existing SimpleXMLElement instance.
102
+     *
103
+     * @param DOMElement $element
104
+     * @return XMLHelper_Converter
105
+     */
106 106
     public static function fromDOMElement(DOMElement $element) : XMLHelper_Converter
107 107
     {
108 108
         return new XMLHelper_Converter(simplexml_import_dom($element));
109 109
     }
110 110
     
111
-   /**
112
-    * Converts the XML to JSON.
113
-    * 
114
-    * @return string
115
-    * @throws XMLHelper_Exception|JsonException
116
-    */
111
+    /**
112
+     * Converts the XML to JSON.
113
+     * 
114
+     * @return string
115
+     * @throws XMLHelper_Exception|JsonException
116
+     */
117 117
     public function toJSON() : string
118 118
     {
119 119
         if (isset($this->json))
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
         }
147 147
     }
148 148
 
149
-   /**
150
-    * Converts the XML to an associative array.
151
-    * @return array
152
-    * @throws XMLHelper_Exception|JsonException
153
-    */
149
+    /**
150
+     * Converts the XML to an associative array.
151
+     * @return array
152
+     * @throws XMLHelper_Exception|JsonException
153
+     */
154 154
     public function toArray() : array 
155 155
     {
156 156
         $json = $this->toJSON();
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -130,8 +130,7 @@
 block discarded – undo
130 130
             unset($this->xml);
131 131
 
132 132
             return $this->json;
133
-        }
134
-        catch (Exception $e)
133
+        } catch (Exception $e)
135 134
         {
136 135
             throw new XMLHelper_Exception(
137 136
                 'Could not convert the XML source to JSON',
Please login to merge, or discard this patch.
src/RegexHelper.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
     
43 43
     public const REGEX_MD5 = '/^[a-f0-9]{32}$/i';
44 44
 
45
-   /**
46
-    * @var string
47
-    * @see https://en.wikipedia.org/wiki/Email_address#Local-part
48
-    */
45
+    /**
46
+     * @var string
47
+     * @see https://en.wikipedia.org/wiki/Email_address#Local-part
48
+     */
49 49
     public const REGEX_EMAIL = '/[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/i';
50 50
     
51 51
     public const REGEX_PHONE = '/\A[+0-9][0-9 +\-()]+\z/m';
@@ -97,14 +97,14 @@  discard block
 block discarded – undo
97 97
      */
98 98
     public const REGEX_IS_HTML = '%<{0,1}[a-z\/][\s\S]*>|<[a-z\/][\s\S]*>{0,1}%i';
99 99
     
100
-   /**
101
-    * Hexadecimal color codes. Allows the following formats:
102
-    * 
103
-    * FFFFFF
104
-    * FFF
105
-    * 
106
-    * @var string
107
-    */
100
+    /**
101
+     * Hexadecimal color codes. Allows the following formats:
102
+     * 
103
+     * FFFFFF
104
+     * FFF
105
+     * 
106
+     * @var string
107
+     */
108 108
     public const REGEX_HEX_COLOR_CODE = '/\A(?:[0-9a-fA-F]{6}|[0-9a-fA-F]{3})\z/iU';
109 109
 
110 110
     /**
Please login to merge, or discard this patch.
src/FileHelper/PHPClassInfo/Class.php 2 patches
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -22,44 +22,44 @@  discard block
 block discarded – undo
22 22
  */
23 23
 class FileHelper_PHPClassInfo_Class 
24 24
 {
25
-   /**
26
-    * @var FileHelper_PHPClassInfo
27
-    */
25
+    /**
26
+     * @var FileHelper_PHPClassInfo
27
+     */
28 28
     protected $info;
29 29
 
30
-   /**
31
-    * @var bool
32
-    */
30
+    /**
31
+     * @var bool
32
+     */
33 33
     protected $abstract = false;
34 34
     
35
-   /**
36
-    * @var bool
37
-    */
35
+    /**
36
+     * @var bool
37
+     */
38 38
     protected $final = false;
39 39
     
40
-   /**
41
-    * @var string
42
-    */
40
+    /**
41
+     * @var string
42
+     */
43 43
     protected $extends = '';
44 44
     
45
-   /**
46
-    * @var string[]
47
-    */
45
+    /**
46
+     * @var string[]
47
+     */
48 48
     protected $implements = array();
49 49
     
50
-   /**
51
-    * @var string
52
-    */
50
+    /**
51
+     * @var string
52
+     */
53 53
     protected $name;
54 54
     
55
-   /**
56
-    * @var string
57
-    */
55
+    /**
56
+     * @var string
57
+     */
58 58
     protected $declaration;
59 59
     
60
-   /**
61
-    * @var string
62
-    */
60
+    /**
61
+     * @var string
62
+     */
63 63
     protected $keyword;
64 64
 
65 65
     /**
@@ -68,10 +68,10 @@  discard block
 block discarded – undo
68 68
     private $type;
69 69
 
70 70
     /**
71
-    * @param FileHelper_PHPClassInfo $info The class info instance.
72
-    * @param string $declaration The full class declaration, e.g. "class SomeName extends SomeOtherClass".
73
-    * @param string $keyword The class keyword, if any, i.e. "abstract" or "final".
74
-    */
71
+     * @param FileHelper_PHPClassInfo $info The class info instance.
72
+     * @param string $declaration The full class declaration, e.g. "class SomeName extends SomeOtherClass".
73
+     * @param string $keyword The class keyword, if any, i.e. "abstract" or "final".
74
+     */
75 75
     public function __construct(FileHelper_PHPClassInfo $info, string $declaration, string $keyword, string $type)
76 76
     {
77 77
         $this->info = $info;
@@ -82,31 +82,31 @@  discard block
 block discarded – undo
82 82
         $this->analyzeCode();
83 83
     }
84 84
     
85
-   /**
86
-    * Check if this class is a subclass of the specified
87
-    * class name.
88
-    * 
89
-    * @param string $className
90
-    * @return bool
91
-    */
85
+    /**
86
+     * Check if this class is a subclass of the specified
87
+     * class name.
88
+     * 
89
+     * @param string $className
90
+     * @return bool
91
+     */
92 92
     public function isSublassOf(string $className) : bool
93 93
     {
94 94
         return is_subclass_of($this->getNameNS(), $className);
95 95
     }
96 96
     
97
-   /**
98
-    * The class name without namespace.
99
-    * @return string
100
-    */
97
+    /**
98
+     * The class name without namespace.
99
+     * @return string
100
+     */
101 101
     public function getName() : string
102 102
     {
103 103
         return $this->name;
104 104
     }
105 105
     
106
-   /**
107
-    * The absolute class name with namespace (if any).
108
-    * @return string
109
-    */
106
+    /**
107
+     * The absolute class name with namespace (if any).
108
+     * @return string
109
+     */
110 110
     public function getNameNS() : string
111 111
     {
112 112
         $name = $this->getName();
@@ -118,48 +118,48 @@  discard block
 block discarded – undo
118 118
         return $name;
119 119
     }
120 120
     
121
-   /**
122
-    * Whether it is an abstract class.
123
-    * @return bool
124
-    */
121
+    /**
122
+     * Whether it is an abstract class.
123
+     * @return bool
124
+     */
125 125
     public function isAbstract() : bool
126 126
     {
127 127
         return $this->abstract;
128 128
     }
129 129
     
130
-   /**
131
-    * Whether it is a final class.
132
-    * @return bool
133
-    */
130
+    /**
131
+     * Whether it is a final class.
132
+     * @return bool
133
+     */
134 134
     public function isFinal() : bool
135 135
     {
136 136
         return $this->final;
137 137
     }
138 138
 
139
-   /**
140
-    * The name of the class that this class extends (with namespace, if specified).
141
-    * @return string
142
-    */
139
+    /**
140
+     * The name of the class that this class extends (with namespace, if specified).
141
+     * @return string
142
+     */
143 143
     public function getExtends() : string
144 144
     {
145 145
         return $this->extends;
146 146
     }
147 147
     
148
-   /**
149
-    * A list of interfaces the class implements, if any.
150
-    * @return string[]
151
-    */
148
+    /**
149
+     * A list of interfaces the class implements, if any.
150
+     * @return string[]
151
+     */
152 152
     public function getImplements() : array
153 153
     {
154 154
         return $this->implements;
155 155
     }
156 156
     
157
-   /**
158
-    * The class declaration string, with normalized spaces and sorted interface names.
159
-    * NOTE: does not include the keyword "abstract" or "final".
160
-    * 
161
-    * @return string
162
-    */
157
+    /**
158
+     * The class declaration string, with normalized spaces and sorted interface names.
159
+     * NOTE: does not include the keyword "abstract" or "final".
160
+     * 
161
+     * @return string
162
+     */
163 163
     public function getDeclaration() : string
164 164
     {
165 165
         $parts = array();
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
         return implode(' ', $parts);
180 180
     }
181 181
     
182
-   /**
183
-    * The keyword before "class", e.g. "abstract".
184
-    * @return string
185
-    */
182
+    /**
183
+     * The keyword before "class", e.g. "abstract".
184
+     * @return string
185
+     */
186 186
     public function getKeyword() : string
187 187
     {
188 188
         return $this->keyword;
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     {
112 112
         $name = $this->getName();
113 113
         
114
-        if($this->info->hasNamespace()) {
114
+        if ($this->info->hasNamespace()) {
115 115
             $name = $this->info->getNamespace().'\\'.$this->name;
116 116
         }
117 117
         
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
         $parts[] = $this->type;
167 167
         $parts[] = $this->getName();
168 168
         
169
-        if(!empty($this->extends)) {
169
+        if (!empty($this->extends)) {
170 170
             $parts[] = 'extends';
171 171
             $parts[] = $this->extends;
172 172
         }
173 173
         
174
-        if(!empty($this->implements)) {
174
+        if (!empty($this->implements)) {
175 175
             $parts[] = 'implements';
176 176
             $parts[] = implode(', ', $this->implements);
177 177
         }
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
 
196 196
     protected function analyzeCode() : void
197 197
     {
198
-        if($this->keyword === 'abstract') {
198
+        if ($this->keyword === 'abstract') {
199 199
             $this->abstract = true;
200
-        } else if($this->keyword === 'final') {
200
+        } else if ($this->keyword === 'final') {
201 201
             $this->final = true;
202 202
         }
203 203
         
@@ -214,16 +214,16 @@  discard block
 block discarded – undo
214 214
         
215 215
         $tokenName = 'none';
216 216
         
217
-        foreach($parts as $part)
217
+        foreach ($parts as $part)
218 218
         {
219 219
             $part = str_replace(',', '', $part);
220 220
             $part = trim($part);
221
-            if(empty($part)) {
221
+            if (empty($part)) {
222 222
                 continue;
223 223
             }
224 224
             
225 225
             $name = strtolower($part);
226
-            if($name === 'extends' || $name === 'implements') {
226
+            if ($name === 'extends' || $name === 'implements') {
227 227
                 $tokenName = $name;
228 228
                 continue;
229 229
             }
@@ -233,13 +233,13 @@  discard block
 block discarded – undo
233 233
         
234 234
         $this->implements = $tokens['implements'];
235 235
         
236
-        if(!empty($this->implements)) {
236
+        if (!empty($this->implements)) {
237 237
             usort($this->implements, function(string $a, string $b) {
238 238
                 return strnatcasecmp($a, $b);
239 239
             });
240 240
         }
241 241
         
242
-        if(!empty($tokens['extends'])) {
242
+        if (!empty($tokens['extends'])) {
243 243
             $this->extends = $tokens['extends'][0];
244 244
         }
245 245
     }
Please login to merge, or discard this patch.
src/StringBuilder.php 3 patches
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.
Indentation   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -37,19 +37,19 @@  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 $noSeparator = '§!§';
54 54
     
55 55
     public function __construct()
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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('&quot;%s&quot;', (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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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)) 
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
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.