Passed
Push — master ( 1dce7e...428f46 )
by Sebastian
03:05
created
src/ConvertHelper.php 1 patch
Indentation   +320 added lines, -320 removed lines patch added patch discarded remove patch
@@ -435,16 +435,16 @@  discard block
 block discarded – undo
435 435
         return $bytes . ' ' . t('B');
436 436
     }
437 437
 
438
-   /**
439
-    * Cuts a text to the specified length if it is longer than the
440
-    * target length. Appends a text to signify it has been cut at 
441
-    * the end of the string.
442
-    * 
443
-    * @param string $text
444
-    * @param int $targetLength
445
-    * @param string $append
446
-    * @return string
447
-    */
438
+    /**
439
+     * Cuts a text to the specified length if it is longer than the
440
+     * target length. Appends a text to signify it has been cut at 
441
+     * the end of the string.
442
+     * 
443
+     * @param string $text
444
+     * @param int $targetLength
445
+     * @param string $append
446
+     * @return string
447
+     */
448 448
     public static function text_cut(string $text, int $targetLength, string $append = '...') : string
449 449
     {
450 450
         $length = mb_strlen($text);
@@ -514,27 +514,27 @@  discard block
 block discarded – undo
514 514
         return self::$booleanStrings[$string];
515 515
     }
516 516
     
517
-   /**
518
-    * Whether the specified string is a boolean string or boolean value.
519
-    * Alias for {@link ConvertHelper::isBoolean()}.
520
-    * 
521
-    * @param mixed $string
522
-    * @return bool
523
-    * @deprecated
524
-    * @see ConvertHelper::isBoolean()
525
-    */
517
+    /**
518
+     * Whether the specified string is a boolean string or boolean value.
519
+     * Alias for {@link ConvertHelper::isBoolean()}.
520
+     * 
521
+     * @param mixed $string
522
+     * @return bool
523
+     * @deprecated
524
+     * @see ConvertHelper::isBoolean()
525
+     */
526 526
     public static function isBooleanString($string) : bool
527 527
     {
528 528
         return self::isBoolean($string);
529 529
     }
530 530
 
531
-   /**
532
-    * Alias for the {@\AppUtils\XMLHelper::string2xml()} method.
533
-    * 
534
-    * @param string $text
535
-    * @return string
536
-    * @deprecated
537
-    */
531
+    /**
532
+     * Alias for the {@\AppUtils\XMLHelper::string2xml()} method.
533
+     * 
534
+     * @param string $text
535
+     * @return string
536
+     * @deprecated
537
+     */
538 538
     public static function text_makeXMLCompliant($text)
539 539
     {
540 540
         return XMLHelper::string2xml($text);
@@ -636,13 +636,13 @@  discard block
 block discarded – undo
636 636
         return $translit->convert($string);
637 637
     }
638 638
     
639
-   /**
640
-    * Retrieves the HEX character codes for all control
641
-    * characters that the {@link stripControlCharacters()} 
642
-    * method will remove.
643
-    * 
644
-    * @return string[]
645
-    */
639
+    /**
640
+     * Retrieves the HEX character codes for all control
641
+     * characters that the {@link stripControlCharacters()} 
642
+     * method will remove.
643
+     * 
644
+     * @return string[]
645
+     */
646 646
     public static function getControlCharactersAsHex()
647 647
     {
648 648
         $hexAlphabet = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
@@ -678,13 +678,13 @@  discard block
 block discarded – undo
678 678
         return $stack;
679 679
     }
680 680
     
681
-   /**
682
-    * Retrieves an array of all control characters that
683
-    * the {@link stripControlCharacters()} method will 
684
-    * remove, as the actual UTF-8 characters.
685
-    * 
686
-    * @return string[]
687
-    */
681
+    /**
682
+     * Retrieves an array of all control characters that
683
+     * the {@link stripControlCharacters()} method will 
684
+     * remove, as the actual UTF-8 characters.
685
+     * 
686
+     * @return string[]
687
+     */
688 688
     public static function getControlCharactersAsUTF8()
689 689
     {
690 690
         $chars = self::getControlCharactersAsHex();
@@ -697,12 +697,12 @@  discard block
 block discarded – undo
697 697
         return $result;
698 698
     }
699 699
     
700
-   /**
701
-    * Retrieves all control characters as JSON encoded
702
-    * characters, e.g. "\u200b".
703
-    * 
704
-    * @return string[]
705
-    */
700
+    /**
701
+     * Retrieves all control characters as JSON encoded
702
+     * characters, e.g. "\u200b".
703
+     * 
704
+     * @return string[]
705
+     */
706 706
     public static function getControlCharactersAsJSON()
707 707
     {
708 708
         $chars = self::getControlCharactersAsHex();
@@ -759,20 +759,20 @@  discard block
 block discarded – undo
759 759
         return preg_replace(self::$controlCharsRegex, '', $string);
760 760
     }
761 761
 
762
-   /**
763
-    * Converts a unicode character to the PHPO notation.
764
-    * 
765
-    * Example:
766
-    * 
767
-    * <pre>unicodeChar2php('"\u0000"')</pre>
768
-    * 
769
-    * Returns
770
-    * 
771
-    * <pre>\x0</pre>
772
-    * 
773
-    * @param string $unicodeChar
774
-    * @return string
775
-    */
762
+    /**
763
+     * Converts a unicode character to the PHPO notation.
764
+     * 
765
+     * Example:
766
+     * 
767
+     * <pre>unicodeChar2php('"\u0000"')</pre>
768
+     * 
769
+     * Returns
770
+     * 
771
+     * <pre>\x0</pre>
772
+     * 
773
+     * @param string $unicodeChar
774
+     * @return string
775
+     */
776 776
     public static function unicodeChar2php($unicodeChar) 
777 777
     {
778 778
         $unicodeChar = json_decode($unicodeChar);
@@ -895,25 +895,25 @@  discard block
 block discarded – undo
895 895
         return 'false';
896 896
     }
897 897
     
898
-   /**
899
-    * Converts an associative array with attribute name > value pairs
900
-    * to an attribute string that can be used in an HTML tag. Empty 
901
-    * attribute values are ignored.
902
-    * 
903
-    * Example:
904
-    * 
905
-    * array2attributeString(array(
906
-    *     'id' => 45,
907
-    *     'href' => 'http://www.mistralys.com'
908
-    * ));
909
-    * 
910
-    * Result:
911
-    * 
912
-    * id="45" href="http://www.mistralys.com"
913
-    * 
914
-    * @param array $array
915
-    * @return string
916
-    */
898
+    /**
899
+     * Converts an associative array with attribute name > value pairs
900
+     * to an attribute string that can be used in an HTML tag. Empty 
901
+     * attribute values are ignored.
902
+     * 
903
+     * Example:
904
+     * 
905
+     * array2attributeString(array(
906
+     *     'id' => 45,
907
+     *     'href' => 'http://www.mistralys.com'
908
+     * ));
909
+     * 
910
+     * Result:
911
+     * 
912
+     * id="45" href="http://www.mistralys.com"
913
+     * 
914
+     * @param array $array
915
+     * @return string
916
+     */
917 917
     public static function array2attributeString($array)
918 918
     {
919 919
         $tokens = array();
@@ -932,14 +932,14 @@  discard block
 block discarded – undo
932 932
         return ' '.implode(' ', $tokens);
933 933
     }
934 934
     
935
-   /**
936
-    * Converts a string so it can safely be used in a javascript
937
-    * statement in an HTML tag: uses single quotes around the string
938
-    * and encodes all special characters as needed.
939
-    * 
940
-    * @param string $string
941
-    * @return string
942
-    */
935
+    /**
936
+     * Converts a string so it can safely be used in a javascript
937
+     * statement in an HTML tag: uses single quotes around the string
938
+     * and encodes all special characters as needed.
939
+     * 
940
+     * @param string $string
941
+     * @return string
942
+     */
943 943
     public static function string2attributeJS($string, $quoted=true)
944 944
     {
945 945
         $converted = addslashes(htmlspecialchars(strip_tags($string), ENT_QUOTES, 'UTF-8'));
@@ -950,15 +950,15 @@  discard block
 block discarded – undo
950 950
         return $converted;
951 951
     }
952 952
     
953
-   /**
954
-    * Checks if the specified string is a boolean value, which
955
-    * includes string representations of boolean values, like 
956
-    * <code>yes</code> or <code>no</code>, and <code>true</code>
957
-    * or <code>false</code>.
958
-    * 
959
-    * @param mixed $value
960
-    * @return boolean
961
-    */
953
+    /**
954
+     * Checks if the specified string is a boolean value, which
955
+     * includes string representations of boolean values, like 
956
+     * <code>yes</code> or <code>no</code>, and <code>true</code>
957
+     * or <code>false</code>.
958
+     * 
959
+     * @param mixed $value
960
+     * @return boolean
961
+     */
962 962
     public static function isBoolean($value) : bool
963 963
     {
964 964
         if(is_bool($value)) {
@@ -972,12 +972,12 @@  discard block
 block discarded – undo
972 972
         return array_key_exists($value, self::$booleanStrings);
973 973
     }
974 974
     
975
-   /**
976
-    * Converts an associative array to an HTML style attribute value string.
977
-    * 
978
-    * @param array $subject
979
-    * @return string
980
-    */
975
+    /**
976
+     * Converts an associative array to an HTML style attribute value string.
977
+     * 
978
+     * @param array $subject
979
+     * @return string
980
+     */
981 981
     public static function array2styleString(array $subject) : string
982 982
     {
983 983
         $tokens = array();
@@ -988,23 +988,23 @@  discard block
 block discarded – undo
988 988
         return implode(';', $tokens);
989 989
     }
990 990
     
991
-   /**
992
-    * Converts a DateTime object to a timestamp, which
993
-    * is PHP 5.2 compatible.
994
-    * 
995
-    * @param \DateTime $date
996
-    * @return integer
997
-    */
991
+    /**
992
+     * Converts a DateTime object to a timestamp, which
993
+     * is PHP 5.2 compatible.
994
+     * 
995
+     * @param \DateTime $date
996
+     * @return integer
997
+     */
998 998
     public static function date2timestamp(\DateTime $date) : int
999 999
     {
1000 1000
         return (int)$date->format('U');
1001 1001
     }
1002 1002
     
1003
-   /**
1004
-    * Converts a timestamp into a DateTime instance.
1005
-    * @param int $timestamp
1006
-    * @return \DateTime
1007
-    */
1003
+    /**
1004
+     * Converts a timestamp into a DateTime instance.
1005
+     * @param int $timestamp
1006
+     * @return \DateTime
1007
+     */
1008 1008
     public static function timestamp2date(int $timestamp) : \DateTime
1009 1009
     {
1010 1010
         $date = new \DateTime();
@@ -1012,13 +1012,13 @@  discard block
 block discarded – undo
1012 1012
         return $date;
1013 1013
     }
1014 1014
     
1015
-   /**
1016
-    * Strips an absolute path to a file within the application
1017
-    * to make the path relative to the application root path.
1018
-    * 
1019
-    * @param string $path
1020
-    * @return string
1021
-    */
1015
+    /**
1016
+     * Strips an absolute path to a file within the application
1017
+     * to make the path relative to the application root path.
1018
+     * 
1019
+     * @param string $path
1020
+     * @return string
1021
+     */
1022 1022
     public static function fileRelativize($path)
1023 1023
     {
1024 1024
         $path = str_replace('\\', '/', $path);
@@ -1030,22 +1030,22 @@  discard block
 block discarded – undo
1030 1030
     
1031 1031
     const JS_REGEX_JSON = 'json';
1032 1032
     
1033
-   /**
1034
-    * Takes a regular expression and attempts to convert it to
1035
-    * its javascript equivalent. Returns an array containing the
1036
-    * format string itself (without start and end characters),
1037
-    * and the modifiers.
1038
-    *  
1039
-    * This is intended to be used with the RegExp object, for ex:
1040
-    * 
1041
-    * <script>
1042
-    * var expression = <?php echo json_encode(ConvertHelper::regex2js('/ab+c/i')) ?>;
1043
-    * var reg = new RegExp(expression.format, expression.modifiers);
1044
-    * </script>
1045
-    *  
1046
-    * @param string $regex
1047
-    * @return array
1048
-    */
1033
+    /**
1034
+     * Takes a regular expression and attempts to convert it to
1035
+     * its javascript equivalent. Returns an array containing the
1036
+     * format string itself (without start and end characters),
1037
+     * and the modifiers.
1038
+     *  
1039
+     * This is intended to be used with the RegExp object, for ex:
1040
+     * 
1041
+     * <script>
1042
+     * var expression = <?php echo json_encode(ConvertHelper::regex2js('/ab+c/i')) ?>;
1043
+     * var reg = new RegExp(expression.format, expression.modifiers);
1044
+     * </script>
1045
+     *  
1046
+     * @param string $regex
1047
+     * @return array
1048
+     */
1049 1049
     public static function regex2js($regex, $return=self::JS_REGEX_OBJECT)
1050 1050
     {
1051 1051
         $regex = trim($regex);
@@ -1091,12 +1091,12 @@  discard block
 block discarded – undo
1091 1091
         );
1092 1092
     }
1093 1093
     
1094
-   /**
1095
-    * Strips all known UTF byte order marks from the specified string.
1096
-    * 
1097
-    * @param string $string
1098
-    * @return string
1099
-    */
1094
+    /**
1095
+     * Strips all known UTF byte order marks from the specified string.
1096
+     * 
1097
+     * @param string $string
1098
+     * @return string
1099
+     */
1100 1100
     public static function stripUTFBom($string)
1101 1101
     {
1102 1102
         $boms = FileHelper::getUTFBOMs();
@@ -1111,13 +1111,13 @@  discard block
 block discarded – undo
1111 1111
         return $string;
1112 1112
     }
1113 1113
 
1114
-   /**
1115
-    * Converts a string to valid utf8, regardless
1116
-    * of the string's encoding(s).
1117
-    * 
1118
-    * @param string $string
1119
-    * @return string
1120
-    */
1114
+    /**
1115
+     * Converts a string to valid utf8, regardless
1116
+     * of the string's encoding(s).
1117
+     * 
1118
+     * @param string $string
1119
+     * @return string
1120
+     */
1121 1121
     public static function string2utf8($string)
1122 1122
     {
1123 1123
         if(!self::isStringASCII($string)) {
@@ -1127,15 +1127,15 @@  discard block
 block discarded – undo
1127 1127
         return $string;
1128 1128
     }
1129 1129
     
1130
-   /**
1131
-    * Checks whether the specified string is an ASCII
1132
-    * string, without any special or UTF8 characters.
1133
-    * Note: empty strings and NULL are considered ASCII.
1134
-    * Any variable types other than strings are not.
1135
-    * 
1136
-    * @param string $string
1137
-    * @return boolean
1138
-    */
1130
+    /**
1131
+     * Checks whether the specified string is an ASCII
1132
+     * string, without any special or UTF8 characters.
1133
+     * Note: empty strings and NULL are considered ASCII.
1134
+     * Any variable types other than strings are not.
1135
+     * 
1136
+     * @param string $string
1137
+     * @return boolean
1138
+     */
1139 1139
     public static function isStringASCII($string)
1140 1140
     {
1141 1141
         if($string === '' || $string === NULL) {
@@ -1160,22 +1160,22 @@  discard block
 block discarded – undo
1160 1160
         return $url;
1161 1161
     }
1162 1162
 
1163
-   /**
1164
-    * Calculates a percentage match of the source string with the target string.
1165
-    * 
1166
-    * Options are:
1167
-    * 
1168
-    * - maxLevenshtein, default: 10
1169
-    *   Any levenshtein results above this value are ignored.
1170
-    *   
1171
-    * - precision, default: 1
1172
-    *   The precision of the percentage float value
1173
-    * 
1174
-    * @param string $source
1175
-    * @param string $target
1176
-    * @param array $options
1177
-    * @return float
1178
-    */
1163
+    /**
1164
+     * Calculates a percentage match of the source string with the target string.
1165
+     * 
1166
+     * Options are:
1167
+     * 
1168
+     * - maxLevenshtein, default: 10
1169
+     *   Any levenshtein results above this value are ignored.
1170
+     *   
1171
+     * - precision, default: 1
1172
+     *   The precision of the percentage float value
1173
+     * 
1174
+     * @param string $source
1175
+     * @param string $target
1176
+     * @param array $options
1177
+     * @return float
1178
+     */
1179 1179
     public static function matchString($source, $target, $options=array())
1180 1180
     {
1181 1181
         $defaults = array(
@@ -1259,14 +1259,14 @@  discard block
 block discarded – undo
1259 1259
     
1260 1260
     const INTERVAL_SECONDS = 'seconds';
1261 1261
     
1262
-   /**
1263
-    * Calculates the total amount of days / hours / minutes or seconds
1264
-    * of a date interval object and returns the value.
1265
-    * 
1266
-    * @param \DateInterval $interval
1267
-    * @param string $unit
1268
-    * @return integer
1269
-    */
1262
+    /**
1263
+     * Calculates the total amount of days / hours / minutes or seconds
1264
+     * of a date interval object and returns the value.
1265
+     * 
1266
+     * @param \DateInterval $interval
1267
+     * @param string $unit
1268
+     * @return integer
1269
+     */
1270 1270
     public static function interval2total(\DateInterval $interval, $unit=self::INTERVAL_SECONDS)
1271 1271
     {
1272 1272
         $total = $interval->format('%a');
@@ -1304,13 +1304,13 @@  discard block
 block discarded – undo
1304 1304
         'Sunday'
1305 1305
     );
1306 1306
     
1307
-   /**
1308
-    * Converts a date to the corresponding day name.
1309
-    * 
1310
-    * @param \DateTime $date
1311
-    * @param string $short
1312
-    * @return string|NULL
1313
-    */
1307
+    /**
1308
+     * Converts a date to the corresponding day name.
1309
+     * 
1310
+     * @param \DateTime $date
1311
+     * @param string $short
1312
+     * @return string|NULL
1313
+     */
1314 1314
     public static function date2dayName(\DateTime $date, $short=false)
1315 1315
     {
1316 1316
         $day = $date->format('l');
@@ -1325,21 +1325,21 @@  discard block
 block discarded – undo
1325 1325
         return null;
1326 1326
     }
1327 1327
     
1328
-   /**
1329
-    * Retrieves a list of english day names.
1330
-    * @return string[]
1331
-    */
1328
+    /**
1329
+     * Retrieves a list of english day names.
1330
+     * @return string[]
1331
+     */
1332 1332
     public static function getDayNamesInvariant()
1333 1333
     {
1334 1334
         return self::$daysInvariant;
1335 1335
     }
1336 1336
     
1337
-   /**
1338
-    * Retrieves the day names list for the current locale.
1339
-    * 
1340
-    * @param string $short
1341
-    * @return string[]
1342
-    */
1337
+    /**
1338
+     * Retrieves the day names list for the current locale.
1339
+     * 
1340
+     * @param string $short
1341
+     * @return string[]
1342
+     */
1343 1343
     public static function getDayNames($short=false)
1344 1344
     {
1345 1345
         if($short) {
@@ -1399,14 +1399,14 @@  discard block
 block discarded – undo
1399 1399
         return $last;
1400 1400
     }
1401 1401
     
1402
-   /**
1403
-    * Splits a string into an array of all characters it is composed of.
1404
-    * Spaces and newlines (both \r and \n) are also considered single
1405
-    * characters. Unicode character safe.
1406
-    * 
1407
-    * @param string $string
1408
-    * @return string[]
1409
-    */
1402
+    /**
1403
+     * Splits a string into an array of all characters it is composed of.
1404
+     * Spaces and newlines (both \r and \n) are also considered single
1405
+     * characters. Unicode character safe.
1406
+     * 
1407
+     * @param string $string
1408
+     * @return string[]
1409
+     */
1410 1410
     public static function string2array(string $string) : array
1411 1411
     {
1412 1412
         $result = preg_split('//u', $string, null, PREG_SPLIT_NO_EMPTY);
@@ -1417,12 +1417,12 @@  discard block
 block discarded – undo
1417 1417
         return array();
1418 1418
     }
1419 1419
     
1420
-   /**
1421
-    * Checks whether the specified string contains HTML code.
1422
-    * 
1423
-    * @param string $string
1424
-    * @return boolean
1425
-    */
1420
+    /**
1421
+     * Checks whether the specified string contains HTML code.
1422
+     * 
1423
+     * @param string $string
1424
+     * @return boolean
1425
+     */
1426 1426
     public static function isStringHTML(string $string) : bool
1427 1427
     {
1428 1428
         if(preg_match('%<[a-z/][\s\S]*>%siU', $string)) {
@@ -1437,18 +1437,18 @@  discard block
 block discarded – undo
1437 1437
         return false;
1438 1438
     }
1439 1439
     
1440
-   /**
1441
-    * UTF8-safe wordwrap method: works like the regular wordwrap
1442
-    * PHP function but compatible with UTF8. Otherwise the lengths
1443
-    * are no calculated correctly.
1444
-    * 
1445
-    * @param string $str
1446
-    * @param int $width
1447
-    * @param string $break
1448
-    * @param bool $cut
1449
-    * @return string
1450
-    * @see https://stackoverflow.com/a/4988494/2298192
1451
-    */
1440
+    /**
1441
+     * UTF8-safe wordwrap method: works like the regular wordwrap
1442
+     * PHP function but compatible with UTF8. Otherwise the lengths
1443
+     * are no calculated correctly.
1444
+     * 
1445
+     * @param string $str
1446
+     * @param int $width
1447
+     * @param string $break
1448
+     * @param bool $cut
1449
+     * @return string
1450
+     * @see https://stackoverflow.com/a/4988494/2298192
1451
+     */
1452 1452
     public static function wordwrap($str, $width = 75, $break = "\n", $cut = false) 
1453 1453
     {
1454 1454
         $lines = explode($break, $str);
@@ -1494,27 +1494,27 @@  discard block
 block discarded – undo
1494 1494
         return implode($break, $lines);
1495 1495
     }
1496 1496
     
1497
-   /**
1498
-    * Calculates the byte length of a string, taking into 
1499
-    * account any unicode characters.
1500
-    * 
1501
-    * @param string $string
1502
-    * @return int
1503
-    * @see https://stackoverflow.com/a/9718273/2298192
1504
-    */
1497
+    /**
1498
+     * Calculates the byte length of a string, taking into 
1499
+     * account any unicode characters.
1500
+     * 
1501
+     * @param string $string
1502
+     * @return int
1503
+     * @see https://stackoverflow.com/a/9718273/2298192
1504
+     */
1505 1505
     public static function string2bytes($string)
1506 1506
     {
1507 1507
         return mb_strlen($string, '8bit');
1508 1508
     }
1509 1509
     
1510
-   /**
1511
-    * Creates a short, 8-character long hash for the specified string.
1512
-    * 
1513
-    * WARNING: Not cryptographically safe.
1514
-    * 
1515
-    * @param string $string
1516
-    * @return string
1517
-    */
1510
+    /**
1511
+     * Creates a short, 8-character long hash for the specified string.
1512
+     * 
1513
+     * WARNING: Not cryptographically safe.
1514
+     * 
1515
+     * @param string $string
1516
+     * @return string
1517
+     */
1518 1518
     public static function string2shortHash($string)
1519 1519
     {
1520 1520
         return hash('crc32', $string, false);
@@ -1540,23 +1540,23 @@  discard block
 block discarded – undo
1540 1540
         return ConvertHelper_ThrowableInfo::fromThrowable($e);
1541 1541
     }
1542 1542
     
1543
-   /**
1544
-    * Parses the specified query string like the native 
1545
-    * function <code>parse_str</code>, without the key
1546
-    * naming limitations.
1547
-    * 
1548
-    * Using parse_str, dots or spaces in key names are 
1549
-    * replaced by underscores. This method keeps all names
1550
-    * intact.
1551
-    * 
1552
-    * It still uses the parse_str implementation as it 
1553
-    * is tested and tried, but fixes the parameter names
1554
-    * after parsing, as needed.
1555
-    * 
1556
-    * @param string $queryString
1557
-    * @return array
1558
-    * @see https://www.php.net/manual/en/function.parse-str.php
1559
-    */
1543
+    /**
1544
+     * Parses the specified query string like the native 
1545
+     * function <code>parse_str</code>, without the key
1546
+     * naming limitations.
1547
+     * 
1548
+     * Using parse_str, dots or spaces in key names are 
1549
+     * replaced by underscores. This method keeps all names
1550
+     * intact.
1551
+     * 
1552
+     * It still uses the parse_str implementation as it 
1553
+     * is tested and tried, but fixes the parameter names
1554
+     * after parsing, as needed.
1555
+     * 
1556
+     * @param string $queryString
1557
+     * @return array
1558
+     * @see https://www.php.net/manual/en/function.parse-str.php
1559
+     */
1560 1560
     public static function parseQueryString(string $queryString) : array
1561 1561
     {
1562 1562
         // allow HTML entities notation
@@ -1596,16 +1596,16 @@  discard block
 block discarded – undo
1596 1596
             $placeholders = array();
1597 1597
             foreach($paramNames as $paramName)
1598 1598
             {
1599
-                 // create a unique placeholder name
1600
-                 $placeholder = '__PLACEHOLDER'.$counter.'__';
1599
+                    // create a unique placeholder name
1600
+                    $placeholder = '__PLACEHOLDER'.$counter.'__';
1601 1601
                  
1602
-                 // store the placeholder name to replace later
1603
-                 $table[$placeholder] = $paramName;
1602
+                    // store the placeholder name to replace later
1603
+                    $table[$placeholder] = $paramName;
1604 1604
                  
1605
-                 // add the placeholder to replace in the query string before parsing
1606
-                 $placeholders[$paramName.'='] = $placeholder.'=';
1605
+                    // add the placeholder to replace in the query string before parsing
1606
+                    $placeholders[$paramName.'='] = $placeholder.'=';
1607 1607
                  
1608
-                 $counter++;
1608
+                    $counter++;
1609 1609
             }
1610 1610
             
1611 1611
             // next challenge: replacing the parameter names by placeholders
@@ -1632,23 +1632,23 @@  discard block
 block discarded – undo
1632 1632
         
1633 1633
         foreach($parsed as $name => $value)
1634 1634
         {
1635
-             $keep[$table[$name]] = $value;
1635
+                $keep[$table[$name]] = $value;
1636 1636
         }
1637 1637
         
1638 1638
         return $keep;
1639 1639
     }
1640 1640
 
1641
-   /**
1642
-    * Searches for needle in the specified string, and returns a list
1643
-    * of all occurrences, including the matched string. The matched 
1644
-    * string is useful when doing a case insensitive search, as it 
1645
-    * shows the exact matched case of needle.
1646
-    *   
1647
-    * @param string $needle
1648
-    * @param string $haystack
1649
-    * @param bool $caseInsensitive
1650
-    * @return ConvertHelper_StringMatch[]
1651
-    */
1641
+    /**
1642
+     * Searches for needle in the specified string, and returns a list
1643
+     * of all occurrences, including the matched string. The matched 
1644
+     * string is useful when doing a case insensitive search, as it 
1645
+     * shows the exact matched case of needle.
1646
+     *   
1647
+     * @param string $needle
1648
+     * @param string $haystack
1649
+     * @param bool $caseInsensitive
1650
+     * @return ConvertHelper_StringMatch[]
1651
+     */
1652 1652
     public static function findString(string $needle, string $haystack, bool $caseInsensitive=false)
1653 1653
     {
1654 1654
         if($needle === '') {
@@ -1674,14 +1674,14 @@  discard block
 block discarded – undo
1674 1674
         return $positions;
1675 1675
     }
1676 1676
     
1677
-   /**
1678
-    * Like explode, but trims all entries, and removes 
1679
-    * empty entries from the resulting array.
1680
-    * 
1681
-    * @param string $delimiter
1682
-    * @param string $string
1683
-    * @return string[]
1684
-    */
1677
+    /**
1678
+     * Like explode, but trims all entries, and removes 
1679
+     * empty entries from the resulting array.
1680
+     * 
1681
+     * @param string $delimiter
1682
+     * @param string $string
1683
+     * @return string[]
1684
+     */
1685 1685
     public static function explodeTrim(string $delimiter, string $string) : array
1686 1686
     {
1687 1687
         if(empty($string) || empty($delimiter)) {
@@ -1703,12 +1703,12 @@  discard block
 block discarded – undo
1703 1703
     
1704 1704
     protected static $eolChars;
1705 1705
 
1706
-   /**
1707
-    * Detects the most used end-of-line character in the subject string.
1708
-    * 
1709
-    * @param string $str The string to check.
1710
-    * @return NULL|ConvertHelper_EOL The detected EOL instance, or NULL if none has been detected.
1711
-    */
1706
+    /**
1707
+     * Detects the most used end-of-line character in the subject string.
1708
+     * 
1709
+     * @param string $str The string to check.
1710
+     * @return NULL|ConvertHelper_EOL The detected EOL instance, or NULL if none has been detected.
1711
+     */
1712 1712
     public static function detectEOLCharacter(string $subjectString) : ?ConvertHelper_EOL
1713 1713
     {
1714 1714
         if(empty($subjectString)) {
@@ -1720,27 +1720,27 @@  discard block
 block discarded – undo
1720 1720
             $cr = chr((int)hexdec('0d'));
1721 1721
             $lf = chr((int)hexdec('0a'));
1722 1722
             
1723
-           self::$eolChars = array(
1724
-               array(
1725
-                   'char' => $cr.$lf,
1726
-                   'type' => ConvertHelper_EOL::TYPE_CRLF,
1727
-                   'description' => t('Carriage return followed by a line feed'),
1728
-               ),
1729
-               array(
1730
-                   'char' => $lf.$cr,
1731
-                   'type' => ConvertHelper_EOL::TYPE_LFCR,
1732
-                   'description' => t('Line feed followed by a carriage return'),
1733
-               ),
1734
-               array(
1735
-                  'char' => $lf,
1736
-                  'type' => ConvertHelper_EOL::TYPE_LF,
1737
-                  'description' => t('Line feed'),
1738
-               ),
1739
-               array(
1740
-                  'char' => $cr,
1741
-                  'type' => ConvertHelper_EOL::TYPE_CR,
1742
-                  'description' => t('Carriage Return'),
1743
-               ),
1723
+            self::$eolChars = array(
1724
+                array(
1725
+                    'char' => $cr.$lf,
1726
+                    'type' => ConvertHelper_EOL::TYPE_CRLF,
1727
+                    'description' => t('Carriage return followed by a line feed'),
1728
+                ),
1729
+                array(
1730
+                    'char' => $lf.$cr,
1731
+                    'type' => ConvertHelper_EOL::TYPE_LFCR,
1732
+                    'description' => t('Line feed followed by a carriage return'),
1733
+                ),
1734
+                array(
1735
+                    'char' => $lf,
1736
+                    'type' => ConvertHelper_EOL::TYPE_LF,
1737
+                    'description' => t('Line feed'),
1738
+                ),
1739
+                array(
1740
+                    'char' => $cr,
1741
+                    'type' => ConvertHelper_EOL::TYPE_CR,
1742
+                    'description' => t('Carriage Return'),
1743
+                ),
1744 1744
             );
1745 1745
         }
1746 1746
         
@@ -1768,13 +1768,13 @@  discard block
 block discarded – undo
1768 1768
         );
1769 1769
     }
1770 1770
 
1771
-   /**
1772
-    * Removes the specified keys from the target array,
1773
-    * if they exist.
1774
-    * 
1775
-    * @param array $array
1776
-    * @param array $keys
1777
-    */
1771
+    /**
1772
+     * Removes the specified keys from the target array,
1773
+     * if they exist.
1774
+     * 
1775
+     * @param array $array
1776
+     * @param array $keys
1777
+     */
1778 1778
     public static function arrayRemoveKeys(array &$array, array $keys) : void
1779 1779
     {
1780 1780
         foreach($keys as $key) 
Please login to merge, or discard this patch.