Passed
Branch master (c991d8)
by Sebastian
08:15
created
src/VariableInfo.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -37,25 +37,25 @@  discard block
 block discarded – undo
37 37
 
38 38
     const ERROR_INVALID_SERIALIZED_DATA = 56301;
39 39
     
40
-   /**
41
-    * @var string
42
-    */
40
+    /**
41
+     * @var string
42
+     */
43 43
     protected $string;
44 44
     
45
-   /**
46
-    * @var mixed
47
-    */
45
+    /**
46
+     * @var mixed
47
+     */
48 48
     protected $value;
49 49
     
50
-   /**
51
-    * @var string
52
-    */
50
+    /**
51
+     * @var string
52
+     */
53 53
     protected $type;
54 54
     
55
-   /**
56
-    * @param mixed $value
57
-    * @param array|null $serialized
58
-    */
55
+    /**
56
+     * @param mixed $value
57
+     * @param array|null $serialized
58
+     */
59 59
     public function __construct($value, $serialized=null)
60 60
     {
61 61
         if(is_array($serialized))
@@ -68,40 +68,40 @@  discard block
 block discarded – undo
68 68
         }
69 69
     }
70 70
     
71
-   /**
72
-    * Creates a new variable info instance from a PHP variable
73
-    * of any type.
74
-    * 
75
-    * @param mixed $variable
76
-    * @return VariableInfo
77
-    */
71
+    /**
72
+     * Creates a new variable info instance from a PHP variable
73
+     * of any type.
74
+     * 
75
+     * @param mixed $variable
76
+     * @return VariableInfo
77
+     */
78 78
     public static function fromVariable($variable) : VariableInfo
79 79
     {
80 80
         return new VariableInfo($variable);
81 81
     }
82 82
     
83
-   /**
84
-    * Restores a variable info instance using a previously serialized
85
-    * array using the serialize() method.
86
-    * 
87
-    * @param array $serialized
88
-    * @return VariableInfo
89
-    * @see VariableInfo::serialize()
90
-    */
83
+    /**
84
+     * Restores a variable info instance using a previously serialized
85
+     * array using the serialize() method.
86
+     * 
87
+     * @param array $serialized
88
+     * @return VariableInfo
89
+     * @see VariableInfo::serialize()
90
+     */
91 91
     public static function fromSerialized(array $serialized) : VariableInfo
92 92
     {
93 93
         return new VariableInfo(null, $serialized);
94 94
     }
95 95
     
96
-   /**
97
-    * Parses a previously serialized data set to restore the 
98
-    * variable information from it.
99
-    * 
100
-    * @param array $serialized
101
-    * @throws BaseException
102
-    * 
103
-    * @see VariableInfo::ERROR_INVALID_SERIALIZED_DATA
104
-    */
96
+    /**
97
+     * Parses a previously serialized data set to restore the 
98
+     * variable information from it.
99
+     * 
100
+     * @param array $serialized
101
+     * @throws BaseException
102
+     * 
103
+     * @see VariableInfo::ERROR_INVALID_SERIALIZED_DATA
104
+     */
105 105
     protected function parseSerialized(array $serialized) : void
106 106
     {
107 107
         if(!isset($serialized['string']) || !isset($serialized['type']) || !isset($serialized['options']))
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
         return $this->value;
137 137
     }
138 138
     
139
-   /**
140
-    * The variable type - this is the same string that
141
-    * is returned by the PHP function `gettype`.
142
-    * 
143
-    * @return string
144
-    */
139
+    /**
140
+     * The variable type - this is the same string that
141
+     * is returned by the PHP function `gettype`.
142
+     * 
143
+     * @return string
144
+     */
145 145
     public function getType() : string
146 146
     {
147 147
         return $this->type;
@@ -155,13 +155,13 @@  discard block
 block discarded – undo
155 155
         );
156 156
     }
157 157
     
158
-   /**
159
-    * Whether to prepend the variable type before the value, 
160
-    * like the var_dump function. Example: <code>string "Some text"</code>.
161
-    * 
162
-    * @param bool $enable
163
-    * @return VariableInfo
164
-    */
158
+    /**
159
+     * Whether to prepend the variable type before the value, 
160
+     * like the var_dump function. Example: <code>string "Some text"</code>.
161
+     * 
162
+     * @param bool $enable
163
+     * @return VariableInfo
164
+     */
165 165
     public function enableType(bool $enable=true) : VariableInfo
166 166
     {
167 167
         return $this->setOption('prepend-type', $enable);
Please login to merge, or discard this patch.
src/ConvertHelper/URLFinder.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -22,14 +22,14 @@  discard block
 block discarded – undo
22 22
  */
23 23
 class ConvertHelper_URLFinder
24 24
 {
25
-   /**
26
-    * @var string
27
-    */
25
+    /**
26
+     * @var string
27
+     */
28 28
     protected $subject;
29 29
     
30
-   /**
31
-    * @var boolean
32
-    */
30
+    /**
31
+     * @var boolean
32
+     */
33 33
     protected $sorting = false;
34 34
     
35 35
     protected $schemes = array(
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
48 48
         $this->subject = $subject;
49 49
     }
50 50
     
51
-   /**
52
-    * Whether to enable sorting the URLs alphabetically (disabled by default).
53
-    * 
54
-    * @param bool $enabled
55
-    * @return ConvertHelper_URLFinder
56
-    */
51
+    /**
52
+     * Whether to enable sorting the URLs alphabetically (disabled by default).
53
+     * 
54
+     * @param bool $enabled
55
+     * @return ConvertHelper_URLFinder
56
+     */
57 57
     public function enableSorting(bool $enabled=true) : ConvertHelper_URLFinder
58 58
     {
59 59
         $this->sorting = $enabled;
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
         return $this;
62 62
     }
63 63
     
64
-   /**
65
-    * Prepares the subject string by adding a newline before all URL schemes,
66
-    * to make it possible to parse even lists of links separated by commas or
67
-    * the like (http://domain.com,http://domain2.com).
68
-    */
64
+    /**
65
+     * Prepares the subject string by adding a newline before all URL schemes,
66
+     * to make it possible to parse even lists of links separated by commas or
67
+     * the like (http://domain.com,http://domain2.com).
68
+     */
69 69
     protected function prepareSubject() : void
70 70
     {
71 71
         $replaces = array();
@@ -78,13 +78,13 @@  discard block
 block discarded – undo
78 78
         $this->subject = str_replace(array_keys($replaces), array_values($replaces), $this->subject);
79 79
     }
80 80
     
81
-   /**
82
-    * Fetches all URLs that can be found in the subject string.
83
-    * 
84
-    * @return string[]
85
-    * 
86
-    * @see https://gist.github.com/gruber/249502
87
-    */
81
+    /**
82
+     * Fetches all URLs that can be found in the subject string.
83
+     * 
84
+     * @return string[]
85
+     * 
86
+     * @see https://gist.github.com/gruber/249502
87
+     */
88 88
     public function getURLs() : array
89 89
     {
90 90
         $this->prepareSubject();
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
         return $result;
116 116
     }
117 117
     
118
-   /**
119
-    * Retrieves all URLs as URLInfo instances.
120
-    * 
121
-    * @return URLInfo[]
122
-    */
118
+    /**
119
+     * Retrieves all URLs as URLInfo instances.
120
+     * 
121
+     * @return URLInfo[]
122
+     */
123 123
     public function getInfos()
124 124
     {
125 125
         $urls = $this->getURLs();
Please login to merge, or discard this patch.
src/ConvertHelper.php 1 patch
Indentation   +490 added lines, -490 removed lines patch added patch discarded remove patch
@@ -58,13 +58,13 @@  discard block
 block discarded – undo
58 58
         return str_replace("\t", str_repeat(' ', $tabSize), $string);
59 59
     }
60 60
     
61
-   /**
62
-    * Converts spaces to tabs in the specified string.
63
-    * 
64
-    * @param string $string
65
-    * @param int $tabSize The amount of spaces per tab in the source string.
66
-    * @return string
67
-    */
61
+    /**
62
+     * Converts spaces to tabs in the specified string.
63
+     * 
64
+     * @param string $string
65
+     * @param int $tabSize The amount of spaces per tab in the source string.
66
+     * @return string
67
+     */
68 68
     public static function spaces2tabs(string $string, int $tabSize=4) : string
69 69
     {
70 70
         return str_replace(str_repeat(' ', $tabSize), "\t", $string);
@@ -77,14 +77,14 @@  discard block
 block discarded – undo
77 77
         return $converter->convert($string);
78 78
     }
79 79
     
80
-   /**
81
-    * Converts the specified amount of seconds into
82
-    * a human readable string split in months, weeks,
83
-    * days, hours, minutes and seconds.
84
-    *
85
-    * @param float $seconds
86
-    * @return string
87
-    */
80
+    /**
81
+     * Converts the specified amount of seconds into
82
+     * a human readable string split in months, weeks,
83
+     * days, hours, minutes and seconds.
84
+     *
85
+     * @param float $seconds
86
+     * @return string
87
+     */
88 88
     public static function time2string($seconds)
89 89
     {
90 90
         static $units = null;
@@ -156,41 +156,41 @@  discard block
 block discarded – undo
156 156
         return implode(', ', $tokens) . ' ' . t('and') . ' ' . $last;
157 157
     }
158 158
 
159
-   /**
160
-    * Converts a timestamp into an easily understandable
161
-    * format, e.g. "2 hours", "1 day", "3 months"
162
-    *
163
-    * If you set the date to parameter, the difference
164
-    * will be calculated between the two dates and not
165
-    * the current time.
166
-    *
167
-    * @param integer|\DateTime $datefrom
168
-    * @param integer|\DateTime $dateto
169
-    * @return string
170
-    */
159
+    /**
160
+     * Converts a timestamp into an easily understandable
161
+     * format, e.g. "2 hours", "1 day", "3 months"
162
+     *
163
+     * If you set the date to parameter, the difference
164
+     * will be calculated between the two dates and not
165
+     * the current time.
166
+     *
167
+     * @param integer|\DateTime $datefrom
168
+     * @param integer|\DateTime $dateto
169
+     * @return string
170
+     */
171 171
     public static function duration2string($datefrom, $dateto = -1) : string
172 172
     {
173
-         $converter = new ConvertHelper_DurationConverter();
173
+            $converter = new ConvertHelper_DurationConverter();
174 174
          
175
-         if($datefrom instanceof \DateTime)
176
-         {
177
-             $converter->setDateFrom($datefrom);
178
-         }
179
-         else
180
-         {
181
-             $converter->setDateFrom(self::timestamp2date($datefrom)); 
182
-         }
175
+            if($datefrom instanceof \DateTime)
176
+            {
177
+                $converter->setDateFrom($datefrom);
178
+            }
179
+            else
180
+            {
181
+                $converter->setDateFrom(self::timestamp2date($datefrom)); 
182
+            }
183 183
 
184
-         if($dateto instanceof \DateTime)
185
-         {
186
-             $converter->setDateTo($dateto);
187
-         }
188
-         else if($dateto > 0)
189
-         {
190
-             $converter->setDateTo(self::timestamp2date($dateto));
191
-         }
184
+            if($dateto instanceof \DateTime)
185
+            {
186
+                $converter->setDateTo($dateto);
187
+            }
188
+            else if($dateto > 0)
189
+            {
190
+                $converter->setDateTo(self::timestamp2date($dateto));
191
+            }
192 192
 
193
-         return $converter->convert();
193
+            return $converter->convert();
194 194
     }
195 195
 
196 196
     /**
@@ -229,44 +229,44 @@  discard block
 block discarded – undo
229 229
         return $geshi->parse_code();
230 230
     }
231 231
     
232
-   /**
233
-    * Converts a number of bytes to a human readable form,
234
-    * e.g. xx Kb / xx Mb / xx Gb
235
-    *
236
-    * @param int $bytes The amount of bytes to convert.
237
-    * @param int $precision The amount of decimals
238
-    * @param int $base The base to calculate with: Base 10 is default (=1000 Bytes in a KB), Base 2 is mainly used for Windows memory (=1024 Bytes in a KB).
239
-    * @return string
240
-    * 
241
-    * @see https://en.m.wikipedia.org/wiki/Megabyte#Definitions
242
-    */
232
+    /**
233
+     * Converts a number of bytes to a human readable form,
234
+     * e.g. xx Kb / xx Mb / xx Gb
235
+     *
236
+     * @param int $bytes The amount of bytes to convert.
237
+     * @param int $precision The amount of decimals
238
+     * @param int $base The base to calculate with: Base 10 is default (=1000 Bytes in a KB), Base 2 is mainly used for Windows memory (=1024 Bytes in a KB).
239
+     * @return string
240
+     * 
241
+     * @see https://en.m.wikipedia.org/wiki/Megabyte#Definitions
242
+     */
243 243
     public static function bytes2readable(int $bytes, int $precision = 1, int $base = ConvertHelper_StorageSizeEnum::BASE_10) : string
244 244
     {
245 245
         return self::parseBytes($bytes)->toString($precision, $base);
246 246
     }
247 247
     
248
-   /**
249
-    * Parses a number of bytes, and creates a converter instance which
250
-    * allows doing common operations with it.
251
-    * 
252
-    * @param int $bytes
253
-    * @return ConvertHelper_ByteConverter
254
-    */
248
+    /**
249
+     * Parses a number of bytes, and creates a converter instance which
250
+     * allows doing common operations with it.
251
+     * 
252
+     * @param int $bytes
253
+     * @return ConvertHelper_ByteConverter
254
+     */
255 255
     public static function parseBytes(int $bytes) : ConvertHelper_ByteConverter
256 256
     {
257 257
         return new ConvertHelper_ByteConverter($bytes);
258 258
     }
259 259
 
260
-   /**
261
-    * Cuts a text to the specified length if it is longer than the
262
-    * target length. Appends a text to signify it has been cut at 
263
-    * the end of the string.
264
-    * 
265
-    * @param string $text
266
-    * @param int $targetLength
267
-    * @param string $append
268
-    * @return string
269
-    */
260
+    /**
261
+     * Cuts a text to the specified length if it is longer than the
262
+     * target length. Appends a text to signify it has been cut at 
263
+     * the end of the string.
264
+     * 
265
+     * @param string $text
266
+     * @param int $targetLength
267
+     * @param string $append
268
+     * @return string
269
+     */
270 270
     public static function text_cut(string $text, int $targetLength, string $append = '...') : string
271 271
     {
272 272
         $length = mb_strlen($text);
@@ -290,14 +290,14 @@  discard block
 block discarded – undo
290 290
         return $info->toString();
291 291
     }
292 292
     
293
-   /**
294
-    * Pretty print_r.
295
-    * 
296
-    * @param mixed $var The variable to dump.
297
-    * @param bool $return Whether to return the dumped code.
298
-    * @param bool $html Whether to style the dump as HTML.
299
-    * @return string
300
-    */
293
+    /**
294
+     * Pretty print_r.
295
+     * 
296
+     * @param mixed $var The variable to dump.
297
+     * @param bool $return Whether to return the dumped code.
298
+     * @param bool $html Whether to style the dump as HTML.
299
+     * @return string
300
+     */
301 301
     public static function print_r($var, bool $return=false, bool $html=true) : string
302 302
     {
303 303
         $result = parseVariable($var)->enableType()->toString();
@@ -327,15 +327,15 @@  discard block
 block discarded – undo
327 327
         'no' => false
328 328
     );
329 329
 
330
-   /**
331
-    * Converts a string, number or boolean value to a boolean value.
332
-    * 
333
-    * @param mixed $string
334
-    * @throws ConvertHelper_Exception
335
-    * @return bool
336
-    * 
337
-    * @see ConvertHelper::ERROR_INVALID_BOOLEAN_STRING
338
-    */
330
+    /**
331
+     * Converts a string, number or boolean value to a boolean value.
332
+     * 
333
+     * @param mixed $string
334
+     * @throws ConvertHelper_Exception
335
+     * @return bool
336
+     * 
337
+     * @see ConvertHelper::ERROR_INVALID_BOOLEAN_STRING
338
+     */
339 339
     public static function string2bool($string) : bool
340 340
     {
341 341
         if($string === '' || $string === null || !is_scalar($string)) 
@@ -363,27 +363,27 @@  discard block
 block discarded – undo
363 363
         );
364 364
     }
365 365
     
366
-   /**
367
-    * Whether the specified string is a boolean string or boolean value.
368
-    * Alias for {@link ConvertHelper::isBoolean()}.
369
-    * 
370
-    * @param mixed $string
371
-    * @return bool
372
-    * @deprecated
373
-    * @see ConvertHelper::isBoolean()
374
-    */
366
+    /**
367
+     * Whether the specified string is a boolean string or boolean value.
368
+     * Alias for {@link ConvertHelper::isBoolean()}.
369
+     * 
370
+     * @param mixed $string
371
+     * @return bool
372
+     * @deprecated
373
+     * @see ConvertHelper::isBoolean()
374
+     */
375 375
     public static function isBooleanString($string) : bool
376 376
     {
377 377
         return self::isBoolean($string);
378 378
     }
379 379
 
380
-   /**
381
-    * Alias for the {@\AppUtils\XMLHelper::string2xml()} method.
382
-    * 
383
-    * @param string $text
384
-    * @return string
385
-    * @deprecated
386
-    */
380
+    /**
381
+     * Alias for the {@\AppUtils\XMLHelper::string2xml()} method.
382
+     * 
383
+     * @param string $text
384
+     * @return string
385
+     * @deprecated
386
+     */
387 387
     public static function text_makeXMLCompliant($text)
388 388
     {
389 389
         return XMLHelper::string2xml($text);
@@ -485,80 +485,80 @@  discard block
 block discarded – undo
485 485
         return $translit->convert($string);
486 486
     }
487 487
     
488
-   /**
489
-    * Retrieves the HEX character codes for all control
490
-    * characters that the {@link stripControlCharacters()} 
491
-    * method will remove.
492
-    * 
493
-    * @return string[]
494
-    */
488
+    /**
489
+     * Retrieves the HEX character codes for all control
490
+     * characters that the {@link stripControlCharacters()} 
491
+     * method will remove.
492
+     * 
493
+     * @return string[]
494
+     */
495 495
     public static function getControlCharactersAsHex()
496 496
     {
497 497
         return self::createControlCharacters()->getCharsAsHex();
498 498
     }
499 499
     
500
-   /**
501
-    * Retrieves an array of all control characters that
502
-    * the {@link stripControlCharacters()} method will 
503
-    * remove, as the actual UTF-8 characters.
504
-    * 
505
-    * @return string[]
506
-    */
500
+    /**
501
+     * Retrieves an array of all control characters that
502
+     * the {@link stripControlCharacters()} method will 
503
+     * remove, as the actual UTF-8 characters.
504
+     * 
505
+     * @return string[]
506
+     */
507 507
     public static function getControlCharactersAsUTF8()
508 508
     {
509 509
         return self::createControlCharacters()->getCharsAsUTF8();
510 510
     }
511 511
     
512
-   /**
513
-    * Retrieves all control characters as JSON encoded
514
-    * characters, e.g. "\u200b".
515
-    * 
516
-    * @return string[]
517
-    */
512
+    /**
513
+     * Retrieves all control characters as JSON encoded
514
+     * characters, e.g. "\u200b".
515
+     * 
516
+     * @return string[]
517
+     */
518 518
     public static function getControlCharactersAsJSON()
519 519
     {
520 520
         return self::createControlCharacters()->getCharsAsJSON();
521 521
     }
522 522
     
523
-   /**
524
-    * Removes all control characters from the specified string
525
-    * that can cause problems in some cases, like creating
526
-    * valid XML documents. This includes invisible non-breaking
527
-    * spaces.
528
-    *
529
-    * @param string $string
530
-    * @return string
531
-    */
523
+    /**
524
+     * Removes all control characters from the specified string
525
+     * that can cause problems in some cases, like creating
526
+     * valid XML documents. This includes invisible non-breaking
527
+     * spaces.
528
+     *
529
+     * @param string $string
530
+     * @return string
531
+     */
532 532
     public static function stripControlCharacters(string $string) : string
533 533
     {
534 534
         return self::createControlCharacters()->stripControlCharacters($string);
535 535
     }
536 536
     
537
-   /**
538
-    * Creates the control characters class, used to 
539
-    * work with control characters in strings.
540
-    * 
541
-    * @return ConvertHelper_ControlCharacters
542
-    */
537
+    /**
538
+     * Creates the control characters class, used to 
539
+     * work with control characters in strings.
540
+     * 
541
+     * @return ConvertHelper_ControlCharacters
542
+     */
543 543
     public static function createControlCharacters() : ConvertHelper_ControlCharacters
544 544
     {
545 545
         return new ConvertHelper_ControlCharacters();
546 546
     }
547 547
 
548
-   /**
549
-    * Converts a unicode character to the PHPO notation.
550
-    * 
551
-    * Example:
552
-    * 
553
-    * <pre>unicodeChar2php('"\u0000"')</pre>
554
-    * 
555
-    * Returns
556
-    * 
557
-    * <pre>\x0</pre>
558
-    * 
559
-    * @param string $unicodeChar
560
-    * @return string
561
-    */
548
+    /**
549
+     * Converts a unicode character to the PHPO notation.
550
+     * 
551
+     * Example:
552
+     * 
553
+     * <pre>unicodeChar2php('"\u0000"')</pre>
554
+     * 
555
+     * Returns
556
+     * 
557
+     * <pre>\x0</pre>
558
+     * 
559
+     * @param string $unicodeChar
560
+     * @return string
561
+     */
562 562
     public static function unicodeChar2php(string $unicodeChar) : string 
563 563
     {
564 564
         $unicodeChar = json_decode($unicodeChar);
@@ -684,25 +684,25 @@  discard block
 block discarded – undo
684 684
         return 'false';
685 685
     }
686 686
     
687
-   /**
688
-    * Converts an associative array with attribute name > value pairs
689
-    * to an attribute string that can be used in an HTML tag. Empty 
690
-    * attribute values are ignored.
691
-    * 
692
-    * Example:
693
-    * 
694
-    * array2attributeString(array(
695
-    *     'id' => 45,
696
-    *     'href' => 'http://www.mistralys.com'
697
-    * ));
698
-    * 
699
-    * Result:
700
-    * 
701
-    * id="45" href="http://www.mistralys.com"
702
-    * 
703
-    * @param array $array
704
-    * @return string
705
-    */
687
+    /**
688
+     * Converts an associative array with attribute name > value pairs
689
+     * to an attribute string that can be used in an HTML tag. Empty 
690
+     * attribute values are ignored.
691
+     * 
692
+     * Example:
693
+     * 
694
+     * array2attributeString(array(
695
+     *     'id' => 45,
696
+     *     'href' => 'http://www.mistralys.com'
697
+     * ));
698
+     * 
699
+     * Result:
700
+     * 
701
+     * id="45" href="http://www.mistralys.com"
702
+     * 
703
+     * @param array $array
704
+     * @return string
705
+     */
706 706
     public static function array2attributeString($array)
707 707
     {
708 708
         $tokens = array();
@@ -721,14 +721,14 @@  discard block
 block discarded – undo
721 721
         return ' '.implode(' ', $tokens);
722 722
     }
723 723
     
724
-   /**
725
-    * Converts a string so it can safely be used in a javascript
726
-    * statement in an HTML tag: uses single quotes around the string
727
-    * and encodes all special characters as needed.
728
-    * 
729
-    * @param string $string
730
-    * @return string
731
-    */
724
+    /**
725
+     * Converts a string so it can safely be used in a javascript
726
+     * statement in an HTML tag: uses single quotes around the string
727
+     * and encodes all special characters as needed.
728
+     * 
729
+     * @param string $string
730
+     * @return string
731
+     */
732 732
     public static function string2attributeJS($string, $quoted=true)
733 733
     {
734 734
         $converted = addslashes(htmlspecialchars(strip_tags($string), ENT_QUOTES, 'UTF-8'));
@@ -739,15 +739,15 @@  discard block
 block discarded – undo
739 739
         return $converted;
740 740
     }
741 741
     
742
-   /**
743
-    * Checks if the specified string is a boolean value, which
744
-    * includes string representations of boolean values, like 
745
-    * <code>yes</code> or <code>no</code>, and <code>true</code>
746
-    * or <code>false</code>.
747
-    * 
748
-    * @param mixed $value
749
-    * @return boolean
750
-    */
742
+    /**
743
+     * Checks if the specified string is a boolean value, which
744
+     * includes string representations of boolean values, like 
745
+     * <code>yes</code> or <code>no</code>, and <code>true</code>
746
+     * or <code>false</code>.
747
+     * 
748
+     * @param mixed $value
749
+     * @return boolean
750
+     */
751 751
     public static function isBoolean($value) : bool
752 752
     {
753 753
         if(is_bool($value)) {
@@ -761,12 +761,12 @@  discard block
 block discarded – undo
761 761
         return array_key_exists($value, self::$booleanStrings);
762 762
     }
763 763
     
764
-   /**
765
-    * Converts an associative array to an HTML style attribute value string.
766
-    * 
767
-    * @param array $subject
768
-    * @return string
769
-    */
764
+    /**
765
+     * Converts an associative array to an HTML style attribute value string.
766
+     * 
767
+     * @param array $subject
768
+     * @return string
769
+     */
770 770
     public static function array2styleString(array $subject) : string
771 771
     {
772 772
         $tokens = array();
@@ -777,23 +777,23 @@  discard block
 block discarded – undo
777 777
         return implode(';', $tokens);
778 778
     }
779 779
     
780
-   /**
781
-    * Converts a DateTime object to a timestamp, which
782
-    * is PHP 5.2 compatible.
783
-    * 
784
-    * @param \DateTime $date
785
-    * @return integer
786
-    */
780
+    /**
781
+     * Converts a DateTime object to a timestamp, which
782
+     * is PHP 5.2 compatible.
783
+     * 
784
+     * @param \DateTime $date
785
+     * @return integer
786
+     */
787 787
     public static function date2timestamp(\DateTime $date) : int
788 788
     {
789 789
         return (int)$date->format('U');
790 790
     }
791 791
     
792
-   /**
793
-    * Converts a timestamp into a DateTime instance.
794
-    * @param int $timestamp
795
-    * @return \DateTime
796
-    */
792
+    /**
793
+     * Converts a timestamp into a DateTime instance.
794
+     * @param int $timestamp
795
+     * @return \DateTime
796
+     */
797 797
     public static function timestamp2date(int $timestamp) : \DateTime
798 798
     {
799 799
         $date = new \DateTime();
@@ -801,50 +801,50 @@  discard block
 block discarded – undo
801 801
         return $date;
802 802
     }
803 803
     
804
-   /**
805
-    * Strips an absolute path to a file within the application
806
-    * to make the path relative to the application root path.
807
-    * 
808
-    * @param string $path
809
-    * @return string
810
-    * 
811
-    * @see FileHelper::relativizePath()
812
-    * @see FileHelper::relativizePathByDepth()
813
-    */
804
+    /**
805
+     * Strips an absolute path to a file within the application
806
+     * to make the path relative to the application root path.
807
+     * 
808
+     * @param string $path
809
+     * @return string
810
+     * 
811
+     * @see FileHelper::relativizePath()
812
+     * @see FileHelper::relativizePathByDepth()
813
+     */
814 814
     public static function fileRelativize(string $path) : string
815 815
     {
816 816
         return FileHelper::relativizePathByDepth($path);
817 817
     }
818 818
     
819 819
     /**
820
-    * Converts a PHP regex to a javascript RegExp object statement.
821
-    * 
822
-    * NOTE: This is an alias for the JSHelper's `convertRegex` method. 
823
-    * More details are available on its usage there.
824
-    *
825
-    * @param string $regex A PHP preg regex
826
-    * @param string $statementType The type of statement to return: Defaults to a statement to create a RegExp object.
827
-    * @return array|string Depending on the specified return type.
828
-    * 
829
-    * @see JSHelper::buildRegexStatement()
830
-    */
820
+     * Converts a PHP regex to a javascript RegExp object statement.
821
+     * 
822
+     * NOTE: This is an alias for the JSHelper's `convertRegex` method. 
823
+     * More details are available on its usage there.
824
+     *
825
+     * @param string $regex A PHP preg regex
826
+     * @param string $statementType The type of statement to return: Defaults to a statement to create a RegExp object.
827
+     * @return array|string Depending on the specified return type.
828
+     * 
829
+     * @see JSHelper::buildRegexStatement()
830
+     */
831 831
     public static function regex2js(string $regex, string $statementType=JSHelper::JS_REGEX_OBJECT)
832 832
     {
833 833
         return JSHelper::buildRegexStatement($regex, $statementType);
834 834
     }
835 835
     
836
-   /**
837
-    * Converts the specified variable to JSON. Works just
838
-    * like the native `json_encode` method, except that it
839
-    * will trigger an exception on failure, which has the 
840
-    * json error details included in its developer details.
841
-    * 
842
-    * @param mixed $variable
843
-    * @param int $options JSON encode options.
844
-    * @param int $depth 
845
-    * @throws ConvertHelper_Exception
846
-    * @return string
847
-    */
836
+    /**
837
+     * Converts the specified variable to JSON. Works just
838
+     * like the native `json_encode` method, except that it
839
+     * will trigger an exception on failure, which has the 
840
+     * json error details included in its developer details.
841
+     * 
842
+     * @param mixed $variable
843
+     * @param int $options JSON encode options.
844
+     * @param int $depth 
845
+     * @throws ConvertHelper_Exception
846
+     * @return string
847
+     */
848 848
     public static function var2json($variable, int $options=0, int $depth=512) : string
849 849
     {
850 850
         $result = json_encode($variable, $options, $depth);
@@ -865,12 +865,12 @@  discard block
 block discarded – undo
865 865
         );
866 866
     }
867 867
     
868
-   /**
869
-    * Strips all known UTF byte order marks from the specified string.
870
-    * 
871
-    * @param string $string
872
-    * @return string
873
-    */
868
+    /**
869
+     * Strips all known UTF byte order marks from the specified string.
870
+     * 
871
+     * @param string $string
872
+     * @return string
873
+     */
874 874
     public static function stripUTFBom($string)
875 875
     {
876 876
         $boms = FileHelper::getUTFBOMs();
@@ -885,13 +885,13 @@  discard block
 block discarded – undo
885 885
         return $string;
886 886
     }
887 887
 
888
-   /**
889
-    * Converts a string to valid utf8, regardless
890
-    * of the string's encoding(s).
891
-    * 
892
-    * @param string $string
893
-    * @return string
894
-    */
888
+    /**
889
+     * Converts a string to valid utf8, regardless
890
+     * of the string's encoding(s).
891
+     * 
892
+     * @param string $string
893
+     * @return string
894
+     */
895 895
     public static function string2utf8($string)
896 896
     {
897 897
         if(!self::isStringASCII($string)) {
@@ -901,15 +901,15 @@  discard block
 block discarded – undo
901 901
         return $string;
902 902
     }
903 903
     
904
-   /**
905
-    * Checks whether the specified string is an ASCII
906
-    * string, without any special or UTF8 characters.
907
-    * Note: empty strings and NULL are considered ASCII.
908
-    * Any variable types other than strings are not.
909
-    * 
910
-    * @param mixed $string
911
-    * @return boolean
912
-    */
904
+    /**
905
+     * Checks whether the specified string is an ASCII
906
+     * string, without any special or UTF8 characters.
907
+     * Note: empty strings and NULL are considered ASCII.
908
+     * Any variable types other than strings are not.
909
+     * 
910
+     * @param mixed $string
911
+     * @return boolean
912
+     */
913 913
     public static function isStringASCII($string) : bool
914 914
     {
915 915
         if($string === '' || $string === NULL) {
@@ -934,22 +934,22 @@  discard block
 block discarded – undo
934 934
         return $url;
935 935
     }
936 936
 
937
-   /**
938
-    * Calculates a percentage match of the source string with the target string.
939
-    * 
940
-    * Options are:
941
-    * 
942
-    * - maxLevenshtein, default: 10
943
-    *   Any levenshtein results above this value are ignored.
944
-    *   
945
-    * - precision, default: 1
946
-    *   The precision of the percentage float value
947
-    * 
948
-    * @param string $source
949
-    * @param string $target
950
-    * @param array $options
951
-    * @return float
952
-    */
937
+    /**
938
+     * Calculates a percentage match of the source string with the target string.
939
+     * 
940
+     * Options are:
941
+     * 
942
+     * - maxLevenshtein, default: 10
943
+     *   Any levenshtein results above this value are ignored.
944
+     *   
945
+     * - precision, default: 1
946
+     *   The precision of the percentage float value
947
+     * 
948
+     * @param string $source
949
+     * @param string $target
950
+     * @param array $options
951
+     * @return float
952
+     */
953 953
     public static function matchString($source, $target, $options=array())
954 954
     {
955 955
         $defaults = array(
@@ -973,14 +973,14 @@  discard block
 block discarded – undo
973 973
         return round(100 - $percent, $options['precision']);
974 974
     }
975 975
     
976
-   /**
977
-    * Converts a date interval to a human readable string with
978
-    * all necessary time components, e.g. "1 year, 2 months and 4 days".
979
-    * 
980
-    * @param \DateInterval $interval
981
-    * @return string
982
-    * @see ConvertHelper_IntervalConverter
983
-    */
976
+    /**
977
+     * Converts a date interval to a human readable string with
978
+     * all necessary time components, e.g. "1 year, 2 months and 4 days".
979
+     * 
980
+     * @param \DateInterval $interval
981
+     * @return string
982
+     * @see ConvertHelper_IntervalConverter
983
+     */
984 984
     public static function interval2string(\DateInterval $interval) : string
985 985
     {
986 986
         $converter = new ConvertHelper_IntervalConverter();
@@ -995,60 +995,60 @@  discard block
 block discarded – undo
995 995
     
996 996
     const INTERVAL_SECONDS = 'seconds';
997 997
     
998
-   /**
999
-    * Converts an interval to its total amount of days.
1000
-    * @param \DateInterval $interval
1001
-    * @return int
1002
-    */
998
+    /**
999
+     * Converts an interval to its total amount of days.
1000
+     * @param \DateInterval $interval
1001
+     * @return int
1002
+     */
1003 1003
     public static function interval2days(\DateInterval $interval) : int
1004 1004
     {
1005 1005
         return self::interval2total($interval, self::INTERVAL_DAYS);
1006 1006
     }
1007 1007
 
1008
-   /**
1009
-    * Converts an interval to its total amount of hours.
1010
-    * @param \DateInterval $interval
1011
-    * @return int
1012
-    */
1008
+    /**
1009
+     * Converts an interval to its total amount of hours.
1010
+     * @param \DateInterval $interval
1011
+     * @return int
1012
+     */
1013 1013
     public static function interval2hours(\DateInterval $interval) : int
1014 1014
     {
1015 1015
         return self::interval2total($interval, self::INTERVAL_HOURS);
1016 1016
     }
1017 1017
     
1018
-   /**
1019
-    * Converts an interval to its total amount of minutes. 
1020
-    * @param \DateInterval $interval
1021
-    * @return int
1022
-    */
1018
+    /**
1019
+     * Converts an interval to its total amount of minutes. 
1020
+     * @param \DateInterval $interval
1021
+     * @return int
1022
+     */
1023 1023
     public static function interval2minutes(\DateInterval $interval) : int
1024 1024
     {
1025 1025
         return self::interval2total($interval, self::INTERVAL_MINUTES);
1026 1026
     }
1027 1027
     
1028
-   /**
1029
-    * Converts an interval to its total amount of seconds.
1030
-    * @param \DateInterval $interval
1031
-    * @return int
1032
-    */    
1028
+    /**
1029
+     * Converts an interval to its total amount of seconds.
1030
+     * @param \DateInterval $interval
1031
+     * @return int
1032
+     */    
1033 1033
     public static function interval2seconds(\DateInterval $interval) : int
1034 1034
     {
1035 1035
         return self::interval2total($interval, self::INTERVAL_SECONDS);
1036 1036
     }
1037 1037
     
1038
-   /**
1039
-    * Calculates the total amount of days / hours / minutes or seconds
1040
-    * of a date interval object (depending in the specified units), and 
1041
-    * returns the total amount.
1042
-    * 
1043
-    * @param \DateInterval $interval
1044
-    * @param string $unit What total value to calculate.
1045
-    * @return integer
1046
-    * 
1047
-    * @see ConvertHelper::INTERVAL_SECONDS
1048
-    * @see ConvertHelper::INTERVAL_MINUTES
1049
-    * @see ConvertHelper::INTERVAL_HOURS
1050
-    * @see ConvertHelper::INTERVAL_DAYS
1051
-    */
1038
+    /**
1039
+     * Calculates the total amount of days / hours / minutes or seconds
1040
+     * of a date interval object (depending in the specified units), and 
1041
+     * returns the total amount.
1042
+     * 
1043
+     * @param \DateInterval $interval
1044
+     * @param string $unit What total value to calculate.
1045
+     * @return integer
1046
+     * 
1047
+     * @see ConvertHelper::INTERVAL_SECONDS
1048
+     * @see ConvertHelper::INTERVAL_MINUTES
1049
+     * @see ConvertHelper::INTERVAL_HOURS
1050
+     * @see ConvertHelper::INTERVAL_DAYS
1051
+     */
1052 1052
     public static function interval2total(\DateInterval $interval, $unit=self::INTERVAL_SECONDS) : int
1053 1053
     {
1054 1054
         $total = (int)$interval->format('%a');
@@ -1088,13 +1088,13 @@  discard block
 block discarded – undo
1088 1088
         'Sunday'
1089 1089
     );
1090 1090
     
1091
-   /**
1092
-    * Converts a date to the corresponding day name.
1093
-    * 
1094
-    * @param \DateTime $date
1095
-    * @param bool $short
1096
-    * @return string|NULL
1097
-    */
1091
+    /**
1092
+     * Converts a date to the corresponding day name.
1093
+     * 
1094
+     * @param \DateTime $date
1095
+     * @param bool $short
1096
+     * @return string|NULL
1097
+     */
1098 1098
     public static function date2dayName(\DateTime $date, bool $short=false)
1099 1099
     {
1100 1100
         $day = $date->format('l');
@@ -1109,21 +1109,21 @@  discard block
 block discarded – undo
1109 1109
         return null;
1110 1110
     }
1111 1111
     
1112
-   /**
1113
-    * Retrieves a list of english day names.
1114
-    * @return string[]
1115
-    */
1112
+    /**
1113
+     * Retrieves a list of english day names.
1114
+     * @return string[]
1115
+     */
1116 1116
     public static function getDayNamesInvariant()
1117 1117
     {
1118 1118
         return self::$daysInvariant;
1119 1119
     }
1120 1120
     
1121
-   /**
1122
-    * Retrieves the day names list for the current locale.
1123
-    * 
1124
-    * @param bool $short
1125
-    * @return array
1126
-    */
1121
+    /**
1122
+     * Retrieves the day names list for the current locale.
1123
+     * 
1124
+     * @param bool $short
1125
+     * @return array
1126
+     */
1127 1127
     public static function getDayNames(bool $short=false) : array
1128 1128
     {
1129 1129
         if($short) {
@@ -1183,16 +1183,16 @@  discard block
 block discarded – undo
1183 1183
         return $last;
1184 1184
     }
1185 1185
     
1186
-   /**
1187
-    * Splits a string into an array of all characters it is composed of.
1188
-    * Unicode character safe.
1189
-    * 
1190
-    * NOTE: Spaces and newlines (both \r and \n) are also considered single
1191
-    * characters.
1192
-    * 
1193
-    * @param string $string
1194
-    * @return array
1195
-    */
1186
+    /**
1187
+     * Splits a string into an array of all characters it is composed of.
1188
+     * Unicode character safe.
1189
+     * 
1190
+     * NOTE: Spaces and newlines (both \r and \n) are also considered single
1191
+     * characters.
1192
+     * 
1193
+     * @param string $string
1194
+     * @return array
1195
+     */
1196 1196
     public static function string2array(string $string) : array
1197 1197
     {
1198 1198
         $result = preg_split('//u', $string, null, PREG_SPLIT_NO_EMPTY);
@@ -1203,12 +1203,12 @@  discard block
 block discarded – undo
1203 1203
         return array();
1204 1204
     }
1205 1205
     
1206
-   /**
1207
-    * Checks whether the specified string contains HTML code.
1208
-    * 
1209
-    * @param string $string
1210
-    * @return boolean
1211
-    */
1206
+    /**
1207
+     * Checks whether the specified string contains HTML code.
1208
+     * 
1209
+     * @param string $string
1210
+     * @return boolean
1211
+     */
1212 1212
     public static function isStringHTML(string $string) : bool
1213 1213
     {
1214 1214
         if(preg_match('%<[a-z/][\s\S]*>%siU', $string)) {
@@ -1223,17 +1223,17 @@  discard block
 block discarded – undo
1223 1223
         return false;
1224 1224
     }
1225 1225
     
1226
-   /**
1227
-    * UTF8-safe wordwrap method: works like the regular wordwrap
1228
-    * PHP function but compatible with UTF8. Otherwise the lengths
1229
-    * are not calculated correctly.
1230
-    * 
1231
-    * @param string $str
1232
-    * @param int $width
1233
-    * @param string $break
1234
-    * @param bool $cut
1235
-    * @return string
1236
-    */
1226
+    /**
1227
+     * UTF8-safe wordwrap method: works like the regular wordwrap
1228
+     * PHP function but compatible with UTF8. Otherwise the lengths
1229
+     * are not calculated correctly.
1230
+     * 
1231
+     * @param string $str
1232
+     * @param int $width
1233
+     * @param string $break
1234
+     * @param bool $cut
1235
+     * @return string
1236
+     */
1237 1237
     public static function wordwrap(string $str, int $width = 75, string $break = "\n", bool $cut = false) : string 
1238 1238
     {
1239 1239
         $wrapper = new ConvertHelper_WordWrapper();
@@ -1245,27 +1245,27 @@  discard block
 block discarded – undo
1245 1245
         ->wrapText($str);
1246 1246
     }
1247 1247
     
1248
-   /**
1249
-    * Calculates the byte length of a string, taking into 
1250
-    * account any unicode characters.
1251
-    * 
1252
-    * @param string $string
1253
-    * @return int
1254
-    * @see https://stackoverflow.com/a/9718273/2298192
1255
-    */
1248
+    /**
1249
+     * Calculates the byte length of a string, taking into 
1250
+     * account any unicode characters.
1251
+     * 
1252
+     * @param string $string
1253
+     * @return int
1254
+     * @see https://stackoverflow.com/a/9718273/2298192
1255
+     */
1256 1256
     public static function string2bytes($string)
1257 1257
     {
1258 1258
         return mb_strlen($string, '8bit');
1259 1259
     }
1260 1260
     
1261
-   /**
1262
-    * Creates a short, 8-character long hash for the specified string.
1263
-    * 
1264
-    * WARNING: Not cryptographically safe.
1265
-    * 
1266
-    * @param string $string
1267
-    * @return string
1268
-    */
1261
+    /**
1262
+     * Creates a short, 8-character long hash for the specified string.
1263
+     * 
1264
+     * WARNING: Not cryptographically safe.
1265
+     * 
1266
+     * @param string $string
1267
+     * @return string
1268
+     */
1269 1269
     public static function string2shortHash($string)
1270 1270
     {
1271 1271
         return hash('crc32', $string, false);
@@ -1291,40 +1291,40 @@  discard block
 block discarded – undo
1291 1291
         return ConvertHelper_ThrowableInfo::fromThrowable($e);
1292 1292
     }
1293 1293
     
1294
-   /**
1295
-    * Parses the specified query string like the native 
1296
-    * function <code>parse_str</code>, without the key
1297
-    * naming limitations.
1298
-    * 
1299
-    * Using parse_str, dots or spaces in key names are 
1300
-    * replaced by underscores. This method keeps all names
1301
-    * intact.
1302
-    * 
1303
-    * It still uses the parse_str implementation as it 
1304
-    * is tested and tried, but fixes the parameter names
1305
-    * after parsing, as needed.
1306
-    * 
1307
-    * @param string $queryString
1308
-    * @return array
1309
-    * @see ConvertHelper_QueryParser
1310
-    */
1294
+    /**
1295
+     * Parses the specified query string like the native 
1296
+     * function <code>parse_str</code>, without the key
1297
+     * naming limitations.
1298
+     * 
1299
+     * Using parse_str, dots or spaces in key names are 
1300
+     * replaced by underscores. This method keeps all names
1301
+     * intact.
1302
+     * 
1303
+     * It still uses the parse_str implementation as it 
1304
+     * is tested and tried, but fixes the parameter names
1305
+     * after parsing, as needed.
1306
+     * 
1307
+     * @param string $queryString
1308
+     * @return array
1309
+     * @see ConvertHelper_QueryParser
1310
+     */
1311 1311
     public static function parseQueryString(string $queryString) : array
1312 1312
     {
1313 1313
         $parser = new ConvertHelper_QueryParser();
1314 1314
         return $parser->parse($queryString);
1315 1315
     }
1316 1316
 
1317
-   /**
1318
-    * Searches for needle in the specified string, and returns a list
1319
-    * of all occurrences, including the matched string. The matched 
1320
-    * string is useful when doing a case insensitive search, as it 
1321
-    * shows the exact matched case of needle.
1322
-    *   
1323
-    * @param string $needle
1324
-    * @param string $haystack
1325
-    * @param bool $caseInsensitive
1326
-    * @return ConvertHelper_StringMatch[]
1327
-    */
1317
+    /**
1318
+     * Searches for needle in the specified string, and returns a list
1319
+     * of all occurrences, including the matched string. The matched 
1320
+     * string is useful when doing a case insensitive search, as it 
1321
+     * shows the exact matched case of needle.
1322
+     *   
1323
+     * @param string $needle
1324
+     * @param string $haystack
1325
+     * @param bool $caseInsensitive
1326
+     * @return ConvertHelper_StringMatch[]
1327
+     */
1328 1328
     public static function findString(string $needle, string $haystack, bool $caseInsensitive=false)
1329 1329
     {
1330 1330
         if($needle === '') {
@@ -1350,14 +1350,14 @@  discard block
 block discarded – undo
1350 1350
         return $positions;
1351 1351
     }
1352 1352
     
1353
-   /**
1354
-    * Like explode, but trims all entries, and removes 
1355
-    * empty entries from the resulting array.
1356
-    * 
1357
-    * @param string $delimiter
1358
-    * @param string $string
1359
-    * @return string[]
1360
-    */
1353
+    /**
1354
+     * Like explode, but trims all entries, and removes 
1355
+     * empty entries from the resulting array.
1356
+     * 
1357
+     * @param string $delimiter
1358
+     * @param string $string
1359
+     * @return string[]
1360
+     */
1361 1361
     public static function explodeTrim(string $delimiter, string $string) : array
1362 1362
     {
1363 1363
         if(empty($string) || empty($delimiter)) {
@@ -1379,12 +1379,12 @@  discard block
 block discarded – undo
1379 1379
     
1380 1380
     protected static $eolChars;
1381 1381
 
1382
-   /**
1383
-    * Detects the most used end-of-line character in the subject string.
1384
-    * 
1385
-    * @param string $subjectString The string to check.
1386
-    * @return NULL|ConvertHelper_EOL The detected EOL instance, or NULL if none has been detected.
1387
-    */
1382
+    /**
1383
+     * Detects the most used end-of-line character in the subject string.
1384
+     * 
1385
+     * @param string $subjectString The string to check.
1386
+     * @return NULL|ConvertHelper_EOL The detected EOL instance, or NULL if none has been detected.
1387
+     */
1388 1388
     public static function detectEOLCharacter(string $subjectString) : ?ConvertHelper_EOL
1389 1389
     {
1390 1390
         if(empty($subjectString)) {
@@ -1396,27 +1396,27 @@  discard block
 block discarded – undo
1396 1396
             $cr = chr((int)hexdec('0d'));
1397 1397
             $lf = chr((int)hexdec('0a'));
1398 1398
             
1399
-           self::$eolChars = array(
1400
-               array(
1401
-                   'char' => $cr.$lf,
1402
-                   'type' => ConvertHelper_EOL::TYPE_CRLF,
1403
-                   'description' => t('Carriage return followed by a line feed'),
1404
-               ),
1405
-               array(
1406
-                   'char' => $lf.$cr,
1407
-                   'type' => ConvertHelper_EOL::TYPE_LFCR,
1408
-                   'description' => t('Line feed followed by a carriage return'),
1409
-               ),
1410
-               array(
1411
-                  'char' => $lf,
1412
-                  'type' => ConvertHelper_EOL::TYPE_LF,
1413
-                  'description' => t('Line feed'),
1414
-               ),
1415
-               array(
1416
-                  'char' => $cr,
1417
-                  'type' => ConvertHelper_EOL::TYPE_CR,
1418
-                  'description' => t('Carriage Return'),
1419
-               ),
1399
+            self::$eolChars = array(
1400
+                array(
1401
+                    'char' => $cr.$lf,
1402
+                    'type' => ConvertHelper_EOL::TYPE_CRLF,
1403
+                    'description' => t('Carriage return followed by a line feed'),
1404
+                ),
1405
+                array(
1406
+                    'char' => $lf.$cr,
1407
+                    'type' => ConvertHelper_EOL::TYPE_LFCR,
1408
+                    'description' => t('Line feed followed by a carriage return'),
1409
+                ),
1410
+                array(
1411
+                    'char' => $lf,
1412
+                    'type' => ConvertHelper_EOL::TYPE_LF,
1413
+                    'description' => t('Line feed'),
1414
+                ),
1415
+                array(
1416
+                    'char' => $cr,
1417
+                    'type' => ConvertHelper_EOL::TYPE_CR,
1418
+                    'description' => t('Carriage Return'),
1419
+                ),
1420 1420
             );
1421 1421
         }
1422 1422
         
@@ -1444,13 +1444,13 @@  discard block
 block discarded – undo
1444 1444
         );
1445 1445
     }
1446 1446
 
1447
-   /**
1448
-    * Removes the specified keys from the target array,
1449
-    * if they exist.
1450
-    * 
1451
-    * @param array $array
1452
-    * @param array $keys
1453
-    */
1447
+    /**
1448
+     * Removes the specified keys from the target array,
1449
+     * if they exist.
1450
+     * 
1451
+     * @param array $array
1452
+     * @param array $keys
1453
+     */
1454 1454
     public static function arrayRemoveKeys(array &$array, array $keys) : void
1455 1455
     {
1456 1456
         foreach($keys as $key) 
@@ -1461,13 +1461,13 @@  discard block
 block discarded – undo
1461 1461
         }
1462 1462
     }
1463 1463
     
1464
-   /**
1465
-    * Checks if the specified variable is an integer or a string containing an integer.
1466
-    * Accepts both positive and negative integers.
1467
-    * 
1468
-    * @param mixed $value
1469
-    * @return bool
1470
-    */
1464
+    /**
1465
+     * Checks if the specified variable is an integer or a string containing an integer.
1466
+     * Accepts both positive and negative integers.
1467
+     * 
1468
+     * @param mixed $value
1469
+     * @return bool
1470
+     */
1471 1471
     public static function isInteger($value) : bool
1472 1472
     {
1473 1473
         if(is_int($value)) {
@@ -1487,52 +1487,52 @@  discard block
 block discarded – undo
1487 1487
         return false;    
1488 1488
     }
1489 1489
     
1490
-   /**
1491
-    * Converts an amount of seconds to a DateInterval object.
1492
-    * 
1493
-    * @param int $seconds
1494
-    * @return \DateInterval
1495
-    * @throws ConvertHelper_Exception If the date interval cannot be created.
1496
-    * 
1497
-    * @see ConvertHelper::ERROR_CANNOT_GET_DATE_DIFF
1498
-    */
1490
+    /**
1491
+     * Converts an amount of seconds to a DateInterval object.
1492
+     * 
1493
+     * @param int $seconds
1494
+     * @return \DateInterval
1495
+     * @throws ConvertHelper_Exception If the date interval cannot be created.
1496
+     * 
1497
+     * @see ConvertHelper::ERROR_CANNOT_GET_DATE_DIFF
1498
+     */
1499 1499
     public static function seconds2interval(int $seconds) : \DateInterval
1500 1500
     {
1501 1501
         return ConvertHelper_DateInterval::fromSeconds($seconds)->getInterval();
1502 1502
     }
1503 1503
     
1504
-   /**
1505
-    * Converts a size string like "50 MB" to the corresponding byte size.
1506
-    * It is case insensitive, ignores spaces, and supports both traditional
1507
-    * "MB" and "MiB" notations.
1508
-    * 
1509
-    * @param string $size
1510
-    * @return int
1511
-    */
1504
+    /**
1505
+     * Converts a size string like "50 MB" to the corresponding byte size.
1506
+     * It is case insensitive, ignores spaces, and supports both traditional
1507
+     * "MB" and "MiB" notations.
1508
+     * 
1509
+     * @param string $size
1510
+     * @return int
1511
+     */
1512 1512
     public static function size2bytes(string $size) : int
1513 1513
     {
1514 1514
         return self::parseSize($size)->toBytes();
1515 1515
     }
1516 1516
     
1517
-   /**
1518
-    * Parses a size string like "50 MB" and returns a size notation instance
1519
-    * that has utility methods to access information on it, and convert it.
1520
-    * 
1521
-    * @param string $size
1522
-    * @return ConvertHelper_SizeNotation
1523
-    */
1517
+    /**
1518
+     * Parses a size string like "50 MB" and returns a size notation instance
1519
+     * that has utility methods to access information on it, and convert it.
1520
+     * 
1521
+     * @param string $size
1522
+     * @return ConvertHelper_SizeNotation
1523
+     */
1524 1524
     public static function parseSize(string $size) : ConvertHelper_SizeNotation
1525 1525
     {
1526 1526
         return new ConvertHelper_SizeNotation($size);
1527 1527
     }
1528 1528
     
1529
-   /**
1530
-    * Creates a URL finder instance, which can be used to find
1531
-    * URLs in a string - be it plain text, or HTML.
1532
-    * 
1533
-    * @param string $subject
1534
-    * @return ConvertHelper_URLFinder
1535
-    */
1529
+    /**
1530
+     * Creates a URL finder instance, which can be used to find
1531
+     * URLs in a string - be it plain text, or HTML.
1532
+     * 
1533
+     * @param string $subject
1534
+     * @return ConvertHelper_URLFinder
1535
+     */
1536 1536
     public static function createURLFinder(string $subject) : ConvertHelper_URLFinder
1537 1537
     {
1538 1538
         return new ConvertHelper_URLFinder($subject);
Please login to merge, or discard this patch.
src/ConvertHelper/DurationConverter.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -32,39 +32,39 @@  discard block
 block discarded – undo
32 32
     const SECONDS_PER_MONTH_APPROX = 2505600; // imprecise - for 29 days, only for approximations. 
33 33
     const SECONDS_PER_YEAR = 31536000;
34 34
     
35
-   /**
36
-    * @var int
37
-    */
35
+    /**
36
+     * @var int
37
+     */
38 38
     protected $dateFrom;
39 39
     
40
-   /**
41
-    * @var int
42
-    */
40
+    /**
41
+     * @var int
42
+     */
43 43
     protected $dateTo;
44 44
     
45
-   /**
46
-    * @var bool
47
-    */
45
+    /**
46
+     * @var bool
47
+     */
48 48
     protected $future = false;
49 49
     
50
-   /**
51
-    * @var string
52
-    */
50
+    /**
51
+     * @var string
52
+     */
53 53
     protected $interval = '';
54 54
     
55
-   /**
56
-    * @var int
57
-    */
55
+    /**
56
+     * @var int
57
+     */
58 58
     protected $difference = 0;
59 59
     
60
-   /**
61
-    * @var int
62
-    */
60
+    /**
61
+     * @var int
62
+     */
63 63
     protected $dateDiff = 0;
64 64
     
65
-   /**
66
-    * @var array|NULL
67
-    */
65
+    /**
66
+     * @var array|NULL
67
+     */
68 68
     protected static $texts = null;
69 69
     
70 70
     public function __construct()
@@ -84,17 +84,17 @@  discard block
 block discarded – undo
84 84
         self::$texts = null;
85 85
     }
86 86
     
87
-   /**
88
-    * Sets the origin date to calculate from.
89
-    * 
90
-    * NOTE: if this is further in the future than
91
-    * the to: date, it will be considered as a 
92
-    * calculation for something to come, i.e. 
93
-    * "In two days".
94
-    *  
95
-    * @param \DateTime $date
96
-    * @return ConvertHelper_DurationConverter
97
-    */
87
+    /**
88
+     * Sets the origin date to calculate from.
89
+     * 
90
+     * NOTE: if this is further in the future than
91
+     * the to: date, it will be considered as a 
92
+     * calculation for something to come, i.e. 
93
+     * "In two days".
94
+     *  
95
+     * @param \DateTime $date
96
+     * @return ConvertHelper_DurationConverter
97
+     */
98 98
     public function setDateFrom(\DateTime $date) : ConvertHelper_DurationConverter
99 99
     {
100 100
         $this->dateFrom = ConvertHelper::date2timestamp($date);
@@ -102,13 +102,13 @@  discard block
 block discarded – undo
102 102
         return $this;
103 103
     }
104 104
     
105
-   /**
106
-    * Sets the date to calculate to. Defaults to 
107
-    * the current time if not set.
108
-    * 
109
-    * @param \DateTime $date
110
-    * @return ConvertHelper_DurationConverter
111
-    */
105
+    /**
106
+     * Sets the date to calculate to. Defaults to 
107
+     * the current time if not set.
108
+     * 
109
+     * @param \DateTime $date
110
+     * @return ConvertHelper_DurationConverter
111
+     */
112 112
     public function setDateTo(\DateTime $date) : ConvertHelper_DurationConverter
113 113
     {
114 114
         $this->dateTo = ConvertHelper::date2timestamp($date);
@@ -116,14 +116,14 @@  discard block
 block discarded – undo
116 116
         return $this;
117 117
     }
118 118
     
119
-   /**
120
-    * Converts the specified dates to a human readable string.
121
-    * 
122
-    * @throws ConvertHelper_Exception
123
-    * @return string
124
-    * 
125
-    * @see ConvertHelper_DurationConverter::ERROR_NO_DATE_FROM_SET
126
-    */
119
+    /**
120
+     * Converts the specified dates to a human readable string.
121
+     * 
122
+     * @throws ConvertHelper_Exception
123
+     * @return string
124
+     * 
125
+     * @see ConvertHelper_DurationConverter::ERROR_NO_DATE_FROM_SET
126
+     */
127 127
     public function convert() : string
128 128
     {
129 129
         $this->initTexts();
Please login to merge, or discard this patch.
src/ConvertHelper/StorageSizeEnum.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -31,17 +31,17 @@  discard block
 block discarded – undo
31 31
     
32 32
     const BASE_2 = 1024;
33 33
     
34
-   /**
35
-    * @var ConvertHelper_StorageSizeEnum_Size[]
36
-    */
34
+    /**
35
+     * @var ConvertHelper_StorageSizeEnum_Size[]
36
+     */
37 37
     protected static $sizes = array();
38 38
     
39
-   /**
40
-    * Initializes the supported unit notations, and
41
-    * how they are supposed to be calculated.
42
-    *
43
-    * @see ConvertHelper_SizeNotation::parseSize()
44
-    */
39
+    /**
40
+     * Initializes the supported unit notations, and
41
+     * how they are supposed to be calculated.
42
+     *
43
+     * @see ConvertHelper_SizeNotation::parseSize()
44
+     */
45 45
     protected static function init() : void
46 46
     {
47 47
         if(!empty(self::$sizes)) {
@@ -68,28 +68,28 @@  discard block
 block discarded – undo
68 68
         }
69 69
     }
70 70
     
71
-   /**
72
-    * Called whenever the application locale is changed,
73
-    * to reset the size definitions so the labels get 
74
-    * translated to the new locale.
75
-    */
71
+    /**
72
+     * Called whenever the application locale is changed,
73
+     * to reset the size definitions so the labels get 
74
+     * translated to the new locale.
75
+     */
76 76
     public static function handle_localeChanged() : void
77 77
     {
78 78
         self::$sizes = array();
79 79
     }
80 80
     
81
-   /**
82
-    * Adds a storage size to the internal collection.
83
-    * 
84
-    * @param string $name The lowercase size name, e.g. "kb", "mib"
85
-    * @param int $base This defines how many bytes there are in a kilobyte, to differentiate with the two common way to calculate sizes: base 10 or base 2. See the Wikipedia link for more details.
86
-    * @param int $exponent The multiplier of the base to get the byte value
87
-    * @param string $suffix The localized short suffix, e.g. "KB", "MiB"
88
-    * @param string $singular The localized singular label of the size, e.g. "Kilobyte".
89
-    * @param string $plural The localized plural label of the size, e.g. "Kilobytes".
90
-    * 
91
-    * @see https://en.m.wikipedia.org/wiki/Megabyte#Definitions
92
-    */
81
+    /**
82
+     * Adds a storage size to the internal collection.
83
+     * 
84
+     * @param string $name The lowercase size name, e.g. "kb", "mib"
85
+     * @param int $base This defines how many bytes there are in a kilobyte, to differentiate with the two common way to calculate sizes: base 10 or base 2. See the Wikipedia link for more details.
86
+     * @param int $exponent The multiplier of the base to get the byte value
87
+     * @param string $suffix The localized short suffix, e.g. "KB", "MiB"
88
+     * @param string $singular The localized singular label of the size, e.g. "Kilobyte".
89
+     * @param string $plural The localized plural label of the size, e.g. "Kilobytes".
90
+     * 
91
+     * @see https://en.m.wikipedia.org/wiki/Megabyte#Definitions
92
+     */
93 93
     protected static function addSize(string $name, int $base, int $exponent, string $suffix, string $singular, string $plural) : void
94 94
     {
95 95
         self::$sizes[$name] = new ConvertHelper_StorageSizeEnum_Size(
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
         );
103 103
     }
104 104
     
105
-   /**
106
-    * Retrieves all known sizes.
107
-    * 
108
-    * @return \AppUtils\ConvertHelper_StorageSizeEnum_Size[]
109
-    */
105
+    /**
106
+     * Retrieves all known sizes.
107
+     * 
108
+     * @return \AppUtils\ConvertHelper_StorageSizeEnum_Size[]
109
+     */
110 110
     public static function getSizes() : array
111 111
     {
112 112
         self::init();
@@ -114,15 +114,15 @@  discard block
 block discarded – undo
114 114
         return self::$sizes;
115 115
     }
116 116
     
117
-   /**
118
-    * Retrieves a size definition instance by its name.
119
-    * 
120
-    * @param string $name Case insensitive. For example "kb", "MiB"...
121
-    * @throws ConvertHelper_Exception
122
-    * @return ConvertHelper_StorageSizeEnum_Size
123
-    * 
124
-    * @see ConvertHelper_StorageSizeEnum::ERROR_UNKNOWN_UNIT_NAME
125
-    */
117
+    /**
118
+     * Retrieves a size definition instance by its name.
119
+     * 
120
+     * @param string $name Case insensitive. For example "kb", "MiB"...
121
+     * @throws ConvertHelper_Exception
122
+     * @return ConvertHelper_StorageSizeEnum_Size
123
+     * 
124
+     * @see ConvertHelper_StorageSizeEnum::ERROR_UNKNOWN_UNIT_NAME
125
+     */
126 126
     public static function getSizeByName(string $name) : ConvertHelper_StorageSizeEnum_Size
127 127
     {
128 128
         self::init();
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
         );
145 145
     }
146 146
     
147
-   /**
148
-    * Retrieves a list of all size names, e.g. "mb", "kib" (lowercase).
149
-    * @return array
150
-    */
147
+    /**
148
+     * Retrieves a list of all size names, e.g. "mb", "kib" (lowercase).
149
+     * @return array
150
+     */
151 151
     public static function getSizeNames() : array
152 152
     {
153 153
         self::init();
@@ -155,16 +155,16 @@  discard block
 block discarded – undo
155 155
         return array_keys(self::$sizes);
156 156
     }
157 157
    
158
-   /**
159
-    * Retrieves all available storage sizes for the specified
160
-    * base value.
161
-    * 
162
-    * @param int $base
163
-    * @return \AppUtils\ConvertHelper_StorageSizeEnum_Size[]
164
-    * 
165
-    * @see ConvertHelper_StorageSizeEnum::BASE_10
166
-    * @see ConvertHelper_StorageSizeEnum::BASE_2
167
-    */
158
+    /**
159
+     * Retrieves all available storage sizes for the specified
160
+     * base value.
161
+     * 
162
+     * @param int $base
163
+     * @return \AppUtils\ConvertHelper_StorageSizeEnum_Size[]
164
+     * 
165
+     * @see ConvertHelper_StorageSizeEnum::BASE_10
166
+     * @see ConvertHelper_StorageSizeEnum::BASE_2
167
+     */
168 168
     public static function getSizesByBase(int $base) : array
169 169
     {
170 170
         self::init();
Please login to merge, or discard this patch.
src/XMLHelper/SimpleXML.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -23,37 +23,37 @@
 block discarded – undo
23 23
 {
24 24
     const ERROR_NOT_LOADED_YET = 56501;
25 25
     
26
-   /**
27
-    * @var \SimpleXMLElement|NULL
28
-    */
26
+    /**
27
+     * @var \SimpleXMLElement|NULL
28
+     */
29 29
     private $element = null;
30 30
     
31
-   /**
32
-    * @var XMLHelper_SimpleXML_Error[]
33
-    */
31
+    /**
32
+     * @var XMLHelper_SimpleXML_Error[]
33
+     */
34 34
     private $errors = array();
35 35
     
36
-   /**
37
-    * Creates a simplexml instance from an XML string.
38
-    *
39
-    * NOTE: returns false in case of a fatal error.
40
-    *
41
-    * @param string $string
42
-    * @return \SimpleXMLElement|NULL
43
-    */
36
+    /**
37
+     * Creates a simplexml instance from an XML string.
38
+     *
39
+     * NOTE: returns false in case of a fatal error.
40
+     *
41
+     * @param string $string
42
+     * @return \SimpleXMLElement|NULL
43
+     */
44 44
     public function loadString(string $string) : ?\SimpleXMLElement
45 45
     {
46 46
         return $this->load('string', $string);
47 47
     }
48 48
     
49
-   /**
50
-    * Creates a simplexml instance from an XML file.
51
-    * 
52
-    * NOTE: returns false in case of a fatal error.
53
-    * 
54
-    * @param string $file
55
-    * @return \SimpleXMLElement|NULL
56
-    */
49
+    /**
50
+     * Creates a simplexml instance from an XML file.
51
+     * 
52
+     * NOTE: returns false in case of a fatal error.
53
+     * 
54
+     * @param string $file
55
+     * @return \SimpleXMLElement|NULL
56
+     */
57 57
     public function loadFile(string $file) : ?\SimpleXMLElement
58 58
     {
59 59
         return $this->load('file', $file);
Please login to merge, or discard this patch.
src/XMLHelper/DOMErrors/Error.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@
 block discarded – undo
24 24
     const ERROR_CANNOT_UNSERIALIZE_ERROR_DATA = 57201;
25 25
     const ERROR_ERROR_DATA_KEY_MISSING = 57202;
26 26
     
27
-   /**
28
-    * @var \LibXMLError
29
-    */
27
+    /**
28
+     * @var \LibXMLError
29
+     */
30 30
     private $error;
31 31
     
32 32
     private static $requiredKeys = array(
Please login to merge, or discard this patch.
src/XMLHelper/HTMLLoader.php 1 patch
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -36,19 +36,19 @@  discard block
 block discarded – undo
36 36
 {
37 37
     const ERROR_STRING_ALREADY_HAS_BODY_TAG = 57001;
38 38
     
39
-   /**
40
-    * @var \DOMElement
41
-    */
39
+    /**
40
+     * @var \DOMElement
41
+     */
42 42
     private $bodyNode;
43 43
     
44
-   /**
45
-    * @var XMLHelper_DOMErrors
46
-    */
44
+    /**
45
+     * @var XMLHelper_DOMErrors
46
+     */
47 47
     private $errors;
48 48
     
49
-   /**
50
-    * @var string
51
-    */
49
+    /**
50
+     * @var string
51
+     */
52 52
     private static $htmlTemplate = 
53 53
     '<!DOCTYPE html>'.
54 54
     '<html>'.
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
         '</body>'.
61 61
     '</html>';
62 62
     
63
-   /**
64
-    * @var \DOMDocument
65
-    */
63
+    /**
64
+     * @var \DOMDocument
65
+     */
66 66
     private $dom;
67 67
 
68 68
     private function __construct(string $html)
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
         $this->load($html);
71 71
     }
72 72
     
73
-   /**
74
-    * Creates an HTML loader from an HTML fragment (without
75
-    * doctype, head and body elements).
76
-    * 
77
-    * @param string $fragment
78
-    * @return XMLHelper_HTMLLoader
79
-    */
73
+    /**
74
+     * Creates an HTML loader from an HTML fragment (without
75
+     * doctype, head and body elements).
76
+     * 
77
+     * @param string $fragment
78
+     * @return XMLHelper_HTMLLoader
79
+     */
80 80
     public static function loadFragment(string $fragment) : XMLHelper_HTMLLoader
81 81
     {
82 82
         self::checkFragment($fragment);
@@ -87,24 +87,24 @@  discard block
 block discarded – undo
87 87
         return new XMLHelper_HTMLLoader($pseudoHTML);
88 88
     }
89 89
     
90
-   /**
91
-    * Creates an HTML loader from a full HTML document (including
92
-    * doctype, head and body elements).
93
-    * 
94
-    * @param string $html
95
-    * @return XMLHelper_HTMLLoader
96
-    */
90
+    /**
91
+     * Creates an HTML loader from a full HTML document (including
92
+     * doctype, head and body elements).
93
+     * 
94
+     * @param string $html
95
+     * @return XMLHelper_HTMLLoader
96
+     */
97 97
     public static function loadHTML(string $html) : XMLHelper_HTMLLoader
98 98
     {
99 99
         return  new XMLHelper_HTMLLoader($html);
100 100
     }
101 101
 
102
-   /**
103
-    * Verifies that the fragment does not already contain a body element or doctype.
104
-    * 
105
-    * @param string $fragment
106
-    * @throws XMLHelper_Exception
107
-    */
102
+    /**
103
+     * Verifies that the fragment does not already contain a body element or doctype.
104
+     * 
105
+     * @param string $fragment
106
+     * @throws XMLHelper_Exception
107
+     */
108 108
     private static function checkFragment(string $fragment) : void
109 109
     {
110 110
         if(!stristr($fragment, '<body') && !stristr($fragment, 'doctype'))
@@ -142,65 +142,65 @@  discard block
 block discarded – undo
142 142
         return $this->bodyNode;
143 143
     }
144 144
     
145
-   /**
146
-    * Retrieves the document's `<body>` tag node.
147
-    * 
148
-    * @return \DOMDocument
149
-    */
145
+    /**
146
+     * Retrieves the document's `<body>` tag node.
147
+     * 
148
+     * @return \DOMDocument
149
+     */
150 150
     public function getDOM() : \DOMDocument
151 151
     {
152 152
         return $this->dom;
153 153
     }
154 154
     
155
-   /**
156
-    * Retrieves all nodes from the HTML fragment (= child nodes
157
-    * of the `<body>` element).
158
-    * 
159
-    * @return \DOMNodeList
160
-    */
155
+    /**
156
+     * Retrieves all nodes from the HTML fragment (= child nodes
157
+     * of the `<body>` element).
158
+     * 
159
+     * @return \DOMNodeList
160
+     */
161 161
     public function getFragmentNodes() : \DOMNodeList
162 162
     {
163 163
         return $this->bodyNode->childNodes;
164 164
     }
165 165
     
166
-   /**
167
-    * Retrieves the LibXML HTML parsing errors collection, which
168
-    * can be used to review any errors that occurred while loading
169
-    * the HTML document.
170
-    * 
171
-    * @return XMLHelper_DOMErrors
172
-    */
166
+    /**
167
+     * Retrieves the LibXML HTML parsing errors collection, which
168
+     * can be used to review any errors that occurred while loading
169
+     * the HTML document.
170
+     * 
171
+     * @return XMLHelper_DOMErrors
172
+     */
173 173
     public function getErrors() : XMLHelper_DOMErrors
174 174
     {
175 175
         return $this->errors;
176 176
     }
177 177
     
178
-   /**
179
-    * Returns a valid HTML string.
180
-    * 
181
-    * @return string
182
-    */
178
+    /**
179
+     * Returns a valid HTML string.
180
+     * 
181
+     * @return string
182
+     */
183 183
     public function toHTML() : string
184 184
     {
185 185
         return $this->dom->saveHTML();
186 186
     }
187 187
     
188
-   /**
189
-    * Returns a valid XML string.
190
-    * 
191
-    * @return string
192
-    */
188
+    /**
189
+     * Returns a valid XML string.
190
+     * 
191
+     * @return string
192
+     */
193 193
     public function toXML() : string
194 194
     {
195 195
         return $this->dom->saveXML();
196 196
     }
197 197
     
198
-   /**
199
-    * Converts the HTML fragment to valid XML (= all
200
-    * child nodes of the `<body>` element).
201
-    * 
202
-    * @return string
203
-    */
198
+    /**
199
+     * Converts the HTML fragment to valid XML (= all
200
+     * child nodes of the `<body>` element).
201
+     * 
202
+     * @return string
203
+     */
204 204
     public function fragmentToXML() : string
205 205
     {
206 206
         $nodes = $this->getFragmentNodes();
Please login to merge, or discard this patch.
src/XMLHelper/DOMErrors.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
 {
24 24
     const SERIALIZE_SEPARATOR = '__SERSEP__';
25 25
     
26
-   /**
27
-    * @var XMLHelper_DOMErrors_Error[]
28
-    */
26
+    /**
27
+     * @var XMLHelper_DOMErrors_Error[]
28
+     */
29 29
     private $errors;
30 30
     
31
-   /**
32
-    * @param \LibXMLError[]|XMLHelper_DOMErrors_Error[] $libxmlErrors
33
-    */
31
+    /**
32
+     * @param \LibXMLError[]|XMLHelper_DOMErrors_Error[] $libxmlErrors
33
+     */
34 34
     public function __construct(array $libxmlErrors)
35 35
     {
36 36
         foreach($libxmlErrors as $error)
@@ -56,11 +56,11 @@  discard block
 block discarded – undo
56 56
         return $this->errors;
57 57
     }
58 58
     
59
-   /**
60
-    * Retrieves all warnings, if any.
61
-    * 
62
-    * @return XMLHelper_DOMErrors_Error[]
63
-    */
59
+    /**
60
+     * Retrieves all warnings, if any.
61
+     * 
62
+     * @return XMLHelper_DOMErrors_Error[]
63
+     */
64 64
     public function getWarnings()
65 65
     {
66 66
         return $this->getByLevel(LIBXML_ERR_WARNING);
@@ -107,12 +107,12 @@  discard block
 block discarded – undo
107 107
     }
108 108
     
109 109
     
110
-   /**
111
-    * Retrieves all errors by the specified libxml error level.
112
-    * 
113
-    * @param int $level
114
-    * @return \AppUtils\XMLHelper_DOMErrors_Error[]
115
-    */
110
+    /**
111
+     * Retrieves all errors by the specified libxml error level.
112
+     * 
113
+     * @param int $level
114
+     * @return \AppUtils\XMLHelper_DOMErrors_Error[]
115
+     */
116 116
     public function getByLevel(int $level)
117 117
     {
118 118
         $result = array();
@@ -128,12 +128,12 @@  discard block
 block discarded – undo
128 128
         return $result;
129 129
     }
130 130
     
131
-   /**
132
-    * Retrieves all errors by the specified libxml error code.
133
-    * 
134
-    * @param int $code
135
-    * @return \AppUtils\XMLHelper_DOMErrors_Error[]
136
-    */
131
+    /**
132
+     * Retrieves all errors by the specified libxml error code.
133
+     * 
134
+     * @param int $code
135
+     * @return \AppUtils\XMLHelper_DOMErrors_Error[]
136
+     */
137 137
     public function getByCode(int $code)
138 138
     {
139 139
         $result = array();
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
         return $result;
150 150
     }
151 151
     
152
-   /**
153
-    * Checks whether there are errors matching the libxml error level.
154
-    * 
155
-    * @param int $level
156
-    * @return bool
157
-    */
152
+    /**
153
+     * Checks whether there are errors matching the libxml error level.
154
+     * 
155
+     * @param int $level
156
+     * @return bool
157
+     */
158 158
     public function hasErrorsByLevel(int $level) : bool
159 159
     {
160 160
         foreach($this->errors as $error)
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
         return false;
169 169
     }
170 170
     
171
-   /**
172
-    * Checks whether there are any errors matching the libxml error code.
173
-    * 
174
-    * @param int $code
175
-    * @return bool
176
-    */
171
+    /**
172
+     * Checks whether there are any errors matching the libxml error code.
173
+     * 
174
+     * @param int $code
175
+     * @return bool
176
+     */
177 177
     public function hasErrorsByCode(int $code) : bool
178 178
     {
179 179
         foreach($this->errors as $error)
@@ -199,13 +199,13 @@  discard block
 block discarded – undo
199 199
         return $result;
200 200
     }
201 201
     
202
-   /**
203
-    * Serializes the errors collection, so it can be stored and
204
-    * restored as needed, using the `fromSerialized()` method.
205
-    * 
206
-    * @return string
207
-    * @see XMLHelper_DOMErrors::fromSerialized()
208
-    */
202
+    /**
203
+     * Serializes the errors collection, so it can be stored and
204
+     * restored as needed, using the `fromSerialized()` method.
205
+     * 
206
+     * @return string
207
+     * @see XMLHelper_DOMErrors::fromSerialized()
208
+     */
209 209
     public function serialize() : string
210 210
     {
211 211
         $data = array();
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
         return implode(self::SERIALIZE_SEPARATOR, $data);
219 219
     }
220 220
     
221
-   /**
222
-    * Restores the errors collection from a previously serialized
223
-    * collection, using `serialize()`. 
224
-    * 
225
-    * @param string $serialized
226
-    * @return XMLHelper_DOMErrors
227
-    * @see XMLHelper_DOMErrors::serialize()
228
-    */
221
+    /**
222
+     * Restores the errors collection from a previously serialized
223
+     * collection, using `serialize()`. 
224
+     * 
225
+     * @param string $serialized
226
+     * @return XMLHelper_DOMErrors
227
+     * @see XMLHelper_DOMErrors::serialize()
228
+     */
229 229
     public static function fromSerialized(string $serialized) : XMLHelper_DOMErrors
230 230
     {
231 231
         $parts = explode(self::SERIALIZE_SEPARATOR, $serialized);
Please login to merge, or discard this patch.