@@ -3,17 +3,17 @@ discard block |
||
3 | 3 | return [ |
4 | 4 | 0x80 => "\xe2\x82\xac", // € |
5 | 5 | 0x82 => "\xe2\x80\x9a", // ‚ |
6 | - 0x83 => "\xc6\x92", // ƒ |
|
6 | + 0x83 => "\xc6\x92", // ƒ |
|
7 | 7 | 0x84 => "\xe2\x80\x9e", // „ |
8 | 8 | 0x85 => "\xe2\x80\xa6", // … |
9 | 9 | 0x86 => "\xe2\x80\xa0", // † |
10 | 10 | 0x87 => "\xe2\x80\xa1", // ‡ |
11 | - 0x88 => "\xcb\x86", // ˆ |
|
11 | + 0x88 => "\xcb\x86", // ˆ |
|
12 | 12 | 0x89 => "\xe2\x80\xb0", // ‰ |
13 | - 0x8a => "\xc5\xa0", // Š |
|
13 | + 0x8a => "\xc5\xa0", // Š |
|
14 | 14 | 0x8b => "\xe2\x80\xb9", // ‹ |
15 | - 0x8c => "\xc5\x92", // Œ |
|
16 | - 0x8e => "\xc5\xbd", // Ž |
|
15 | + 0x8c => "\xc5\x92", // Œ |
|
16 | + 0x8e => "\xc5\xbd", // Ž |
|
17 | 17 | 0x91 => "\xe2\x80\x98", // ‘ |
18 | 18 | 0x92 => "\xe2\x80\x99", // ’ |
19 | 19 | 0x93 => "\xe2\x80\x9c", // “ |
@@ -21,106 +21,106 @@ discard block |
||
21 | 21 | 0x95 => "\xe2\x80\xa2", // • |
22 | 22 | 0x96 => "\xe2\x80\x93", // – |
23 | 23 | 0x97 => "\xe2\x80\x94", // — |
24 | - 0x98 => "\xcb\x9c", // ˜ |
|
24 | + 0x98 => "\xcb\x9c", // ˜ |
|
25 | 25 | 0x99 => "\xe2\x84\xa2", // ™ |
26 | - 0x9a => "\xc5\xa1", // š |
|
26 | + 0x9a => "\xc5\xa1", // š |
|
27 | 27 | 0x9b => "\xe2\x80\xba", // › |
28 | - 0x9c => "\xc5\x93", // œ |
|
29 | - 0x9e => "\xc5\xbe", // ž |
|
30 | - 0x9f => "\xc5\xb8", // Ÿ |
|
28 | + 0x9c => "\xc5\x93", // œ |
|
29 | + 0x9e => "\xc5\xbe", // ž |
|
30 | + 0x9f => "\xc5\xb8", // Ÿ |
|
31 | 31 | 0xa0 => "\xc2\xa0", |
32 | - 0xa1 => "\xc2\xa1", // ¡ |
|
33 | - 0xa2 => "\xc2\xa2", // ¢ |
|
34 | - 0xa3 => "\xc2\xa3", // £ |
|
35 | - 0xa4 => "\xc2\xa4", // ¤ |
|
36 | - 0xa5 => "\xc2\xa5", // ¥ |
|
37 | - 0xa6 => "\xc2\xa6", // ¦ |
|
38 | - 0xa7 => "\xc2\xa7", // § |
|
39 | - 0xa8 => "\xc2\xa8", // ¨ |
|
40 | - 0xa9 => "\xc2\xa9", // © |
|
41 | - 0xaa => "\xc2\xaa", // ª |
|
42 | - 0xab => "\xc2\xab", // « |
|
43 | - 0xac => "\xc2\xac", // ¬ |
|
44 | - 0xad => "\xc2\xad", // |
|
45 | - 0xae => "\xc2\xae", // ® |
|
46 | - 0xaf => "\xc2\xaf", // ¯ |
|
47 | - 0xb0 => "\xc2\xb0", // ° |
|
48 | - 0xb1 => "\xc2\xb1", // ± |
|
49 | - 0xb2 => "\xc2\xb2", // ² |
|
50 | - 0xb3 => "\xc2\xb3", // ³ |
|
51 | - 0xb4 => "\xc2\xb4", // ´ |
|
52 | - 0xb5 => "\xc2\xb5", // µ |
|
53 | - 0xb6 => "\xc2\xb6", // ¶ |
|
54 | - 0xb7 => "\xc2\xb7", // · |
|
55 | - 0xb8 => "\xc2\xb8", // ¸ |
|
56 | - 0xb9 => "\xc2\xb9", // ¹ |
|
57 | - 0xba => "\xc2\xba", // º |
|
58 | - 0xbb => "\xc2\xbb", // » |
|
59 | - 0xbc => "\xc2\xbc", // ¼ |
|
60 | - 0xbd => "\xc2\xbd", // ½ |
|
61 | - 0xbe => "\xc2\xbe", // ¾ |
|
62 | - 0xbf => "\xc2\xbf", // ¿ |
|
63 | - 0xc0 => "\xc3\x80", // À |
|
64 | - 0xc1 => "\xc3\x81", // Á |
|
65 | - 0xc2 => "\xc3\x82", // Â |
|
66 | - 0xc3 => "\xc3\x83", // Ã |
|
67 | - 0xc4 => "\xc3\x84", // Ä |
|
68 | - 0xc5 => "\xc3\x85", // Å |
|
69 | - 0xc6 => "\xc3\x86", // Æ |
|
70 | - 0xc7 => "\xc3\x87", // Ç |
|
71 | - 0xc8 => "\xc3\x88", // È |
|
72 | - 0xc9 => "\xc3\x89", // É |
|
73 | - 0xca => "\xc3\x8a", // Ê |
|
74 | - 0xcb => "\xc3\x8b", // Ë |
|
75 | - 0xcc => "\xc3\x8c", // Ì |
|
76 | - 0xcd => "\xc3\x8d", // Í |
|
77 | - 0xce => "\xc3\x8e", // Î |
|
78 | - 0xcf => "\xc3\x8f", // Ï |
|
79 | - 0xd0 => "\xc3\x90", // Ð |
|
80 | - 0xd1 => "\xc3\x91", // Ñ |
|
81 | - 0xd2 => "\xc3\x92", // Ò |
|
82 | - 0xd3 => "\xc3\x93", // Ó |
|
83 | - 0xd4 => "\xc3\x94", // Ô |
|
84 | - 0xd5 => "\xc3\x95", // Õ |
|
85 | - 0xd6 => "\xc3\x96", // Ö |
|
86 | - 0xd7 => "\xc3\x97", // × |
|
87 | - 0xd8 => "\xc3\x98", // Ø |
|
88 | - 0xd9 => "\xc3\x99", // Ù |
|
89 | - 0xda => "\xc3\x9a", // Ú |
|
90 | - 0xdb => "\xc3\x9b", // Û |
|
91 | - 0xdc => "\xc3\x9c", // Ü |
|
92 | - 0xdd => "\xc3\x9d", // Ý |
|
93 | - 0xde => "\xc3\x9e", // Þ |
|
94 | - 0xdf => "\xc3\x9f", // ß |
|
95 | - 0xe0 => "\xc3\xa0", // à |
|
96 | - 0xe1 => "\xc3\xa1", // á |
|
97 | - 0xe2 => "\xc3\xa2", // â |
|
98 | - 0xe3 => "\xc3\xa3", // ã |
|
99 | - 0xe4 => "\xc3\xa4", // ä |
|
100 | - 0xe5 => "\xc3\xa5", // å |
|
101 | - 0xe6 => "\xc3\xa6", // æ |
|
102 | - 0xe7 => "\xc3\xa7", // ç |
|
103 | - 0xe8 => "\xc3\xa8", // è |
|
104 | - 0xe9 => "\xc3\xa9", // é |
|
105 | - 0xea => "\xc3\xaa", // ê |
|
106 | - 0xeb => "\xc3\xab", // ë |
|
107 | - 0xec => "\xc3\xac", // ì |
|
108 | - 0xed => "\xc3\xad", // í |
|
109 | - 0xee => "\xc3\xae", // î |
|
110 | - 0xef => "\xc3\xaf", // ï |
|
111 | - 0xf0 => "\xc3\xb0", // ð |
|
112 | - 0xf1 => "\xc3\xb1", // ñ |
|
113 | - 0xf2 => "\xc3\xb2", // ò |
|
114 | - 0xf3 => "\xc3\xb3", // ó |
|
115 | - 0xf4 => "\xc3\xb4", // ô |
|
116 | - 0xf5 => "\xc3\xb5", // õ |
|
117 | - 0xf6 => "\xc3\xb6", // ö |
|
118 | - 0xf7 => "\xc3\xb7", // ÷ |
|
119 | - 0xf8 => "\xc3\xb8", // ø |
|
120 | - 0xf9 => "\xc3\xb9", // ù |
|
121 | - 0xfa => "\xc3\xba", // ú |
|
122 | - 0xfb => "\xc3\xbb", // û |
|
123 | - 0xfc => "\xc3\xbc", // ü |
|
124 | - 0xfd => "\xc3\xbd", // ý |
|
125 | - 0xfe => "\xc3\xbe", // þ |
|
32 | + 0xa1 => "\xc2\xa1", // ¡ |
|
33 | + 0xa2 => "\xc2\xa2", // ¢ |
|
34 | + 0xa3 => "\xc2\xa3", // £ |
|
35 | + 0xa4 => "\xc2\xa4", // ¤ |
|
36 | + 0xa5 => "\xc2\xa5", // ¥ |
|
37 | + 0xa6 => "\xc2\xa6", // ¦ |
|
38 | + 0xa7 => "\xc2\xa7", // § |
|
39 | + 0xa8 => "\xc2\xa8", // ¨ |
|
40 | + 0xa9 => "\xc2\xa9", // © |
|
41 | + 0xaa => "\xc2\xaa", // ª |
|
42 | + 0xab => "\xc2\xab", // « |
|
43 | + 0xac => "\xc2\xac", // ¬ |
|
44 | + 0xad => "\xc2\xad", // |
|
45 | + 0xae => "\xc2\xae", // ® |
|
46 | + 0xaf => "\xc2\xaf", // ¯ |
|
47 | + 0xb0 => "\xc2\xb0", // ° |
|
48 | + 0xb1 => "\xc2\xb1", // ± |
|
49 | + 0xb2 => "\xc2\xb2", // ² |
|
50 | + 0xb3 => "\xc2\xb3", // ³ |
|
51 | + 0xb4 => "\xc2\xb4", // ´ |
|
52 | + 0xb5 => "\xc2\xb5", // µ |
|
53 | + 0xb6 => "\xc2\xb6", // ¶ |
|
54 | + 0xb7 => "\xc2\xb7", // · |
|
55 | + 0xb8 => "\xc2\xb8", // ¸ |
|
56 | + 0xb9 => "\xc2\xb9", // ¹ |
|
57 | + 0xba => "\xc2\xba", // º |
|
58 | + 0xbb => "\xc2\xbb", // » |
|
59 | + 0xbc => "\xc2\xbc", // ¼ |
|
60 | + 0xbd => "\xc2\xbd", // ½ |
|
61 | + 0xbe => "\xc2\xbe", // ¾ |
|
62 | + 0xbf => "\xc2\xbf", // ¿ |
|
63 | + 0xc0 => "\xc3\x80", // À |
|
64 | + 0xc1 => "\xc3\x81", // Á |
|
65 | + 0xc2 => "\xc3\x82", // Â |
|
66 | + 0xc3 => "\xc3\x83", // Ã |
|
67 | + 0xc4 => "\xc3\x84", // Ä |
|
68 | + 0xc5 => "\xc3\x85", // Å |
|
69 | + 0xc6 => "\xc3\x86", // Æ |
|
70 | + 0xc7 => "\xc3\x87", // Ç |
|
71 | + 0xc8 => "\xc3\x88", // È |
|
72 | + 0xc9 => "\xc3\x89", // É |
|
73 | + 0xca => "\xc3\x8a", // Ê |
|
74 | + 0xcb => "\xc3\x8b", // Ë |
|
75 | + 0xcc => "\xc3\x8c", // Ì |
|
76 | + 0xcd => "\xc3\x8d", // Í |
|
77 | + 0xce => "\xc3\x8e", // Î |
|
78 | + 0xcf => "\xc3\x8f", // Ï |
|
79 | + 0xd0 => "\xc3\x90", // Ð |
|
80 | + 0xd1 => "\xc3\x91", // Ñ |
|
81 | + 0xd2 => "\xc3\x92", // Ò |
|
82 | + 0xd3 => "\xc3\x93", // Ó |
|
83 | + 0xd4 => "\xc3\x94", // Ô |
|
84 | + 0xd5 => "\xc3\x95", // Õ |
|
85 | + 0xd6 => "\xc3\x96", // Ö |
|
86 | + 0xd7 => "\xc3\x97", // × |
|
87 | + 0xd8 => "\xc3\x98", // Ø |
|
88 | + 0xd9 => "\xc3\x99", // Ù |
|
89 | + 0xda => "\xc3\x9a", // Ú |
|
90 | + 0xdb => "\xc3\x9b", // Û |
|
91 | + 0xdc => "\xc3\x9c", // Ü |
|
92 | + 0xdd => "\xc3\x9d", // Ý |
|
93 | + 0xde => "\xc3\x9e", // Þ |
|
94 | + 0xdf => "\xc3\x9f", // ß |
|
95 | + 0xe0 => "\xc3\xa0", // à |
|
96 | + 0xe1 => "\xc3\xa1", // á |
|
97 | + 0xe2 => "\xc3\xa2", // â |
|
98 | + 0xe3 => "\xc3\xa3", // ã |
|
99 | + 0xe4 => "\xc3\xa4", // ä |
|
100 | + 0xe5 => "\xc3\xa5", // å |
|
101 | + 0xe6 => "\xc3\xa6", // æ |
|
102 | + 0xe7 => "\xc3\xa7", // ç |
|
103 | + 0xe8 => "\xc3\xa8", // è |
|
104 | + 0xe9 => "\xc3\xa9", // é |
|
105 | + 0xea => "\xc3\xaa", // ê |
|
106 | + 0xeb => "\xc3\xab", // ë |
|
107 | + 0xec => "\xc3\xac", // ì |
|
108 | + 0xed => "\xc3\xad", // í |
|
109 | + 0xee => "\xc3\xae", // î |
|
110 | + 0xef => "\xc3\xaf", // ï |
|
111 | + 0xf0 => "\xc3\xb0", // ð |
|
112 | + 0xf1 => "\xc3\xb1", // ñ |
|
113 | + 0xf2 => "\xc3\xb2", // ò |
|
114 | + 0xf3 => "\xc3\xb3", // ó |
|
115 | + 0xf4 => "\xc3\xb4", // ô |
|
116 | + 0xf5 => "\xc3\xb5", // õ |
|
117 | + 0xf6 => "\xc3\xb6", // ö |
|
118 | + 0xf7 => "\xc3\xb7", // ÷ |
|
119 | + 0xf8 => "\xc3\xb8", // ø |
|
120 | + 0xf9 => "\xc3\xb9", // ù |
|
121 | + 0xfa => "\xc3\xba", // ú |
|
122 | + 0xfb => "\xc3\xbb", // û |
|
123 | + 0xfc => "\xc3\xbc", // ü |
|
124 | + 0xfd => "\xc3\xbd", // ý |
|
125 | + 0xfe => "\xc3\xbe", // þ |
|
126 | 126 | ]; |
@@ -581,22 +581,22 @@ discard block |
||
581 | 581 | * @psalm-suppress PossiblyNullArrayAccess |
582 | 582 | */ |
583 | 583 | $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
584 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
584 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
585 | 585 | } elseif ($code_point <= 0xFFFF) { |
586 | 586 | /** |
587 | 587 | * @psalm-suppress PossiblyNullArrayAccess |
588 | 588 | */ |
589 | 589 | $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
590 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
591 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
590 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
591 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
592 | 592 | } else { |
593 | 593 | /** |
594 | 594 | * @psalm-suppress PossiblyNullArrayAccess |
595 | 595 | */ |
596 | 596 | $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
597 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
598 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
599 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
597 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
598 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
599 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
600 | 600 | } |
601 | 601 | |
602 | 602 | if ($encoding !== 'UTF-8') { |
@@ -5655,8 +5655,8 @@ discard block |
||
5655 | 5655 | |
5656 | 5656 | /** @noinspection UnnecessaryCastingInspection */ |
5657 | 5657 | return (string) \mb_substr($str, 0, $index) . |
5658 | - $substring . |
|
5659 | - (string) \mb_substr($str, $index, $len); |
|
5658 | + $substring . |
|
5659 | + (string) \mb_substr($str, $index, $len); |
|
5660 | 5660 | } |
5661 | 5661 | |
5662 | 5662 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -5667,8 +5667,8 @@ discard block |
||
5667 | 5667 | } |
5668 | 5668 | |
5669 | 5669 | return ((string) self::substr($str, 0, $index, $encoding)) . |
5670 | - $substring . |
|
5671 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5670 | + $substring . |
|
5671 | + ((string) self::substr($str, $index, $len, $encoding)); |
|
5672 | 5672 | } |
5673 | 5673 | |
5674 | 5674 | /** |
@@ -7679,11 +7679,11 @@ discard block |
||
7679 | 7679 | if ($use_mb_functions === true) { |
7680 | 7680 | if ($encoding === 'UTF-8') { |
7681 | 7681 | return \mb_strtoupper(\mb_substr($match[0], 0, 1)) |
7682 | - . \mb_strtolower(\mb_substr($match[0], 1)); |
|
7682 | + . \mb_strtolower(\mb_substr($match[0], 1)); |
|
7683 | 7683 | } |
7684 | 7684 | |
7685 | 7685 | return \mb_strtoupper(\mb_substr($match[0], 0, 1, $encoding), $encoding) |
7686 | - . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
7686 | + . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
7687 | 7687 | } |
7688 | 7688 | |
7689 | 7689 | return self::ucfirst( |
@@ -8054,13 +8054,13 @@ discard block |
||
8054 | 8054 | } |
8055 | 8055 | |
8056 | 8056 | return ( |
8057 | - (string) self::substr( |
|
8058 | - $str, |
|
8059 | - 0, |
|
8060 | - $length, |
|
8061 | - $encoding |
|
8062 | - ) |
|
8063 | - ) . $substring; |
|
8057 | + (string) self::substr( |
|
8058 | + $str, |
|
8059 | + 0, |
|
8060 | + $length, |
|
8061 | + $encoding |
|
8062 | + ) |
|
8063 | + ) . $substring; |
|
8064 | 8064 | } |
8065 | 8065 | |
8066 | 8066 | /** |
@@ -10868,8 +10868,8 @@ discard block |
||
10868 | 10868 | |
10869 | 10869 | /** @noinspection AdditionOperationOnArraysInspection */ |
10870 | 10870 | return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
10871 | - $replacement . |
|
10872 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10871 | + $replacement . |
|
10872 | + ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10873 | 10873 | } |
10874 | 10874 | |
10875 | 10875 | // |
@@ -237,10 +237,10 @@ discard block |
||
237 | 237 | } |
238 | 238 | |
239 | 239 | if ($encoding === 'UTF-8') { |
240 | - return (string) \mb_substr($str, $pos, 1); |
|
240 | + return (string)\mb_substr($str, $pos, 1); |
|
241 | 241 | } |
242 | 242 | |
243 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
243 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | public static function add_bom_to_string(string $str): string |
256 | 256 | { |
257 | 257 | if (self::string_has_bom($str) === false) { |
258 | - $str = self::bom() . $str; |
|
258 | + $str = self::bom().$str; |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | return $str; |
@@ -288,8 +288,8 @@ discard block |
||
288 | 288 | $return = []; |
289 | 289 | foreach ($array as $key => &$value) { |
290 | 290 | $key = $case === \CASE_LOWER |
291 | - ? self::strtolower((string) $key, $encoding) |
|
292 | - : self::strtoupper((string) $key, $encoding); |
|
291 | + ? self::strtolower((string)$key, $encoding) |
|
292 | + : self::strtoupper((string)$key, $encoding); |
|
293 | 293 | |
294 | 294 | $return[$key] = $value; |
295 | 295 | } |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | return ''; |
324 | 324 | } |
325 | 325 | |
326 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
326 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
327 | 327 | $end_position = \mb_strpos($str, $end, $substr_index); |
328 | 328 | if ( |
329 | 329 | $end_position === false |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | return ''; |
334 | 334 | } |
335 | 335 | |
336 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
336 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | return ''; |
344 | 344 | } |
345 | 345 | |
346 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
346 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
347 | 347 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
348 | 348 | if ( |
349 | 349 | $end_position === false |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | return ''; |
354 | 354 | } |
355 | 355 | |
356 | - return (string) self::substr( |
|
356 | + return (string)self::substr( |
|
357 | 357 | $str, |
358 | 358 | $substr_index, |
359 | 359 | $end_position - $substr_index, |
@@ -421,10 +421,10 @@ discard block |
||
421 | 421 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
422 | 422 | { |
423 | 423 | if ($encoding === 'UTF-8') { |
424 | - return (string) \mb_substr($str, $index, 1); |
|
424 | + return (string)\mb_substr($str, $index, 1); |
|
425 | 425 | } |
426 | 426 | |
427 | - return (string) self::substr($str, $index, 1, $encoding); |
|
427 | + return (string)self::substr($str, $index, 1, $encoding); |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | /** |
@@ -523,10 +523,10 @@ discard block |
||
523 | 523 | && |
524 | 524 | self::$SUPPORT['mbstring'] === false |
525 | 525 | ) { |
526 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
526 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
527 | 527 | } |
528 | 528 | |
529 | - $cache_key = $code_point . $encoding; |
|
529 | + $cache_key = $code_point.$encoding; |
|
530 | 530 | if (isset($CHAR_CACHE[$cache_key]) === true) { |
531 | 531 | return $CHAR_CACHE[$cache_key]; |
532 | 532 | } |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | self::$CHR = self::getData('chr'); |
573 | 573 | } |
574 | 574 | |
575 | - $code_point = (int) $code_point; |
|
575 | + $code_point = (int)$code_point; |
|
576 | 576 | if ($code_point <= 0x7F) { |
577 | 577 | /** |
578 | 578 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -582,22 +582,22 @@ discard block |
||
582 | 582 | /** |
583 | 583 | * @psalm-suppress PossiblyNullArrayAccess |
584 | 584 | */ |
585 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
585 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
586 | 586 | self::$CHR[($code_point & 0x3F) + 0x80]; |
587 | 587 | } elseif ($code_point <= 0xFFFF) { |
588 | 588 | /** |
589 | 589 | * @psalm-suppress PossiblyNullArrayAccess |
590 | 590 | */ |
591 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
592 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
591 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
592 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
593 | 593 | self::$CHR[($code_point & 0x3F) + 0x80]; |
594 | 594 | } else { |
595 | 595 | /** |
596 | 596 | * @psalm-suppress PossiblyNullArrayAccess |
597 | 597 | */ |
598 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
599 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
600 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
598 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
599 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
600 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
601 | 601 | self::$CHR[($code_point & 0x3F) + 0x80]; |
602 | 602 | } |
603 | 603 | |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | |
646 | 646 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
647 | 647 | return \array_map( |
648 | - static function (string $data): int { |
|
648 | + static function(string $data): int { |
|
649 | 649 | // "mb_" is available if overload is used, so use it ... |
650 | 650 | return \mb_strlen($data, 'CP850'); // 8-BIT |
651 | 651 | }, |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | $char = ''; |
722 | 722 | } |
723 | 723 | |
724 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
724 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
725 | 725 | } |
726 | 726 | |
727 | 727 | /** |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
803 | 803 | /x'; |
804 | 804 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
805 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
805 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
806 | 806 | |
807 | 807 | if ($replace_diamond_question_mark === true) { |
808 | 808 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -837,7 +837,7 @@ discard block |
||
837 | 837 | public static function cleanup($str): string |
838 | 838 | { |
839 | 839 | // init |
840 | - $str = (string) $str; |
|
840 | + $str = (string)$str; |
|
841 | 841 | |
842 | 842 | if ($str === '') { |
843 | 843 | return ''; |
@@ -927,7 +927,7 @@ discard block |
||
927 | 927 | { |
928 | 928 | if (self::$SUPPORT['mbstring'] === true) { |
929 | 929 | /** @noinspection PhpComposerExtensionStubsInspection */ |
930 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
930 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
931 | 931 | } |
932 | 932 | |
933 | 933 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -967,7 +967,7 @@ discard block |
||
967 | 967 | */ |
968 | 968 | public static function css_stripe_media_queries(string $str): string |
969 | 969 | { |
970 | - return (string) \preg_replace( |
|
970 | + return (string)\preg_replace( |
|
971 | 971 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
972 | 972 | '', |
973 | 973 | $str |
@@ -994,7 +994,7 @@ discard block |
||
994 | 994 | */ |
995 | 995 | public static function decimal_to_chr($int): string |
996 | 996 | { |
997 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
997 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
998 | 998 | } |
999 | 999 | |
1000 | 1000 | /** |
@@ -1041,16 +1041,16 @@ discard block |
||
1041 | 1041 | self::initEmojiData(); |
1042 | 1042 | |
1043 | 1043 | if ($use_reversible_string_mappings === true) { |
1044 | - return (string) \str_replace( |
|
1045 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1046 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1044 | + return (string)\str_replace( |
|
1045 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1046 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1047 | 1047 | $str |
1048 | 1048 | ); |
1049 | 1049 | } |
1050 | 1050 | |
1051 | - return (string) \str_replace( |
|
1052 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1053 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1051 | + return (string)\str_replace( |
|
1052 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1053 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1054 | 1054 | $str |
1055 | 1055 | ); |
1056 | 1056 | } |
@@ -1072,16 +1072,16 @@ discard block |
||
1072 | 1072 | self::initEmojiData(); |
1073 | 1073 | |
1074 | 1074 | if ($use_reversible_string_mappings === true) { |
1075 | - return (string) \str_replace( |
|
1076 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1077 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1075 | + return (string)\str_replace( |
|
1076 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1077 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1078 | 1078 | $str |
1079 | 1079 | ); |
1080 | 1080 | } |
1081 | 1081 | |
1082 | - return (string) \str_replace( |
|
1083 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1084 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1082 | + return (string)\str_replace( |
|
1083 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1084 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1085 | 1085 | $str |
1086 | 1086 | ); |
1087 | 1087 | } |
@@ -1135,7 +1135,7 @@ discard block |
||
1135 | 1135 | if ($to_encoding === 'JSON') { |
1136 | 1136 | $return = self::json_encode($str); |
1137 | 1137 | if ($return === false) { |
1138 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1138 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1139 | 1139 | } |
1140 | 1140 | |
1141 | 1141 | return $return; |
@@ -1222,7 +1222,7 @@ discard block |
||
1222 | 1222 | && |
1223 | 1223 | self::$SUPPORT['mbstring'] === false |
1224 | 1224 | ) { |
1225 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
1225 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
1226 | 1226 | } |
1227 | 1227 | |
1228 | 1228 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1316,31 +1316,31 @@ discard block |
||
1316 | 1316 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1317 | 1317 | |
1318 | 1318 | if ($length === null) { |
1319 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
1319 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
1320 | 1320 | } |
1321 | 1321 | |
1322 | 1322 | if ($search === '') { |
1323 | 1323 | if ($encoding === 'UTF-8') { |
1324 | 1324 | if ($length > 0) { |
1325 | - $string_length = (int) \mb_strlen($str); |
|
1325 | + $string_length = (int)\mb_strlen($str); |
|
1326 | 1326 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1327 | 1327 | } else { |
1328 | 1328 | $end = 0; |
1329 | 1329 | } |
1330 | 1330 | |
1331 | - $pos = (int) \min( |
|
1331 | + $pos = (int)\min( |
|
1332 | 1332 | \mb_strpos($str, ' ', $end), |
1333 | 1333 | \mb_strpos($str, '.', $end) |
1334 | 1334 | ); |
1335 | 1335 | } else { |
1336 | 1336 | if ($length > 0) { |
1337 | - $string_length = (int) self::strlen($str, $encoding); |
|
1337 | + $string_length = (int)self::strlen($str, $encoding); |
|
1338 | 1338 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1339 | 1339 | } else { |
1340 | 1340 | $end = 0; |
1341 | 1341 | } |
1342 | 1342 | |
1343 | - $pos = (int) \min( |
|
1343 | + $pos = (int)\min( |
|
1344 | 1344 | self::strpos($str, ' ', $end, $encoding), |
1345 | 1345 | self::strpos($str, '.', $end, $encoding) |
1346 | 1346 | ); |
@@ -1357,18 +1357,18 @@ discard block |
||
1357 | 1357 | return ''; |
1358 | 1358 | } |
1359 | 1359 | |
1360 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1360 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1361 | 1361 | } |
1362 | 1362 | |
1363 | 1363 | return $str; |
1364 | 1364 | } |
1365 | 1365 | |
1366 | 1366 | if ($encoding === 'UTF-8') { |
1367 | - $word_position = (int) \mb_stripos($str, $search); |
|
1368 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1367 | + $word_position = (int)\mb_stripos($str, $search); |
|
1368 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1369 | 1369 | } else { |
1370 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
1371 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1370 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
1371 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1372 | 1372 | } |
1373 | 1373 | |
1374 | 1374 | $pos_start = 0; |
@@ -1380,12 +1380,12 @@ discard block |
||
1380 | 1380 | } |
1381 | 1381 | if ($half_text !== false) { |
1382 | 1382 | if ($encoding === 'UTF-8') { |
1383 | - $pos_start = (int) \max( |
|
1383 | + $pos_start = (int)\max( |
|
1384 | 1384 | \mb_strrpos($half_text, ' '), |
1385 | 1385 | \mb_strrpos($half_text, '.') |
1386 | 1386 | ); |
1387 | 1387 | } else { |
1388 | - $pos_start = (int) \max( |
|
1388 | + $pos_start = (int)\max( |
|
1389 | 1389 | self::strrpos($half_text, ' ', 0, $encoding), |
1390 | 1390 | self::strrpos($half_text, '.', 0, $encoding) |
1391 | 1391 | ); |
@@ -1395,19 +1395,19 @@ discard block |
||
1395 | 1395 | |
1396 | 1396 | if ($word_position && $half_side > 0) { |
1397 | 1397 | $offset = $pos_start + $length - 1; |
1398 | - $real_length = (int) self::strlen($str, $encoding); |
|
1398 | + $real_length = (int)self::strlen($str, $encoding); |
|
1399 | 1399 | |
1400 | 1400 | if ($offset > $real_length) { |
1401 | 1401 | $offset = $real_length; |
1402 | 1402 | } |
1403 | 1403 | |
1404 | 1404 | if ($encoding === 'UTF-8') { |
1405 | - $pos_end = (int) \min( |
|
1405 | + $pos_end = (int)\min( |
|
1406 | 1406 | \mb_strpos($str, ' ', $offset), |
1407 | 1407 | \mb_strpos($str, '.', $offset) |
1408 | 1408 | ) - $pos_start; |
1409 | 1409 | } else { |
1410 | - $pos_end = (int) \min( |
|
1410 | + $pos_end = (int)\min( |
|
1411 | 1411 | self::strpos($str, ' ', $offset, $encoding), |
1412 | 1412 | self::strpos($str, '.', $offset, $encoding) |
1413 | 1413 | ) - $pos_start; |
@@ -1415,12 +1415,12 @@ discard block |
||
1415 | 1415 | |
1416 | 1416 | if (!$pos_end || $pos_end <= 0) { |
1417 | 1417 | if ($encoding === 'UTF-8') { |
1418 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1418 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1419 | 1419 | } else { |
1420 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1420 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1421 | 1421 | } |
1422 | 1422 | if ($str_sub !== false) { |
1423 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
1423 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
1424 | 1424 | } else { |
1425 | 1425 | $extract = ''; |
1426 | 1426 | } |
@@ -1431,26 +1431,26 @@ discard block |
||
1431 | 1431 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
1432 | 1432 | } |
1433 | 1433 | if ($str_sub !== false) { |
1434 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1434 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1435 | 1435 | } else { |
1436 | 1436 | $extract = ''; |
1437 | 1437 | } |
1438 | 1438 | } |
1439 | 1439 | } else { |
1440 | 1440 | $offset = $length - 1; |
1441 | - $true_length = (int) self::strlen($str, $encoding); |
|
1441 | + $true_length = (int)self::strlen($str, $encoding); |
|
1442 | 1442 | |
1443 | 1443 | if ($offset > $true_length) { |
1444 | 1444 | $offset = $true_length; |
1445 | 1445 | } |
1446 | 1446 | |
1447 | 1447 | if ($encoding === 'UTF-8') { |
1448 | - $pos_end = (int) \min( |
|
1448 | + $pos_end = (int)\min( |
|
1449 | 1449 | \mb_strpos($str, ' ', $offset), |
1450 | 1450 | \mb_strpos($str, '.', $offset) |
1451 | 1451 | ); |
1452 | 1452 | } else { |
1453 | - $pos_end = (int) \min( |
|
1453 | + $pos_end = (int)\min( |
|
1454 | 1454 | self::strpos($str, ' ', $offset, $encoding), |
1455 | 1455 | self::strpos($str, '.', $offset, $encoding) |
1456 | 1456 | ); |
@@ -1463,7 +1463,7 @@ discard block |
||
1463 | 1463 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
1464 | 1464 | } |
1465 | 1465 | if ($str_sub !== false) { |
1466 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1466 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1467 | 1467 | } else { |
1468 | 1468 | $extract = ''; |
1469 | 1469 | } |
@@ -1586,7 +1586,7 @@ discard block |
||
1586 | 1586 | { |
1587 | 1587 | $file_content = \file_get_contents($file_path); |
1588 | 1588 | if ($file_content === false) { |
1589 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1589 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1590 | 1590 | } |
1591 | 1591 | |
1592 | 1592 | return self::string_has_bom($file_content); |
@@ -1652,7 +1652,7 @@ discard block |
||
1652 | 1652 | ) { |
1653 | 1653 | // Prevent leading combining chars |
1654 | 1654 | // for NFC-safe concatenations. |
1655 | - $var = $leading_combining . $var; |
|
1655 | + $var = $leading_combining.$var; |
|
1656 | 1656 | } |
1657 | 1657 | } |
1658 | 1658 | |
@@ -1903,10 +1903,10 @@ discard block |
||
1903 | 1903 | } |
1904 | 1904 | |
1905 | 1905 | if ($encoding === 'UTF-8') { |
1906 | - return (string) \mb_substr($str, 0, $n); |
|
1906 | + return (string)\mb_substr($str, 0, $n); |
|
1907 | 1907 | } |
1908 | 1908 | |
1909 | - return (string) self::substr($str, 0, $n, $encoding); |
|
1909 | + return (string)self::substr($str, 0, $n, $encoding); |
|
1910 | 1910 | } |
1911 | 1911 | |
1912 | 1912 | /** |
@@ -1919,7 +1919,7 @@ discard block |
||
1919 | 1919 | */ |
1920 | 1920 | public static function fits_inside(string $str, int $box_size): bool |
1921 | 1921 | { |
1922 | - return (int) self::strlen($str) <= $box_size; |
|
1922 | + return (int)self::strlen($str) <= $box_size; |
|
1923 | 1923 | } |
1924 | 1924 | |
1925 | 1925 | /** |
@@ -1981,7 +1981,7 @@ discard block |
||
1981 | 1981 | return $str; |
1982 | 1982 | } |
1983 | 1983 | |
1984 | - $str = (string) $str; |
|
1984 | + $str = (string)$str; |
|
1985 | 1985 | $last = ''; |
1986 | 1986 | while ($last !== $str) { |
1987 | 1987 | $last = $str; |
@@ -2175,7 +2175,7 @@ discard block |
||
2175 | 2175 | return $fallback; |
2176 | 2176 | } |
2177 | 2177 | /** @noinspection OffsetOperationsInspection */ |
2178 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2178 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2179 | 2179 | |
2180 | 2180 | // DEBUG |
2181 | 2181 | //var_dump($type_code); |
@@ -2233,7 +2233,7 @@ discard block |
||
2233 | 2233 | // |
2234 | 2234 | |
2235 | 2235 | if ($encoding === 'UTF-8') { |
2236 | - $max_length = (int) \mb_strlen($possible_chars); |
|
2236 | + $max_length = (int)\mb_strlen($possible_chars); |
|
2237 | 2237 | if ($max_length === 0) { |
2238 | 2238 | return ''; |
2239 | 2239 | } |
@@ -2254,7 +2254,7 @@ discard block |
||
2254 | 2254 | } else { |
2255 | 2255 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2256 | 2256 | |
2257 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
2257 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
2258 | 2258 | if ($max_length === 0) { |
2259 | 2259 | return ''; |
2260 | 2260 | } |
@@ -2285,16 +2285,16 @@ discard block |
||
2285 | 2285 | */ |
2286 | 2286 | public static function get_unique_string($entropy_extra = '', bool $use_md5 = true): string |
2287 | 2287 | { |
2288 | - $unique_helper = \random_int(0, \mt_getrandmax()) . |
|
2289 | - \session_id() . |
|
2290 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2291 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2288 | + $unique_helper = \random_int(0, \mt_getrandmax()). |
|
2289 | + \session_id(). |
|
2290 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2291 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2292 | 2292 | $entropy_extra; |
2293 | 2293 | |
2294 | 2294 | $unique_string = \uniqid($unique_helper, true); |
2295 | 2295 | |
2296 | 2296 | if ($use_md5) { |
2297 | - $unique_string = \md5($unique_string . $unique_helper); |
|
2297 | + $unique_string = \md5($unique_string.$unique_helper); |
|
2298 | 2298 | } |
2299 | 2299 | |
2300 | 2300 | return $unique_string; |
@@ -2374,7 +2374,7 @@ discard block |
||
2374 | 2374 | public static function hex_to_int($hexdec) |
2375 | 2375 | { |
2376 | 2376 | // init |
2377 | - $hexdec = (string) $hexdec; |
|
2377 | + $hexdec = (string)$hexdec; |
|
2378 | 2378 | |
2379 | 2379 | if ($hexdec === '') { |
2380 | 2380 | return false; |
@@ -2467,7 +2467,7 @@ discard block |
||
2467 | 2467 | return \implode( |
2468 | 2468 | '', |
2469 | 2469 | \array_map( |
2470 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2470 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2471 | 2471 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
2472 | 2472 | }, |
2473 | 2473 | self::str_split($str) |
@@ -2574,7 +2574,7 @@ discard block |
||
2574 | 2574 | && |
2575 | 2575 | self::$SUPPORT['mbstring'] === false |
2576 | 2576 | ) { |
2577 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2577 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2578 | 2578 | } |
2579 | 2579 | |
2580 | 2580 | do { |
@@ -2583,7 +2583,7 @@ discard block |
||
2583 | 2583 | if (\strpos($str, '&') !== false) { |
2584 | 2584 | if (\strpos($str, '&#') !== false) { |
2585 | 2585 | // decode also numeric & UTF16 two byte entities |
2586 | - $str = (string) \preg_replace( |
|
2586 | + $str = (string)\preg_replace( |
|
2587 | 2587 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
2588 | 2588 | '$1;', |
2589 | 2589 | $str |
@@ -2629,7 +2629,7 @@ discard block |
||
2629 | 2629 | */ |
2630 | 2630 | public static function html_stripe_empty_tags(string $str): string |
2631 | 2631 | { |
2632 | - return (string) \preg_replace( |
|
2632 | + return (string)\preg_replace( |
|
2633 | 2633 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
2634 | 2634 | '', |
2635 | 2635 | $str |
@@ -2939,9 +2939,9 @@ discard block |
||
2939 | 2939 | { |
2940 | 2940 | $hex = \dechex($int); |
2941 | 2941 | |
2942 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
2942 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
2943 | 2943 | |
2944 | - return $prefix . $hex . ''; |
|
2944 | + return $prefix.$hex.''; |
|
2945 | 2945 | } |
2946 | 2946 | |
2947 | 2947 | /** |
@@ -3201,7 +3201,7 @@ discard block |
||
3201 | 3201 | */ |
3202 | 3202 | public static function is_binary($input, bool $strict = false): bool |
3203 | 3203 | { |
3204 | - $input = (string) $input; |
|
3204 | + $input = (string)$input; |
|
3205 | 3205 | if ($input === '') { |
3206 | 3206 | return false; |
3207 | 3207 | } |
@@ -3468,7 +3468,7 @@ discard block |
||
3468 | 3468 | public static function is_utf16($str, $check_if_string_is_binary = true) |
3469 | 3469 | { |
3470 | 3470 | // init |
3471 | - $str = (string) $str; |
|
3471 | + $str = (string)$str; |
|
3472 | 3472 | $str_chars = []; |
3473 | 3473 | |
3474 | 3474 | if ( |
@@ -3549,7 +3549,7 @@ discard block |
||
3549 | 3549 | public static function is_utf32($str, $check_if_string_is_binary = true) |
3550 | 3550 | { |
3551 | 3551 | // init |
3552 | - $str = (string) $str; |
|
3552 | + $str = (string)$str; |
|
3553 | 3553 | $str_chars = []; |
3554 | 3554 | |
3555 | 3555 | if ( |
@@ -3636,7 +3636,7 @@ discard block |
||
3636 | 3636 | return true; |
3637 | 3637 | } |
3638 | 3638 | |
3639 | - return self::is_utf8_string((string) $str, $strict); |
|
3639 | + return self::is_utf8_string((string)$str, $strict); |
|
3640 | 3640 | } |
3641 | 3641 | |
3642 | 3642 | /** |
@@ -3776,15 +3776,15 @@ discard block |
||
3776 | 3776 | $use_mb_functions = ($lang === null && $try_to_keep_the_string_length === false); |
3777 | 3777 | |
3778 | 3778 | if ($encoding === 'UTF-8') { |
3779 | - $str_part_two = (string) \mb_substr($str, 1); |
|
3779 | + $str_part_two = (string)\mb_substr($str, 1); |
|
3780 | 3780 | |
3781 | 3781 | if ($use_mb_functions === true) { |
3782 | 3782 | $str_part_one = \mb_strtolower( |
3783 | - (string) \mb_substr($str, 0, 1) |
|
3783 | + (string)\mb_substr($str, 0, 1) |
|
3784 | 3784 | ); |
3785 | 3785 | } else { |
3786 | 3786 | $str_part_one = self::strtolower( |
3787 | - (string) \mb_substr($str, 0, 1), |
|
3787 | + (string)\mb_substr($str, 0, 1), |
|
3788 | 3788 | $encoding, |
3789 | 3789 | false, |
3790 | 3790 | $lang, |
@@ -3794,10 +3794,10 @@ discard block |
||
3794 | 3794 | } else { |
3795 | 3795 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
3796 | 3796 | |
3797 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
3797 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
3798 | 3798 | |
3799 | 3799 | $str_part_one = self::strtolower( |
3800 | - (string) self::substr($str, 0, 1, $encoding), |
|
3800 | + (string)self::substr($str, 0, 1, $encoding), |
|
3801 | 3801 | $encoding, |
3802 | 3802 | false, |
3803 | 3803 | $lang, |
@@ -3805,7 +3805,7 @@ discard block |
||
3805 | 3805 | ); |
3806 | 3806 | } |
3807 | 3807 | |
3808 | - return $str_part_one . $str_part_two; |
|
3808 | + return $str_part_one.$str_part_two; |
|
3809 | 3809 | } |
3810 | 3810 | |
3811 | 3811 | /** |
@@ -3942,7 +3942,7 @@ discard block |
||
3942 | 3942 | } |
3943 | 3943 | |
3944 | 3944 | /** @noinspection PhpComposerExtensionStubsInspection */ |
3945 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
3945 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
3946 | 3946 | } |
3947 | 3947 | |
3948 | 3948 | if ($chars) { |
@@ -3991,7 +3991,7 @@ discard block |
||
3991 | 3991 | { |
3992 | 3992 | $bytes = self::chr_size_list($str); |
3993 | 3993 | if ($bytes !== []) { |
3994 | - return (int) \max($bytes); |
|
3994 | + return (int)\max($bytes); |
|
3995 | 3995 | } |
3996 | 3996 | |
3997 | 3997 | return 0; |
@@ -4060,7 +4060,7 @@ discard block |
||
4060 | 4060 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4061 | 4061 | |
4062 | 4062 | // init |
4063 | - $encoding = (string) $encoding; |
|
4063 | + $encoding = (string)$encoding; |
|
4064 | 4064 | |
4065 | 4065 | if (!$encoding) { |
4066 | 4066 | return $fallback; |
@@ -4122,7 +4122,7 @@ discard block |
||
4122 | 4122 | |
4123 | 4123 | $encoding_original = $encoding; |
4124 | 4124 | $encoding = \strtoupper($encoding); |
4125 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4125 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4126 | 4126 | |
4127 | 4127 | $equivalences = [ |
4128 | 4128 | 'ISO8859' => 'ISO-8859-1', |
@@ -4266,13 +4266,13 @@ discard block |
||
4266 | 4266 | static $CHAR_CACHE = []; |
4267 | 4267 | |
4268 | 4268 | // init |
4269 | - $chr = (string) $chr; |
|
4269 | + $chr = (string)$chr; |
|
4270 | 4270 | |
4271 | 4271 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
4272 | 4272 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4273 | 4273 | } |
4274 | 4274 | |
4275 | - $cache_key = $chr . $encoding; |
|
4275 | + $cache_key = $chr.$encoding; |
|
4276 | 4276 | if (isset($CHAR_CACHE[$cache_key]) === true) { |
4277 | 4277 | return $CHAR_CACHE[$cache_key]; |
4278 | 4278 | } |
@@ -4307,7 +4307,7 @@ discard block |
||
4307 | 4307 | // |
4308 | 4308 | |
4309 | 4309 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
4310 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
4310 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
4311 | 4311 | /** @noinspection OffsetOperationsInspection */ |
4312 | 4312 | $code = $chr ? $chr[1] : 0; |
4313 | 4313 | |
@@ -4315,21 +4315,21 @@ discard block |
||
4315 | 4315 | if ($code >= 0xF0 && isset($chr[4])) { |
4316 | 4316 | /** @noinspection UnnecessaryCastingInspection */ |
4317 | 4317 | /** @noinspection OffsetOperationsInspection */ |
4318 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4318 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4319 | 4319 | } |
4320 | 4320 | |
4321 | 4321 | /** @noinspection OffsetOperationsInspection */ |
4322 | 4322 | if ($code >= 0xE0 && isset($chr[3])) { |
4323 | 4323 | /** @noinspection UnnecessaryCastingInspection */ |
4324 | 4324 | /** @noinspection OffsetOperationsInspection */ |
4325 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4325 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4326 | 4326 | } |
4327 | 4327 | |
4328 | 4328 | /** @noinspection OffsetOperationsInspection */ |
4329 | 4329 | if ($code >= 0xC0 && isset($chr[2])) { |
4330 | 4330 | /** @noinspection UnnecessaryCastingInspection */ |
4331 | 4331 | /** @noinspection OffsetOperationsInspection */ |
4332 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4332 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4333 | 4333 | } |
4334 | 4334 | |
4335 | 4335 | return $CHAR_CACHE[$cache_key] = $code; |
@@ -4380,7 +4380,7 @@ discard block |
||
4380 | 4380 | public static function pcre_utf8_support(): bool |
4381 | 4381 | { |
4382 | 4382 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4383 | - return (bool) @\preg_match('//u', ''); |
|
4383 | + return (bool)@\preg_match('//u', ''); |
|
4384 | 4384 | } |
4385 | 4385 | |
4386 | 4386 | /** |
@@ -4415,14 +4415,14 @@ discard block |
||
4415 | 4415 | * @psalm-suppress RedundantConditionGivenDocblockType |
4416 | 4416 | */ |
4417 | 4417 | if (!\is_numeric($step)) { |
4418 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
4418 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
4419 | 4419 | } |
4420 | 4420 | |
4421 | 4421 | /** |
4422 | 4422 | * @psalm-suppress RedundantConditionGivenDocblockType - false-positive from psalm? |
4423 | 4423 | */ |
4424 | 4424 | if ($step <= 0) { |
4425 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
4425 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
4426 | 4426 | } |
4427 | 4427 | } |
4428 | 4428 | |
@@ -4434,14 +4434,14 @@ discard block |
||
4434 | 4434 | $is_xdigit = false; |
4435 | 4435 | |
4436 | 4436 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4437 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
4437 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
4438 | 4438 | $is_digit = true; |
4439 | - $start = (int) $var1; |
|
4439 | + $start = (int)$var1; |
|
4440 | 4440 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
4441 | 4441 | $is_xdigit = true; |
4442 | - $start = (int) self::hex_to_int($var1); |
|
4442 | + $start = (int)self::hex_to_int($var1); |
|
4443 | 4443 | } elseif (!$use_ctype && \is_numeric($var1)) { |
4444 | - $start = (int) $var1; |
|
4444 | + $start = (int)$var1; |
|
4445 | 4445 | } else { |
4446 | 4446 | $start = self::ord($var1); |
4447 | 4447 | } |
@@ -4451,11 +4451,11 @@ discard block |
||
4451 | 4451 | } |
4452 | 4452 | |
4453 | 4453 | if ($is_digit) { |
4454 | - $end = (int) $var2; |
|
4454 | + $end = (int)$var2; |
|
4455 | 4455 | } elseif ($is_xdigit) { |
4456 | - $end = (int) self::hex_to_int($var2); |
|
4456 | + $end = (int)self::hex_to_int($var2); |
|
4457 | 4457 | } elseif (!$use_ctype && \is_numeric($var2)) { |
4458 | - $end = (int) $var2; |
|
4458 | + $end = (int)$var2; |
|
4459 | 4459 | } else { |
4460 | 4460 | $end = self::ord($var2); |
4461 | 4461 | } |
@@ -4466,7 +4466,7 @@ discard block |
||
4466 | 4466 | |
4467 | 4467 | $array = []; |
4468 | 4468 | foreach (\range($start, $end, $step) as $i) { |
4469 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
4469 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
4470 | 4470 | } |
4471 | 4471 | |
4472 | 4472 | return $array; |
@@ -4572,8 +4572,8 @@ discard block |
||
4572 | 4572 | $delimiter = '/'; |
4573 | 4573 | } |
4574 | 4574 | |
4575 | - return (string) \preg_replace( |
|
4576 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4575 | + return (string)\preg_replace( |
|
4576 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4577 | 4577 | $replacement, |
4578 | 4578 | $str |
4579 | 4579 | ); |
@@ -4617,9 +4617,9 @@ discard block |
||
4617 | 4617 | return ''; |
4618 | 4618 | } |
4619 | 4619 | |
4620 | - $str_length -= (int) $bom_byte_length; |
|
4620 | + $str_length -= (int)$bom_byte_length; |
|
4621 | 4621 | |
4622 | - $str = (string) $str_tmp; |
|
4622 | + $str = (string)$str_tmp; |
|
4623 | 4623 | } |
4624 | 4624 | } |
4625 | 4625 | |
@@ -4646,7 +4646,7 @@ discard block |
||
4646 | 4646 | */ |
4647 | 4647 | if (\is_array($what) === true) { |
4648 | 4648 | foreach ($what as $item) { |
4649 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
4649 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
4650 | 4650 | } |
4651 | 4651 | } |
4652 | 4652 | |
@@ -4680,7 +4680,7 @@ discard block |
||
4680 | 4680 | */ |
4681 | 4681 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
4682 | 4682 | { |
4683 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4683 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4684 | 4684 | } |
4685 | 4685 | |
4686 | 4686 | /** |
@@ -4731,17 +4731,17 @@ discard block |
||
4731 | 4731 | ): string { |
4732 | 4732 | if ($substring && \strpos($str, $substring) === 0) { |
4733 | 4733 | if ($encoding === 'UTF-8') { |
4734 | - return (string) \mb_substr( |
|
4734 | + return (string)\mb_substr( |
|
4735 | 4735 | $str, |
4736 | - (int) \mb_strlen($substring) |
|
4736 | + (int)\mb_strlen($substring) |
|
4737 | 4737 | ); |
4738 | 4738 | } |
4739 | 4739 | |
4740 | 4740 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4741 | 4741 | |
4742 | - return (string) self::substr( |
|
4742 | + return (string)self::substr( |
|
4743 | 4743 | $str, |
4744 | - (int) self::strlen($substring, $encoding), |
|
4744 | + (int)self::strlen($substring, $encoding), |
|
4745 | 4745 | null, |
4746 | 4746 | $encoding |
4747 | 4747 | ); |
@@ -4767,19 +4767,19 @@ discard block |
||
4767 | 4767 | ): string { |
4768 | 4768 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
4769 | 4769 | if ($encoding === 'UTF-8') { |
4770 | - return (string) \mb_substr( |
|
4770 | + return (string)\mb_substr( |
|
4771 | 4771 | $str, |
4772 | 4772 | 0, |
4773 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
4773 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
4774 | 4774 | ); |
4775 | 4775 | } |
4776 | 4776 | |
4777 | 4777 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4778 | 4778 | |
4779 | - return (string) self::substr( |
|
4779 | + return (string)self::substr( |
|
4780 | 4780 | $str, |
4781 | 4781 | 0, |
4782 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
4782 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
4783 | 4783 | $encoding |
4784 | 4784 | ); |
4785 | 4785 | } |
@@ -4869,7 +4869,7 @@ discard block |
||
4869 | 4869 | $save = \mb_substitute_character(); |
4870 | 4870 | \mb_substitute_character($replacement_char_helper); |
4871 | 4871 | // the polyfill maybe return false, so cast to string |
4872 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4872 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4873 | 4873 | \mb_substitute_character($save); |
4874 | 4874 | } |
4875 | 4875 | |
@@ -4911,7 +4911,7 @@ discard block |
||
4911 | 4911 | } |
4912 | 4912 | |
4913 | 4913 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4914 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4914 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4915 | 4915 | } |
4916 | 4916 | |
4917 | 4917 | if ($chars) { |
@@ -4933,7 +4933,7 @@ discard block |
||
4933 | 4933 | { |
4934 | 4934 | echo '<pre>'; |
4935 | 4935 | foreach (self::$SUPPORT as $key => &$value) { |
4936 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
4936 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
4937 | 4937 | } |
4938 | 4938 | unset($value); |
4939 | 4939 | echo '</pre>'; |
@@ -4966,7 +4966,7 @@ discard block |
||
4966 | 4966 | return $char; |
4967 | 4967 | } |
4968 | 4968 | |
4969 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
4969 | + return '&#'.self::ord($char, $encoding).';'; |
|
4970 | 4970 | } |
4971 | 4971 | |
4972 | 4972 | /** |
@@ -5059,18 +5059,18 @@ discard block |
||
5059 | 5059 | $lang, |
5060 | 5060 | $try_to_keep_the_string_length |
5061 | 5061 | ); |
5062 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5062 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5063 | 5063 | |
5064 | 5064 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
5065 | 5065 | |
5066 | - $str = (string) \preg_replace_callback( |
|
5066 | + $str = (string)\preg_replace_callback( |
|
5067 | 5067 | '/[-_\\s]+(.)?/u', |
5068 | 5068 | /** |
5069 | 5069 | * @param array $match |
5070 | 5070 | * |
5071 | 5071 | * @return string |
5072 | 5072 | */ |
5073 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5073 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5074 | 5074 | if (isset($match[1])) { |
5075 | 5075 | if ($use_mb_functions === true) { |
5076 | 5076 | if ($encoding === 'UTF-8') { |
@@ -5088,14 +5088,14 @@ discard block |
||
5088 | 5088 | $str |
5089 | 5089 | ); |
5090 | 5090 | |
5091 | - return (string) \preg_replace_callback( |
|
5091 | + return (string)\preg_replace_callback( |
|
5092 | 5092 | '/[\\p{N}]+(.)?/u', |
5093 | 5093 | /** |
5094 | 5094 | * @param array $match |
5095 | 5095 | * |
5096 | 5096 | * @return string |
5097 | 5097 | */ |
5098 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5098 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5099 | 5099 | if ($use_mb_functions === true) { |
5100 | 5100 | if ($encoding === 'UTF-8') { |
5101 | 5101 | return \mb_strtoupper($match[0]); |
@@ -5274,7 +5274,7 @@ discard block |
||
5274 | 5274 | ): string { |
5275 | 5275 | if (self::$SUPPORT['mbstring'] === true) { |
5276 | 5276 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5277 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5277 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5278 | 5278 | |
5279 | 5279 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
5280 | 5280 | if ($use_mb_functions === true && $encoding === 'UTF-8') { |
@@ -5284,10 +5284,10 @@ discard block |
||
5284 | 5284 | } |
5285 | 5285 | |
5286 | 5286 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5287 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5287 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5288 | 5288 | } |
5289 | 5289 | |
5290 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5290 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5291 | 5291 | |
5292 | 5292 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
5293 | 5293 | if ($use_mb_functions === true && $encoding === 'UTF-8') { |
@@ -5296,7 +5296,7 @@ discard block |
||
5296 | 5296 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
5297 | 5297 | } |
5298 | 5298 | |
5299 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5299 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5300 | 5300 | } |
5301 | 5301 | |
5302 | 5302 | /** |
@@ -5311,7 +5311,7 @@ discard block |
||
5311 | 5311 | public static function str_detect_encoding($str) |
5312 | 5312 | { |
5313 | 5313 | // init |
5314 | - $str = (string) $str; |
|
5314 | + $str = (string)$str; |
|
5315 | 5315 | |
5316 | 5316 | // |
5317 | 5317 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5413,7 +5413,7 @@ discard block |
||
5413 | 5413 | foreach (self::$ENCODINGS as $encoding_tmp) { |
5414 | 5414 | // INFO: //IGNORE but still throw notice |
5415 | 5415 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5416 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
5416 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
5417 | 5417 | return $encoding_tmp; |
5418 | 5418 | } |
5419 | 5419 | } |
@@ -5502,7 +5502,7 @@ discard block |
||
5502 | 5502 | return $str; |
5503 | 5503 | } |
5504 | 5504 | |
5505 | - return $substring . $str; |
|
5505 | + return $substring.$str; |
|
5506 | 5506 | } |
5507 | 5507 | |
5508 | 5508 | /** |
@@ -5771,27 +5771,27 @@ discard block |
||
5771 | 5771 | string $encoding = 'UTF-8' |
5772 | 5772 | ): string { |
5773 | 5773 | if ($encoding === 'UTF-8') { |
5774 | - $len = (int) \mb_strlen($str); |
|
5774 | + $len = (int)\mb_strlen($str); |
|
5775 | 5775 | if ($index > $len) { |
5776 | 5776 | return $str; |
5777 | 5777 | } |
5778 | 5778 | |
5779 | 5779 | /** @noinspection UnnecessaryCastingInspection */ |
5780 | - return (string) \mb_substr($str, 0, $index) . |
|
5781 | - $substring . |
|
5782 | - (string) \mb_substr($str, $index, $len); |
|
5780 | + return (string)\mb_substr($str, 0, $index). |
|
5781 | + $substring. |
|
5782 | + (string)\mb_substr($str, $index, $len); |
|
5783 | 5783 | } |
5784 | 5784 | |
5785 | 5785 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5786 | 5786 | |
5787 | - $len = (int) self::strlen($str, $encoding); |
|
5787 | + $len = (int)self::strlen($str, $encoding); |
|
5788 | 5788 | if ($index > $len) { |
5789 | 5789 | return $str; |
5790 | 5790 | } |
5791 | 5791 | |
5792 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
5793 | - $substring . |
|
5794 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5792 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
5793 | + $substring. |
|
5794 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
5795 | 5795 | } |
5796 | 5796 | |
5797 | 5797 | /** |
@@ -5821,15 +5821,15 @@ discard block |
||
5821 | 5821 | */ |
5822 | 5822 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
5823 | 5823 | { |
5824 | - $search = (array) $search; |
|
5824 | + $search = (array)$search; |
|
5825 | 5825 | |
5826 | 5826 | /** @noinspection AlterInForeachInspection */ |
5827 | 5827 | foreach ($search as &$s) { |
5828 | - $s = (string) $s; |
|
5828 | + $s = (string)$s; |
|
5829 | 5829 | if ($s === '') { |
5830 | 5830 | $s = '/^(?<=.)$/'; |
5831 | 5831 | } else { |
5832 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5832 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5833 | 5833 | } |
5834 | 5834 | } |
5835 | 5835 | |
@@ -5861,11 +5861,11 @@ discard block |
||
5861 | 5861 | } |
5862 | 5862 | |
5863 | 5863 | if ($search === '') { |
5864 | - return $str . $replacement; |
|
5864 | + return $str.$replacement; |
|
5865 | 5865 | } |
5866 | 5866 | |
5867 | 5867 | if (\stripos($str, $search) === 0) { |
5868 | - return $replacement . \substr($str, \strlen($search)); |
|
5868 | + return $replacement.\substr($str, \strlen($search)); |
|
5869 | 5869 | } |
5870 | 5870 | |
5871 | 5871 | return $str; |
@@ -5894,11 +5894,11 @@ discard block |
||
5894 | 5894 | } |
5895 | 5895 | |
5896 | 5896 | if ($search === '') { |
5897 | - return $str . $replacement; |
|
5897 | + return $str.$replacement; |
|
5898 | 5898 | } |
5899 | 5899 | |
5900 | 5900 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
5901 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
5901 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
5902 | 5902 | } |
5903 | 5903 | |
5904 | 5904 | return $str; |
@@ -5978,15 +5978,15 @@ discard block |
||
5978 | 5978 | } |
5979 | 5979 | |
5980 | 5980 | if ($encoding === 'UTF-8') { |
5981 | - return (string) \mb_substr( |
|
5981 | + return (string)\mb_substr( |
|
5982 | 5982 | $str, |
5983 | - $offset + (int) \mb_strlen($separator) |
|
5983 | + $offset + (int)\mb_strlen($separator) |
|
5984 | 5984 | ); |
5985 | 5985 | } |
5986 | 5986 | |
5987 | - return (string) self::substr( |
|
5987 | + return (string)self::substr( |
|
5988 | 5988 | $str, |
5989 | - $offset + (int) self::strlen($separator, $encoding), |
|
5989 | + $offset + (int)self::strlen($separator, $encoding), |
|
5990 | 5990 | null, |
5991 | 5991 | $encoding |
5992 | 5992 | ); |
@@ -6016,15 +6016,15 @@ discard block |
||
6016 | 6016 | } |
6017 | 6017 | |
6018 | 6018 | if ($encoding === 'UTF-8') { |
6019 | - return (string) \mb_substr( |
|
6019 | + return (string)\mb_substr( |
|
6020 | 6020 | $str, |
6021 | - $offset + (int) self::strlen($separator) |
|
6021 | + $offset + (int)self::strlen($separator) |
|
6022 | 6022 | ); |
6023 | 6023 | } |
6024 | 6024 | |
6025 | - return (string) self::substr( |
|
6025 | + return (string)self::substr( |
|
6026 | 6026 | $str, |
6027 | - $offset + (int) self::strlen($separator, $encoding), |
|
6027 | + $offset + (int)self::strlen($separator, $encoding), |
|
6028 | 6028 | null, |
6029 | 6029 | $encoding |
6030 | 6030 | ); |
@@ -6054,10 +6054,10 @@ discard block |
||
6054 | 6054 | } |
6055 | 6055 | |
6056 | 6056 | if ($encoding === 'UTF-8') { |
6057 | - return (string) \mb_substr($str, 0, $offset); |
|
6057 | + return (string)\mb_substr($str, 0, $offset); |
|
6058 | 6058 | } |
6059 | 6059 | |
6060 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6060 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6061 | 6061 | } |
6062 | 6062 | |
6063 | 6063 | /** |
@@ -6084,7 +6084,7 @@ discard block |
||
6084 | 6084 | return ''; |
6085 | 6085 | } |
6086 | 6086 | |
6087 | - return (string) \mb_substr($str, 0, $offset); |
|
6087 | + return (string)\mb_substr($str, 0, $offset); |
|
6088 | 6088 | } |
6089 | 6089 | |
6090 | 6090 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6092,7 +6092,7 @@ discard block |
||
6092 | 6092 | return ''; |
6093 | 6093 | } |
6094 | 6094 | |
6095 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6095 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6096 | 6096 | } |
6097 | 6097 | |
6098 | 6098 | /** |
@@ -6188,12 +6188,12 @@ discard block |
||
6188 | 6188 | } |
6189 | 6189 | |
6190 | 6190 | if ($encoding === 'UTF-8') { |
6191 | - return (string) \mb_substr($str, -$n); |
|
6191 | + return (string)\mb_substr($str, -$n); |
|
6192 | 6192 | } |
6193 | 6193 | |
6194 | 6194 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6195 | 6195 | |
6196 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6196 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6197 | 6197 | } |
6198 | 6198 | |
6199 | 6199 | /** |
@@ -6217,21 +6217,21 @@ discard block |
||
6217 | 6217 | } |
6218 | 6218 | |
6219 | 6219 | if ($encoding === 'UTF-8') { |
6220 | - if ((int) \mb_strlen($str) <= $length) { |
|
6220 | + if ((int)\mb_strlen($str) <= $length) { |
|
6221 | 6221 | return $str; |
6222 | 6222 | } |
6223 | 6223 | |
6224 | 6224 | /** @noinspection UnnecessaryCastingInspection */ |
6225 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
6225 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
6226 | 6226 | } |
6227 | 6227 | |
6228 | 6228 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6229 | 6229 | |
6230 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6230 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6231 | 6231 | return $str; |
6232 | 6232 | } |
6233 | 6233 | |
6234 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
6234 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
6235 | 6235 | } |
6236 | 6236 | |
6237 | 6237 | /** |
@@ -6256,12 +6256,12 @@ discard block |
||
6256 | 6256 | |
6257 | 6257 | if ($encoding === 'UTF-8') { |
6258 | 6258 | /** @noinspection UnnecessaryCastingInspection */ |
6259 | - if ((int) \mb_strlen($str) <= $length) { |
|
6259 | + if ((int)\mb_strlen($str) <= $length) { |
|
6260 | 6260 | return $str; |
6261 | 6261 | } |
6262 | 6262 | |
6263 | 6263 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6264 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6264 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6265 | 6265 | } |
6266 | 6266 | |
6267 | 6267 | $str = \mb_substr($str, 0, $length); |
@@ -6271,22 +6271,22 @@ discard block |
||
6271 | 6271 | $new_str = \implode(' ', $array); |
6272 | 6272 | |
6273 | 6273 | if ($new_str === '') { |
6274 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6274 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6275 | 6275 | } |
6276 | 6276 | } else { |
6277 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6277 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6278 | 6278 | return $str; |
6279 | 6279 | } |
6280 | 6280 | |
6281 | 6281 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6282 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6282 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6283 | 6283 | } |
6284 | 6284 | |
6285 | 6285 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6286 | 6286 | $str = self::substr($str, 0, $length, $encoding); |
6287 | 6287 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6288 | 6288 | if ($str === false) { |
6289 | - return '' . $str_add_on; |
|
6289 | + return ''.$str_add_on; |
|
6290 | 6290 | } |
6291 | 6291 | |
6292 | 6292 | $array = \explode(' ', $str); |
@@ -6294,11 +6294,11 @@ discard block |
||
6294 | 6294 | $new_str = \implode(' ', $array); |
6295 | 6295 | |
6296 | 6296 | if ($new_str === '') { |
6297 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6297 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6298 | 6298 | } |
6299 | 6299 | } |
6300 | 6300 | |
6301 | - return $new_str . $str_add_on; |
|
6301 | + return $new_str.$str_add_on; |
|
6302 | 6302 | } |
6303 | 6303 | |
6304 | 6304 | /** |
@@ -6319,7 +6319,7 @@ discard block |
||
6319 | 6319 | $longest_common_prefix = ''; |
6320 | 6320 | |
6321 | 6321 | if ($encoding === 'UTF-8') { |
6322 | - $max_length = (int) \min( |
|
6322 | + $max_length = (int)\min( |
|
6323 | 6323 | \mb_strlen($str1), |
6324 | 6324 | \mb_strlen($str2) |
6325 | 6325 | ); |
@@ -6340,7 +6340,7 @@ discard block |
||
6340 | 6340 | } else { |
6341 | 6341 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6342 | 6342 | |
6343 | - $max_length = (int) \min( |
|
6343 | + $max_length = (int)\min( |
|
6344 | 6344 | self::strlen($str1, $encoding), |
6345 | 6345 | self::strlen($str2, $encoding) |
6346 | 6346 | ); |
@@ -6387,13 +6387,13 @@ discard block |
||
6387 | 6387 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6388 | 6388 | |
6389 | 6389 | if ($encoding === 'UTF-8') { |
6390 | - $str_length = (int) \mb_strlen($str1); |
|
6391 | - $other_length = (int) \mb_strlen($str2); |
|
6390 | + $str_length = (int)\mb_strlen($str1); |
|
6391 | + $other_length = (int)\mb_strlen($str2); |
|
6392 | 6392 | } else { |
6393 | 6393 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6394 | 6394 | |
6395 | - $str_length = (int) self::strlen($str1, $encoding); |
|
6396 | - $other_length = (int) self::strlen($str2, $encoding); |
|
6395 | + $str_length = (int)self::strlen($str1, $encoding); |
|
6396 | + $other_length = (int)self::strlen($str2, $encoding); |
|
6397 | 6397 | } |
6398 | 6398 | |
6399 | 6399 | // Return if either string is empty |
@@ -6446,10 +6446,10 @@ discard block |
||
6446 | 6446 | } |
6447 | 6447 | |
6448 | 6448 | if ($encoding === 'UTF-8') { |
6449 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
6449 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
6450 | 6450 | } |
6451 | 6451 | |
6452 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
6452 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
6453 | 6453 | } |
6454 | 6454 | |
6455 | 6455 | /** |
@@ -6471,7 +6471,7 @@ discard block |
||
6471 | 6471 | } |
6472 | 6472 | |
6473 | 6473 | if ($encoding === 'UTF-8') { |
6474 | - $max_length = (int) \min( |
|
6474 | + $max_length = (int)\min( |
|
6475 | 6475 | \mb_strlen($str1, $encoding), |
6476 | 6476 | \mb_strlen($str2, $encoding) |
6477 | 6477 | ); |
@@ -6485,7 +6485,7 @@ discard block |
||
6485 | 6485 | && |
6486 | 6486 | $char === \mb_substr($str2, -$i, 1) |
6487 | 6487 | ) { |
6488 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
6488 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
6489 | 6489 | } else { |
6490 | 6490 | break; |
6491 | 6491 | } |
@@ -6493,7 +6493,7 @@ discard block |
||
6493 | 6493 | } else { |
6494 | 6494 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6495 | 6495 | |
6496 | - $max_length = (int) \min( |
|
6496 | + $max_length = (int)\min( |
|
6497 | 6497 | self::strlen($str1, $encoding), |
6498 | 6498 | self::strlen($str2, $encoding) |
6499 | 6499 | ); |
@@ -6507,7 +6507,7 @@ discard block |
||
6507 | 6507 | && |
6508 | 6508 | $char === self::substr($str2, -$i, 1, $encoding) |
6509 | 6509 | ) { |
6510 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
6510 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
6511 | 6511 | } else { |
6512 | 6512 | break; |
6513 | 6513 | } |
@@ -6527,7 +6527,7 @@ discard block |
||
6527 | 6527 | */ |
6528 | 6528 | public static function str_matches_pattern(string $str, string $pattern): bool |
6529 | 6529 | { |
6530 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
6530 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
6531 | 6531 | } |
6532 | 6532 | |
6533 | 6533 | /** |
@@ -6544,7 +6544,7 @@ discard block |
||
6544 | 6544 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
6545 | 6545 | { |
6546 | 6546 | // init |
6547 | - $length = (int) self::strlen($str, $encoding); |
|
6547 | + $length = (int)self::strlen($str, $encoding); |
|
6548 | 6548 | |
6549 | 6549 | if ($offset >= 0) { |
6550 | 6550 | return $length > $offset; |
@@ -6571,7 +6571,7 @@ discard block |
||
6571 | 6571 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
6572 | 6572 | { |
6573 | 6573 | // init |
6574 | - $length = (int) self::strlen($str); |
|
6574 | + $length = (int)self::strlen($str); |
|
6575 | 6575 | |
6576 | 6576 | if ( |
6577 | 6577 | ($index >= 0 && $length <= $index) |
@@ -6611,7 +6611,7 @@ discard block |
||
6611 | 6611 | return $str; |
6612 | 6612 | } |
6613 | 6613 | |
6614 | - if ($pad_type !== (int) $pad_type) { |
|
6614 | + if ($pad_type !== (int)$pad_type) { |
|
6615 | 6615 | if ($pad_type === 'left') { |
6616 | 6616 | $pad_type = \STR_PAD_LEFT; |
6617 | 6617 | } elseif ($pad_type === 'right') { |
@@ -6620,23 +6620,23 @@ discard block |
||
6620 | 6620 | $pad_type = \STR_PAD_BOTH; |
6621 | 6621 | } else { |
6622 | 6622 | throw new \InvalidArgumentException( |
6623 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
6623 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
6624 | 6624 | ); |
6625 | 6625 | } |
6626 | 6626 | } |
6627 | 6627 | |
6628 | 6628 | if ($encoding === 'UTF-8') { |
6629 | - $str_length = (int) \mb_strlen($str); |
|
6629 | + $str_length = (int)\mb_strlen($str); |
|
6630 | 6630 | |
6631 | 6631 | if ($pad_length >= $str_length) { |
6632 | 6632 | switch ($pad_type) { |
6633 | 6633 | case \STR_PAD_LEFT: |
6634 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6634 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6635 | 6635 | |
6636 | 6636 | $diff = ($pad_length - $str_length); |
6637 | 6637 | |
6638 | - $pre = (string) \mb_substr( |
|
6639 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6638 | + $pre = (string)\mb_substr( |
|
6639 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6640 | 6640 | 0, |
6641 | 6641 | $diff |
6642 | 6642 | ); |
@@ -6647,16 +6647,16 @@ discard block |
||
6647 | 6647 | case \STR_PAD_BOTH: |
6648 | 6648 | $diff = ($pad_length - $str_length); |
6649 | 6649 | |
6650 | - $ps_length_left = (int) \floor($diff / 2); |
|
6650 | + $ps_length_left = (int)\floor($diff / 2); |
|
6651 | 6651 | |
6652 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6652 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6653 | 6653 | |
6654 | - $pre = (string) \mb_substr( |
|
6654 | + $pre = (string)\mb_substr( |
|
6655 | 6655 | \str_repeat($pad_string, $ps_length_left), |
6656 | 6656 | 0, |
6657 | 6657 | $ps_length_left |
6658 | 6658 | ); |
6659 | - $post = (string) \mb_substr( |
|
6659 | + $post = (string)\mb_substr( |
|
6660 | 6660 | \str_repeat($pad_string, $ps_length_right), |
6661 | 6661 | 0, |
6662 | 6662 | $ps_length_right |
@@ -6666,19 +6666,19 @@ discard block |
||
6666 | 6666 | |
6667 | 6667 | case \STR_PAD_RIGHT: |
6668 | 6668 | default: |
6669 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6669 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6670 | 6670 | |
6671 | 6671 | $diff = ($pad_length - $str_length); |
6672 | 6672 | |
6673 | - $post = (string) \mb_substr( |
|
6674 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6673 | + $post = (string)\mb_substr( |
|
6674 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6675 | 6675 | 0, |
6676 | 6676 | $diff |
6677 | 6677 | ); |
6678 | 6678 | $pre = ''; |
6679 | 6679 | } |
6680 | 6680 | |
6681 | - return $pre . $str . $post; |
|
6681 | + return $pre.$str.$post; |
|
6682 | 6682 | } |
6683 | 6683 | |
6684 | 6684 | return $str; |
@@ -6686,17 +6686,17 @@ discard block |
||
6686 | 6686 | |
6687 | 6687 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6688 | 6688 | |
6689 | - $str_length = (int) self::strlen($str, $encoding); |
|
6689 | + $str_length = (int)self::strlen($str, $encoding); |
|
6690 | 6690 | |
6691 | 6691 | if ($pad_length >= $str_length) { |
6692 | 6692 | switch ($pad_type) { |
6693 | 6693 | case \STR_PAD_LEFT: |
6694 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6694 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6695 | 6695 | |
6696 | 6696 | $diff = ($pad_length - $str_length); |
6697 | 6697 | |
6698 | - $pre = (string) self::substr( |
|
6699 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6698 | + $pre = (string)self::substr( |
|
6699 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6700 | 6700 | 0, |
6701 | 6701 | $diff, |
6702 | 6702 | $encoding |
@@ -6708,17 +6708,17 @@ discard block |
||
6708 | 6708 | case \STR_PAD_BOTH: |
6709 | 6709 | $diff = ($pad_length - $str_length); |
6710 | 6710 | |
6711 | - $ps_length_left = (int) \floor($diff / 2); |
|
6711 | + $ps_length_left = (int)\floor($diff / 2); |
|
6712 | 6712 | |
6713 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6713 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6714 | 6714 | |
6715 | - $pre = (string) self::substr( |
|
6715 | + $pre = (string)self::substr( |
|
6716 | 6716 | \str_repeat($pad_string, $ps_length_left), |
6717 | 6717 | 0, |
6718 | 6718 | $ps_length_left, |
6719 | 6719 | $encoding |
6720 | 6720 | ); |
6721 | - $post = (string) self::substr( |
|
6721 | + $post = (string)self::substr( |
|
6722 | 6722 | \str_repeat($pad_string, $ps_length_right), |
6723 | 6723 | 0, |
6724 | 6724 | $ps_length_right, |
@@ -6729,12 +6729,12 @@ discard block |
||
6729 | 6729 | |
6730 | 6730 | case \STR_PAD_RIGHT: |
6731 | 6731 | default: |
6732 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6732 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6733 | 6733 | |
6734 | 6734 | $diff = ($pad_length - $str_length); |
6735 | 6735 | |
6736 | - $post = (string) self::substr( |
|
6737 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6736 | + $post = (string)self::substr( |
|
6737 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6738 | 6738 | 0, |
6739 | 6739 | $diff, |
6740 | 6740 | $encoding |
@@ -6742,7 +6742,7 @@ discard block |
||
6742 | 6742 | $pre = ''; |
6743 | 6743 | } |
6744 | 6744 | |
6745 | - return $pre . $str . $post; |
|
6745 | + return $pre.$str.$post; |
|
6746 | 6746 | } |
6747 | 6747 | |
6748 | 6748 | return $str; |
@@ -6927,11 +6927,11 @@ discard block |
||
6927 | 6927 | } |
6928 | 6928 | |
6929 | 6929 | if ($search === '') { |
6930 | - return $str . $replacement; |
|
6930 | + return $str.$replacement; |
|
6931 | 6931 | } |
6932 | 6932 | |
6933 | 6933 | if (\strpos($str, $search) === 0) { |
6934 | - return $replacement . \substr($str, \strlen($search)); |
|
6934 | + return $replacement.\substr($str, \strlen($search)); |
|
6935 | 6935 | } |
6936 | 6936 | |
6937 | 6937 | return $str; |
@@ -6963,11 +6963,11 @@ discard block |
||
6963 | 6963 | } |
6964 | 6964 | |
6965 | 6965 | if ($search === '') { |
6966 | - return $str . $replacement; |
|
6966 | + return $str.$replacement; |
|
6967 | 6967 | } |
6968 | 6968 | |
6969 | 6969 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6970 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6970 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6971 | 6971 | } |
6972 | 6972 | |
6973 | 6973 | return $str; |
@@ -6999,7 +6999,7 @@ discard block |
||
6999 | 6999 | $subject, |
7000 | 7000 | $replace, |
7001 | 7001 | $pos, |
7002 | - (int) self::strlen($search) |
|
7002 | + (int)self::strlen($search) |
|
7003 | 7003 | ); |
7004 | 7004 | } |
7005 | 7005 | |
@@ -7031,7 +7031,7 @@ discard block |
||
7031 | 7031 | $subject, |
7032 | 7032 | $replace, |
7033 | 7033 | $pos, |
7034 | - (int) self::strlen($search) |
|
7034 | + (int)self::strlen($search) |
|
7035 | 7035 | ); |
7036 | 7036 | } |
7037 | 7037 | |
@@ -7052,7 +7052,7 @@ discard block |
||
7052 | 7052 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
7053 | 7053 | { |
7054 | 7054 | if ($encoding === 'UTF-8') { |
7055 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
7055 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
7056 | 7056 | /** @noinspection NonSecureShuffleUsageInspection */ |
7057 | 7057 | \shuffle($indexes); |
7058 | 7058 | |
@@ -7068,7 +7068,7 @@ discard block |
||
7068 | 7068 | } else { |
7069 | 7069 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7070 | 7070 | |
7071 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
7071 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
7072 | 7072 | /** @noinspection NonSecureShuffleUsageInspection */ |
7073 | 7073 | \shuffle($indexes); |
7074 | 7074 | |
@@ -7109,11 +7109,11 @@ discard block |
||
7109 | 7109 | ) { |
7110 | 7110 | if ($encoding === 'UTF-8') { |
7111 | 7111 | if ($end === null) { |
7112 | - $length = (int) \mb_strlen($str); |
|
7112 | + $length = (int)\mb_strlen($str); |
|
7113 | 7113 | } elseif ($end >= 0 && $end <= $start) { |
7114 | 7114 | return ''; |
7115 | 7115 | } elseif ($end < 0) { |
7116 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7116 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7117 | 7117 | } else { |
7118 | 7118 | $length = $end - $start; |
7119 | 7119 | } |
@@ -7124,11 +7124,11 @@ discard block |
||
7124 | 7124 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7125 | 7125 | |
7126 | 7126 | if ($end === null) { |
7127 | - $length = (int) self::strlen($str, $encoding); |
|
7127 | + $length = (int)self::strlen($str, $encoding); |
|
7128 | 7128 | } elseif ($end >= 0 && $end <= $start) { |
7129 | 7129 | return ''; |
7130 | 7130 | } elseif ($end < 0) { |
7131 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7131 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7132 | 7132 | } else { |
7133 | 7133 | $length = $end - $start; |
7134 | 7134 | } |
@@ -7161,35 +7161,35 @@ discard block |
||
7161 | 7161 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7162 | 7162 | } |
7163 | 7163 | |
7164 | - $str = (string) \preg_replace_callback( |
|
7164 | + $str = (string)\preg_replace_callback( |
|
7165 | 7165 | '/([\\p{N}|\\p{Lu}])/u', |
7166 | 7166 | /** |
7167 | 7167 | * @param string[] $matches |
7168 | 7168 | * |
7169 | 7169 | * @return string |
7170 | 7170 | */ |
7171 | - static function (array $matches) use ($encoding): string { |
|
7171 | + static function(array $matches) use ($encoding): string { |
|
7172 | 7172 | $match = $matches[1]; |
7173 | - $match_int = (int) $match; |
|
7173 | + $match_int = (int)$match; |
|
7174 | 7174 | |
7175 | - if ((string) $match_int === $match) { |
|
7176 | - return '_' . $match . '_'; |
|
7175 | + if ((string)$match_int === $match) { |
|
7176 | + return '_'.$match.'_'; |
|
7177 | 7177 | } |
7178 | 7178 | |
7179 | 7179 | if ($encoding === 'UTF-8') { |
7180 | - return '_' . \mb_strtolower($match); |
|
7180 | + return '_'.\mb_strtolower($match); |
|
7181 | 7181 | } |
7182 | 7182 | |
7183 | - return '_' . self::strtolower($match, $encoding); |
|
7183 | + return '_'.self::strtolower($match, $encoding); |
|
7184 | 7184 | }, |
7185 | 7185 | $str |
7186 | 7186 | ); |
7187 | 7187 | |
7188 | - $str = (string) \preg_replace( |
|
7188 | + $str = (string)\preg_replace( |
|
7189 | 7189 | [ |
7190 | - '/\\s+/u', // convert spaces to "_" |
|
7190 | + '/\\s+/u', // convert spaces to "_" |
|
7191 | 7191 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
7192 | - '/_+/', // remove double "_" |
|
7192 | + '/_+/', // remove double "_" |
|
7193 | 7193 | ], |
7194 | 7194 | [ |
7195 | 7195 | '_', |
@@ -7266,7 +7266,7 @@ discard block |
||
7266 | 7266 | } |
7267 | 7267 | |
7268 | 7268 | // init |
7269 | - $str = (string) $str; |
|
7269 | + $str = (string)$str; |
|
7270 | 7270 | |
7271 | 7271 | if ($str === '') { |
7272 | 7272 | return []; |
@@ -7317,7 +7317,7 @@ discard block |
||
7317 | 7317 | ($str[$i] & "\xE0") === "\xC0" |
7318 | 7318 | ) { |
7319 | 7319 | if (($str[$i + 1] & "\xC0") === "\x80") { |
7320 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
7320 | + $ret[] = $str[$i].$str[$i + 1]; |
|
7321 | 7321 | |
7322 | 7322 | ++$i; |
7323 | 7323 | } |
@@ -7331,7 +7331,7 @@ discard block |
||
7331 | 7331 | && |
7332 | 7332 | ($str[$i + 2] & "\xC0") === "\x80" |
7333 | 7333 | ) { |
7334 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
7334 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
7335 | 7335 | |
7336 | 7336 | $i += 2; |
7337 | 7337 | } |
@@ -7347,7 +7347,7 @@ discard block |
||
7347 | 7347 | && |
7348 | 7348 | ($str[$i + 3] & "\xC0") === "\x80" |
7349 | 7349 | ) { |
7350 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
7350 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
7351 | 7351 | |
7352 | 7352 | $i += 3; |
7353 | 7353 | } |
@@ -7359,7 +7359,7 @@ discard block |
||
7359 | 7359 | $ret = \array_chunk($ret, $length); |
7360 | 7360 | |
7361 | 7361 | return \array_map( |
7362 | - static function (array &$item): string { |
|
7362 | + static function(array &$item): string { |
|
7363 | 7363 | return \implode('', $item); |
7364 | 7364 | }, |
7365 | 7365 | $ret |
@@ -7423,7 +7423,7 @@ discard block |
||
7423 | 7423 | $limit = -1; |
7424 | 7424 | } |
7425 | 7425 | |
7426 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7426 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7427 | 7427 | |
7428 | 7428 | if ($array === false) { |
7429 | 7429 | return []; |
@@ -7507,9 +7507,9 @@ discard block |
||
7507 | 7507 | return ''; |
7508 | 7508 | } |
7509 | 7509 | |
7510 | - return (string) \mb_substr( |
|
7510 | + return (string)\mb_substr( |
|
7511 | 7511 | $str, |
7512 | - $offset + (int) \mb_strlen($separator) |
|
7512 | + $offset + (int)\mb_strlen($separator) |
|
7513 | 7513 | ); |
7514 | 7514 | } |
7515 | 7515 | |
@@ -7518,9 +7518,9 @@ discard block |
||
7518 | 7518 | return ''; |
7519 | 7519 | } |
7520 | 7520 | |
7521 | - return (string) \mb_substr( |
|
7521 | + return (string)\mb_substr( |
|
7522 | 7522 | $str, |
7523 | - $offset + (int) self::strlen($separator, $encoding), |
|
7523 | + $offset + (int)self::strlen($separator, $encoding), |
|
7524 | 7524 | null, |
7525 | 7525 | $encoding |
7526 | 7526 | ); |
@@ -7547,9 +7547,9 @@ discard block |
||
7547 | 7547 | return ''; |
7548 | 7548 | } |
7549 | 7549 | |
7550 | - return (string) \mb_substr( |
|
7550 | + return (string)\mb_substr( |
|
7551 | 7551 | $str, |
7552 | - $offset + (int) \mb_strlen($separator) |
|
7552 | + $offset + (int)\mb_strlen($separator) |
|
7553 | 7553 | ); |
7554 | 7554 | } |
7555 | 7555 | |
@@ -7558,9 +7558,9 @@ discard block |
||
7558 | 7558 | return ''; |
7559 | 7559 | } |
7560 | 7560 | |
7561 | - return (string) self::substr( |
|
7561 | + return (string)self::substr( |
|
7562 | 7562 | $str, |
7563 | - $offset + (int) self::strlen($separator, $encoding), |
|
7563 | + $offset + (int)self::strlen($separator, $encoding), |
|
7564 | 7564 | null, |
7565 | 7565 | $encoding |
7566 | 7566 | ); |
@@ -7590,7 +7590,7 @@ discard block |
||
7590 | 7590 | return ''; |
7591 | 7591 | } |
7592 | 7592 | |
7593 | - return (string) \mb_substr( |
|
7593 | + return (string)\mb_substr( |
|
7594 | 7594 | $str, |
7595 | 7595 | 0, |
7596 | 7596 | $offset |
@@ -7602,7 +7602,7 @@ discard block |
||
7602 | 7602 | return ''; |
7603 | 7603 | } |
7604 | 7604 | |
7605 | - return (string) self::substr( |
|
7605 | + return (string)self::substr( |
|
7606 | 7606 | $str, |
7607 | 7607 | 0, |
7608 | 7608 | $offset, |
@@ -7631,7 +7631,7 @@ discard block |
||
7631 | 7631 | return ''; |
7632 | 7632 | } |
7633 | 7633 | |
7634 | - return (string) \mb_substr( |
|
7634 | + return (string)\mb_substr( |
|
7635 | 7635 | $str, |
7636 | 7636 | 0, |
7637 | 7637 | $offset |
@@ -7645,7 +7645,7 @@ discard block |
||
7645 | 7645 | |
7646 | 7646 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7647 | 7647 | |
7648 | - return (string) self::substr( |
|
7648 | + return (string)self::substr( |
|
7649 | 7649 | $str, |
7650 | 7650 | 0, |
7651 | 7651 | $offset, |
@@ -7754,7 +7754,7 @@ discard block |
||
7754 | 7754 | */ |
7755 | 7755 | public static function str_surround(string $str, string $substring): string |
7756 | 7756 | { |
7757 | - return $substring . $str . $substring; |
|
7757 | + return $substring.$str.$substring; |
|
7758 | 7758 | } |
7759 | 7759 | |
7760 | 7760 | /** |
@@ -7811,9 +7811,9 @@ discard block |
||
7811 | 7811 | $word_define_chars = ''; |
7812 | 7812 | } |
7813 | 7813 | |
7814 | - $str = (string) \preg_replace_callback( |
|
7815 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
7816 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
7814 | + $str = (string)\preg_replace_callback( |
|
7815 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
7816 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
7817 | 7817 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
7818 | 7818 | return $match[0]; |
7819 | 7819 | } |
@@ -7910,16 +7910,16 @@ discard block |
||
7910 | 7910 | } |
7911 | 7911 | |
7912 | 7912 | // the main substitutions |
7913 | - $str = (string) \preg_replace_callback( |
|
7913 | + $str = (string)\preg_replace_callback( |
|
7914 | 7914 | '~\\b (_*) (?: # 1. Leading underscore and |
7915 | 7915 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
7916 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
7916 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
7917 | 7917 | | |
7918 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
7918 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
7919 | 7919 | | |
7920 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
7920 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
7921 | 7921 | | |
7922 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
7922 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
7923 | 7923 | ) (_*) \\b # 6. With trailing underscore |
7924 | 7924 | ~ux', |
7925 | 7925 | /** |
@@ -7927,7 +7927,7 @@ discard block |
||
7927 | 7927 | * |
7928 | 7928 | * @return string |
7929 | 7929 | */ |
7930 | - static function (array $matches) use ($encoding): string { |
|
7930 | + static function(array $matches) use ($encoding): string { |
|
7931 | 7931 | // preserve leading underscore |
7932 | 7932 | $str = $matches[1]; |
7933 | 7933 | if ($matches[2]) { |
@@ -7952,26 +7952,26 @@ discard block |
||
7952 | 7952 | ); |
7953 | 7953 | |
7954 | 7954 | // Exceptions for small words: capitalize at start of title... |
7955 | - $str = (string) \preg_replace_callback( |
|
7955 | + $str = (string)\preg_replace_callback( |
|
7956 | 7956 | '~( \\A [[:punct:]]* # start of title... |
7957 | 7957 | | [:.;?!][ ]+ # or of subsentence... |
7958 | 7958 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
7959 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
7959 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
7960 | 7960 | ~uxi', |
7961 | 7961 | /** |
7962 | 7962 | * @param string[] $matches |
7963 | 7963 | * |
7964 | 7964 | * @return string |
7965 | 7965 | */ |
7966 | - static function (array $matches) use ($encoding): string { |
|
7967 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
7966 | + static function(array $matches) use ($encoding): string { |
|
7967 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
7968 | 7968 | }, |
7969 | 7969 | $str |
7970 | 7970 | ); |
7971 | 7971 | |
7972 | 7972 | // ...and end of title |
7973 | - $str = (string) \preg_replace_callback( |
|
7974 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
7973 | + $str = (string)\preg_replace_callback( |
|
7974 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
7975 | 7975 | (?= [[:punct:]]* \Z # ...at the end of the title... |
7976 | 7976 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
7977 | 7977 | ~uxi', |
@@ -7980,7 +7980,7 @@ discard block |
||
7980 | 7980 | * |
7981 | 7981 | * @return string |
7982 | 7982 | */ |
7983 | - static function (array $matches) use ($encoding): string { |
|
7983 | + static function(array $matches) use ($encoding): string { |
|
7984 | 7984 | return static::ucfirst($matches[1], $encoding); |
7985 | 7985 | }, |
7986 | 7986 | $str |
@@ -7988,10 +7988,10 @@ discard block |
||
7988 | 7988 | |
7989 | 7989 | // Exceptions for small words in hyphenated compound words. |
7990 | 7990 | // e.g. "in-flight" -> In-Flight |
7991 | - $str = (string) \preg_replace_callback( |
|
7991 | + $str = (string)\preg_replace_callback( |
|
7992 | 7992 | '~\\b |
7993 | 7993 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
7994 | - ( ' . $small_words_rx . ' ) |
|
7994 | + ( ' . $small_words_rx.' ) |
|
7995 | 7995 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
7996 | 7996 | ~uxi', |
7997 | 7997 | /** |
@@ -7999,18 +7999,18 @@ discard block |
||
7999 | 7999 | * |
8000 | 8000 | * @return string |
8001 | 8001 | */ |
8002 | - static function (array $matches) use ($encoding): string { |
|
8002 | + static function(array $matches) use ($encoding): string { |
|
8003 | 8003 | return static::ucfirst($matches[1], $encoding); |
8004 | 8004 | }, |
8005 | 8005 | $str |
8006 | 8006 | ); |
8007 | 8007 | |
8008 | 8008 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
8009 | - $str = (string) \preg_replace_callback( |
|
8009 | + $str = (string)\preg_replace_callback( |
|
8010 | 8010 | '~\\b |
8011 | 8011 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
8012 | 8012 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
8013 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
8013 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
8014 | 8014 | (?! - ) # Negative lookahead for another - |
8015 | 8015 | ~uxi', |
8016 | 8016 | /** |
@@ -8018,8 +8018,8 @@ discard block |
||
8018 | 8018 | * |
8019 | 8019 | * @return string |
8020 | 8020 | */ |
8021 | - static function (array $matches) use ($encoding): string { |
|
8022 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
8021 | + static function(array $matches) use ($encoding): string { |
|
8022 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
8023 | 8023 | }, |
8024 | 8024 | $str |
8025 | 8025 | ); |
@@ -8128,7 +8128,7 @@ discard block |
||
8128 | 8128 | ); |
8129 | 8129 | |
8130 | 8130 | foreach ($tmp_return as &$item) { |
8131 | - $item = (string) $item; |
|
8131 | + $item = (string)$item; |
|
8132 | 8132 | } |
8133 | 8133 | |
8134 | 8134 | return $tmp_return; |
@@ -8178,39 +8178,39 @@ discard block |
||
8178 | 8178 | } |
8179 | 8179 | |
8180 | 8180 | if ($encoding === 'UTF-8') { |
8181 | - if ($length >= (int) \mb_strlen($str)) { |
|
8181 | + if ($length >= (int)\mb_strlen($str)) { |
|
8182 | 8182 | return $str; |
8183 | 8183 | } |
8184 | 8184 | |
8185 | 8185 | if ($substring !== '') { |
8186 | - $length -= (int) \mb_strlen($substring); |
|
8186 | + $length -= (int)\mb_strlen($substring); |
|
8187 | 8187 | |
8188 | 8188 | /** @noinspection UnnecessaryCastingInspection */ |
8189 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
8189 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
8190 | 8190 | } |
8191 | 8191 | |
8192 | 8192 | /** @noinspection UnnecessaryCastingInspection */ |
8193 | - return (string) \mb_substr($str, 0, $length); |
|
8193 | + return (string)\mb_substr($str, 0, $length); |
|
8194 | 8194 | } |
8195 | 8195 | |
8196 | 8196 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8197 | 8197 | |
8198 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8198 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8199 | 8199 | return $str; |
8200 | 8200 | } |
8201 | 8201 | |
8202 | 8202 | if ($substring !== '') { |
8203 | - $length -= (int) self::strlen($substring, $encoding); |
|
8203 | + $length -= (int)self::strlen($substring, $encoding); |
|
8204 | 8204 | } |
8205 | 8205 | |
8206 | 8206 | return ( |
8207 | - (string) self::substr( |
|
8207 | + (string)self::substr( |
|
8208 | 8208 | $str, |
8209 | 8209 | 0, |
8210 | 8210 | $length, |
8211 | 8211 | $encoding |
8212 | 8212 | ) |
8213 | - ) . $substring; |
|
8213 | + ).$substring; |
|
8214 | 8214 | } |
8215 | 8215 | |
8216 | 8216 | /** |
@@ -8241,12 +8241,12 @@ discard block |
||
8241 | 8241 | } |
8242 | 8242 | |
8243 | 8243 | if ($encoding === 'UTF-8') { |
8244 | - if ($length >= (int) \mb_strlen($str)) { |
|
8244 | + if ($length >= (int)\mb_strlen($str)) { |
|
8245 | 8245 | return $str; |
8246 | 8246 | } |
8247 | 8247 | |
8248 | 8248 | // need to further trim the string so we can append the substring |
8249 | - $length -= (int) \mb_strlen($substring); |
|
8249 | + $length -= (int)\mb_strlen($substring); |
|
8250 | 8250 | if ($length <= 0) { |
8251 | 8251 | return $substring; |
8252 | 8252 | } |
@@ -8268,18 +8268,18 @@ discard block |
||
8268 | 8268 | || |
8269 | 8269 | ($space_position !== false && $ignore_do_not_split_words_for_one_word === false) |
8270 | 8270 | ) { |
8271 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
8271 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
8272 | 8272 | } |
8273 | 8273 | } |
8274 | 8274 | } else { |
8275 | 8275 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8276 | 8276 | |
8277 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8277 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8278 | 8278 | return $str; |
8279 | 8279 | } |
8280 | 8280 | |
8281 | 8281 | // need to further trim the string so we can append the substring |
8282 | - $length -= (int) self::strlen($substring, $encoding); |
|
8282 | + $length -= (int)self::strlen($substring, $encoding); |
|
8283 | 8283 | if ($length <= 0) { |
8284 | 8284 | return $substring; |
8285 | 8285 | } |
@@ -8301,12 +8301,12 @@ discard block |
||
8301 | 8301 | || |
8302 | 8302 | ($space_position !== false && $ignore_do_not_split_words_for_one_word === false) |
8303 | 8303 | ) { |
8304 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
8304 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
8305 | 8305 | } |
8306 | 8306 | } |
8307 | 8307 | } |
8308 | 8308 | |
8309 | - return $truncated . $substring; |
|
8309 | + return $truncated.$substring; |
|
8310 | 8310 | } |
8311 | 8311 | |
8312 | 8312 | /** |
@@ -8405,13 +8405,13 @@ discard block |
||
8405 | 8405 | } |
8406 | 8406 | } elseif ($format === 2) { |
8407 | 8407 | $number_of_words = []; |
8408 | - $offset = (int) self::strlen($str_parts[0]); |
|
8408 | + $offset = (int)self::strlen($str_parts[0]); |
|
8409 | 8409 | for ($i = 1; $i < $len; $i += 2) { |
8410 | 8410 | $number_of_words[$offset] = $str_parts[$i]; |
8411 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
8411 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
8412 | 8412 | } |
8413 | 8413 | } else { |
8414 | - $number_of_words = (int) (($len - 1) / 2); |
|
8414 | + $number_of_words = (int)(($len - 1) / 2); |
|
8415 | 8415 | } |
8416 | 8416 | |
8417 | 8417 | return $number_of_words; |
@@ -8532,21 +8532,21 @@ discard block |
||
8532 | 8532 | } |
8533 | 8533 | |
8534 | 8534 | if ($char_list === '') { |
8535 | - return (int) self::strlen($str, $encoding); |
|
8535 | + return (int)self::strlen($str, $encoding); |
|
8536 | 8536 | } |
8537 | 8537 | |
8538 | 8538 | if ($offset !== null || $length !== null) { |
8539 | 8539 | if ($encoding === 'UTF-8') { |
8540 | 8540 | if ($length === null) { |
8541 | 8541 | /** @noinspection UnnecessaryCastingInspection */ |
8542 | - $str_tmp = \mb_substr($str, (int) $offset); |
|
8542 | + $str_tmp = \mb_substr($str, (int)$offset); |
|
8543 | 8543 | } else { |
8544 | 8544 | /** @noinspection UnnecessaryCastingInspection */ |
8545 | - $str_tmp = \mb_substr($str, (int) $offset, $length); |
|
8545 | + $str_tmp = \mb_substr($str, (int)$offset, $length); |
|
8546 | 8546 | } |
8547 | 8547 | } else { |
8548 | 8548 | /** @noinspection UnnecessaryCastingInspection */ |
8549 | - $str_tmp = self::substr($str, (int) $offset, $length, $encoding); |
|
8549 | + $str_tmp = self::substr($str, (int)$offset, $length, $encoding); |
|
8550 | 8550 | } |
8551 | 8551 | |
8552 | 8552 | if ($str_tmp === false) { |
@@ -8562,7 +8562,7 @@ discard block |
||
8562 | 8562 | } |
8563 | 8563 | |
8564 | 8564 | $matches = []; |
8565 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
8565 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
8566 | 8566 | $return = self::strlen($matches[1], $encoding); |
8567 | 8567 | if ($return === false) { |
8568 | 8568 | return 0; |
@@ -8571,7 +8571,7 @@ discard block |
||
8571 | 8571 | return $return; |
8572 | 8572 | } |
8573 | 8573 | |
8574 | - return (int) self::strlen($str, $encoding); |
|
8574 | + return (int)self::strlen($str, $encoding); |
|
8575 | 8575 | } |
8576 | 8576 | |
8577 | 8577 | /** |
@@ -8622,7 +8622,7 @@ discard block |
||
8622 | 8622 | |
8623 | 8623 | $str = ''; |
8624 | 8624 | foreach ($array as $strPart) { |
8625 | - $str .= '&#' . (int) $strPart . ';'; |
|
8625 | + $str .= '&#'.(int)$strPart.';'; |
|
8626 | 8626 | } |
8627 | 8627 | |
8628 | 8628 | return self::html_entity_decode($str, \ENT_QUOTES | \ENT_HTML5); |
@@ -8705,7 +8705,7 @@ discard block |
||
8705 | 8705 | return ''; |
8706 | 8706 | } |
8707 | 8707 | |
8708 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
8708 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
8709 | 8709 | } |
8710 | 8710 | |
8711 | 8711 | /** |
@@ -8770,7 +8770,7 @@ discard block |
||
8770 | 8770 | // fallback for ascii only |
8771 | 8771 | // |
8772 | 8772 | |
8773 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
8773 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
8774 | 8774 | return \stripos($haystack, $needle, $offset); |
8775 | 8775 | } |
8776 | 8776 | |
@@ -8838,7 +8838,7 @@ discard block |
||
8838 | 8838 | && |
8839 | 8839 | self::$SUPPORT['mbstring'] === false |
8840 | 8840 | ) { |
8841 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8841 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8842 | 8842 | } |
8843 | 8843 | |
8844 | 8844 | if ( |
@@ -8852,11 +8852,11 @@ discard block |
||
8852 | 8852 | } |
8853 | 8853 | } |
8854 | 8854 | |
8855 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
8855 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
8856 | 8856 | return \stristr($haystack, $needle, $before_needle); |
8857 | 8857 | } |
8858 | 8858 | |
8859 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
8859 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
8860 | 8860 | |
8861 | 8861 | if (!isset($match[1])) { |
8862 | 8862 | return false; |
@@ -8866,7 +8866,7 @@ discard block |
||
8866 | 8866 | return $match[1]; |
8867 | 8867 | } |
8868 | 8868 | |
8869 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
8869 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
8870 | 8870 | } |
8871 | 8871 | |
8872 | 8872 | /** |
@@ -8938,7 +8938,7 @@ discard block |
||
8938 | 8938 | && |
8939 | 8939 | self::$SUPPORT['iconv'] === false |
8940 | 8940 | ) { |
8941 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8941 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8942 | 8942 | } |
8943 | 8943 | |
8944 | 8944 | // |
@@ -9054,8 +9054,8 @@ discard block |
||
9054 | 9054 | } |
9055 | 9055 | |
9056 | 9056 | return \strnatcmp( |
9057 | - (string) self::strtonatfold($str1), |
|
9058 | - (string) self::strtonatfold($str2) |
|
9057 | + (string)self::strtonatfold($str1), |
|
9058 | + (string)self::strtonatfold($str2) |
|
9059 | 9059 | ); |
9060 | 9060 | } |
9061 | 9061 | |
@@ -9113,11 +9113,11 @@ discard block |
||
9113 | 9113 | } |
9114 | 9114 | |
9115 | 9115 | if ($encoding === 'UTF-8') { |
9116 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
9117 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
9116 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
9117 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
9118 | 9118 | } else { |
9119 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
9120 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
9119 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
9120 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
9121 | 9121 | } |
9122 | 9122 | |
9123 | 9123 | return self::strcmp($str1, $str2); |
@@ -9139,8 +9139,8 @@ discard block |
||
9139 | 9139 | return false; |
9140 | 9140 | } |
9141 | 9141 | |
9142 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
9143 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
9142 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
9143 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
9144 | 9144 | } |
9145 | 9145 | |
9146 | 9146 | return false; |
@@ -9173,10 +9173,10 @@ discard block |
||
9173 | 9173 | } |
9174 | 9174 | |
9175 | 9175 | // iconv and mbstring do not support integer $needle |
9176 | - if ((int) $needle === $needle) { |
|
9177 | - $needle = (string) self::chr($needle); |
|
9176 | + if ((int)$needle === $needle) { |
|
9177 | + $needle = (string)self::chr($needle); |
|
9178 | 9178 | } |
9179 | - $needle = (string) $needle; |
|
9179 | + $needle = (string)$needle; |
|
9180 | 9180 | |
9181 | 9181 | if ($needle === '') { |
9182 | 9182 | return false; |
@@ -9223,7 +9223,7 @@ discard block |
||
9223 | 9223 | && |
9224 | 9224 | self::$SUPPORT['mbstring'] === false |
9225 | 9225 | ) { |
9226 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9226 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9227 | 9227 | } |
9228 | 9228 | |
9229 | 9229 | // |
@@ -9264,7 +9264,7 @@ discard block |
||
9264 | 9264 | // fallback for ascii only |
9265 | 9265 | // |
9266 | 9266 | |
9267 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9267 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9268 | 9268 | return \strpos($haystack, $needle, $offset); |
9269 | 9269 | } |
9270 | 9270 | |
@@ -9276,7 +9276,7 @@ discard block |
||
9276 | 9276 | if ($haystack_tmp === false) { |
9277 | 9277 | $haystack_tmp = ''; |
9278 | 9278 | } |
9279 | - $haystack = (string) $haystack_tmp; |
|
9279 | + $haystack = (string)$haystack_tmp; |
|
9280 | 9280 | |
9281 | 9281 | if ($offset < 0) { |
9282 | 9282 | $offset = 0; |
@@ -9288,7 +9288,7 @@ discard block |
||
9288 | 9288 | } |
9289 | 9289 | |
9290 | 9290 | if ($pos) { |
9291 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9291 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9292 | 9292 | } |
9293 | 9293 | |
9294 | 9294 | return $offset + 0; |
@@ -9399,7 +9399,7 @@ discard block |
||
9399 | 9399 | && |
9400 | 9400 | self::$SUPPORT['mbstring'] === false |
9401 | 9401 | ) { |
9402 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9402 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9403 | 9403 | } |
9404 | 9404 | |
9405 | 9405 | // |
@@ -9411,7 +9411,7 @@ discard block |
||
9411 | 9411 | if ($needle_tmp === false) { |
9412 | 9412 | return false; |
9413 | 9413 | } |
9414 | - $needle = (string) $needle_tmp; |
|
9414 | + $needle = (string)$needle_tmp; |
|
9415 | 9415 | |
9416 | 9416 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
9417 | 9417 | if ($pos === false) { |
@@ -9433,7 +9433,7 @@ discard block |
||
9433 | 9433 | if ($needle_tmp === false) { |
9434 | 9434 | return false; |
9435 | 9435 | } |
9436 | - $needle = (string) $needle_tmp; |
|
9436 | + $needle = (string)$needle_tmp; |
|
9437 | 9437 | |
9438 | 9438 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
9439 | 9439 | if ($pos === false) { |
@@ -9469,7 +9469,7 @@ discard block |
||
9469 | 9469 | if ($encoding === 'UTF-8') { |
9470 | 9470 | if (self::$SUPPORT['intl'] === true) { |
9471 | 9471 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
9472 | - $i = (int) \grapheme_strlen($str); |
|
9472 | + $i = (int)\grapheme_strlen($str); |
|
9473 | 9473 | while ($i--) { |
9474 | 9474 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
9475 | 9475 | if ($reversed_tmp !== false) { |
@@ -9477,7 +9477,7 @@ discard block |
||
9477 | 9477 | } |
9478 | 9478 | } |
9479 | 9479 | } else { |
9480 | - $i = (int) \mb_strlen($str); |
|
9480 | + $i = (int)\mb_strlen($str); |
|
9481 | 9481 | while ($i--) { |
9482 | 9482 | $reversed_tmp = \mb_substr($str, $i, 1); |
9483 | 9483 | if ($reversed_tmp !== false) { |
@@ -9488,7 +9488,7 @@ discard block |
||
9488 | 9488 | } else { |
9489 | 9489 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9490 | 9490 | |
9491 | - $i = (int) self::strlen($str, $encoding); |
|
9491 | + $i = (int)self::strlen($str, $encoding); |
|
9492 | 9492 | while ($i--) { |
9493 | 9493 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
9494 | 9494 | if ($reversed_tmp !== false) { |
@@ -9562,7 +9562,7 @@ discard block |
||
9562 | 9562 | if ($needle_tmp === false) { |
9563 | 9563 | return false; |
9564 | 9564 | } |
9565 | - $needle = (string) $needle_tmp; |
|
9565 | + $needle = (string)$needle_tmp; |
|
9566 | 9566 | |
9567 | 9567 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
9568 | 9568 | if ($pos === false) { |
@@ -9601,10 +9601,10 @@ discard block |
||
9601 | 9601 | } |
9602 | 9602 | |
9603 | 9603 | // iconv and mbstring do not support integer $needle |
9604 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9605 | - $needle = (string) self::chr($needle); |
|
9604 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9605 | + $needle = (string)self::chr($needle); |
|
9606 | 9606 | } |
9607 | - $needle = (string) $needle; |
|
9607 | + $needle = (string)$needle; |
|
9608 | 9608 | |
9609 | 9609 | if ($needle === '') { |
9610 | 9610 | return false; |
@@ -9649,7 +9649,7 @@ discard block |
||
9649 | 9649 | && |
9650 | 9650 | self::$SUPPORT['mbstring'] === false |
9651 | 9651 | ) { |
9652 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9652 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9653 | 9653 | } |
9654 | 9654 | |
9655 | 9655 | // |
@@ -9673,7 +9673,7 @@ discard block |
||
9673 | 9673 | // fallback for ascii only |
9674 | 9674 | // |
9675 | 9675 | |
9676 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9676 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9677 | 9677 | return \strripos($haystack, $needle, $offset); |
9678 | 9678 | } |
9679 | 9679 | |
@@ -9750,10 +9750,10 @@ discard block |
||
9750 | 9750 | } |
9751 | 9751 | |
9752 | 9752 | // iconv and mbstring do not support integer $needle |
9753 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9754 | - $needle = (string) self::chr($needle); |
|
9753 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9754 | + $needle = (string)self::chr($needle); |
|
9755 | 9755 | } |
9756 | - $needle = (string) $needle; |
|
9756 | + $needle = (string)$needle; |
|
9757 | 9757 | |
9758 | 9758 | if ($needle === '') { |
9759 | 9759 | return false; |
@@ -9798,7 +9798,7 @@ discard block |
||
9798 | 9798 | && |
9799 | 9799 | self::$SUPPORT['mbstring'] === false |
9800 | 9800 | ) { |
9801 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9801 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9802 | 9802 | } |
9803 | 9803 | |
9804 | 9804 | // |
@@ -9822,7 +9822,7 @@ discard block |
||
9822 | 9822 | // fallback for ascii only |
9823 | 9823 | // |
9824 | 9824 | |
9825 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9825 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9826 | 9826 | return \strrpos($haystack, $needle, $offset); |
9827 | 9827 | } |
9828 | 9828 | |
@@ -9842,7 +9842,7 @@ discard block |
||
9842 | 9842 | if ($haystack_tmp === false) { |
9843 | 9843 | $haystack_tmp = ''; |
9844 | 9844 | } |
9845 | - $haystack = (string) $haystack_tmp; |
|
9845 | + $haystack = (string)$haystack_tmp; |
|
9846 | 9846 | } |
9847 | 9847 | |
9848 | 9848 | $pos = \strrpos($haystack, $needle); |
@@ -9856,7 +9856,7 @@ discard block |
||
9856 | 9856 | return false; |
9857 | 9857 | } |
9858 | 9858 | |
9859 | - return $offset + (int) self::strlen($str_tmp); |
|
9859 | + return $offset + (int)self::strlen($str_tmp); |
|
9860 | 9860 | } |
9861 | 9861 | |
9862 | 9862 | /** |
@@ -9918,12 +9918,12 @@ discard block |
||
9918 | 9918 | if ($offset || $length !== null) { |
9919 | 9919 | if ($encoding === 'UTF-8') { |
9920 | 9920 | if ($length === null) { |
9921 | - $str = (string) \mb_substr($str, $offset); |
|
9921 | + $str = (string)\mb_substr($str, $offset); |
|
9922 | 9922 | } else { |
9923 | - $str = (string) \mb_substr($str, $offset, $length); |
|
9923 | + $str = (string)\mb_substr($str, $offset, $length); |
|
9924 | 9924 | } |
9925 | 9925 | } else { |
9926 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
9926 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
9927 | 9927 | } |
9928 | 9928 | } |
9929 | 9929 | |
@@ -9933,7 +9933,7 @@ discard block |
||
9933 | 9933 | |
9934 | 9934 | $matches = []; |
9935 | 9935 | |
9936 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
9936 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
9937 | 9937 | } |
9938 | 9938 | |
9939 | 9939 | /** |
@@ -10002,7 +10002,7 @@ discard block |
||
10002 | 10002 | && |
10003 | 10003 | self::$SUPPORT['mbstring'] === false |
10004 | 10004 | ) { |
10005 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10005 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10006 | 10006 | } |
10007 | 10007 | |
10008 | 10008 | // |
@@ -10024,7 +10024,7 @@ discard block |
||
10024 | 10024 | // fallback for ascii only |
10025 | 10025 | // |
10026 | 10026 | |
10027 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10027 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10028 | 10028 | return \strstr($haystack, $needle, $before_needle); |
10029 | 10029 | } |
10030 | 10030 | |
@@ -10032,7 +10032,7 @@ discard block |
||
10032 | 10032 | // fallback via vanilla php |
10033 | 10033 | // |
10034 | 10034 | |
10035 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
10035 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
10036 | 10036 | |
10037 | 10037 | if (!isset($match[1])) { |
10038 | 10038 | return false; |
@@ -10042,7 +10042,7 @@ discard block |
||
10042 | 10042 | return $match[1]; |
10043 | 10043 | } |
10044 | 10044 | |
10045 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
10045 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
10046 | 10046 | } |
10047 | 10047 | |
10048 | 10048 | /** |
@@ -10160,7 +10160,7 @@ discard block |
||
10160 | 10160 | bool $try_to_keep_the_string_length = false |
10161 | 10161 | ): string { |
10162 | 10162 | // init |
10163 | - $str = (string) $str; |
|
10163 | + $str = (string)$str; |
|
10164 | 10164 | |
10165 | 10165 | if ($str === '') { |
10166 | 10166 | return ''; |
@@ -10189,19 +10189,19 @@ discard block |
||
10189 | 10189 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10190 | 10190 | } |
10191 | 10191 | |
10192 | - $language_code = $lang . '-Lower'; |
|
10192 | + $language_code = $lang.'-Lower'; |
|
10193 | 10193 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10194 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
10194 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
10195 | 10195 | |
10196 | 10196 | $language_code = 'Any-Lower'; |
10197 | 10197 | } |
10198 | 10198 | |
10199 | 10199 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10200 | 10200 | /** @noinspection UnnecessaryCastingInspection */ |
10201 | - return (string) \transliterator_transliterate($language_code, $str); |
|
10201 | + return (string)\transliterator_transliterate($language_code, $str); |
|
10202 | 10202 | } |
10203 | 10203 | |
10204 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
10204 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
10205 | 10205 | } |
10206 | 10206 | |
10207 | 10207 | // always fallback via symfony polyfill |
@@ -10230,7 +10230,7 @@ discard block |
||
10230 | 10230 | bool $try_to_keep_the_string_length = false |
10231 | 10231 | ): string { |
10232 | 10232 | // init |
10233 | - $str = (string) $str; |
|
10233 | + $str = (string)$str; |
|
10234 | 10234 | |
10235 | 10235 | if ($str === '') { |
10236 | 10236 | return ''; |
@@ -10259,19 +10259,19 @@ discard block |
||
10259 | 10259 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10260 | 10260 | } |
10261 | 10261 | |
10262 | - $language_code = $lang . '-Upper'; |
|
10262 | + $language_code = $lang.'-Upper'; |
|
10263 | 10263 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10264 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
10264 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
10265 | 10265 | |
10266 | 10266 | $language_code = 'Any-Upper'; |
10267 | 10267 | } |
10268 | 10268 | |
10269 | 10269 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10270 | 10270 | /** @noinspection UnnecessaryCastingInspection */ |
10271 | - return (string) \transliterator_transliterate($language_code, $str); |
|
10271 | + return (string)\transliterator_transliterate($language_code, $str); |
|
10272 | 10272 | } |
10273 | 10273 | |
10274 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
10274 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
10275 | 10275 | } |
10276 | 10276 | |
10277 | 10277 | // always fallback via symfony polyfill |
@@ -10316,7 +10316,7 @@ discard block |
||
10316 | 10316 | $from = \array_combine($from, $to); |
10317 | 10317 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
10318 | 10318 | if ($from === false) { |
10319 | - throw new \InvalidArgumentException('The number of elements for each array isn\'t equal or the arrays are empty: (from: ' . \print_r($from, true) . ' | to: ' . \print_r($to, true) . ')'); |
|
10319 | + throw new \InvalidArgumentException('The number of elements for each array isn\'t equal or the arrays are empty: (from: '.\print_r($from, true).' | to: '.\print_r($to, true).')'); |
|
10320 | 10320 | } |
10321 | 10321 | } |
10322 | 10322 | |
@@ -10376,9 +10376,9 @@ discard block |
||
10376 | 10376 | } |
10377 | 10377 | |
10378 | 10378 | $wide = 0; |
10379 | - $str = (string) \preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $str, -1, $wide); |
|
10379 | + $str = (string)\preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $str, -1, $wide); |
|
10380 | 10380 | |
10381 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
10381 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
10382 | 10382 | } |
10383 | 10383 | |
10384 | 10384 | /** |
@@ -10478,9 +10478,9 @@ discard block |
||
10478 | 10478 | } |
10479 | 10479 | |
10480 | 10480 | if ($length === null) { |
10481 | - $length = (int) $str_length; |
|
10481 | + $length = (int)$str_length; |
|
10482 | 10482 | } else { |
10483 | - $length = (int) $length; |
|
10483 | + $length = (int)$length; |
|
10484 | 10484 | } |
10485 | 10485 | |
10486 | 10486 | if ( |
@@ -10488,7 +10488,7 @@ discard block |
||
10488 | 10488 | && |
10489 | 10489 | self::$SUPPORT['mbstring'] === false |
10490 | 10490 | ) { |
10491 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10491 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10492 | 10492 | } |
10493 | 10493 | |
10494 | 10494 | // |
@@ -10576,16 +10576,16 @@ discard block |
||
10576 | 10576 | ) { |
10577 | 10577 | if ($encoding === 'UTF-8') { |
10578 | 10578 | if ($length === null) { |
10579 | - $str1 = (string) \mb_substr($str1, $offset); |
|
10579 | + $str1 = (string)\mb_substr($str1, $offset); |
|
10580 | 10580 | } else { |
10581 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
10581 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
10582 | 10582 | } |
10583 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
10583 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
10584 | 10584 | } else { |
10585 | 10585 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10586 | 10586 | |
10587 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
10588 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
10587 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
10588 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
10589 | 10589 | } |
10590 | 10590 | } |
10591 | 10591 | |
@@ -10647,13 +10647,13 @@ discard block |
||
10647 | 10647 | if ($length_tmp === false) { |
10648 | 10648 | return false; |
10649 | 10649 | } |
10650 | - $length = (int) $length_tmp; |
|
10650 | + $length = (int)$length_tmp; |
|
10651 | 10651 | } |
10652 | 10652 | |
10653 | 10653 | if ($encoding === 'UTF-8') { |
10654 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
10654 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
10655 | 10655 | } else { |
10656 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
10656 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
10657 | 10657 | } |
10658 | 10658 | } |
10659 | 10659 | |
@@ -10662,7 +10662,7 @@ discard block |
||
10662 | 10662 | && |
10663 | 10663 | self::$SUPPORT['mbstring'] === false |
10664 | 10664 | ) { |
10665 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10665 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10666 | 10666 | } |
10667 | 10667 | |
10668 | 10668 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10673,7 +10673,7 @@ discard block |
||
10673 | 10673 | return \mb_substr_count($haystack, $needle, $encoding); |
10674 | 10674 | } |
10675 | 10675 | |
10676 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10676 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10677 | 10677 | |
10678 | 10678 | return \count($matches); |
10679 | 10679 | } |
@@ -10720,7 +10720,7 @@ discard block |
||
10720 | 10720 | if ($length_tmp === false) { |
10721 | 10721 | return false; |
10722 | 10722 | } |
10723 | - $length = (int) $length_tmp; |
|
10723 | + $length = (int)$length_tmp; |
|
10724 | 10724 | } |
10725 | 10725 | |
10726 | 10726 | if ( |
@@ -10742,7 +10742,7 @@ discard block |
||
10742 | 10742 | if ($haystack_tmp === false) { |
10743 | 10743 | $haystack_tmp = ''; |
10744 | 10744 | } |
10745 | - $haystack = (string) $haystack_tmp; |
|
10745 | + $haystack = (string)$haystack_tmp; |
|
10746 | 10746 | } |
10747 | 10747 | |
10748 | 10748 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10781,10 +10781,10 @@ discard block |
||
10781 | 10781 | |
10782 | 10782 | if ($encoding === 'UTF-8') { |
10783 | 10783 | if ($case_sensitive) { |
10784 | - return (int) \mb_substr_count($str, $substring); |
|
10784 | + return (int)\mb_substr_count($str, $substring); |
|
10785 | 10785 | } |
10786 | 10786 | |
10787 | - return (int) \mb_substr_count( |
|
10787 | + return (int)\mb_substr_count( |
|
10788 | 10788 | \mb_strtoupper($str), |
10789 | 10789 | \mb_strtoupper($substring) |
10790 | 10790 | ); |
@@ -10793,10 +10793,10 @@ discard block |
||
10793 | 10793 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10794 | 10794 | |
10795 | 10795 | if ($case_sensitive) { |
10796 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
10796 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
10797 | 10797 | } |
10798 | 10798 | |
10799 | - return (int) \mb_substr_count( |
|
10799 | + return (int)\mb_substr_count( |
|
10800 | 10800 | self::strtocasefold($str, true, false, $encoding, null, false), |
10801 | 10801 | self::strtocasefold($substring, true, false, $encoding, null, false), |
10802 | 10802 | $encoding |
@@ -10822,7 +10822,7 @@ discard block |
||
10822 | 10822 | } |
10823 | 10823 | |
10824 | 10824 | if (self::str_istarts_with($haystack, $needle) === true) { |
10825 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10825 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10826 | 10826 | } |
10827 | 10827 | |
10828 | 10828 | return $haystack; |
@@ -10879,7 +10879,7 @@ discard block |
||
10879 | 10879 | } |
10880 | 10880 | |
10881 | 10881 | if (self::str_iends_with($haystack, $needle) === true) { |
10882 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
10882 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
10883 | 10883 | } |
10884 | 10884 | |
10885 | 10885 | return $haystack; |
@@ -10904,7 +10904,7 @@ discard block |
||
10904 | 10904 | } |
10905 | 10905 | |
10906 | 10906 | if (self::str_starts_with($haystack, $needle) === true) { |
10907 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10907 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10908 | 10908 | } |
10909 | 10909 | |
10910 | 10910 | return $haystack; |
@@ -10956,7 +10956,7 @@ discard block |
||
10956 | 10956 | if (\is_array($offset) === true) { |
10957 | 10957 | $offset = \array_slice($offset, 0, $num); |
10958 | 10958 | foreach ($offset as &$value_tmp) { |
10959 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
10959 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
10960 | 10960 | } |
10961 | 10961 | unset($value_tmp); |
10962 | 10962 | } else { |
@@ -10969,7 +10969,7 @@ discard block |
||
10969 | 10969 | } elseif (\is_array($length) === true) { |
10970 | 10970 | $length = \array_slice($length, 0, $num); |
10971 | 10971 | foreach ($length as &$value_tmp_V2) { |
10972 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
10972 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
10973 | 10973 | } |
10974 | 10974 | unset($value_tmp_V2); |
10975 | 10975 | } else { |
@@ -10989,8 +10989,8 @@ discard block |
||
10989 | 10989 | } |
10990 | 10990 | |
10991 | 10991 | // init |
10992 | - $str = (string) $str; |
|
10993 | - $replacement = (string) $replacement; |
|
10992 | + $str = (string)$str; |
|
10993 | + $replacement = (string)$replacement; |
|
10994 | 10994 | |
10995 | 10995 | if (\is_array($length) === true) { |
10996 | 10996 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -11005,16 +11005,16 @@ discard block |
||
11005 | 11005 | } |
11006 | 11006 | |
11007 | 11007 | if (self::$SUPPORT['mbstring'] === true) { |
11008 | - $string_length = (int) self::strlen($str, $encoding); |
|
11008 | + $string_length = (int)self::strlen($str, $encoding); |
|
11009 | 11009 | |
11010 | 11010 | if ($offset < 0) { |
11011 | - $offset = (int) \max(0, $string_length + $offset); |
|
11011 | + $offset = (int)\max(0, $string_length + $offset); |
|
11012 | 11012 | } elseif ($offset > $string_length) { |
11013 | 11013 | $offset = $string_length; |
11014 | 11014 | } |
11015 | 11015 | |
11016 | 11016 | if ($length !== null && $length < 0) { |
11017 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
11017 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
11018 | 11018 | } elseif ($length === null || $length > $string_length) { |
11019 | 11019 | $length = $string_length; |
11020 | 11020 | } |
@@ -11025,9 +11025,9 @@ discard block |
||
11025 | 11025 | } |
11026 | 11026 | |
11027 | 11027 | /** @noinspection AdditionOperationOnArraysInspection */ |
11028 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
11029 | - $replacement . |
|
11030 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
11028 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
11029 | + $replacement. |
|
11030 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
11031 | 11031 | } |
11032 | 11032 | |
11033 | 11033 | // |
@@ -11036,8 +11036,7 @@ discard block |
||
11036 | 11036 | |
11037 | 11037 | if (ASCII::is_ascii($str)) { |
11038 | 11038 | return ($length === null) ? |
11039 | - \substr_replace($str, $replacement, $offset) : |
|
11040 | - \substr_replace($str, $replacement, $offset, $length); |
|
11039 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
11041 | 11040 | } |
11042 | 11041 | |
11043 | 11042 | // |
@@ -11053,7 +11052,7 @@ discard block |
||
11053 | 11052 | // e.g.: non mbstring support + invalid chars |
11054 | 11053 | return ''; |
11055 | 11054 | } |
11056 | - $length = (int) $length_tmp; |
|
11055 | + $length = (int)$length_tmp; |
|
11057 | 11056 | } |
11058 | 11057 | |
11059 | 11058 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -11088,14 +11087,14 @@ discard block |
||
11088 | 11087 | && |
11089 | 11088 | \substr($haystack, -\strlen($needle)) === $needle |
11090 | 11089 | ) { |
11091 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
11090 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
11092 | 11091 | } |
11093 | 11092 | |
11094 | 11093 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
11095 | - return (string) self::substr( |
|
11094 | + return (string)self::substr( |
|
11096 | 11095 | $haystack, |
11097 | 11096 | 0, |
11098 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
11097 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
11099 | 11098 | $encoding |
11100 | 11099 | ); |
11101 | 11100 | } |
@@ -11125,10 +11124,10 @@ discard block |
||
11125 | 11124 | } |
11126 | 11125 | |
11127 | 11126 | if ($encoding === 'UTF-8') { |
11128 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
11127 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
11129 | 11128 | } |
11130 | 11129 | |
11131 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
11130 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
11132 | 11131 | } |
11133 | 11132 | |
11134 | 11133 | /** |
@@ -11312,7 +11311,7 @@ discard block |
||
11312 | 11311 | public static function to_boolean($str): bool |
11313 | 11312 | { |
11314 | 11313 | // init |
11315 | - $str = (string) $str; |
|
11314 | + $str = (string)$str; |
|
11316 | 11315 | |
11317 | 11316 | if ($str === '') { |
11318 | 11317 | return false; |
@@ -11340,10 +11339,10 @@ discard block |
||
11340 | 11339 | } |
11341 | 11340 | |
11342 | 11341 | if (\is_numeric($str)) { |
11343 | - return ((float) $str + 0) > 0; |
|
11342 | + return ((float)$str + 0) > 0; |
|
11344 | 11343 | } |
11345 | 11344 | |
11346 | - return (bool) \trim($str); |
|
11345 | + return (bool)\trim($str); |
|
11347 | 11346 | } |
11348 | 11347 | |
11349 | 11348 | /** |
@@ -11385,7 +11384,7 @@ discard block |
||
11385 | 11384 | return $str; |
11386 | 11385 | } |
11387 | 11386 | |
11388 | - $str = (string) $str; |
|
11387 | + $str = (string)$str; |
|
11389 | 11388 | if ($str === '') { |
11390 | 11389 | return ''; |
11391 | 11390 | } |
@@ -11433,7 +11432,7 @@ discard block |
||
11433 | 11432 | return $str; |
11434 | 11433 | } |
11435 | 11434 | |
11436 | - $str = (string) $str; |
|
11435 | + $str = (string)$str; |
|
11437 | 11436 | if ($str === '') { |
11438 | 11437 | return $str; |
11439 | 11438 | } |
@@ -11451,7 +11450,7 @@ discard block |
||
11451 | 11450 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
11452 | 11451 | |
11453 | 11452 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11454 | - $buf .= $c1 . $c2; |
|
11453 | + $buf .= $c1.$c2; |
|
11455 | 11454 | ++$i; |
11456 | 11455 | } else { // not valid UTF8 - convert it |
11457 | 11456 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11462,7 +11461,7 @@ discard block |
||
11462 | 11461 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
11463 | 11462 | |
11464 | 11463 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11465 | - $buf .= $c1 . $c2 . $c3; |
|
11464 | + $buf .= $c1.$c2.$c3; |
|
11466 | 11465 | $i += 2; |
11467 | 11466 | } else { // not valid UTF8 - convert it |
11468 | 11467 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11474,7 +11473,7 @@ discard block |
||
11474 | 11473 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
11475 | 11474 | |
11476 | 11475 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11477 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
11476 | + $buf .= $c1.$c2.$c3.$c4; |
|
11478 | 11477 | $i += 3; |
11479 | 11478 | } else { // not valid UTF8 - convert it |
11480 | 11479 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11500,13 +11499,13 @@ discard block |
||
11500 | 11499 | * |
11501 | 11500 | * @return string |
11502 | 11501 | */ |
11503 | - static function (array $matches): string { |
|
11502 | + static function(array $matches): string { |
|
11504 | 11503 | if (isset($matches[3])) { |
11505 | - $cp = (int) \hexdec($matches[3]); |
|
11504 | + $cp = (int)\hexdec($matches[3]); |
|
11506 | 11505 | } else { |
11507 | 11506 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
11508 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
11509 | - + (int) \hexdec($matches[2]) |
|
11507 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
11508 | + + (int)\hexdec($matches[2]) |
|
11510 | 11509 | + 0x10000 |
11511 | 11510 | - (0xD800 << 10) |
11512 | 11511 | - 0xDC00; |
@@ -11517,12 +11516,12 @@ discard block |
||
11517 | 11516 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
11518 | 11517 | |
11519 | 11518 | if ($cp < 0x80) { |
11520 | - return (string) self::chr($cp); |
|
11519 | + return (string)self::chr($cp); |
|
11521 | 11520 | } |
11522 | 11521 | |
11523 | 11522 | if ($cp < 0xA0) { |
11524 | 11523 | /** @noinspection UnnecessaryCastingInspection */ |
11525 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
11524 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
11526 | 11525 | } |
11527 | 11526 | |
11528 | 11527 | return self::decimal_to_chr($cp); |
@@ -11571,7 +11570,7 @@ discard block |
||
11571 | 11570 | } |
11572 | 11571 | |
11573 | 11572 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11574 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
11573 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
11575 | 11574 | } |
11576 | 11575 | |
11577 | 11576 | if ($chars) { |
@@ -11615,15 +11614,15 @@ discard block |
||
11615 | 11614 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
11616 | 11615 | |
11617 | 11616 | if ($encoding === 'UTF-8') { |
11618 | - $str_part_two = (string) \mb_substr($str, 1); |
|
11617 | + $str_part_two = (string)\mb_substr($str, 1); |
|
11619 | 11618 | |
11620 | 11619 | if ($use_mb_functions === true) { |
11621 | 11620 | $str_part_one = \mb_strtoupper( |
11622 | - (string) \mb_substr($str, 0, 1) |
|
11621 | + (string)\mb_substr($str, 0, 1) |
|
11623 | 11622 | ); |
11624 | 11623 | } else { |
11625 | 11624 | $str_part_one = self::strtoupper( |
11626 | - (string) \mb_substr($str, 0, 1), |
|
11625 | + (string)\mb_substr($str, 0, 1), |
|
11627 | 11626 | $encoding, |
11628 | 11627 | false, |
11629 | 11628 | $lang, |
@@ -11633,16 +11632,16 @@ discard block |
||
11633 | 11632 | } else { |
11634 | 11633 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11635 | 11634 | |
11636 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
11635 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
11637 | 11636 | |
11638 | 11637 | if ($use_mb_functions === true) { |
11639 | 11638 | $str_part_one = \mb_strtoupper( |
11640 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
11639 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
11641 | 11640 | $encoding |
11642 | 11641 | ); |
11643 | 11642 | } else { |
11644 | 11643 | $str_part_one = self::strtoupper( |
11645 | - (string) self::substr($str, 0, 1, $encoding), |
|
11644 | + (string)self::substr($str, 0, 1, $encoding), |
|
11646 | 11645 | $encoding, |
11647 | 11646 | false, |
11648 | 11647 | $lang, |
@@ -11651,7 +11650,7 @@ discard block |
||
11651 | 11650 | } |
11652 | 11651 | } |
11653 | 11652 | |
11654 | - return $str_part_one . $str_part_two; |
|
11653 | + return $str_part_one.$str_part_two; |
|
11655 | 11654 | } |
11656 | 11655 | |
11657 | 11656 | /** |
@@ -11706,7 +11705,7 @@ discard block |
||
11706 | 11705 | $str = self::clean($str); |
11707 | 11706 | } |
11708 | 11707 | |
11709 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
11708 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
11710 | 11709 | |
11711 | 11710 | if ( |
11712 | 11711 | $use_php_default_functions === true |
@@ -12111,7 +12110,7 @@ discard block |
||
12111 | 12110 | if ( |
12112 | 12111 | $keep_utf8_chars === true |
12113 | 12112 | && |
12114 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
12113 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
12115 | 12114 | ) { |
12116 | 12115 | return $str_backup; |
12117 | 12116 | } |
@@ -12190,17 +12189,17 @@ discard block |
||
12190 | 12189 | return ''; |
12191 | 12190 | } |
12192 | 12191 | |
12193 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
12192 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
12194 | 12193 | |
12195 | 12194 | if ( |
12196 | 12195 | !isset($matches[0]) |
12197 | 12196 | || |
12198 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
12197 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
12199 | 12198 | ) { |
12200 | 12199 | return $str; |
12201 | 12200 | } |
12202 | 12201 | |
12203 | - return \rtrim($matches[0]) . $str_add_on; |
|
12202 | + return \rtrim($matches[0]).$str_add_on; |
|
12204 | 12203 | } |
12205 | 12204 | |
12206 | 12205 | /** |
@@ -12287,7 +12286,7 @@ discard block |
||
12287 | 12286 | } |
12288 | 12287 | } |
12289 | 12288 | |
12290 | - return $str_return . \implode('', $chars); |
|
12289 | + return $str_return.\implode('', $chars); |
|
12291 | 12290 | } |
12292 | 12291 | |
12293 | 12292 | /** |
@@ -12339,7 +12338,7 @@ discard block |
||
12339 | 12338 | $final_break = ''; |
12340 | 12339 | } |
12341 | 12340 | |
12342 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
12341 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
12343 | 12342 | } |
12344 | 12343 | |
12345 | 12344 | /** |
@@ -12561,7 +12560,7 @@ discard block |
||
12561 | 12560 | /** @noinspection PhpIncludeInspection */ |
12562 | 12561 | /** @noinspection UsingInclusionReturnValueInspection */ |
12563 | 12562 | /** @psalm-suppress UnresolvableInclude */ |
12564 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
12563 | + return include __DIR__.'/data/'.$file.'.php'; |
|
12565 | 12564 | } |
12566 | 12565 | |
12567 | 12566 | /** |
@@ -12576,7 +12575,7 @@ discard block |
||
12576 | 12575 | |
12577 | 12576 | \uksort( |
12578 | 12577 | self::$EMOJI, |
12579 | - static function (string $a, string $b): int { |
|
12578 | + static function(string $a, string $b): int { |
|
12580 | 12579 | return \strlen($b) <=> \strlen($a); |
12581 | 12580 | } |
12582 | 12581 | ); |
@@ -12586,7 +12585,7 @@ discard block |
||
12586 | 12585 | |
12587 | 12586 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
12588 | 12587 | $tmp_key = \crc32($key); |
12589 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
12588 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
12590 | 12589 | } |
12591 | 12590 | |
12592 | 12591 | return true; |
@@ -12612,7 +12611,7 @@ discard block |
||
12612 | 12611 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
12613 | 12612 | return \defined('MB_OVERLOAD_STRING') |
12614 | 12613 | && |
12615 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12614 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12616 | 12615 | } |
12617 | 12616 | |
12618 | 12617 | /** |
@@ -12669,7 +12668,7 @@ discard block |
||
12669 | 12668 | { |
12670 | 12669 | static $RX_CLASS_CACHE = []; |
12671 | 12670 | |
12672 | - $cache_key = $s . $class; |
|
12671 | + $cache_key = $s.$class; |
|
12673 | 12672 | |
12674 | 12673 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
12675 | 12674 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -12681,7 +12680,7 @@ discard block |
||
12681 | 12680 | /** @noinspection AlterInForeachInspection */ |
12682 | 12681 | foreach (self::str_split($s) as &$s) { |
12683 | 12682 | if ($s === '-') { |
12684 | - $class_array[0] = '-' . $class_array[0]; |
|
12683 | + $class_array[0] = '-'.$class_array[0]; |
|
12685 | 12684 | } elseif (!isset($s[2])) { |
12686 | 12685 | $class_array[0] .= \preg_quote($s, '/'); |
12687 | 12686 | } elseif (self::strlen($s) === 1) { |
@@ -12692,13 +12691,13 @@ discard block |
||
12692 | 12691 | } |
12693 | 12692 | |
12694 | 12693 | if ($class_array[0]) { |
12695 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
12694 | + $class_array[0] = '['.$class_array[0].']'; |
|
12696 | 12695 | } |
12697 | 12696 | |
12698 | 12697 | if (\count($class_array) === 1) { |
12699 | 12698 | $return = $class_array[0]; |
12700 | 12699 | } else { |
12701 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
12700 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
12702 | 12701 | } |
12703 | 12702 | |
12704 | 12703 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -12777,7 +12776,7 @@ discard block |
||
12777 | 12776 | |
12778 | 12777 | if ($delimiter === '-') { |
12779 | 12778 | /** @noinspection AlterInForeachInspection */ |
12780 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
12779 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
12781 | 12780 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12782 | 12781 | $continue = true; |
12783 | 12782 | } |
@@ -12785,7 +12784,7 @@ discard block |
||
12785 | 12784 | } |
12786 | 12785 | |
12787 | 12786 | /** @noinspection AlterInForeachInspection */ |
12788 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
12787 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
12789 | 12788 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12790 | 12789 | $continue = true; |
12791 | 12790 | } |
@@ -12848,8 +12847,8 @@ discard block |
||
12848 | 12847 | } else { |
12849 | 12848 | /** @noinspection OffsetOperationsInspection */ |
12850 | 12849 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
12851 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
12852 | - $buf .= $cc1 . $cc2; |
|
12850 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
12851 | + $buf .= $cc1.$cc2; |
|
12853 | 12852 | } |
12854 | 12853 | |
12855 | 12854 | return $buf; |
@@ -12866,7 +12865,7 @@ discard block |
||
12866 | 12865 | { |
12867 | 12866 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
12868 | 12867 | if (\preg_match($pattern, $str)) { |
12869 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
12868 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
12870 | 12869 | } |
12871 | 12870 | |
12872 | 12871 | return $str; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | return false; |
81 | 81 | } |
82 | 82 | |
83 | - $uri = (string) $_SERVER['REQUEST_URI']; |
|
83 | + $uri = (string)$_SERVER['REQUEST_URI']; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | $uriOrig = $uri; |
@@ -97,27 +97,27 @@ discard block |
||
97 | 97 | // When not, assumes Windows-1252 and redirects to the corresponding UTF-8 encoded URL |
98 | 98 | // |
99 | 99 | |
100 | - $uri = (string) \preg_replace_callback( |
|
100 | + $uri = (string)\preg_replace_callback( |
|
101 | 101 | '/[\x80-\xFF]+/', |
102 | 102 | /** |
103 | 103 | * @param array $m |
104 | 104 | * |
105 | 105 | * @return string |
106 | 106 | */ |
107 | - static function (array $m): string { |
|
107 | + static function(array $m): string { |
|
108 | 108 | return \rawurlencode($m[0]); |
109 | 109 | }, |
110 | 110 | $uri |
111 | 111 | ); |
112 | 112 | |
113 | - $uri = (string) \preg_replace_callback( |
|
113 | + $uri = (string)\preg_replace_callback( |
|
114 | 114 | '/(?:%[89A-F][0-9A-F])+/i', |
115 | 115 | /** |
116 | 116 | * @param array $m |
117 | 117 | * |
118 | 118 | * @return string |
119 | 119 | */ |
120 | - static function (array $m): string { |
|
120 | + static function(array $m): string { |
|
121 | 121 | return \rawurlencode(UTF8::rawurldecode($m[0])); |
122 | 122 | }, |
123 | 123 | $uri |
@@ -131,19 +131,19 @@ discard block |
||
131 | 131 | \headers_sent() === false |
132 | 132 | ) { |
133 | 133 | $severProtocol = ($_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'); |
134 | - \header($severProtocol . ' 301 Moved Permanently'); |
|
134 | + \header($severProtocol.' 301 Moved Permanently'); |
|
135 | 135 | |
136 | 136 | if (\strncmp($uri, '/', 1) === 0) { |
137 | - \header('Location: /' . \ltrim($uri, '/')); |
|
137 | + \header('Location: /'.\ltrim($uri, '/')); |
|
138 | 138 | } else { |
139 | - \header('Location: ' . $uri); |
|
139 | + \header('Location: '.$uri); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | exit(); |
143 | 143 | } |
144 | 144 | |
145 | 145 | if (\strncmp($uri, '/', 1) === 0) { |
146 | - $uri = '/' . \ltrim($uri, '/'); |
|
146 | + $uri = '/'.\ltrim($uri, '/'); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | return $uri; |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | return false; |
187 | 187 | } |
188 | 188 | |
189 | - $length = (int) $length; |
|
189 | + $length = (int)$length; |
|
190 | 190 | |
191 | 191 | if ($length <= 0) { |
192 | 192 | return false; |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | { |
220 | 220 | static $_IS_PHP; |
221 | 221 | |
222 | - $version = (string) $version; |
|
222 | + $version = (string)$version; |
|
223 | 223 | |
224 | 224 | if (!isset($_IS_PHP[$version])) { |
225 | 225 | $_IS_PHP[$version] = \version_compare(\PHP_VERSION, $version, '>='); |