Test Failed
Push — master ( 9d3a5c...c5f273 )
by Sebastian
08:26
created
src/FileHelper/FolderInfo.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     {
31 31
         $pathString = AbstractPathInfo::type2string($path);
32 32
 
33
-        if(empty($path)) {
33
+        if (empty($path)) {
34 34
             throw new FileHelper_Exception(
35 35
                 'Invalid',
36 36
                 '',
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
             );
39 39
         }
40 40
 
41
-        if($path instanceof FileInfo || FileInfo::is_file($pathString))
41
+        if ($path instanceof FileInfo || FileInfo::is_file($pathString))
42 42
         {
43 43
             throw new FileHelper_Exception(
44 44
                 'Cannot use a file',
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
             );
51 51
         }
52 52
 
53
-        if(!isset(self::$infoCache[$pathString]))
53
+        if (!isset(self::$infoCache[$pathString]))
54 54
         {
55 55
             self::$infoCache[$pathString] = new FolderInfo($pathString);
56 56
         }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         $path = trim($path);
88 88
         $test = trim($path, '/\\');
89 89
 
90
-        if($path === '' || $test === '.' || $test === '..')
90
+        if ($path === '' || $test === '.' || $test === '..')
91 91
         {
92 92
             return false;
93 93
         }
@@ -105,12 +105,12 @@  discard block
 block discarded – undo
105 105
      */
106 106
     public function delete() : FolderInfo
107 107
     {
108
-        if(!$this->exists())
108
+        if (!$this->exists())
109 109
         {
110 110
             return $this;
111 111
         }
112 112
 
113
-        if(rmdir($this->path))
113
+        if (rmdir($this->path))
114 114
         {
115 115
             return $this;
116 116
         }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      */
137 137
     public function create() : FolderInfo
138 138
     {
139
-        if(is_dir($this->path) || mkdir($this->path, 0777, true) || is_dir($this->path))
139
+        if (is_dir($this->path) || mkdir($this->path, 0777, true) || is_dir($this->path))
140 140
         {
141 141
             return $this;
142 142
         }
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         return FileHelper::createFolder($this->getPath().'/'.$name);
187 187
     }
188 188
 
189
-    public function saveFile(string $fileName, string $content='') : FileInfo
189
+    public function saveFile(string $fileName, string $content = '') : FileInfo
190 190
     {
191 191
         return FileHelper::saveFile($this.'/'.$fileName, $content);
192 192
     }
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
      * @return JSONFile
199 199
      * @throws FileHelper_Exception
200 200
      */
201
-    public function saveJSONFile(array $data, string $fileName, bool $pretty=false) : JSONFile
201
+    public function saveJSONFile(array $data, string $fileName, bool $pretty = false) : JSONFile
202 202
     {
203 203
         return FileHelper::saveAsJSON($data, $this.'/'.$fileName, $pretty);
204 204
     }
Please login to merge, or discard this patch.
src/ArrayDataCollection.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     /**
43 43
      * @param array<string,mixed> $data
44 44
      */
45
-    public function __construct(array $data=array())
45
+    public function __construct(array $data = array())
46 46
     {
47 47
         $this->data = $data;
48 48
     }
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
      * @param ArrayDataCollection|array<string,mixed>|NULL $data
52 52
      * @return ArrayDataCollection
53 53
      */
54
-    public static function create($data=array()) : ArrayDataCollection
54
+    public static function create($data = array()) : ArrayDataCollection
55 55
     {
56
-        if($data instanceof self) {
56
+        if ($data instanceof self) {
57 57
             return $data;
58 58
         }
59 59
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      */
75 75
     public function setKeys(array $data) : self
76 76
     {
77
-        foreach($data as $key => $value)
77
+        foreach ($data as $key => $value)
78 78
         {
79 79
             $this->setKey($key, $value);
80 80
         }
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
     {
143 143
         $value = $this->getKey($name);
144 144
 
145
-        if(is_string($value)) {
145
+        if (is_string($value)) {
146 146
             return $value;
147 147
         }
148 148
 
149
-        if(is_numeric($value)) {
149
+        if (is_numeric($value)) {
150 150
             return (string)$value;
151 151
         }
152 152
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
     {
166 166
         $value = $this->getKey($name);
167 167
 
168
-        if(is_numeric($value)) {
168
+        if (is_numeric($value)) {
169 169
             return (int)$value;
170 170
         }
171 171
 
@@ -187,11 +187,11 @@  discard block
 block discarded – undo
187 187
         $value = $this->getKey($name);
188 188
 
189 189
         // Does not need to be decoded after all
190
-        if(is_array($value)) {
190
+        if (is_array($value)) {
191 191
             return $value;
192 192
         }
193 193
 
194
-        if(empty($value) || !is_string($value)) {
194
+        if (empty($value) || !is_string($value)) {
195 195
             return array();
196 196
         }
197 197
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
     {
203 203
         $value = $this->getKey($name);
204 204
 
205
-        if(is_array($value)) {
205
+        if (is_array($value)) {
206 206
             return $value;
207 207
         }
208 208
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
     {
214 214
         $value = $this->getKey($name);
215 215
 
216
-        if(is_string($value)) {
216
+        if (is_string($value)) {
217 217
             $value = strtolower($value);
218 218
         }
219 219
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
     {
232 232
         $value = $this->getKey($name);
233 233
 
234
-        if(is_numeric($value)) {
234
+        if (is_numeric($value)) {
235 235
             return (float)$value;
236 236
         }
237 237
 
@@ -288,11 +288,11 @@  discard block
 block discarded – undo
288 288
     {
289 289
         $value = $this->getString($name);
290 290
 
291
-        if(empty($value)) {
291
+        if (empty($value)) {
292 292
             return null;
293 293
         }
294 294
 
295
-        if(is_numeric($value)) {
295
+        if (is_numeric($value)) {
296 296
             $date = new DateTime();
297 297
             $date->setTimestamp((int)$value);
298 298
             return $date;
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
     {
375 375
         $date = $this->getDateTime($name);
376 376
 
377
-        if($date !== null)
377
+        if ($date !== null)
378 378
         {
379 379
             return $date->getTimestamp();
380 380
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -301,8 +301,7 @@  discard block
 block discarded – undo
301 301
         try
302 302
         {
303 303
             return new DateTime($value);
304
-        }
305
-        catch (Exception $e)
304
+        } catch (Exception $e)
306 305
         {
307 306
             return null;
308 307
         }
@@ -320,8 +319,7 @@  discard block
 block discarded – undo
320 319
         try
321 320
         {
322 321
             return Microtime::createFromString($this->getString($name));
323
-        }
324
-        catch (Exception $e)
322
+        } catch (Exception $e)
325 323
         {
326 324
             return null;
327 325
         }
Please login to merge, or discard this patch.
src/ConvertHelper.php 2 patches
Indentation   +471 added lines, -471 removed lines patch added patch discarded remove patch
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
         return ConvertHelper_String::tabs2spaces($string, $tabSize);
67 67
     }
68 68
     
69
-   /**
70
-    * Converts spaces to tabs in the specified string.
71
-    * 
72
-    * @param string $string
73
-    * @param int $tabSize The amount of spaces per tab in the source string.
74
-    * @return string
75
-    */
69
+    /**
70
+     * Converts spaces to tabs in the specified string.
71
+     * 
72
+     * @param string $string
73
+     * @param int $tabSize The amount of spaces per tab in the source string.
74
+     * @return string
75
+     */
76 76
     public static function spaces2tabs(string $string, int $tabSize=4) : string
77 77
     {
78 78
         return ConvertHelper_String::spaces2tabs($string, $tabSize);
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
         return ConvertHelper_String::hidden2visible($string);
91 91
     }
92 92
     
93
-   /**
94
-    * Converts the specified amount of seconds into
95
-    * a human-readable string split in months, weeks,
96
-    * days, hours, minutes and seconds.
97
-    *
98
-    * @param float $seconds
99
-    * @return string
100
-    */
93
+    /**
94
+     * Converts the specified amount of seconds into
95
+     * a human-readable string split in months, weeks,
96
+     * days, hours, minutes and seconds.
97
+     *
98
+     * @param float $seconds
99
+     * @return string
100
+     */
101 101
     public static function time2string($seconds) : string
102 102
     {
103 103
         $converter = new ConvertHelper_TimeConverter($seconds);
@@ -121,85 +121,85 @@  discard block
 block discarded – undo
121 121
      */
122 122
     public static function duration2string($datefrom, $dateto = -1) : string
123 123
     {
124
-         return ConvertHelper_DurationConverter::toString($datefrom, $dateto);
124
+            return ConvertHelper_DurationConverter::toString($datefrom, $dateto);
125 125
     }
126 126
 
127
-   /**
128
-    * Adds HTML syntax highlighting to the specified SQL string.
129
-    * 
130
-    * @param string $sql
131
-    * @return string
132
-    * @deprecated Use the Highlighter class directly instead.
133
-    * @see Highlighter::sql()
134
-    */
127
+    /**
128
+     * Adds HTML syntax highlighting to the specified SQL string.
129
+     * 
130
+     * @param string $sql
131
+     * @return string
132
+     * @deprecated Use the Highlighter class directly instead.
133
+     * @see Highlighter::sql()
134
+     */
135 135
     public static function highlight_sql(string $sql) : string
136 136
     {
137 137
         return Highlighter::sql($sql);
138 138
     }
139 139
 
140
-   /**
141
-    * Adds HTML syntax highlighting to the specified XML code.
142
-    * 
143
-    * @param string $xml The XML to highlight.
144
-    * @param bool $formatSource Whether to format the source with indentation to make it readable.
145
-    * @return string
146
-    * @deprecated Use the Highlighter class directly instead.
147
-    * @see Highlighter::xml()
148
-    */
140
+    /**
141
+     * Adds HTML syntax highlighting to the specified XML code.
142
+     * 
143
+     * @param string $xml The XML to highlight.
144
+     * @param bool $formatSource Whether to format the source with indentation to make it readable.
145
+     * @return string
146
+     * @deprecated Use the Highlighter class directly instead.
147
+     * @see Highlighter::xml()
148
+     */
149 149
     public static function highlight_xml(string $xml, bool $formatSource=false) : string
150 150
     {
151 151
         return Highlighter::xml($xml, $formatSource);
152 152
     }
153 153
 
154
-   /**
155
-    * @param string $phpCode
156
-    * @return string
157
-    * @deprecated Use the Highlighter class directly instead.
158
-    * @see Highlighter::php()
159
-    */
154
+    /**
155
+     * @param string $phpCode
156
+     * @return string
157
+     * @deprecated Use the Highlighter class directly instead.
158
+     * @see Highlighter::php()
159
+     */
160 160
     public static function highlight_php(string $phpCode) : string
161 161
     {
162 162
         return Highlighter::php($phpCode);
163 163
     }
164 164
     
165
-   /**
166
-    * Converts a number of bytes to a human-readable form,
167
-    * e.g. xx Kb / xx Mb / xx Gb
168
-    *
169
-    * @param int $bytes The amount of bytes to convert.
170
-    * @param int $precision The amount of decimals
171
-    * @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).
172
-    * @return string
173
-    * 
174
-    * @see https://en.m.wikipedia.org/wiki/Megabyte#Definitions
175
-    */
165
+    /**
166
+     * Converts a number of bytes to a human-readable form,
167
+     * e.g. xx Kb / xx Mb / xx Gb
168
+     *
169
+     * @param int $bytes The amount of bytes to convert.
170
+     * @param int $precision The amount of decimals
171
+     * @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).
172
+     * @return string
173
+     * 
174
+     * @see https://en.m.wikipedia.org/wiki/Megabyte#Definitions
175
+     */
176 176
     public static function bytes2readable(int $bytes, int $precision = 1, int $base = ConvertHelper_StorageSizeEnum::BASE_10) : string
177 177
     {
178 178
         return self::parseBytes($bytes)->toString($precision, $base);
179 179
     }
180 180
     
181
-   /**
182
-    * Parses a number of bytes, and creates a converter instance which
183
-    * allows doing common operations with it.
184
-    * 
185
-    * @param int $bytes
186
-    * @return ConvertHelper_ByteConverter
187
-    */
181
+    /**
182
+     * Parses a number of bytes, and creates a converter instance which
183
+     * allows doing common operations with it.
184
+     * 
185
+     * @param int $bytes
186
+     * @return ConvertHelper_ByteConverter
187
+     */
188 188
     public static function parseBytes(int $bytes) : ConvertHelper_ByteConverter
189 189
     {
190 190
         return new ConvertHelper_ByteConverter($bytes);
191 191
     }
192 192
 
193
-   /**
194
-    * Cuts a text to the specified length if it is longer than the
195
-    * target length. Appends a text to signify it has been cut at 
196
-    * the end of the string.
197
-    * 
198
-    * @param string $text
199
-    * @param int $targetLength
200
-    * @param string $append
201
-    * @return string
202
-    */
193
+    /**
194
+     * Cuts a text to the specified length if it is longer than the
195
+     * target length. Appends a text to signify it has been cut at 
196
+     * the end of the string.
197
+     * 
198
+     * @param string $text
199
+     * @param int $targetLength
200
+     * @param string $append
201
+     * @return string
202
+     */
203 203
     public static function text_cut(string $text, int $targetLength, string $append = '...') : string
204 204
     {
205 205
         return ConvertHelper_String::cutText($text, $targetLength, $append);
@@ -223,14 +223,14 @@  discard block
 block discarded – undo
223 223
         return $info->toString();
224 224
     }
225 225
     
226
-   /**
227
-    * Pretty `print_r`.
228
-    * 
229
-    * @param mixed $var The variable to dump.
230
-    * @param bool $return Whether to return the dumped code.
231
-    * @param bool $html Whether to style the dump as HTML.
232
-    * @return string
233
-    */
226
+    /**
227
+     * Pretty `print_r`.
228
+     * 
229
+     * @param mixed $var The variable to dump.
230
+     * @param bool $return Whether to return the dumped code.
231
+     * @param bool $html Whether to style the dump as HTML.
232
+     * @return string
233
+     */
234 234
     public static function print_r($var, bool $return=false, bool $html=true) : string
235 235
     {
236 236
         $result = parseVariable($var)->enableType()->toString();
@@ -251,29 +251,29 @@  discard block
 block discarded – undo
251 251
         return $result;
252 252
     }
253 253
     
254
-   /**
255
-    * Converts a string, number or boolean value to a boolean value.
256
-    *
257
-    * @param mixed $string
258
-    * @throws ConvertHelper_Exception
259
-    * @return bool
260
-    *
261
-    * @see ConvertHelper::ERROR_INVALID_BOOLEAN_STRING
262
-    */
254
+    /**
255
+     * Converts a string, number or boolean value to a boolean value.
256
+     *
257
+     * @param mixed $string
258
+     * @throws ConvertHelper_Exception
259
+     * @return bool
260
+     *
261
+     * @see ConvertHelper::ERROR_INVALID_BOOLEAN_STRING
262
+     */
263 263
     public static function string2bool($string) : bool
264 264
     {
265 265
         return ConvertHelper_Bool::fromString($string);
266 266
     }
267 267
 
268
-   /**
269
-    * Whether the specified string is a boolean string or boolean value.
270
-    * Alias for {@link ConvertHelper::isBoolean()}.
271
-    *
272
-    * @param mixed $string
273
-    * @return bool
274
-    * @deprecated
275
-    * @see ConvertHelper::isBoolean()
276
-    */
268
+    /**
269
+     * Whether the specified string is a boolean string or boolean value.
270
+     * Alias for {@link ConvertHelper::isBoolean()}.
271
+     *
272
+     * @param mixed $string
273
+     * @return bool
274
+     * @deprecated
275
+     * @see ConvertHelper::isBoolean()
276
+     */
277 277
     public static function isBooleanString($string) : bool
278 278
     {
279 279
         return self::isBoolean($string);
@@ -343,36 +343,36 @@  discard block
 block discarded – undo
343 343
         return ConvertHelper_String::transliterate($string, $spaceChar, $lowercase);
344 344
     }
345 345
     
346
-   /**
347
-    * Retrieves the HEX character codes for all control
348
-    * characters that the {@link stripControlCharacters()} 
349
-    * method will remove.
350
-    * 
351
-    * @return string[]
352
-    */
346
+    /**
347
+     * Retrieves the HEX character codes for all control
348
+     * characters that the {@link stripControlCharacters()} 
349
+     * method will remove.
350
+     * 
351
+     * @return string[]
352
+     */
353 353
     public static function getControlCharactersAsHex() : array
354 354
     {
355 355
         return self::createControlCharacters()->getCharsAsHex();
356 356
     }
357 357
     
358
-   /**
359
-    * Retrieves an array of all control characters that
360
-    * the {@link stripControlCharacters()} method will 
361
-    * remove, as the actual UTF-8 characters.
362
-    * 
363
-    * @return string[]
364
-    */
358
+    /**
359
+     * Retrieves an array of all control characters that
360
+     * the {@link stripControlCharacters()} method will 
361
+     * remove, as the actual UTF-8 characters.
362
+     * 
363
+     * @return string[]
364
+     */
365 365
     public static function getControlCharactersAsUTF8() : array
366 366
     {
367 367
         return self::createControlCharacters()->getCharsAsUTF8();
368 368
     }
369 369
     
370
-   /**
371
-    * Retrieves all control characters as JSON encoded
372
-    * characters, e.g. "\u200b".
373
-    * 
374
-    * @return string[]
375
-    */
370
+    /**
371
+     * Retrieves all control characters as JSON encoded
372
+     * characters, e.g. "\u200b".
373
+     * 
374
+     * @return string[]
375
+     */
376 376
     public static function getControlCharactersAsJSON() : array
377 377
     {
378 378
         return self::createControlCharacters()->getCharsAsJSON();
@@ -393,31 +393,31 @@  discard block
 block discarded – undo
393 393
         return self::createControlCharacters()->stripControlCharacters($string);
394 394
     }
395 395
     
396
-   /**
397
-    * Creates the control characters class, used to 
398
-    * work with control characters in strings.
399
-    * 
400
-    * @return ConvertHelper_ControlCharacters
401
-    */
396
+    /**
397
+     * Creates the control characters class, used to 
398
+     * work with control characters in strings.
399
+     * 
400
+     * @return ConvertHelper_ControlCharacters
401
+     */
402 402
     public static function createControlCharacters() : ConvertHelper_ControlCharacters
403 403
     {
404 404
         return new ConvertHelper_ControlCharacters();
405 405
     }
406 406
 
407
-   /**
408
-    * Converts a unicode character to the PHP notation.
409
-    * 
410
-    * Example:
411
-    * 
412
-    * <pre>unicodeChar2php('"\u0000"')</pre>
413
-    * 
414
-    * Returns
415
-    * 
416
-    * <pre>\x0</pre>
417
-    * 
418
-    * @param string $unicodeChar
419
-    * @return string
420
-    */
407
+    /**
408
+     * Converts a unicode character to the PHP notation.
409
+     * 
410
+     * Example:
411
+     * 
412
+     * <pre>unicodeChar2php('"\u0000"')</pre>
413
+     * 
414
+     * Returns
415
+     * 
416
+     * <pre>\x0</pre>
417
+     * 
418
+     * @param string $unicodeChar
419
+     * @return string
420
+     */
421 421
     public static function unicodeChar2php(string $unicodeChar) : string 
422 422
     {
423 423
         $unicodeChar = json_decode($unicodeChar);
@@ -531,25 +531,25 @@  discard block
 block discarded – undo
531 531
         return ConvertHelper_Bool::toStringStrict($boolean, $yesNo);
532 532
     }
533 533
 
534
-   /**
535
-    * Converts an associative array with attribute name > value pairs
536
-    * to an attribute string that can be used in an HTML tag. Empty 
537
-    * attribute values are ignored.
538
-    * 
539
-    * Example:
540
-    * 
541
-    * array2attributeString(array(
542
-    *     'id' => 45,
543
-    *     'href' => 'http://www.mistralys.com'
544
-    * ));
545
-    * 
546
-    * Result:
547
-    * 
548
-    * id="45" href="http://www.mistralys.com"
549
-    * 
550
-    * @param array<string,mixed> $array
551
-    * @return string
552
-    */
534
+    /**
535
+     * Converts an associative array with attribute name > value pairs
536
+     * to an attribute string that can be used in an HTML tag. Empty 
537
+     * attribute values are ignored.
538
+     * 
539
+     * Example:
540
+     * 
541
+     * array2attributeString(array(
542
+     *     'id' => 45,
543
+     *     'href' => 'http://www.mistralys.com'
544
+     * ));
545
+     * 
546
+     * Result:
547
+     * 
548
+     * id="45" href="http://www.mistralys.com"
549
+     * 
550
+     * @param array<string,mixed> $array
551
+     * @return string
552
+     */
553 553
     public static function array2attributeString(array $array) : string
554 554
     {
555 555
         return ConvertHelper_Array::toAttributeString($array);
@@ -569,116 +569,116 @@  discard block
 block discarded – undo
569 569
         return self::var2json($array);
570 570
     }
571 571
     
572
-   /**
573
-    * Converts a string, so it can safely be used in a javascript
574
-    * statement in an HTML tag: uses single quotes around the string
575
-    * and encodes all special characters as needed.
576
-    * 
577
-    * @param string $string
578
-    * @return string
579
-    * @deprecated Use the JSHelper class instead.
580
-    * @see JSHelper::phpVariable2AttributeJS()
581
-    */
572
+    /**
573
+     * Converts a string, so it can safely be used in a javascript
574
+     * statement in an HTML tag: uses single quotes around the string
575
+     * and encodes all special characters as needed.
576
+     * 
577
+     * @param string $string
578
+     * @return string
579
+     * @deprecated Use the JSHelper class instead.
580
+     * @see JSHelper::phpVariable2AttributeJS()
581
+     */
582 582
     public static function string2attributeJS(string $string) : string
583 583
     {
584 584
         return JSHelper::phpVariable2AttributeJS($string);
585 585
     }
586 586
     
587
-   /**
588
-    * Checks if the specified string is a boolean value, which
589
-    * includes string representations of boolean values, like 
590
-    * <code>yes</code> or <code>no</code>, and <code>true</code>
591
-    * or <code>false</code>.
592
-    * 
593
-    * @param mixed $value
594
-    * @return boolean
595
-    */
587
+    /**
588
+     * Checks if the specified string is a boolean value, which
589
+     * includes string representations of boolean values, like 
590
+     * <code>yes</code> or <code>no</code>, and <code>true</code>
591
+     * or <code>false</code>.
592
+     * 
593
+     * @param mixed $value
594
+     * @return boolean
595
+     */
596 596
     public static function isBoolean($value) : bool
597 597
     {
598 598
         return ConvertHelper_Bool::isBoolean($value);
599 599
     }
600 600
     
601
-   /**
602
-    * Converts an associative array to an HTML style attribute value string.
603
-    * 
604
-    * @param array<string,mixed> $subject
605
-    * @return string
606
-    */
601
+    /**
602
+     * Converts an associative array to an HTML style attribute value string.
603
+     * 
604
+     * @param array<string,mixed> $subject
605
+     * @return string
606
+     */
607 607
     public static function array2styleString(array $subject) : string
608 608
     {
609 609
         return ConvertHelper_Array::toStyleString($subject);
610 610
     }
611 611
     
612
-   /**
613
-    * Converts a DateTime object to a timestamp, which
614
-    * is PHP 5.2 compatible.
615
-    * 
616
-    * @param DateTime $date
617
-    * @return integer
618
-    */
612
+    /**
613
+     * Converts a DateTime object to a timestamp, which
614
+     * is PHP 5.2 compatible.
615
+     * 
616
+     * @param DateTime $date
617
+     * @return integer
618
+     */
619 619
     public static function date2timestamp(DateTime $date) : int
620 620
     {
621 621
         return ConvertHelper_Date::toTimestamp($date);
622 622
     }
623 623
     
624
-   /**
625
-    * Converts a timestamp into a DateTime instance.
626
-    * @param int $timestamp
627
-    * @return DateTime
628
-    */
624
+    /**
625
+     * Converts a timestamp into a DateTime instance.
626
+     * @param int $timestamp
627
+     * @return DateTime
628
+     */
629 629
     public static function timestamp2date(int $timestamp) : DateTime
630 630
     {
631 631
         return ConvertHelper_Date::fromTimestamp($timestamp);
632 632
     }
633 633
     
634
-   /**
635
-    * Strips an absolute path to a file within the application
636
-    * to make the path relative to the application root path.
637
-    * 
638
-    * @param string $path
639
-    * @return string
640
-    * 
641
-    * @see FileHelper::relativizePath()
642
-    * @see FileHelper::relativizePathByDepth()
643
-    */
634
+    /**
635
+     * Strips an absolute path to a file within the application
636
+     * to make the path relative to the application root path.
637
+     * 
638
+     * @param string $path
639
+     * @return string
640
+     * 
641
+     * @see FileHelper::relativizePath()
642
+     * @see FileHelper::relativizePathByDepth()
643
+     */
644 644
     public static function fileRelativize(string $path) : string
645 645
     {
646 646
         return FileHelper::relativizePathByDepth($path);
647 647
     }
648 648
     
649 649
     /**
650
-    * Converts a PHP regex to a javascript RegExp object statement.
651
-    * 
652
-    * NOTE: This is an alias for the JSHelper's `convertRegex` method. 
653
-    * More details are available on its usage there.
654
-    *
655
-    * @param string $regex A PHP preg regex
656
-    * @param string $statementType The type of statement to return: Defaults to a statement to create a RegExp object.
657
-    * @return string Depending on the specified return type.
658
-    * 
659
-    * @see JSHelper::buildRegexStatement()
660
-    */
650
+     * Converts a PHP regex to a javascript RegExp object statement.
651
+     * 
652
+     * NOTE: This is an alias for the JSHelper's `convertRegex` method. 
653
+     * More details are available on its usage there.
654
+     *
655
+     * @param string $regex A PHP preg regex
656
+     * @param string $statementType The type of statement to return: Defaults to a statement to create a RegExp object.
657
+     * @return string Depending on the specified return type.
658
+     * 
659
+     * @see JSHelper::buildRegexStatement()
660
+     */
661 661
     public static function regex2js(string $regex, string $statementType=JSHelper::JS_REGEX_OBJECT) : string
662 662
     {
663 663
         return JSHelper::buildRegexStatement($regex, $statementType);
664 664
     }
665 665
     
666
-   /**
667
-    * Converts the specified variable to a JSON string.
668
-    *
669
-    * Works just like the native `json_encode` method,
670
-    * except that it will trigger an exception on failure,
671
-    * which has the json error details included in its
672
-    * developer details.
673
-    * 
674
-    * @param mixed $variable
675
-    * @param int $options JSON encode options.
676
-    * @param int $depth 
677
-    * @return string
678
-    *
679
-    * @throws JSONConverterException
680
-    * @see ConvertHelper::ERROR_JSON_ENCODE_FAILED
681
-    */
666
+    /**
667
+     * Converts the specified variable to a JSON string.
668
+     *
669
+     * Works just like the native `json_encode` method,
670
+     * except that it will trigger an exception on failure,
671
+     * which has the json error details included in its
672
+     * developer details.
673
+     * 
674
+     * @param mixed $variable
675
+     * @param int $options JSON encode options.
676
+     * @param int $depth 
677
+     * @return string
678
+     *
679
+     * @throws JSONConverterException
680
+     * @see ConvertHelper::ERROR_JSON_ENCODE_FAILED
681
+     */
682 682
     public static function var2json($variable, int $options=0, int $depth=512) : string
683 683
     {
684 684
         return JSONConverter::var2json($variable, $options, $depth);
@@ -726,12 +726,12 @@  discard block
 block discarded – undo
726 726
             ->toString();
727 727
     }
728 728
     
729
-   /**
730
-    * Strips all known UTF byte order marks from the specified string.
731
-    * 
732
-    * @param string $string
733
-    * @return string
734
-    */
729
+    /**
730
+     * Strips all known UTF byte order marks from the specified string.
731
+     * 
732
+     * @param string $string
733
+     * @return string
734
+     */
735 735
     public static function stripUTFBom(string $string) : string
736 736
     {
737 737
         $boms = FileHelper::createUnicodeHandling()->getUTFBOMs();
@@ -750,69 +750,69 @@  discard block
 block discarded – undo
750 750
         return $string;
751 751
     }
752 752
 
753
-   /**
754
-    * Converts a string to valid utf8, regardless
755
-    * of the string's encoding(s).
756
-    * 
757
-    * @param string $string
758
-    * @return string
759
-    */
753
+    /**
754
+     * Converts a string to valid utf8, regardless
755
+     * of the string's encoding(s).
756
+     * 
757
+     * @param string $string
758
+     * @return string
759
+     */
760 760
     public static function string2utf8(string $string) : string
761 761
     {
762 762
         return ConvertHelper_String::toUtf8($string);
763 763
     }
764 764
     
765
-   /**
766
-    * Checks whether the specified string is an ASCII
767
-    * string, without any special or UTF8 characters.
768
-    * Note: empty strings and NULL are considered ASCII.
769
-    * Any variable types other than strings are not.
770
-    * 
771
-    * @param string|float|int|NULL $string
772
-    * @return boolean
773
-    */
765
+    /**
766
+     * Checks whether the specified string is an ASCII
767
+     * string, without any special or UTF8 characters.
768
+     * Note: empty strings and NULL are considered ASCII.
769
+     * Any variable types other than strings are not.
770
+     * 
771
+     * @param string|float|int|NULL $string
772
+     * @return boolean
773
+     */
774 774
     public static function isStringASCII($string) : bool
775 775
     {
776 776
         return ConvertHelper_String::isASCII(strval($string));
777 777
     }
778 778
     
779
-   /**
780
-    * Adds HTML syntax highlighting to an URL.
781
-    * 
782
-    * NOTE: Includes the necessary CSS styles. When
783
-    * highlighting several URLs in the same page,
784
-    * prefer using the `parseURL` function instead.
785
-    * 
786
-    * @param string $url
787
-    * @return string
788
-    * @deprecated Use the Highlighter class directly instead.
789
-    * @see Highlighter
790
-    */
779
+    /**
780
+     * Adds HTML syntax highlighting to an URL.
781
+     * 
782
+     * NOTE: Includes the necessary CSS styles. When
783
+     * highlighting several URLs in the same page,
784
+     * prefer using the `parseURL` function instead.
785
+     * 
786
+     * @param string $url
787
+     * @return string
788
+     * @deprecated Use the Highlighter class directly instead.
789
+     * @see Highlighter
790
+     */
791 791
     public static function highlight_url(string $url) : string
792 792
     {
793 793
         return Highlighter::url($url);
794 794
     }
795 795
 
796
-   /**
797
-    * Calculates a percentage match of the source string with the target string.
798
-    * 
799
-    * Options are:
800
-    * 
801
-    * - maxLevenshtein, default: 10
802
-    *   Any levenshtein results above this value are ignored.
803
-    *   
804
-    * - precision, default: 1
805
-    *   The precision of the percentage float value
806
-    * 
807
-    * @param string $source
808
-    * @param string $target
809
-    * @param array<string,mixed> $options
810
-    * @return float
811
-    *
812
-    * @see ConvertHelper_TextComparer
813
-    * @see ConvertHelper_TextComparer::OPTION_MAX_LEVENSHTEIN_DISTANCE
814
-    * @see ConvertHelper_TextComparer::OPTION_PRECISION
815
-    */
796
+    /**
797
+     * Calculates a percentage match of the source string with the target string.
798
+     * 
799
+     * Options are:
800
+     * 
801
+     * - maxLevenshtein, default: 10
802
+     *   Any levenshtein results above this value are ignored.
803
+     *   
804
+     * - precision, default: 1
805
+     *   The precision of the percentage float value
806
+     * 
807
+     * @param string $source
808
+     * @param string $target
809
+     * @param array<string,mixed> $options
810
+     * @return float
811
+     *
812
+     * @see ConvertHelper_TextComparer
813
+     * @see ConvertHelper_TextComparer::OPTION_MAX_LEVENSHTEIN_DISTANCE
814
+     * @see ConvertHelper_TextComparer::OPTION_PRECISION
815
+     */
816 816
     public static function matchString(string $source, string $target, array $options=array()) : float
817 817
     {
818 818
         return (new ConvertHelper_TextComparer())
@@ -820,109 +820,109 @@  discard block
 block discarded – undo
820 820
             ->match($source, $target);
821 821
     }
822 822
     
823
-   /**
824
-    * Converts a date interval to a human-readable string with
825
-    * all necessary time components, e.g. "1 year, 2 months and 4 days".
826
-    * 
827
-    * @param DateInterval $interval
828
-    * @return string
829
-    * @see ConvertHelper_IntervalConverter
830
-    *
831
-    * @throws ConvertHelper_Exception
832
-    * @see ConvertHelper_IntervalConverter::ERROR_MISSING_TRANSLATION
833
-    */
823
+    /**
824
+     * Converts a date interval to a human-readable string with
825
+     * all necessary time components, e.g. "1 year, 2 months and 4 days".
826
+     * 
827
+     * @param DateInterval $interval
828
+     * @return string
829
+     * @see ConvertHelper_IntervalConverter
830
+     *
831
+     * @throws ConvertHelper_Exception
832
+     * @see ConvertHelper_IntervalConverter::ERROR_MISSING_TRANSLATION
833
+     */
834 834
     public static function interval2string(DateInterval $interval) : string
835 835
     {
836 836
         return (new ConvertHelper_IntervalConverter())
837 837
             ->toString($interval);
838 838
     }
839 839
     
840
-   /**
841
-    * Converts an interval to its total amount of days.
842
-    * @param DateInterval $interval
843
-    * @return int
844
-    */
840
+    /**
841
+     * Converts an interval to its total amount of days.
842
+     * @param DateInterval $interval
843
+     * @return int
844
+     */
845 845
     public static function interval2days(DateInterval $interval) : int
846 846
     {
847 847
         return ConvertHelper_DateInterval::toDays($interval);
848 848
     }
849 849
 
850
-   /**
851
-    * Converts an interval to its total amount of hours.
852
-    * @param DateInterval $interval
853
-    * @return int
854
-    */
850
+    /**
851
+     * Converts an interval to its total amount of hours.
852
+     * @param DateInterval $interval
853
+     * @return int
854
+     */
855 855
     public static function interval2hours(DateInterval $interval) : int
856 856
     {
857 857
         return ConvertHelper_DateInterval::toHours($interval);
858 858
     }
859 859
     
860
-   /**
861
-    * Converts an interval to its total amount of minutes. 
862
-    * @param DateInterval $interval
863
-    * @return int
864
-    */
860
+    /**
861
+     * Converts an interval to its total amount of minutes. 
862
+     * @param DateInterval $interval
863
+     * @return int
864
+     */
865 865
     public static function interval2minutes(DateInterval $interval) : int
866 866
     {
867 867
         return ConvertHelper_DateInterval::toMinutes($interval);
868 868
     }
869 869
     
870
-   /**
871
-    * Converts an interval to its total amount of seconds.
872
-    * @param DateInterval $interval
873
-    * @return int
874
-    */    
870
+    /**
871
+     * Converts an interval to its total amount of seconds.
872
+     * @param DateInterval $interval
873
+     * @return int
874
+     */    
875 875
     public static function interval2seconds(DateInterval $interval) : int
876 876
     {
877 877
         return ConvertHelper_DateInterval::toSeconds($interval);
878 878
     }
879 879
     
880
-   /**
881
-    * Calculates the total amount of days / hours / minutes or seconds
882
-    * of a date interval object (depending on the specified units), and
883
-    * returns the total amount.
884
-    * 
885
-    * @param DateInterval $interval
886
-    * @param string $unit What total value to calculate.
887
-    * @return integer
888
-    * 
889
-    * @see ConvertHelper::INTERVAL_SECONDS
890
-    * @see ConvertHelper::INTERVAL_MINUTES
891
-    * @see ConvertHelper::INTERVAL_HOURS
892
-    * @see ConvertHelper::INTERVAL_DAYS
893
-    */
880
+    /**
881
+     * Calculates the total amount of days / hours / minutes or seconds
882
+     * of a date interval object (depending on the specified units), and
883
+     * returns the total amount.
884
+     * 
885
+     * @param DateInterval $interval
886
+     * @param string $unit What total value to calculate.
887
+     * @return integer
888
+     * 
889
+     * @see ConvertHelper::INTERVAL_SECONDS
890
+     * @see ConvertHelper::INTERVAL_MINUTES
891
+     * @see ConvertHelper::INTERVAL_HOURS
892
+     * @see ConvertHelper::INTERVAL_DAYS
893
+     */
894 894
     public static function interval2total(DateInterval $interval, string $unit=self::INTERVAL_SECONDS) : int
895 895
     {
896 896
         return ConvertHelper_DateInterval::toTotal($interval, $unit);
897 897
     }
898 898
 
899
-   /**
900
-    * Converts a date to the corresponding day name.
901
-    * 
902
-    * @param DateTime $date
903
-    * @param bool $short
904
-    * @return string|NULL
905
-    */
899
+    /**
900
+     * Converts a date to the corresponding day name.
901
+     * 
902
+     * @param DateTime $date
903
+     * @param bool $short
904
+     * @return string|NULL
905
+     */
906 906
     public static function date2dayName(DateTime $date, bool $short=false) : ?string
907 907
     {
908 908
         return ConvertHelper_Date::toDayName($date, $short);
909 909
     }
910 910
     
911
-   /**
912
-    * Retrieves a list of english day names.
913
-    * @return string[]
914
-    */
911
+    /**
912
+     * Retrieves a list of english day names.
913
+     * @return string[]
914
+     */
915 915
     public static function getDayNamesInvariant() : array
916 916
     {
917 917
         return ConvertHelper_Date::getDayNamesInvariant();
918 918
     }
919 919
     
920
-   /**
921
-    * Retrieves the day names list for the current locale.
922
-    * 
923
-    * @param bool $short
924
-    * @return string[]
925
-    */
920
+    /**
921
+     * Retrieves the day names list for the current locale.
922
+     * 
923
+     * @param bool $short
924
+     * @return string[]
925
+     */
926 926
     public static function getDayNames(bool $short=false) : array
927 927
     {
928 928
         return ConvertHelper_Date::getDayNames($short);
@@ -941,16 +941,16 @@  discard block
 block discarded – undo
941 941
         return ConvertHelper_Array::implodeWithAnd($list, $sep, $conjunction);
942 942
     }
943 943
     
944
-   /**
945
-    * Splits a string into an array of all characters it is composed of.
946
-    * Unicode character safe.
947
-    * 
948
-    * NOTE: Spaces and newlines (both \r and \n) are also considered single
949
-    * characters.
950
-    * 
951
-    * @param string $string
952
-    * @return string[]
953
-    */
944
+    /**
945
+     * Splits a string into an array of all characters it is composed of.
946
+     * Unicode character safe.
947
+     * 
948
+     * NOTE: Spaces and newlines (both \r and \n) are also considered single
949
+     * characters.
950
+     * 
951
+     * @param string $string
952
+     * @return string[]
953
+     */
954 954
     public static function string2array(string $string) : array
955 955
     {
956 956
         return ConvertHelper_String::toArray($string);
@@ -961,53 +961,53 @@  discard block
 block discarded – undo
961 961
         return new WordSplitter($string);
962 962
     }
963 963
     
964
-   /**
965
-    * Checks whether the specified string contains HTML code.
966
-    * 
967
-    * @param string $string
968
-    * @return boolean
969
-    */
964
+    /**
965
+     * Checks whether the specified string contains HTML code.
966
+     * 
967
+     * @param string $string
968
+     * @return boolean
969
+     */
970 970
     public static function isStringHTML(string $string) : bool
971 971
     {
972 972
         return ConvertHelper_String::isHTML($string);
973 973
     }
974 974
     
975
-   /**
976
-    * UTF8-safe wordwrap method: works like the regular wordwrap
977
-    * PHP function but compatible with UTF8. Otherwise the lengths
978
-    * are not calculated correctly.
979
-    * 
980
-    * @param string $str
981
-    * @param int $width
982
-    * @param string $break
983
-    * @param bool $cut
984
-    * @return string
985
-    */
975
+    /**
976
+     * UTF8-safe wordwrap method: works like the regular wordwrap
977
+     * PHP function but compatible with UTF8. Otherwise the lengths
978
+     * are not calculated correctly.
979
+     * 
980
+     * @param string $str
981
+     * @param int $width
982
+     * @param string $break
983
+     * @param bool $cut
984
+     * @return string
985
+     */
986 986
     public static function wordwrap(string $str, int $width = 75, string $break = "\n", bool $cut = false) : string 
987 987
     {
988 988
         return ConvertHelper_String::wordwrap($str, $width, $break, $cut);
989 989
     }
990 990
     
991
-   /**
992
-    * Calculates the byte length of a string, taking into 
993
-    * account any unicode characters.
994
-    * 
995
-    * @param string $string
996
-    * @return int
997
-    */
991
+    /**
992
+     * Calculates the byte length of a string, taking into 
993
+     * account any unicode characters.
994
+     * 
995
+     * @param string $string
996
+     * @return int
997
+     */
998 998
     public static function string2bytes(string $string): int
999 999
     {
1000 1000
         return ConvertHelper_String::toBytes($string);
1001 1001
     }
1002 1002
     
1003
-   /**
1004
-    * Creates a short, 8-character long hash for the specified string.
1005
-    * 
1006
-    * WARNING: Not cryptographically safe.
1007
-    * 
1008
-    * @param string $string
1009
-    * @return string
1010
-    */
1003
+    /**
1004
+     * Creates a short, 8-character long hash for the specified string.
1005
+     * 
1006
+     * WARNING: Not cryptographically safe.
1007
+     * 
1008
+     * @param string $string
1009
+     * @return string
1010
+     */
1011 1011
     public static function string2shortHash(string $string) : string
1012 1012
     {
1013 1013
         return ConvertHelper_String::toShortHash($string);
@@ -1053,88 +1053,88 @@  discard block
 block discarded – undo
1053 1053
         return ConvertHelper_ThrowableInfo::fromThrowable($e);
1054 1054
     }
1055 1055
     
1056
-   /**
1057
-    * Parses the specified query string like the native 
1058
-    * function <code>parse_str</code>, without the key
1059
-    * naming limitations.
1060
-    * 
1061
-    * Using parse_str, dots or spaces in key names are 
1062
-    * replaced by underscores. This method keeps all names
1063
-    * intact.
1064
-    * 
1065
-    * It still uses the parse_str implementation as it 
1066
-    * is tested and tried, but fixes the parameter names
1067
-    * after parsing, as needed.
1068
-    * 
1069
-    * @param string $queryString
1070
-    * @return array<string,string>
1071
-    * @see ConvertHelper_QueryParser
1072
-    */
1056
+    /**
1057
+     * Parses the specified query string like the native 
1058
+     * function <code>parse_str</code>, without the key
1059
+     * naming limitations.
1060
+     * 
1061
+     * Using parse_str, dots or spaces in key names are 
1062
+     * replaced by underscores. This method keeps all names
1063
+     * intact.
1064
+     * 
1065
+     * It still uses the parse_str implementation as it 
1066
+     * is tested and tried, but fixes the parameter names
1067
+     * after parsing, as needed.
1068
+     * 
1069
+     * @param string $queryString
1070
+     * @return array<string,string>
1071
+     * @see ConvertHelper_QueryParser
1072
+     */
1073 1073
     public static function parseQueryString(string $queryString) : array
1074 1074
     {
1075 1075
         $parser = new ConvertHelper_QueryParser();
1076 1076
         return $parser->parse($queryString);
1077 1077
     }
1078 1078
 
1079
-   /**
1080
-    * Searches for needle in the specified string, and returns a list
1081
-    * of all occurrences, including the matched string. The matched 
1082
-    * string is useful when doing a case-insensitive search, as it
1083
-    * shows the exact matched case of needle.
1084
-    *   
1085
-    * @param string $needle
1086
-    * @param string $haystack
1087
-    * @param bool $caseInsensitive
1088
-    * @return ConvertHelper_StringMatch[]
1089
-    */
1079
+    /**
1080
+     * Searches for needle in the specified string, and returns a list
1081
+     * of all occurrences, including the matched string. The matched 
1082
+     * string is useful when doing a case-insensitive search, as it
1083
+     * shows the exact matched case of needle.
1084
+     *   
1085
+     * @param string $needle
1086
+     * @param string $haystack
1087
+     * @param bool $caseInsensitive
1088
+     * @return ConvertHelper_StringMatch[]
1089
+     */
1090 1090
     public static function findString(string $needle, string $haystack, bool $caseInsensitive=false): array
1091 1091
     {
1092 1092
         return ConvertHelper_String::findString($needle, $haystack, $caseInsensitive);
1093 1093
     }
1094 1094
     
1095
-   /**
1096
-    * Like explode, but trims all entries, and removes 
1097
-    * empty entries from the resulting array.
1098
-    * 
1099
-    * @param string $delimiter
1100
-    * @param string $string
1101
-    * @return string[]
1102
-    */
1095
+    /**
1096
+     * Like explode, but trims all entries, and removes 
1097
+     * empty entries from the resulting array.
1098
+     * 
1099
+     * @param string $delimiter
1100
+     * @param string $string
1101
+     * @return string[]
1102
+     */
1103 1103
     public static function explodeTrim(string $delimiter, string $string) : array
1104 1104
     {
1105 1105
         return ConvertHelper_String::explodeTrim($delimiter, $string);
1106 1106
     }
1107 1107
     
1108
-   /**
1109
-    * Detects the most used end-of-line character in the subject string.
1110
-    * 
1111
-    * @param string $subjectString The string to check.
1112
-    * @return NULL|ConvertHelper_EOL The detected EOL instance, or NULL if none has been detected.
1113
-    */
1108
+    /**
1109
+     * Detects the most used end-of-line character in the subject string.
1110
+     * 
1111
+     * @param string $subjectString The string to check.
1112
+     * @return NULL|ConvertHelper_EOL The detected EOL instance, or NULL if none has been detected.
1113
+     */
1114 1114
     public static function detectEOLCharacter(string $subjectString) : ?ConvertHelper_EOL
1115 1115
     {
1116 1116
         return ConvertHelper_EOL::detect($subjectString);
1117 1117
     }
1118 1118
 
1119
-   /**
1120
-    * Removes the specified keys from the target array,
1121
-    * if they exist.
1122
-    * 
1123
-    * @param array<string|int,mixed> $array
1124
-    * @param string[] $keys
1125
-    */
1119
+    /**
1120
+     * Removes the specified keys from the target array,
1121
+     * if they exist.
1122
+     * 
1123
+     * @param array<string|int,mixed> $array
1124
+     * @param string[] $keys
1125
+     */
1126 1126
     public static function arrayRemoveKeys(array &$array, array $keys) : void
1127 1127
     {
1128 1128
         ConvertHelper_Array::removeKeys($array, $keys);
1129 1129
     }
1130 1130
     
1131
-   /**
1132
-    * Checks if the specified variable is an integer or a string containing an integer.
1133
-    * Accepts both positive and negative integers.
1134
-    * 
1135
-    * @param mixed $value
1136
-    * @return bool
1137
-    */
1131
+    /**
1132
+     * Checks if the specified variable is an integer or a string containing an integer.
1133
+     * Accepts both positive and negative integers.
1134
+     * 
1135
+     * @param mixed $value
1136
+     * @return bool
1137
+     */
1138 1138
     public static function isInteger($value) : bool
1139 1139
     {
1140 1140
         if(is_int($value)) {
@@ -1154,52 +1154,52 @@  discard block
 block discarded – undo
1154 1154
         return false;    
1155 1155
     }
1156 1156
     
1157
-   /**
1158
-    * Converts an amount of seconds to a DateInterval object.
1159
-    * 
1160
-    * @param int $seconds
1161
-    * @return DateInterval
1162
-    * @throws ConvertHelper_Exception If the date interval cannot be created.
1163
-    * 
1164
-    * @see ConvertHelper::ERROR_CANNOT_GET_DATE_DIFF
1165
-    */
1157
+    /**
1158
+     * Converts an amount of seconds to a DateInterval object.
1159
+     * 
1160
+     * @param int $seconds
1161
+     * @return DateInterval
1162
+     * @throws ConvertHelper_Exception If the date interval cannot be created.
1163
+     * 
1164
+     * @see ConvertHelper::ERROR_CANNOT_GET_DATE_DIFF
1165
+     */
1166 1166
     public static function seconds2interval(int $seconds) : DateInterval
1167 1167
     {
1168 1168
         return ConvertHelper_DateInterval::fromSeconds($seconds)->getInterval();
1169 1169
     }
1170 1170
     
1171
-   /**
1172
-    * Converts a size string like "50 MB" to the corresponding byte size.
1173
-    * It is case-insensitive, ignores spaces, and supports both traditional
1174
-    * "MB" and "MiB" notations.
1175
-    * 
1176
-    * @param string $size
1177
-    * @return int
1178
-    */
1171
+    /**
1172
+     * Converts a size string like "50 MB" to the corresponding byte size.
1173
+     * It is case-insensitive, ignores spaces, and supports both traditional
1174
+     * "MB" and "MiB" notations.
1175
+     * 
1176
+     * @param string $size
1177
+     * @return int
1178
+     */
1179 1179
     public static function size2bytes(string $size) : int
1180 1180
     {
1181 1181
         return self::parseSize($size)->toBytes();
1182 1182
     }
1183 1183
     
1184
-   /**
1185
-    * Parses a size string like "50 MB" and returns a size notation instance
1186
-    * that has utility methods to access information on it, and convert it.
1187
-    * 
1188
-    * @param string $size
1189
-    * @return ConvertHelper_SizeNotation
1190
-    */
1184
+    /**
1185
+     * Parses a size string like "50 MB" and returns a size notation instance
1186
+     * that has utility methods to access information on it, and convert it.
1187
+     * 
1188
+     * @param string $size
1189
+     * @return ConvertHelper_SizeNotation
1190
+     */
1191 1191
     public static function parseSize(string $size) : ConvertHelper_SizeNotation
1192 1192
     {
1193 1193
         return new ConvertHelper_SizeNotation($size);
1194 1194
     }
1195 1195
     
1196
-   /**
1197
-    * Creates a URL finder instance, which can be used to find
1198
-    * URLs in a string - be it plain text, or HTML.
1199
-    * 
1200
-    * @param string $subject
1201
-    * @return ConvertHelper_URLFinder
1202
-    */
1196
+    /**
1197
+     * Creates a URL finder instance, which can be used to find
1198
+     * URLs in a string - be it plain text, or HTML.
1199
+     * 
1200
+     * @param string $subject
1201
+     * @return ConvertHelper_URLFinder
1202
+     */
1203 1203
     public static function createURLFinder(string $subject) : ConvertHelper_URLFinder
1204 1204
     {
1205 1205
         return new ConvertHelper_URLFinder($subject);
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      * @param int $tabSize The amount of spaces per tab.
62 62
      * @return string
63 63
      */
64
-    public static function tabs2spaces(string $string, int $tabSize=4) : string
64
+    public static function tabs2spaces(string $string, int $tabSize = 4) : string
65 65
     {
66 66
         return ConvertHelper_String::tabs2spaces($string, $tabSize);
67 67
     }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     * @param int $tabSize The amount of spaces per tab in the source string.
74 74
     * @return string
75 75
     */
76
-    public static function spaces2tabs(string $string, int $tabSize=4) : string
76
+    public static function spaces2tabs(string $string, int $tabSize = 4) : string
77 77
     {
78 78
         return ConvertHelper_String::spaces2tabs($string, $tabSize);
79 79
     }
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
     * @deprecated Use the Highlighter class directly instead.
147 147
     * @see Highlighter::xml()
148 148
     */
149
-    public static function highlight_xml(string $xml, bool $formatSource=false) : string
149
+    public static function highlight_xml(string $xml, bool $formatSource = false) : string
150 150
     {
151 151
         return Highlighter::xml($xml, $formatSource);
152 152
     }
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
      * @param bool $html
213 213
      * @return string
214 214
      */
215
-    public static function var_dump($var, bool $html=true) : string
215
+    public static function var_dump($var, bool $html = true) : string
216 216
     {
217 217
         $info = parseVariable($var);
218 218
         
219
-        if($html) {
219
+        if ($html) {
220 220
             return $info->toHTML();
221 221
         }
222 222
         
@@ -231,11 +231,11 @@  discard block
 block discarded – undo
231 231
     * @param bool $html Whether to style the dump as HTML.
232 232
     * @return string
233 233
     */
234
-    public static function print_r($var, bool $return=false, bool $html=true) : string
234
+    public static function print_r($var, bool $return = false, bool $html = true) : string
235 235
     {
236 236
         $result = parseVariable($var)->enableType()->toString();
237 237
         
238
-        if($html) 
238
+        if ($html) 
239 239
         {
240 240
             $result = 
241 241
             '<pre style="background:#fff;color:#333;padding:16px;border:solid 1px #bbb;border-radius:4px">'.
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
             '</pre>';
244 244
         }
245 245
         
246
-        if(!$return) 
246
+        if (!$return) 
247 247
         {
248 248
             echo $result;
249 249
         }
@@ -425,12 +425,12 @@  discard block
 block discarded – undo
425 425
         $output = '';
426 426
         $split = str_split($unicodeChar);
427 427
         
428
-        foreach($split as $octet) 
428
+        foreach ($split as $octet) 
429 429
         {
430 430
             $ordInt = ord($octet);
431 431
             // Convert from int (base 10) to hex (base 16), for PHP \x syntax
432 432
             $ordHex = base_convert((string)$ordInt, 10, 16);
433
-            $output .= '\x' . $ordHex;
433
+            $output .= '\x'.$ordHex;
434 434
         }
435 435
         
436 436
         return $output;
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
     * 
659 659
     * @see JSHelper::buildRegexStatement()
660 660
     */
661
-    public static function regex2js(string $regex, string $statementType=JSHelper::JS_REGEX_OBJECT) : string
661
+    public static function regex2js(string $regex, string $statementType = JSHelper::JS_REGEX_OBJECT) : string
662 662
     {
663 663
         return JSHelper::buildRegexStatement($regex, $statementType);
664 664
     }
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
     * @throws JSONConverterException
680 680
     * @see ConvertHelper::ERROR_JSON_ENCODE_FAILED
681 681
     */
682
-    public static function var2json($variable, int $options=0, int $depth=512) : string
682
+    public static function var2json($variable, int $options = 0, int $depth = 512) : string
683 683
     {
684 684
         return JSONConverter::var2json($variable, $options, $depth);
685 685
     }
@@ -736,12 +736,12 @@  discard block
 block discarded – undo
736 736
     {
737 737
         $boms = FileHelper::createUnicodeHandling()->getUTFBOMs();
738 738
 
739
-        foreach($boms as $bomChars)
739
+        foreach ($boms as $bomChars)
740 740
         {
741 741
             $length = mb_strlen($bomChars);
742 742
             $text = mb_substr($string, 0, $length);
743 743
 
744
-            if($text===$bomChars)
744
+            if ($text === $bomChars)
745 745
             {
746 746
                 return mb_substr($string, $length);
747 747
             }
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
     * @see ConvertHelper_TextComparer::OPTION_MAX_LEVENSHTEIN_DISTANCE
814 814
     * @see ConvertHelper_TextComparer::OPTION_PRECISION
815 815
     */
816
-    public static function matchString(string $source, string $target, array $options=array()) : float
816
+    public static function matchString(string $source, string $target, array $options = array()) : float
817 817
     {
818 818
         return (new ConvertHelper_TextComparer())
819 819
             ->setOptions($options)
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
     * @see ConvertHelper::INTERVAL_HOURS
892 892
     * @see ConvertHelper::INTERVAL_DAYS
893 893
     */
894
-    public static function interval2total(DateInterval $interval, string $unit=self::INTERVAL_SECONDS) : int
894
+    public static function interval2total(DateInterval $interval, string $unit = self::INTERVAL_SECONDS) : int
895 895
     {
896 896
         return ConvertHelper_DateInterval::toTotal($interval, $unit);
897 897
     }
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
     * @param bool $short
904 904
     * @return string|NULL
905 905
     */
906
-    public static function date2dayName(DateTime $date, bool $short=false) : ?string
906
+    public static function date2dayName(DateTime $date, bool $short = false) : ?string
907 907
     {
908 908
         return ConvertHelper_Date::toDayName($date, $short);
909 909
     }
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
     * @param bool $short
924 924
     * @return string[]
925 925
     */
926
-    public static function getDayNames(bool $short=false) : array
926
+    public static function getDayNames(bool $short = false) : array
927 927
     {
928 928
         return ConvertHelper_Date::getDayNames($short);
929 929
     }
@@ -1087,7 +1087,7 @@  discard block
 block discarded – undo
1087 1087
     * @param bool $caseInsensitive
1088 1088
     * @return ConvertHelper_StringMatch[]
1089 1089
     */
1090
-    public static function findString(string $needle, string $haystack, bool $caseInsensitive=false): array
1090
+    public static function findString(string $needle, string $haystack, bool $caseInsensitive = false): array
1091 1091
     {
1092 1092
         return ConvertHelper_String::findString($needle, $haystack, $caseInsensitive);
1093 1093
     }
@@ -1137,17 +1137,17 @@  discard block
 block discarded – undo
1137 1137
     */
1138 1138
     public static function isInteger($value) : bool
1139 1139
     {
1140
-        if(is_int($value)) {
1140
+        if (is_int($value)) {
1141 1141
             return true;
1142 1142
         }
1143 1143
         
1144 1144
         // booleans get converted to numbers, so they would
1145 1145
         // actually match the regex.
1146
-        if(is_bool($value)) {
1146
+        if (is_bool($value)) {
1147 1147
             return false;
1148 1148
         }
1149 1149
         
1150
-        if(is_string($value) && $value !== '') {
1150
+        if (is_string($value) && $value !== '') {
1151 1151
             return preg_match('/\A-?\d+\z/', $value) === 1;
1152 1152
         }
1153 1153
         
@@ -1213,7 +1213,7 @@  discard block
 block discarded – undo
1213 1213
      * @param bool $keepKeys
1214 1214
      * @return array<number|string,mixed>
1215 1215
      */
1216
-    public static function arrayRemoveValues(array $sourceArray, array $values, bool $keepKeys=false) : array
1216
+    public static function arrayRemoveValues(array $sourceArray, array $values, bool $keepKeys = false) : array
1217 1217
     {
1218 1218
         return ConvertHelper_Array::removeValues($sourceArray, $values, $keepKeys);
1219 1219
     }
Please login to merge, or discard this patch.
src/Highlighter.php 2 patches
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -43,60 +43,60 @@  discard block
 block discarded – undo
43 43
  */
44 44
 class Highlighter
45 45
 {
46
-   /**
47
-    * Creates a new GeSHi instance from a source code string.
48
-    * 
49
-    * @param string $sourceCode
50
-    * @param string $format
51
-    * @return GeSHi
52
-    */
46
+    /**
47
+     * Creates a new GeSHi instance from a source code string.
48
+     * 
49
+     * @param string $sourceCode
50
+     * @param string $format
51
+     * @return GeSHi
52
+     */
53 53
     public static function fromString(string $sourceCode, string $format) : GeSHi
54 54
     {
55 55
         return new GeSHi($sourceCode, $format);
56 56
     }
57 57
     
58
-   /**
59
-    * Creates a new GeSHi instance from the contents of a file.
60
-    * 
61
-    * @param string $path
62
-    * @param string $format
63
-    * @return GeSHi
64
-    */
58
+    /**
59
+     * Creates a new GeSHi instance from the contents of a file.
60
+     * 
61
+     * @param string $path
62
+     * @param string $format
63
+     * @return GeSHi
64
+     */
65 65
     public static function fromFile(string $path, string $format) : GeSHi
66 66
     {
67 67
         return self::fromString(FileHelper::readContents($path), $format);
68 68
     }
69 69
     
70
-   /**
71
-    * Parses and highlights the target string.
72
-    * 
73
-    * @param string $sourceCode
74
-    * @param string $format
75
-    * @return string
76
-    */
70
+    /**
71
+     * Parses and highlights the target string.
72
+     * 
73
+     * @param string $sourceCode
74
+     * @param string $format
75
+     * @return string
76
+     */
77 77
     public static function parseString(string $sourceCode, string $format) : string
78 78
     {
79 79
         return self::fromString($sourceCode, $format)->parse_code();
80 80
     }
81 81
     
82
-   /**
83
-    * Parses and highlights the contents of the target file.
84
-    * 
85
-    * @param string $path
86
-    * @param string $format
87
-    * @return string
88
-    */
82
+    /**
83
+     * Parses and highlights the contents of the target file.
84
+     * 
85
+     * @param string $path
86
+     * @param string $format
87
+     * @return string
88
+     */
89 89
     public static function parseFile(string $path, string $format) : string
90 90
     {
91 91
         return self::fromFile($path, $format)->parse_code();
92 92
     }
93 93
     
94
-   /**
95
-    * Adds HTML syntax highlighting to the specified SQL string.
96
-    *
97
-    * @param string $sql
98
-    * @return string
99
-    */
94
+    /**
95
+     * Adds HTML syntax highlighting to the specified SQL string.
96
+     *
97
+     * @param string $sql
98
+     * @return string
99
+     */
100 100
     public static function sql(string $sql) : string
101 101
     {
102 102
         return self::parseString($sql, 'sql');
@@ -122,13 +122,13 @@  discard block
 block discarded – undo
122 122
         return self::parseString($subject, 'javascript');
123 123
     }
124 124
     
125
-   /**
126
-    * Adds HTML syntax highlighting to the specified XML code.
127
-    *
128
-    * @param string $xml The XML to highlight.
129
-    * @param bool $formatSource Whether to format the source with indentation to make it readable.
130
-    * @return string
131
-    */
125
+    /**
126
+     * Adds HTML syntax highlighting to the specified XML code.
127
+     *
128
+     * @param string $xml The XML to highlight.
129
+     * @param bool $formatSource Whether to format the source with indentation to make it readable.
130
+     * @return string
131
+     */
132 132
     public static function xml(string $xml, bool $formatSource=false) : string
133 133
     {
134 134
         if($formatSource)
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
         return self::parseString($xml, 'xml');
146 146
     }
147 147
     
148
-   /**
149
-    * Adds HTML syntax highlighting to the specified HTML code.
150
-    * 
151
-    * @param string $html
152
-    * @param bool $formatSource
153
-    * @return string
154
-    */
148
+    /**
149
+     * Adds HTML syntax highlighting to the specified HTML code.
150
+     * 
151
+     * @param string $html
152
+     * @param bool $formatSource
153
+     * @return string
154
+     */
155 155
     public static function html(string $html, bool $formatSource=false) : string
156 156
     {
157 157
         if($formatSource)
@@ -168,27 +168,27 @@  discard block
 block discarded – undo
168 168
         return self::parseString($html, 'xml');
169 169
     }
170 170
     
171
-   /**
172
-    * Adds HTML syntax highlighting to a bit of PHP code.
173
-    * 
174
-    * @param string $phpCode
175
-    * @return string
176
-    */
171
+    /**
172
+     * Adds HTML syntax highlighting to a bit of PHP code.
173
+     * 
174
+     * @param string $phpCode
175
+     * @return string
176
+     */
177 177
     public static function php(string $phpCode) : string
178 178
     {
179 179
         return self::parseString($phpCode, 'php');
180 180
     }
181 181
     
182
-   /**
183
-    * Adds HTML syntax highlighting to an URL.
184
-    *
185
-    * NOTE: Includes the necessary CSS styles. When
186
-    * highlighting several URLs in the same page,
187
-    * prefer using the `parseURL` function instead.
188
-    *
189
-    * @param string $url
190
-    * @return string
191
-    */
182
+    /**
183
+     * Adds HTML syntax highlighting to an URL.
184
+     *
185
+     * NOTE: Includes the necessary CSS styles. When
186
+     * highlighting several URLs in the same page,
187
+     * prefer using the `parseURL` function instead.
188
+     *
189
+     * @param string $url
190
+     * @return string
191
+     */
192 192
     public static function url(string $url) : string
193 193
     {
194 194
         $info = parseURL($url);
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      */
113 113
     public static function json($subject) : string
114 114
     {
115
-        if(!is_string($subject))
115
+        if (!is_string($subject))
116 116
         {
117 117
             $subject = JSONConverter::var2json($subject, JSON_PRETTY_PRINT);
118 118
         }
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
     * @param bool $formatSource Whether to format the source with indentation to make it readable.
130 130
     * @return string
131 131
     */
132
-    public static function xml(string $xml, bool $formatSource=false) : string
132
+    public static function xml(string $xml, bool $formatSource = false) : string
133 133
     {
134
-        if($formatSource)
134
+        if ($formatSource)
135 135
         {
136 136
             $dom = new DOMDocument();
137 137
             $dom->preserveWhiteSpace = false;
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
     * @param bool $formatSource
153 153
     * @return string
154 154
     */
155
-    public static function html(string $html, bool $formatSource=false) : string
155
+    public static function html(string $html, bool $formatSource = false) : string
156 156
     {
157
-        if($formatSource)
157
+        if ($formatSource)
158 158
         {
159 159
             $dom = new DOMDocument();
160 160
             $dom->preserveWhiteSpace = false;
Please login to merge, or discard this patch.
src/ConvertHelper/JSONConverter.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      * @throws JSONConverterException
42 42
      * @see ConvertHelper::ERROR_JSON_ENCODE_FAILED
43 43
      */
44
-    public static function var2json($variable, int $options=0, int $depth=512) : string
44
+    public static function var2json($variable, int $options = 0, int $depth = 512) : string
45 45
     {
46 46
         try
47 47
         {
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
      * @return mixed|NULL
70 70
      * @throws JSONConverterException
71 71
      */
72
-    public static function json2var(string $json, bool $assoc=true)
72
+    public static function json2var(string $json, bool $assoc = true)
73 73
     {
74
-        if(empty($json)) {
74
+        if (empty($json)) {
75 75
             return null;
76 76
         }
77 77
 
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
      */
113 113
     public static function json2array($json) : array
114 114
     {
115
-        if(is_array($json)) {
115
+        if (is_array($json)) {
116 116
             return $json;
117 117
         }
118 118
 
119 119
         $result = self::json2var($json);
120
-        if(is_array($result)) {
120
+        if (is_array($result)) {
121 121
             return $result;
122 122
         }
123 123
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      * @param int $depth
166 166
      * @return string
167 167
      */
168
-    public static function var2jsonSilent($variable, int $options=0, int $depth=512) : string
168
+    public static function var2jsonSilent($variable, int $options = 0, int $depth = 512) : string
169 169
     {
170 170
         try
171 171
         {
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
      * @param bool $assoc
186 186
      * @return mixed|null
187 187
      */
188
-    public static function json2varSilent(string $json, bool $assoc=true)
188
+    public static function json2varSilent(string $json, bool $assoc = true)
189 189
     {
190 190
         try
191 191
         {
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -46,8 +46,7 @@  discard block
 block discarded – undo
46 46
         try
47 47
         {
48 48
             return json_encode($variable, JSON_THROW_ON_ERROR | $options, $depth);
49
-        }
50
-        catch (JsonException $e)
49
+        } catch (JsonException $e)
51 50
         {
52 51
             throw new JSONConverterException(
53 52
                 'Could not create json array'.json_last_error_msg(),
@@ -78,8 +77,7 @@  discard block
 block discarded – undo
78 77
         try
79 78
         {
80 79
             return json_decode($json, $assoc, 512, JSON_THROW_ON_ERROR);
81
-        }
82
-        catch (JsonException $e)
80
+        } catch (JsonException $e)
83 81
         {
84 82
             throw new JSONConverterException(
85 83
                 'Could not decode JSON string.',
@@ -149,8 +147,7 @@  discard block
 block discarded – undo
149 147
         try
150 148
         {
151 149
             return self::json2array($json);
152
-        }
153
-        catch (JSONConverterException $e)
150
+        } catch (JSONConverterException $e)
154 151
         {
155 152
             return array();
156 153
         }
@@ -170,8 +167,7 @@  discard block
 block discarded – undo
170 167
         try
171 168
         {
172 169
             return self::var2json($variable, $options, $depth);
173
-        }
174
-        catch (JSONConverterException $e)
170
+        } catch (JSONConverterException $e)
175 171
         {
176 172
             return '';
177 173
         }
@@ -190,8 +186,7 @@  discard block
 block discarded – undo
190 186
         try
191 187
         {
192 188
             return self::json2var($json, $assoc);
193
-        }
194
-        catch (JSONConverterException $e)
189
+        } catch (JSONConverterException $e)
195 190
         {
196 191
             return null;
197 192
         }
Please login to merge, or discard this patch.
src/XMLHelper/Converter.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
     
52 52
     protected SimpleXMLElement $xml;
53 53
     
54
-   /**
55
-    * @var string|NULL
56
-    */
54
+    /**
55
+     * @var string|NULL
56
+     */
57 57
     protected ?string $json;
58 58
     
59 59
     protected function __construct(SimpleXMLElement $element)
@@ -98,34 +98,34 @@  discard block
 block discarded – undo
98 98
         }
99 99
     }
100 100
     
101
-   /**
102
-    * Factory method: creates a converter from an existing SimpleXMLElement instance.
103
-    * 
104
-    * @param SimpleXMLElement $element
105
-    * @return XMLHelper_Converter
106
-    */
101
+    /**
102
+     * Factory method: creates a converter from an existing SimpleXMLElement instance.
103
+     * 
104
+     * @param SimpleXMLElement $element
105
+     * @return XMLHelper_Converter
106
+     */
107 107
     public static function fromElement(SimpleXMLElement $element) : XMLHelper_Converter
108 108
     {
109 109
         return new XMLHelper_Converter($element);
110 110
     }
111 111
 
112
-   /**
113
-    * Factory method: creates a converter from an existing SimpleXMLElement instance.
114
-    *
115
-    * @param DOMElement $element
116
-    * @return XMLHelper_Converter
117
-    */
112
+    /**
113
+     * Factory method: creates a converter from an existing SimpleXMLElement instance.
114
+     *
115
+     * @param DOMElement $element
116
+     * @return XMLHelper_Converter
117
+     */
118 118
     public static function fromDOMElement(DOMElement $element) : XMLHelper_Converter
119 119
     {
120 120
         return new XMLHelper_Converter(simplexml_import_dom($element));
121 121
     }
122 122
     
123
-   /**
124
-    * Converts the XML to JSON.
125
-    * 
126
-    * @return string
127
-    * @throws XMLHelper_Exception
128
-    */
123
+    /**
124
+     * Converts the XML to JSON.
125
+     * 
126
+     * @return string
127
+     * @throws XMLHelper_Exception
128
+     */
129 129
     public function toJSON() : string
130 130
     {
131 131
         if (isset($this->json))
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -86,8 +86,7 @@  discard block
 block discarded – undo
86 86
         try
87 87
         {
88 88
             return self::fromElement(new SimpleXMLElement($xmlString));
89
-        }
90
-        catch (Exception $e)
89
+        } catch (Exception $e)
91 90
         {
92 91
             throw new XMLHelper_Exception(
93 92
                 'Cannot create new element from string.',
@@ -142,8 +141,7 @@  discard block
 block discarded – undo
142 141
             unset($this->xml);
143 142
 
144 143
             return $this->json;
145
-        }
146
-        catch (JSONConverterException $e)
144
+        } catch (JSONConverterException $e)
147 145
         {
148 146
             throw new XMLHelper_Exception(
149 147
                 'Could not convert the XML source to JSON.',
@@ -171,8 +169,7 @@  discard block
 block discarded – undo
171 169
         try
172 170
         {
173 171
             return JSONConverter::json2array($this->toJSON());
174
-        }
175
-        catch (JSONConverterException $e)
172
+        } catch (JSONConverterException $e)
176 173
         {
177 174
             throw new XMLHelper_Exception(
178 175
                 'Could not convert the JSON string to an array.',
Please login to merge, or discard this patch.
src/FileHelper/JSONFile.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 
123 123
     private function convertEncoding(string $contents) : string
124 124
     {
125
-        if(!empty($this->targetEncoding))
125
+        if (!empty($this->targetEncoding))
126 126
         {
127 127
             return (string)mb_convert_encoding(
128 128
                 $contents,
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     {
145 145
         $options = 0;
146 146
 
147
-        if($pretty)
147
+        if ($pretty)
148 148
         {
149 149
             $options = JSON_PRETTY_PRINT;
150 150
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -95,8 +95,7 @@  discard block
 block discarded – undo
95 95
                 512,
96 96
                 JSON_THROW_ON_ERROR
97 97
             );
98
-        }
99
-        catch (JsonException $e)
98
+        } catch (JsonException $e)
100 99
         {
101 100
             throw new FileHelper_Exception(
102 101
                 'Cannot decode json data',
@@ -156,8 +155,7 @@  discard block
 block discarded – undo
156 155
             $this->putContents($json);
157 156
 
158 157
             return $this;
159
-        }
160
-        catch (JSONConverterException $e)
158
+        } catch (JSONConverterException $e)
161 159
         {
162 160
             throw new FileHelper_Exception(
163 161
                 'An error occurred while encoding a data set to JSON.',
Please login to merge, or discard this patch.
src/JSHelper.php 3 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -38,27 +38,27 @@  discard block
 block discarded – undo
38 38
     public const JS_REGEX_JSON = 'json';
39 39
 
40 40
     /**
41
-    * @var array<string,string>
42
-    */
41
+     * @var array<string,string>
42
+     */
43 43
     protected static array $variableCache = array();
44 44
     protected static int $elementCounter = 0;
45 45
     protected static string $idPrefix = 'E';
46 46
     
47
-   /**
48
-    * Builds a javascript statement. The first parameter is the
49
-    * javascript function to call, any additional parameters are
50
-    * used as arguments for the javascript function call. Variable
51
-    * types are automagically converted to the javascript equivalents.
52
-    *
53
-    * Examples:
54
-    *
55
-    * // add an alert(); statement:
56
-    * JSHelper::buildStatement('alert');
57
-    *
58
-    * // add an alert('Alert text'); statement
59
-    * JSHelper::buildStatement('alert', 'Alert text');
60
-    *
61
-    */
47
+    /**
48
+     * Builds a javascript statement. The first parameter is the
49
+     * javascript function to call, any additional parameters are
50
+     * used as arguments for the javascript function call. Variable
51
+     * types are automagically converted to the javascript equivalents.
52
+     *
53
+     * Examples:
54
+     *
55
+     * // add an alert(); statement:
56
+     * JSHelper::buildStatement('alert');
57
+     *
58
+     * // add an alert('Alert text'); statement
59
+     * JSHelper::buildStatement('alert', 'Alert text');
60
+     *
61
+     */
62 62
     public static function buildStatement() : string
63 63
     {
64 64
         $args = func_get_args();
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
         return call_user_func_array(array(self::class, 'buildStatementQuoteStyle'), $args);
67 67
     }
68 68
     
69
-   /**
70
-    * Like {@link JSHelper::buildStatement()}, but using single quotes
71
-    * to make it possible to use the statement in an HTML tag attribute.
72
-    * 
73
-    * @return string
74
-    * @see JSHelper::buildStatement()
75
-    */
69
+    /**
70
+     * Like {@link JSHelper::buildStatement()}, but using single quotes
71
+     * to make it possible to use the statement in an HTML tag attribute.
72
+     * 
73
+     * @return string
74
+     * @see JSHelper::buildStatement()
75
+     */
76 76
     public static function buildStatementAttribute() : string
77 77
     {
78 78
         $args = func_get_args();
@@ -225,13 +225,13 @@  discard block
 block discarded – undo
225 225
         return self::phpVariable2JS($variable, self::QUOTE_STYLE_SINGLE);
226 226
     }
227 227
 
228
-   /**
229
-    * Generates a dynamic element ID to be used with dynamically generated
230
-    * HTML code to tie in with clientside javascript when compact but unique
231
-    * IDs are needed in a  request.
232
-    *
233
-    * @return string
234
-    */
228
+    /**
229
+     * Generates a dynamic element ID to be used with dynamically generated
230
+     * HTML code to tie in with clientside javascript when compact but unique
231
+     * IDs are needed in a  request.
232
+     *
233
+     * @return string
234
+     */
235 235
     public static function nextElementID() : string
236 236
     {
237 237
         self::$elementCounter++;
@@ -239,33 +239,33 @@  discard block
 block discarded – undo
239 239
         return self::$idPrefix . self::$elementCounter;
240 240
     }
241 241
     
242
-   /**
243
-    * Retrieves the ID prefix currently used.
244
-    * 
245
-    * @return string
246
-    */
242
+    /**
243
+     * Retrieves the ID prefix currently used.
244
+     * 
245
+     * @return string
246
+     */
247 247
     public static function getIDPrefix() : string
248 248
     {
249 249
         return self::$idPrefix;
250 250
     }
251 251
     
252
-   /**
253
-    * Retrieves the value of the internal elements counter.
254
-    * 
255
-    * @return integer
256
-    */
252
+    /**
253
+     * Retrieves the value of the internal elements counter.
254
+     * 
255
+     * @return integer
256
+     */
257 257
     public static function getElementCounter() : int
258 258
     {
259 259
         return self::$elementCounter;
260 260
     }
261 261
     
262
-   /**
263
-    * Sets the prefix that is added in front of all IDs
264
-    * retrieved using the {@link nextElementID()} method.
265
-    * 
266
-    * @param string $prefix
267
-    * @see JSHelper::nextElementID()
268
-    */
262
+    /**
263
+     * Sets the prefix that is added in front of all IDs
264
+     * retrieved using the {@link nextElementID()} method.
265
+     * 
266
+     * @param string $prefix
267
+     * @see JSHelper::nextElementID()
268
+     */
269 269
     public static function setIDPrefix(string $prefix) : void
270 270
     {
271 271
         self::$idPrefix = $prefix;
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -86,20 +86,20 @@  discard block
 block discarded – undo
86 86
         $quoteStyle = array_shift($params);
87 87
         $method = array_shift($params);
88 88
         
89
-        $call = $method . '(';
89
+        $call = $method.'(';
90 90
         
91 91
         $total = count($params);
92
-        if($total > 0) {
93
-            for($i=0; $i < $total; $i++) 
92
+        if ($total > 0) {
93
+            for ($i = 0; $i < $total; $i++) 
94 94
             {
95 95
                 $call .= self::phpVariable2JS($params[$i], $quoteStyle);
96
-                if($i < ($total-1)) {
96
+                if ($i < ($total - 1)) {
97 97
                     $call .= ',';
98 98
                 }
99 99
             }
100 100
         }
101 101
         
102
-        return $call . ');';
102
+        return $call.');';
103 103
     }
104 104
 
105 105
     /**
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public static function buildVariable(string $varName, $varValue) : string
127 127
     {
128
-        return $varName . "=" . self::phpVariable2JS($varValue) . ';';
128
+        return $varName."=".self::phpVariable2JS($varValue).';';
129 129
     }
130 130
 
131 131
     /**
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
      * @return string
139 139
      * @throws JSONConverterException
140 140
      */
141
-    public static function phpVariable2JS($variable, int $quoteStyle=self::QUOTE_STYLE_DOUBLE) : string
141
+    public static function phpVariable2JS($variable, int $quoteStyle = self::QUOTE_STYLE_DOUBLE) : string
142 142
     {
143 143
         // after much profiling, this variant of the method offers
144 144
         // the best performance. Repeat scalar values are cached 
@@ -146,22 +146,22 @@  discard block
 block discarded – undo
146 146
         
147 147
         $type = gettype($variable);
148 148
         $hash = null;
149
-        if(is_scalar($variable) === true) 
149
+        if (is_scalar($variable) === true) 
150 150
         {
151 151
             $hash = $variable;
152 152
         
153
-            if($hash === true) 
153
+            if ($hash === true) 
154 154
             { 
155 155
                 $hash = 'true'; 
156 156
             } 
157
-            else if($hash === false) 
157
+            else if ($hash === false) 
158 158
             { 
159 159
                 $hash = 'false'; 
160 160
             }
161 161
             
162 162
             $hash .= '-'.$quoteStyle.'-'.$type;
163 163
             
164
-            if(isset(self::$variableCache[$hash])) {
164
+            if (isset(self::$variableCache[$hash])) {
165 165
                 return self::$variableCache[$hash];
166 166
             }
167 167
         }
@@ -169,13 +169,13 @@  discard block
 block discarded – undo
169 169
         $result = 'null';
170 170
 
171 171
         // one gettype call is better than a strict if-else.
172
-        switch($type) 
172
+        switch ($type) 
173 173
         {
174 174
             case 'double':
175 175
             case 'string':
176 176
                 $string = JSONConverter::var2json($variable);
177 177
                 
178
-                if($quoteStyle === self::QUOTE_STYLE_SINGLE)
178
+                if ($quoteStyle === self::QUOTE_STYLE_SINGLE)
179 179
                 {
180 180
                     $string = mb_substr($string, 1, -1);
181 181
                     $string = "'".str_replace("'", "\'", $string)."'";
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
                 break;
186 186
                 
187 187
             case 'boolean':
188
-                if($variable === true) {
188
+                if ($variable === true) {
189 189
                     $result = 'true';
190 190
                 } else {
191 191
                     $result = 'false';
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
         }
204 204
 
205 205
         // cache cacheable values
206
-        if($hash !== null) 
206
+        if ($hash !== null) 
207 207
         {
208 208
             self::$variableCache[$hash] = $result;
209 209
         }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
     {
237 237
         self::$elementCounter++;
238 238
 
239
-        return self::$idPrefix . self::$elementCounter;
239
+        return self::$idPrefix.self::$elementCounter;
240 240
     }
241 241
     
242 242
    /**
@@ -309,11 +309,11 @@  discard block
 block discarded – undo
309 309
      * @see JSHelper::JS_REGEX_OBJECT
310 310
      * @see JSHelper::JS_REGEX_JSON
311 311
      */
312
-    public static function buildRegexStatement(string $regex, string $statementType=self::JS_REGEX_OBJECT) : string
312
+    public static function buildRegexStatement(string $regex, string $statementType = self::JS_REGEX_OBJECT) : string
313 313
     {
314 314
         $regex = trim($regex);
315 315
 
316
-        if(empty($regex))
316
+        if (empty($regex))
317 317
         {
318 318
             throw new JSHelperException(
319 319
                 'Empty regex.',
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
         array_shift($parts);
328 328
         
329 329
         $modifiers = array_pop($parts);
330
-        if($modifiers === $separator) {
330
+        if ($modifiers === $separator) {
331 331
             $modifiers = '';
332 332
         }
333 333
         
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
         // convert the anchors that are not supported in js regexes
348 348
         $format = str_replace(array('\\A', '\\Z', '\\z'), array('^', '$', ''), $format);
349 349
         
350
-        if($statementType === self::JS_REGEX_JSON)
350
+        if ($statementType === self::JS_REGEX_JSON)
351 351
         {
352 352
             return ConvertHelper::var2json(array(
353 353
                 'format' => $format,
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
             ));
356 356
         }
357 357
         
358
-        if(!empty($modifiers)) {
358
+        if (!empty($modifiers)) {
359 359
             return sprintf(
360 360
                 'new RegExp(%s, %s)',
361 361
                 ConvertHelper::var2json($format),
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -153,8 +153,7 @@
 block discarded – undo
153 153
             if($hash === true) 
154 154
             { 
155 155
                 $hash = 'true'; 
156
-            } 
157
-            else if($hash === false) 
156
+            } else if($hash === false) 
158 157
             { 
159 158
                 $hash = 'false'; 
160 159
             }
Please login to merge, or discard this patch.
src/ZIPHelper.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
         'WriteThreshold' => 100
41 41
     );
42 42
     
43
-   /**
44
-    * @var string
45
-    */
43
+    /**
44
+     * @var string
45
+     */
46 46
     protected $file;
47 47
     
48
-   /**
49
-    * @var ZipArchive|NULL
50
-    */
48
+    /**
49
+     * @var ZipArchive|NULL
50
+     */
51 51
     protected $zip;
52 52
 
53 53
     protected bool $open = false;
@@ -57,35 +57,35 @@  discard block
 block discarded – undo
57 57
         $this->file = $targetFile;
58 58
     }
59 59
     
60
-   /**
61
-    * Sets an option, among the available options:
62
-    * 
63
-    * <ul>
64
-    * <li>WriteThreshold: The amount of files to add before the zip is automatically written to disk and re-opened to release the file handles. Set to 0 to disable.</li>
65
-    * </ul>
66
-    * 
67
-    * @param string $name
68
-    * @param mixed $value
69
-    * @return ZIPHelper
70
-    */
60
+    /**
61
+     * Sets an option, among the available options:
62
+     * 
63
+     * <ul>
64
+     * <li>WriteThreshold: The amount of files to add before the zip is automatically written to disk and re-opened to release the file handles. Set to 0 to disable.</li>
65
+     * </ul>
66
+     * 
67
+     * @param string $name
68
+     * @param mixed $value
69
+     * @return ZIPHelper
70
+     */
71 71
     public function setOption(string $name, $value) : ZIPHelper
72 72
     {
73 73
         $this->options[$name] = $value;
74 74
         return $this;
75 75
     }
76 76
     
77
-   /**
78
-    * Adds a file to the zip. By default, the file is stored
79
-    * with the same name in the root of the zip. Use the optional
80
-    * parameter to change the location in the zip.
81
-    * 
82
-    * @param string $filePath
83
-    * @param string|null $zipPath If no path is specified, file will be added with the same name in the ZIP's root.
84
-    * @throws ZIPHelper_Exception
85
-    * @return bool
86
-    * 
87
-    * @see FileHelper::ERROR_SOURCE_FILE_DOES_NOT_EXIST
88
-    */
77
+    /**
78
+     * Adds a file to the zip. By default, the file is stored
79
+     * with the same name in the root of the zip. Use the optional
80
+     * parameter to change the location in the zip.
81
+     * 
82
+     * @param string $filePath
83
+     * @param string|null $zipPath If no path is specified, file will be added with the same name in the ZIP's root.
84
+     * @throws ZIPHelper_Exception
85
+     * @return bool
86
+     * 
87
+     * @see FileHelper::ERROR_SOURCE_FILE_DOES_NOT_EXIST
88
+     */
89 89
     public function addFile(string $filePath, ?string $zipPath=null) : bool
90 90
     {
91 91
         $this->open();
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     public const ERROR_SOURCE_FILE_DOES_NOT_EXIST = 338001;
32 32
     public const ERROR_NO_FILES_IN_ARCHIVE = 338002;
33 33
     public const ERROR_OPENING_ZIP_FILE = 338003;
34
-    public const ERROR_CANNOT_SAVE_FILE_TO_DISK =338004;
34
+    public const ERROR_CANNOT_SAVE_FILE_TO_DISK = 338004;
35 35
 
36 36
     /**
37 37
      * @var array<string,mixed>
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     * 
87 87
     * @see FileHelper::ERROR_SOURCE_FILE_DOES_NOT_EXIST
88 88
     */
89
-    public function addFile(string $filePath, ?string $zipPath=null) : bool
89
+    public function addFile(string $filePath, ?string $zipPath = null) : bool
90 90
     {
91 91
         $this->open();
92 92
         
@@ -134,16 +134,16 @@  discard block
 block discarded – undo
134 134
      */
135 135
     protected function open() : void
136 136
     {
137
-        if($this->open) {
137
+        if ($this->open) {
138 138
             return;
139 139
         }
140 140
         
141
-        if(!isset($this->zip)) {
141
+        if (!isset($this->zip)) {
142 142
             $this->zip = new ZipArchive();
143 143
         }
144 144
         
145 145
         $flag = null;
146
-        if(!file_exists($this->file)) {
146
+        if (!file_exists($this->file)) {
147 147
             $flag = ZipArchive::CREATE;
148 148
         }
149 149
         
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     {
187 187
         $this->fileTracker++;
188 188
 
189
-        if($this->options['WriteThreshold'] < 1) {
189
+        if ($this->options['WriteThreshold'] < 1) {
190 190
             return;
191 191
         }
192 192
         
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      */
204 204
     protected function close() : void
205 205
     {
206
-        if(!$this->open) {
206
+        if (!$this->open) {
207 207
             return;
208 208
         }
209 209
         
@@ -212,8 +212,8 @@  discard block
 block discarded – undo
212 212
             throw new ZIPHelper_Exception(
213 213
                 'Could not save ZIP file to disk',
214 214
                 sprintf(
215
-                    'Tried saving the ZIP file [%1$s], but the write failed. This can have several causes, ' .
216
-                    'including adding files that do not exist on disk, trying to create an empty zip, ' .
215
+                    'Tried saving the ZIP file [%1$s], but the write failed. This can have several causes, '.
216
+                    'including adding files that do not exist on disk, trying to create an empty zip, '.
217 217
                     'or trying to save to a directory that does not exist.',
218 218
                     $this->file
219 219
                 ),
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
     {
233 233
         $this->open();
234 234
         
235
-        if($this->countFiles() < 1) 
235
+        if ($this->countFiles() < 1) 
236 236
         {
237 237
             throw new ZIPHelper_Exception(
238 238
                 'No files in the zip file',
@@ -258,18 +258,18 @@  discard block
 block discarded – undo
258 258
      * @throws ZIPHelper_Exception
259 259
      * @return string The file name that was sent (useful in case none was specified).
260 260
      */
261
-    public function download(?string $fileName=null) : string
261
+    public function download(?string $fileName = null) : string
262 262
     {
263 263
         $this->save();
264 264
         
265
-        if(empty($fileName))
265
+        if (empty($fileName))
266 266
         {
267 267
             $fileName = basename($this->file);
268 268
         }
269 269
         
270 270
         header('Content-type: application/zip');
271
-        header('Content-Disposition: attachment; filename=' . $fileName);
272
-        header('Content-length: ' . filesize($this->file));
271
+        header('Content-Disposition: attachment; filename='.$fileName);
272
+        header('Content-length: '.filesize($this->file));
273 273
         header('Pragma: no-cache');
274 274
         header('Expires: 0');
275 275
         readfile($this->file);
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
      * @throws ZIPHelper_Exception
288 288
      * @see ZIPHelper::download()
289 289
      */
290
-    public function downloadAndDelete(?string $fileName=null) : ZIPHelper
290
+    public function downloadAndDelete(?string $fileName = null) : ZIPHelper
291 291
     {
292 292
         $this->download($fileName);
293 293
         
@@ -305,9 +305,9 @@  discard block
 block discarded – undo
305 305
      * @return boolean
306 306
      * @throws ZIPHelper_Exception
307 307
      */
308
-    public function extractAll(?string $outputFolder=null) : bool
308
+    public function extractAll(?string $outputFolder = null) : bool
309 309
     {
310
-        if(empty($outputFolder)) {
310
+        if (empty($outputFolder)) {
311 311
             $outputFolder = dirname($this->file);
312 312
         }
313 313
         
Please login to merge, or discard this patch.