@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | return false; |
71 | 71 | } |
72 | 72 | |
73 | - $uri = (string) $_SERVER['REQUEST_URI']; |
|
73 | + $uri = (string)$_SERVER['REQUEST_URI']; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | $uriOrig = $uri; |
@@ -87,27 +87,27 @@ discard block |
||
87 | 87 | // When not, assumes Windows-1252 and redirects to the corresponding UTF-8 encoded URL |
88 | 88 | // |
89 | 89 | |
90 | - $uri = (string) \preg_replace_callback( |
|
90 | + $uri = (string)\preg_replace_callback( |
|
91 | 91 | '/[\x80-\xFF]+/', |
92 | 92 | /** |
93 | 93 | * @param array $m |
94 | 94 | * |
95 | 95 | * @return string |
96 | 96 | */ |
97 | - static function (array $m): string { |
|
97 | + static function(array $m): string { |
|
98 | 98 | return \rawurlencode($m[0]); |
99 | 99 | }, |
100 | 100 | $uri |
101 | 101 | ); |
102 | 102 | |
103 | - $uri = (string) \preg_replace_callback( |
|
103 | + $uri = (string)\preg_replace_callback( |
|
104 | 104 | '/(?:%[89A-F][0-9A-F])+/i', |
105 | 105 | /** |
106 | 106 | * @param array $m |
107 | 107 | * |
108 | 108 | * @return string |
109 | 109 | */ |
110 | - static function (array $m): string { |
|
110 | + static function(array $m): string { |
|
111 | 111 | return \rawurlencode(UTF8::rawurldecode($m[0])); |
112 | 112 | }, |
113 | 113 | $uri |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | ) { |
123 | 123 | // Use ob_start() to buffer content and avoid problem of headers already sent... |
124 | 124 | $severProtocol = ($_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'); |
125 | - \header($severProtocol . ' 301 Moved Permanently'); |
|
126 | - \header('Location: ' . $uri); |
|
125 | + \header($severProtocol.' 301 Moved Permanently'); |
|
126 | + \header('Location: '.$uri); |
|
127 | 127 | exit(); |
128 | 128 | } |
129 | 129 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | return false; |
161 | 161 | } |
162 | 162 | |
163 | - $length = (int) $length; |
|
163 | + $length = (int)$length; |
|
164 | 164 | |
165 | 165 | if ($length <= 0) { |
166 | 166 | return false; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | { |
192 | 192 | static $_IS_PHP; |
193 | 193 | |
194 | - $version = (string) $version; |
|
194 | + $version = (string)$version; |
|
195 | 195 | |
196 | 196 | if (!isset($_IS_PHP[$version])) { |
197 | 197 | $_IS_PHP[$version] = \version_compare(\PHP_VERSION, $version, '>='); |
@@ -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 | ]; |
@@ -602,22 +602,22 @@ discard block |
||
602 | 602 | * @psalm-suppress PossiblyNullArrayAccess |
603 | 603 | */ |
604 | 604 | $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
605 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
605 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
606 | 606 | } elseif ($code_point <= 0xFFFF) { |
607 | 607 | /** |
608 | 608 | * @psalm-suppress PossiblyNullArrayAccess |
609 | 609 | */ |
610 | 610 | $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
611 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
612 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
611 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
612 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
613 | 613 | } else { |
614 | 614 | /** |
615 | 615 | * @psalm-suppress PossiblyNullArrayAccess |
616 | 616 | */ |
617 | 617 | $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
618 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
619 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
620 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
618 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
619 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
620 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
621 | 621 | } |
622 | 622 | |
623 | 623 | if ($encoding !== 'UTF-8') { |
@@ -5804,8 +5804,8 @@ discard block |
||
5804 | 5804 | |
5805 | 5805 | /** @noinspection UnnecessaryCastingInspection */ |
5806 | 5806 | return (string) \mb_substr($str, 0, $index) . |
5807 | - $substring . |
|
5808 | - (string) \mb_substr($str, $index, $len); |
|
5807 | + $substring . |
|
5808 | + (string) \mb_substr($str, $index, $len); |
|
5809 | 5809 | } |
5810 | 5810 | |
5811 | 5811 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -5816,8 +5816,8 @@ discard block |
||
5816 | 5816 | } |
5817 | 5817 | |
5818 | 5818 | return ((string) self::substr($str, 0, $index, $encoding)) . |
5819 | - $substring . |
|
5820 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5819 | + $substring . |
|
5820 | + ((string) self::substr($str, $index, $len, $encoding)); |
|
5821 | 5821 | } |
5822 | 5822 | |
5823 | 5823 | /** |
@@ -7757,11 +7757,11 @@ discard block |
||
7757 | 7757 | if ($useMbFunction === true) { |
7758 | 7758 | if ($encoding === 'UTF-8') { |
7759 | 7759 | return \mb_strtoupper(\mb_substr($match[0], 0, 1)) |
7760 | - . \mb_strtolower(\mb_substr($match[0], 1)); |
|
7760 | + . \mb_strtolower(\mb_substr($match[0], 1)); |
|
7761 | 7761 | } |
7762 | 7762 | |
7763 | 7763 | return \mb_strtoupper(\mb_substr($match[0], 0, 1, $encoding), $encoding) |
7764 | - . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
7764 | + . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
7765 | 7765 | } |
7766 | 7766 | |
7767 | 7767 | return self::ucfirst( |
@@ -8118,13 +8118,13 @@ discard block |
||
8118 | 8118 | } |
8119 | 8119 | |
8120 | 8120 | return ( |
8121 | - (string) self::substr( |
|
8122 | - $str, |
|
8123 | - 0, |
|
8124 | - $length, |
|
8125 | - $encoding |
|
8126 | - ) |
|
8127 | - ) . $substring; |
|
8121 | + (string) self::substr( |
|
8122 | + $str, |
|
8123 | + 0, |
|
8124 | + $length, |
|
8125 | + $encoding |
|
8126 | + ) |
|
8127 | + ) . $substring; |
|
8128 | 8128 | } |
8129 | 8129 | |
8130 | 8130 | /** |
@@ -10864,8 +10864,8 @@ discard block |
||
10864 | 10864 | |
10865 | 10865 | /** @noinspection AdditionOperationOnArraysInspection */ |
10866 | 10866 | return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
10867 | - $replacement . |
|
10868 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10867 | + $replacement . |
|
10868 | + ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10869 | 10869 | } |
10870 | 10870 | |
10871 | 10871 | // |
@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | } |
261 | 261 | |
262 | 262 | if ($encoding === 'UTF-8') { |
263 | - return (string) \mb_substr($str, $pos, 1); |
|
263 | + return (string)\mb_substr($str, $pos, 1); |
|
264 | 264 | } |
265 | 265 | |
266 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
266 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | public static function add_bom_to_string(string $str): string |
279 | 279 | { |
280 | 280 | if (self::string_has_bom($str) === false) { |
281 | - $str = self::bom() . $str; |
|
281 | + $str = self::bom().$str; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | return $str; |
@@ -307,8 +307,8 @@ discard block |
||
307 | 307 | $return = []; |
308 | 308 | foreach ($array as $key => &$value) { |
309 | 309 | $key = $case === \CASE_LOWER |
310 | - ? self::strtolower((string) $key, $encoding) |
|
311 | - : self::strtoupper((string) $key, $encoding); |
|
310 | + ? self::strtolower((string)$key, $encoding) |
|
311 | + : self::strtoupper((string)$key, $encoding); |
|
312 | 312 | |
313 | 313 | $return[$key] = $value; |
314 | 314 | } |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | return ''; |
343 | 343 | } |
344 | 344 | |
345 | - $substrIndex = $posStart + (int) \mb_strlen($start); |
|
345 | + $substrIndex = $posStart + (int)\mb_strlen($start); |
|
346 | 346 | $posEnd = \mb_strpos($str, $end, $substrIndex); |
347 | 347 | if ( |
348 | 348 | $posEnd === false |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | return ''; |
353 | 353 | } |
354 | 354 | |
355 | - return (string) \mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
355 | + return (string)\mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | return ''; |
363 | 363 | } |
364 | 364 | |
365 | - $substrIndex = $posStart + (int) self::strlen($start, $encoding); |
|
365 | + $substrIndex = $posStart + (int)self::strlen($start, $encoding); |
|
366 | 366 | $posEnd = self::strpos($str, $end, $substrIndex, $encoding); |
367 | 367 | if ( |
368 | 368 | $posEnd === false |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | return ''; |
373 | 373 | } |
374 | 374 | |
375 | - return (string) self::substr( |
|
375 | + return (string)self::substr( |
|
376 | 376 | $str, |
377 | 377 | $substrIndex, |
378 | 378 | $posEnd - $substrIndex, |
@@ -440,10 +440,10 @@ discard block |
||
440 | 440 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
441 | 441 | { |
442 | 442 | if ($encoding === 'UTF-8') { |
443 | - return (string) \mb_substr($str, $index, 1); |
|
443 | + return (string)\mb_substr($str, $index, 1); |
|
444 | 444 | } |
445 | 445 | |
446 | - return (string) self::substr($str, $index, 1, $encoding); |
|
446 | + return (string)self::substr($str, $index, 1, $encoding); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
@@ -542,10 +542,10 @@ discard block |
||
542 | 542 | && |
543 | 543 | self::$SUPPORT['mbstring'] === false |
544 | 544 | ) { |
545 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
545 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
546 | 546 | } |
547 | 547 | |
548 | - $cacheKey = $code_point . $encoding; |
|
548 | + $cacheKey = $code_point.$encoding; |
|
549 | 549 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
550 | 550 | return $CHAR_CACHE[$cacheKey]; |
551 | 551 | } |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | if ($code_point <= 127) { // use "simple"-char only until "\x80" |
554 | 554 | |
555 | 555 | if (self::$CHR === null) { |
556 | - self::$CHR = (array) self::getData('chr'); |
|
556 | + self::$CHR = (array)self::getData('chr'); |
|
557 | 557 | } |
558 | 558 | |
559 | 559 | /** |
@@ -588,10 +588,10 @@ discard block |
||
588 | 588 | // |
589 | 589 | |
590 | 590 | if (self::$CHR === null) { |
591 | - self::$CHR = (array) self::getData('chr'); |
|
591 | + self::$CHR = (array)self::getData('chr'); |
|
592 | 592 | } |
593 | 593 | |
594 | - $code_point = (int) $code_point; |
|
594 | + $code_point = (int)$code_point; |
|
595 | 595 | if ($code_point <= 0x7F) { |
596 | 596 | /** |
597 | 597 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -601,22 +601,22 @@ discard block |
||
601 | 601 | /** |
602 | 602 | * @psalm-suppress PossiblyNullArrayAccess |
603 | 603 | */ |
604 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
604 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
605 | 605 | self::$CHR[($code_point & 0x3F) + 0x80]; |
606 | 606 | } elseif ($code_point <= 0xFFFF) { |
607 | 607 | /** |
608 | 608 | * @psalm-suppress PossiblyNullArrayAccess |
609 | 609 | */ |
610 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
611 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
610 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
611 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
612 | 612 | self::$CHR[($code_point & 0x3F) + 0x80]; |
613 | 613 | } else { |
614 | 614 | /** |
615 | 615 | * @psalm-suppress PossiblyNullArrayAccess |
616 | 616 | */ |
617 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
618 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
619 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
617 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
618 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
619 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
620 | 620 | self::$CHR[($code_point & 0x3F) + 0x80]; |
621 | 621 | } |
622 | 622 | |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | |
664 | 664 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
665 | 665 | return \array_map( |
666 | - static function (string $data): int { |
|
666 | + static function(string $data): int { |
|
667 | 667 | // "mb_" is available if overload is used, so use it ... |
668 | 668 | return \mb_strlen($data, 'CP850'); // 8-BIT |
669 | 669 | }, |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | $char = ''; |
732 | 732 | } |
733 | 733 | |
734 | - return self::int_to_hex(self::ord((string) $char), $pfix); |
|
734 | + return self::int_to_hex(self::ord((string)$char), $pfix); |
|
735 | 735 | } |
736 | 736 | |
737 | 737 | /** |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | | ( [\x80-\xBF] ) # invalid byte in range 10000000 - 10111111 |
806 | 806 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
807 | 807 | /x'; |
808 | - $str = (string) \preg_replace($regx, '$1', $str); |
|
808 | + $str = (string)\preg_replace($regx, '$1', $str); |
|
809 | 809 | |
810 | 810 | if ($replace_diamond_question_mark === true) { |
811 | 811 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | public static function cleanup($str): string |
841 | 841 | { |
842 | 842 | // init |
843 | - $str = (string) $str; |
|
843 | + $str = (string)$str; |
|
844 | 844 | |
845 | 845 | if ($str === '') { |
846 | 846 | return ''; |
@@ -923,7 +923,7 @@ discard block |
||
923 | 923 | { |
924 | 924 | if (self::$SUPPORT['mbstring'] === true) { |
925 | 925 | /** @noinspection PhpComposerExtensionStubsInspection */ |
926 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
926 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
927 | 927 | } |
928 | 928 | |
929 | 929 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | */ |
964 | 964 | public static function css_stripe_media_queries(string $str): string |
965 | 965 | { |
966 | - return (string) \preg_replace( |
|
966 | + return (string)\preg_replace( |
|
967 | 967 | '#@media\\s+(?:only\\s)?(?:[\\s{\\(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
968 | 968 | '', |
969 | 969 | $str |
@@ -990,7 +990,7 @@ discard block |
||
990 | 990 | */ |
991 | 991 | public static function decimal_to_chr($int): string |
992 | 992 | { |
993 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
993 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
994 | 994 | } |
995 | 995 | |
996 | 996 | /** |
@@ -1035,16 +1035,16 @@ discard block |
||
1035 | 1035 | self::initEmojiData(); |
1036 | 1036 | |
1037 | 1037 | if ($useReversibleStringMapping === true) { |
1038 | - return (string) \str_replace( |
|
1039 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1040 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1038 | + return (string)\str_replace( |
|
1039 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1040 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1041 | 1041 | $str |
1042 | 1042 | ); |
1043 | 1043 | } |
1044 | 1044 | |
1045 | - return (string) \str_replace( |
|
1046 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1047 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1045 | + return (string)\str_replace( |
|
1046 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1047 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1048 | 1048 | $str |
1049 | 1049 | ); |
1050 | 1050 | } |
@@ -1064,16 +1064,16 @@ discard block |
||
1064 | 1064 | self::initEmojiData(); |
1065 | 1065 | |
1066 | 1066 | if ($useReversibleStringMapping === true) { |
1067 | - return (string) \str_replace( |
|
1068 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1069 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1067 | + return (string)\str_replace( |
|
1068 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1069 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1070 | 1070 | $str |
1071 | 1071 | ); |
1072 | 1072 | } |
1073 | 1073 | |
1074 | - return (string) \str_replace( |
|
1075 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1076 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1074 | + return (string)\str_replace( |
|
1075 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1076 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1077 | 1077 | $str |
1078 | 1078 | ); |
1079 | 1079 | } |
@@ -1127,7 +1127,7 @@ discard block |
||
1127 | 1127 | if ($toEncoding === 'JSON') { |
1128 | 1128 | $return = self::json_encode($str); |
1129 | 1129 | if ($return === false) { |
1130 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1130 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1131 | 1131 | } |
1132 | 1132 | |
1133 | 1133 | return $return; |
@@ -1213,7 +1213,7 @@ discard block |
||
1213 | 1213 | && |
1214 | 1214 | self::$SUPPORT['mbstring'] === false |
1215 | 1215 | ) { |
1216 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $toEncoding . '" encoding', \E_USER_WARNING); |
|
1216 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$toEncoding.'" encoding', \E_USER_WARNING); |
|
1217 | 1217 | } |
1218 | 1218 | |
1219 | 1219 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1307,31 +1307,31 @@ discard block |
||
1307 | 1307 | $trimChars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1308 | 1308 | |
1309 | 1309 | if ($length === null) { |
1310 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
1310 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
1311 | 1311 | } |
1312 | 1312 | |
1313 | 1313 | if ($search === '') { |
1314 | 1314 | if ($encoding === 'UTF-8') { |
1315 | 1315 | if ($length > 0) { |
1316 | - $stringLength = (int) \mb_strlen($str); |
|
1316 | + $stringLength = (int)\mb_strlen($str); |
|
1317 | 1317 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
1318 | 1318 | } else { |
1319 | 1319 | $end = 0; |
1320 | 1320 | } |
1321 | 1321 | |
1322 | - $pos = (int) \min( |
|
1322 | + $pos = (int)\min( |
|
1323 | 1323 | \mb_strpos($str, ' ', $end), |
1324 | 1324 | \mb_strpos($str, '.', $end) |
1325 | 1325 | ); |
1326 | 1326 | } else { |
1327 | 1327 | if ($length > 0) { |
1328 | - $stringLength = (int) self::strlen($str, $encoding); |
|
1328 | + $stringLength = (int)self::strlen($str, $encoding); |
|
1329 | 1329 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
1330 | 1330 | } else { |
1331 | 1331 | $end = 0; |
1332 | 1332 | } |
1333 | 1333 | |
1334 | - $pos = (int) \min( |
|
1334 | + $pos = (int)\min( |
|
1335 | 1335 | self::strpos($str, ' ', $end, $encoding), |
1336 | 1336 | self::strpos($str, '.', $end, $encoding) |
1337 | 1337 | ); |
@@ -1348,18 +1348,18 @@ discard block |
||
1348 | 1348 | return ''; |
1349 | 1349 | } |
1350 | 1350 | |
1351 | - return \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1351 | + return \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1352 | 1352 | } |
1353 | 1353 | |
1354 | 1354 | return $str; |
1355 | 1355 | } |
1356 | 1356 | |
1357 | 1357 | if ($encoding === 'UTF-8') { |
1358 | - $wordPos = (int) \mb_stripos($str, $search); |
|
1359 | - $halfSide = (int) ($wordPos - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1358 | + $wordPos = (int)\mb_stripos($str, $search); |
|
1359 | + $halfSide = (int)($wordPos - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1360 | 1360 | } else { |
1361 | - $wordPos = (int) self::stripos($str, $search, 0, $encoding); |
|
1362 | - $halfSide = (int) ($wordPos - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1361 | + $wordPos = (int)self::stripos($str, $search, 0, $encoding); |
|
1362 | + $halfSide = (int)($wordPos - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1363 | 1363 | } |
1364 | 1364 | |
1365 | 1365 | $pos_start = 0; |
@@ -1371,12 +1371,12 @@ discard block |
||
1371 | 1371 | } |
1372 | 1372 | if ($halfText !== false) { |
1373 | 1373 | if ($encoding === 'UTF-8') { |
1374 | - $pos_start = (int) \max( |
|
1374 | + $pos_start = (int)\max( |
|
1375 | 1375 | \mb_strrpos($halfText, ' '), |
1376 | 1376 | \mb_strrpos($halfText, '.') |
1377 | 1377 | ); |
1378 | 1378 | } else { |
1379 | - $pos_start = (int) \max( |
|
1379 | + $pos_start = (int)\max( |
|
1380 | 1380 | self::strrpos($halfText, ' ', 0, $encoding), |
1381 | 1381 | self::strrpos($halfText, '.', 0, $encoding) |
1382 | 1382 | ); |
@@ -1386,19 +1386,19 @@ discard block |
||
1386 | 1386 | |
1387 | 1387 | if ($wordPos && $halfSide > 0) { |
1388 | 1388 | $offset = $pos_start + $length - 1; |
1389 | - $realLength = (int) self::strlen($str, $encoding); |
|
1389 | + $realLength = (int)self::strlen($str, $encoding); |
|
1390 | 1390 | |
1391 | 1391 | if ($offset > $realLength) { |
1392 | 1392 | $offset = $realLength; |
1393 | 1393 | } |
1394 | 1394 | |
1395 | 1395 | if ($encoding === 'UTF-8') { |
1396 | - $pos_end = (int) \min( |
|
1396 | + $pos_end = (int)\min( |
|
1397 | 1397 | \mb_strpos($str, ' ', $offset), |
1398 | 1398 | \mb_strpos($str, '.', $offset) |
1399 | 1399 | ) - $pos_start; |
1400 | 1400 | } else { |
1401 | - $pos_end = (int) \min( |
|
1401 | + $pos_end = (int)\min( |
|
1402 | 1402 | self::strpos($str, ' ', $offset, $encoding), |
1403 | 1403 | self::strpos($str, '.', $offset, $encoding) |
1404 | 1404 | ) - $pos_start; |
@@ -1406,12 +1406,12 @@ discard block |
||
1406 | 1406 | |
1407 | 1407 | if (!$pos_end || $pos_end <= 0) { |
1408 | 1408 | if ($encoding === 'UTF-8') { |
1409 | - $strSub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1409 | + $strSub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1410 | 1410 | } else { |
1411 | - $strSub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1411 | + $strSub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1412 | 1412 | } |
1413 | 1413 | if ($strSub !== false) { |
1414 | - $extract = $replacerForSkippedText . \ltrim($strSub, $trimChars); |
|
1414 | + $extract = $replacerForSkippedText.\ltrim($strSub, $trimChars); |
|
1415 | 1415 | } else { |
1416 | 1416 | $extract = ''; |
1417 | 1417 | } |
@@ -1422,26 +1422,26 @@ discard block |
||
1422 | 1422 | $strSub = self::substr($str, $pos_start, $pos_end, $encoding); |
1423 | 1423 | } |
1424 | 1424 | if ($strSub !== false) { |
1425 | - $extract = $replacerForSkippedText . \trim($strSub, $trimChars) . $replacerForSkippedText; |
|
1425 | + $extract = $replacerForSkippedText.\trim($strSub, $trimChars).$replacerForSkippedText; |
|
1426 | 1426 | } else { |
1427 | 1427 | $extract = ''; |
1428 | 1428 | } |
1429 | 1429 | } |
1430 | 1430 | } else { |
1431 | 1431 | $offset = $length - 1; |
1432 | - $trueLength = (int) self::strlen($str, $encoding); |
|
1432 | + $trueLength = (int)self::strlen($str, $encoding); |
|
1433 | 1433 | |
1434 | 1434 | if ($offset > $trueLength) { |
1435 | 1435 | $offset = $trueLength; |
1436 | 1436 | } |
1437 | 1437 | |
1438 | 1438 | if ($encoding === 'UTF-8') { |
1439 | - $pos_end = (int) \min( |
|
1439 | + $pos_end = (int)\min( |
|
1440 | 1440 | \mb_strpos($str, ' ', $offset), |
1441 | 1441 | \mb_strpos($str, '.', $offset) |
1442 | 1442 | ); |
1443 | 1443 | } else { |
1444 | - $pos_end = (int) \min( |
|
1444 | + $pos_end = (int)\min( |
|
1445 | 1445 | self::strpos($str, ' ', $offset, $encoding), |
1446 | 1446 | self::strpos($str, '.', $offset, $encoding) |
1447 | 1447 | ); |
@@ -1454,7 +1454,7 @@ discard block |
||
1454 | 1454 | $strSub = self::substr($str, 0, $pos_end, $encoding); |
1455 | 1455 | } |
1456 | 1456 | if ($strSub !== false) { |
1457 | - $extract = \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1457 | + $extract = \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1458 | 1458 | } else { |
1459 | 1459 | $extract = ''; |
1460 | 1460 | } |
@@ -1578,7 +1578,7 @@ discard block |
||
1578 | 1578 | { |
1579 | 1579 | $file_content = \file_get_contents($file_path); |
1580 | 1580 | if ($file_content === false) { |
1581 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1581 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1582 | 1582 | } |
1583 | 1583 | |
1584 | 1584 | return self::string_has_bom($file_content); |
@@ -1639,7 +1639,7 @@ discard block |
||
1639 | 1639 | ) { |
1640 | 1640 | // Prevent leading combining chars |
1641 | 1641 | // for NFC-safe concatenations. |
1642 | - $var = $leading_combining . $var; |
|
1642 | + $var = $leading_combining.$var; |
|
1643 | 1643 | } |
1644 | 1644 | } |
1645 | 1645 | |
@@ -1878,10 +1878,10 @@ discard block |
||
1878 | 1878 | } |
1879 | 1879 | |
1880 | 1880 | if ($encoding === 'UTF-8') { |
1881 | - return (string) \mb_substr($str, 0, $n); |
|
1881 | + return (string)\mb_substr($str, 0, $n); |
|
1882 | 1882 | } |
1883 | 1883 | |
1884 | - return (string) self::substr($str, 0, $n, $encoding); |
|
1884 | + return (string)self::substr($str, 0, $n, $encoding); |
|
1885 | 1885 | } |
1886 | 1886 | |
1887 | 1887 | /** |
@@ -1956,7 +1956,7 @@ discard block |
||
1956 | 1956 | return $str; |
1957 | 1957 | } |
1958 | 1958 | |
1959 | - $str = (string) $str; |
|
1959 | + $str = (string)$str; |
|
1960 | 1960 | $last = ''; |
1961 | 1961 | while ($last !== $str) { |
1962 | 1962 | $last = $str; |
@@ -2144,7 +2144,7 @@ discard block |
||
2144 | 2144 | if ($str_info === false) { |
2145 | 2145 | return $fallback; |
2146 | 2146 | } |
2147 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2147 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2148 | 2148 | |
2149 | 2149 | // DEBUG |
2150 | 2150 | //var_dump($type_code); |
@@ -2239,7 +2239,7 @@ discard block |
||
2239 | 2239 | // |
2240 | 2240 | |
2241 | 2241 | if ($encoding === 'UTF-8') { |
2242 | - $maxlength = (int) \mb_strlen($possibleChars); |
|
2242 | + $maxlength = (int)\mb_strlen($possibleChars); |
|
2243 | 2243 | if ($maxlength === 0) { |
2244 | 2244 | return ''; |
2245 | 2245 | } |
@@ -2260,7 +2260,7 @@ discard block |
||
2260 | 2260 | } else { |
2261 | 2261 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2262 | 2262 | |
2263 | - $maxlength = (int) self::strlen($possibleChars, $encoding); |
|
2263 | + $maxlength = (int)self::strlen($possibleChars, $encoding); |
|
2264 | 2264 | if ($maxlength === 0) { |
2265 | 2265 | return ''; |
2266 | 2266 | } |
@@ -2291,16 +2291,16 @@ discard block |
||
2291 | 2291 | */ |
2292 | 2292 | public static function get_unique_string($entropyExtra = '', bool $md5 = true): string |
2293 | 2293 | { |
2294 | - $uniqueHelper = \random_int(0, \mt_getrandmax()) . |
|
2295 | - \session_id() . |
|
2296 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2297 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2294 | + $uniqueHelper = \random_int(0, \mt_getrandmax()). |
|
2295 | + \session_id(). |
|
2296 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2297 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2298 | 2298 | $entropyExtra; |
2299 | 2299 | |
2300 | 2300 | $uniqueString = \uniqid($uniqueHelper, true); |
2301 | 2301 | |
2302 | 2302 | if ($md5) { |
2303 | - $uniqueString = \md5($uniqueString . $uniqueHelper); |
|
2303 | + $uniqueString = \md5($uniqueString.$uniqueHelper); |
|
2304 | 2304 | } |
2305 | 2305 | |
2306 | 2306 | return $uniqueString; |
@@ -2379,7 +2379,7 @@ discard block |
||
2379 | 2379 | public static function hex_to_int($hexDec) |
2380 | 2380 | { |
2381 | 2381 | // init |
2382 | - $hexDec = (string) $hexDec; |
|
2382 | + $hexDec = (string)$hexDec; |
|
2383 | 2383 | |
2384 | 2384 | if ($hexDec === '') { |
2385 | 2385 | return false; |
@@ -2457,7 +2457,7 @@ discard block |
||
2457 | 2457 | return \implode( |
2458 | 2458 | '', |
2459 | 2459 | \array_map( |
2460 | - static function (string $chr) use ($keepAsciiChars, $encoding): string { |
|
2460 | + static function(string $chr) use ($keepAsciiChars, $encoding): string { |
|
2461 | 2461 | return self::single_chr_html_encode($chr, $keepAsciiChars, $encoding); |
2462 | 2462 | }, |
2463 | 2463 | self::str_split($str) |
@@ -2561,7 +2561,7 @@ discard block |
||
2561 | 2561 | && |
2562 | 2562 | self::$SUPPORT['mbstring'] === false |
2563 | 2563 | ) { |
2564 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2564 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2565 | 2565 | } |
2566 | 2566 | |
2567 | 2567 | do { |
@@ -2582,14 +2582,14 @@ discard block |
||
2582 | 2582 | ); |
2583 | 2583 | } |
2584 | 2584 | } else { |
2585 | - $str = (string) \preg_replace_callback( |
|
2585 | + $str = (string)\preg_replace_callback( |
|
2586 | 2586 | "/&#\d{2,6};/", |
2587 | 2587 | /** |
2588 | 2588 | * @param string[] $matches |
2589 | 2589 | * |
2590 | 2590 | * @return string |
2591 | 2591 | */ |
2592 | - static function (array $matches) use ($encoding): string { |
|
2592 | + static function(array $matches) use ($encoding): string { |
|
2593 | 2593 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
2594 | 2594 | if ($returnTmp !== '"' && $returnTmp !== "'") { |
2595 | 2595 | return $returnTmp; |
@@ -2604,7 +2604,7 @@ discard block |
||
2604 | 2604 | if (\strpos($str, '&') !== false) { |
2605 | 2605 | if (\strpos($str, '&#') !== false) { |
2606 | 2606 | // decode also numeric & UTF16 two byte entities |
2607 | - $str = (string) \preg_replace( |
|
2607 | + $str = (string)\preg_replace( |
|
2608 | 2608 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
2609 | 2609 | '$1;', |
2610 | 2610 | $str |
@@ -2650,7 +2650,7 @@ discard block |
||
2650 | 2650 | */ |
2651 | 2651 | public static function html_stripe_empty_tags(string $str): string |
2652 | 2652 | { |
2653 | - return (string) \preg_replace( |
|
2653 | + return (string)\preg_replace( |
|
2654 | 2654 | "/<[^\/>]*>(([\s]?)*|)<\/[^>]*>/u", |
2655 | 2655 | '', |
2656 | 2656 | $str |
@@ -2949,9 +2949,9 @@ discard block |
||
2949 | 2949 | { |
2950 | 2950 | $hex = \dechex($int); |
2951 | 2951 | |
2952 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
2952 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
2953 | 2953 | |
2954 | - return $pfix . $hex . ''; |
|
2954 | + return $pfix.$hex.''; |
|
2955 | 2955 | } |
2956 | 2956 | |
2957 | 2957 | /** |
@@ -3209,7 +3209,7 @@ discard block |
||
3209 | 3209 | */ |
3210 | 3210 | public static function is_binary($input, bool $strict = false): bool |
3211 | 3211 | { |
3212 | - $input = (string) $input; |
|
3212 | + $input = (string)$input; |
|
3213 | 3213 | if ($input === '') { |
3214 | 3214 | return false; |
3215 | 3215 | } |
@@ -3468,7 +3468,7 @@ discard block |
||
3468 | 3468 | public static function is_utf16($str, $checkIfStringIsBinary = true) |
3469 | 3469 | { |
3470 | 3470 | // init |
3471 | - $str = (string) $str; |
|
3471 | + $str = (string)$str; |
|
3472 | 3472 | $strChars = []; |
3473 | 3473 | |
3474 | 3474 | if ( |
@@ -3546,7 +3546,7 @@ discard block |
||
3546 | 3546 | public static function is_utf32($str, $checkIfStringIsBinary = true) |
3547 | 3547 | { |
3548 | 3548 | // init |
3549 | - $str = (string) $str; |
|
3549 | + $str = (string)$str; |
|
3550 | 3550 | $strChars = []; |
3551 | 3551 | |
3552 | 3552 | if ( |
@@ -3666,7 +3666,7 @@ discard block |
||
3666 | 3666 | self::$ORD = self::getData('ord'); |
3667 | 3667 | } |
3668 | 3668 | |
3669 | - $len = \strlen((string) $str); |
|
3669 | + $len = \strlen((string)$str); |
|
3670 | 3670 | /** @noinspection ForeachInvariantsInspection */ |
3671 | 3671 | for ($i = 0; $i < $len; ++$i) { |
3672 | 3672 | $in = self::$ORD[$str[$i]]; |
@@ -3903,15 +3903,15 @@ discard block |
||
3903 | 3903 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
3904 | 3904 | |
3905 | 3905 | if ($encoding === 'UTF-8') { |
3906 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
3906 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
3907 | 3907 | |
3908 | 3908 | if ($useMbFunction === true) { |
3909 | 3909 | $strPartOne = \mb_strtolower( |
3910 | - (string) \mb_substr($str, 0, 1) |
|
3910 | + (string)\mb_substr($str, 0, 1) |
|
3911 | 3911 | ); |
3912 | 3912 | } else { |
3913 | 3913 | $strPartOne = self::strtolower( |
3914 | - (string) \mb_substr($str, 0, 1), |
|
3914 | + (string)\mb_substr($str, 0, 1), |
|
3915 | 3915 | $encoding, |
3916 | 3916 | false, |
3917 | 3917 | $lang, |
@@ -3921,10 +3921,10 @@ discard block |
||
3921 | 3921 | } else { |
3922 | 3922 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
3923 | 3923 | |
3924 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
3924 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
3925 | 3925 | |
3926 | 3926 | $strPartOne = self::strtolower( |
3927 | - (string) self::substr($str, 0, 1, $encoding), |
|
3927 | + (string)self::substr($str, 0, 1, $encoding), |
|
3928 | 3928 | $encoding, |
3929 | 3929 | false, |
3930 | 3930 | $lang, |
@@ -3932,7 +3932,7 @@ discard block |
||
3932 | 3932 | ); |
3933 | 3933 | } |
3934 | 3934 | |
3935 | - return $strPartOne . $strPartTwo; |
|
3935 | + return $strPartOne.$strPartTwo; |
|
3936 | 3936 | } |
3937 | 3937 | |
3938 | 3938 | /** |
@@ -4051,7 +4051,7 @@ discard block |
||
4051 | 4051 | |
4052 | 4052 | if (self::$SUPPORT['mbstring'] === true) { |
4053 | 4053 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4054 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4054 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4055 | 4055 | } |
4056 | 4056 | |
4057 | 4057 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -4092,7 +4092,7 @@ discard block |
||
4092 | 4092 | { |
4093 | 4093 | $bytes = self::chr_size_list($str); |
4094 | 4094 | if (\count($bytes) > 0) { |
4095 | - return (int) \max($bytes); |
|
4095 | + return (int)\max($bytes); |
|
4096 | 4096 | } |
4097 | 4097 | |
4098 | 4098 | return 0; |
@@ -4161,7 +4161,7 @@ discard block |
||
4161 | 4161 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4162 | 4162 | |
4163 | 4163 | // init |
4164 | - $encoding = (string) $encoding; |
|
4164 | + $encoding = (string)$encoding; |
|
4165 | 4165 | |
4166 | 4166 | if (!$encoding) { |
4167 | 4167 | return $fallback; |
@@ -4215,7 +4215,7 @@ discard block |
||
4215 | 4215 | |
4216 | 4216 | $encodingOrig = $encoding; |
4217 | 4217 | $encoding = \strtoupper($encoding); |
4218 | - $encodingUpperHelper = (string) \preg_replace('/[^a-zA-Z0-9\s]/u', '', $encoding); |
|
4218 | + $encodingUpperHelper = (string)\preg_replace('/[^a-zA-Z0-9\s]/u', '', $encoding); |
|
4219 | 4219 | |
4220 | 4220 | $equivalences = [ |
4221 | 4221 | 'ISO8859' => 'ISO-8859-1', |
@@ -4373,7 +4373,7 @@ discard block |
||
4373 | 4373 | } |
4374 | 4374 | |
4375 | 4375 | static $WHITESPACE_CACHE = []; |
4376 | - $cacheKey = (int) $keepNonBreakingSpace; |
|
4376 | + $cacheKey = (int)$keepNonBreakingSpace; |
|
4377 | 4377 | |
4378 | 4378 | if (!isset($WHITESPACE_CACHE[$cacheKey])) { |
4379 | 4379 | $WHITESPACE_CACHE[$cacheKey] = self::$WHITESPACE_TABLE; |
@@ -4415,13 +4415,13 @@ discard block |
||
4415 | 4415 | static $CHAR_CACHE = []; |
4416 | 4416 | |
4417 | 4417 | // init |
4418 | - $chr = (string) $chr; |
|
4418 | + $chr = (string)$chr; |
|
4419 | 4419 | |
4420 | 4420 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
4421 | 4421 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4422 | 4422 | } |
4423 | 4423 | |
4424 | - $cacheKey = $chr . $encoding; |
|
4424 | + $cacheKey = $chr.$encoding; |
|
4425 | 4425 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
4426 | 4426 | return $CHAR_CACHE[$cacheKey]; |
4427 | 4427 | } |
@@ -4456,22 +4456,22 @@ discard block |
||
4456 | 4456 | // |
4457 | 4457 | |
4458 | 4458 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
4459 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
4459 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
4460 | 4460 | $code = $chr ? $chr[1] : 0; |
4461 | 4461 | |
4462 | 4462 | if ($code >= 0xF0 && isset($chr[4])) { |
4463 | 4463 | /** @noinspection UnnecessaryCastingInspection */ |
4464 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4464 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4465 | 4465 | } |
4466 | 4466 | |
4467 | 4467 | if ($code >= 0xE0 && isset($chr[3])) { |
4468 | 4468 | /** @noinspection UnnecessaryCastingInspection */ |
4469 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4469 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4470 | 4470 | } |
4471 | 4471 | |
4472 | 4472 | if ($code >= 0xC0 && isset($chr[2])) { |
4473 | 4473 | /** @noinspection UnnecessaryCastingInspection */ |
4474 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4474 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4475 | 4475 | } |
4476 | 4476 | |
4477 | 4477 | return $CHAR_CACHE[$cacheKey] = $code; |
@@ -4520,7 +4520,7 @@ discard block |
||
4520 | 4520 | public static function pcre_utf8_support(): bool |
4521 | 4521 | { |
4522 | 4522 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4523 | - return (bool) @\preg_match('//u', ''); |
|
4523 | + return (bool)@\preg_match('//u', ''); |
|
4524 | 4524 | } |
4525 | 4525 | |
4526 | 4526 | /** |
@@ -4542,10 +4542,10 @@ discard block |
||
4542 | 4542 | } |
4543 | 4543 | |
4544 | 4544 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4545 | - if (\ctype_digit((string) $var1)) { |
|
4546 | - $start = (int) $var1; |
|
4545 | + if (\ctype_digit((string)$var1)) { |
|
4546 | + $start = (int)$var1; |
|
4547 | 4547 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var1)) { |
4548 | - $start = (int) self::hex_to_int($var1); |
|
4548 | + $start = (int)self::hex_to_int($var1); |
|
4549 | 4549 | } else { |
4550 | 4550 | $start = self::ord($var1); |
4551 | 4551 | } |
@@ -4555,10 +4555,10 @@ discard block |
||
4555 | 4555 | } |
4556 | 4556 | |
4557 | 4557 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4558 | - if (\ctype_digit((string) $var2)) { |
|
4559 | - $end = (int) $var2; |
|
4558 | + if (\ctype_digit((string)$var2)) { |
|
4559 | + $end = (int)$var2; |
|
4560 | 4560 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var2)) { |
4561 | - $end = (int) self::hex_to_int($var2); |
|
4561 | + $end = (int)self::hex_to_int($var2); |
|
4562 | 4562 | } else { |
4563 | 4563 | $end = self::ord($var2); |
4564 | 4564 | } |
@@ -4568,8 +4568,8 @@ discard block |
||
4568 | 4568 | } |
4569 | 4569 | |
4570 | 4570 | return \array_map( |
4571 | - static function (int $i): string { |
|
4572 | - return (string) self::chr($i); |
|
4571 | + static function(int $i): string { |
|
4572 | + return (string)self::chr($i); |
|
4573 | 4573 | }, |
4574 | 4574 | \range($start, $end) |
4575 | 4575 | ); |
@@ -4660,8 +4660,8 @@ discard block |
||
4660 | 4660 | $delimiter = '/'; |
4661 | 4661 | } |
4662 | 4662 | |
4663 | - return (string) \preg_replace( |
|
4664 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4663 | + return (string)\preg_replace( |
|
4664 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4665 | 4665 | $replacement, |
4666 | 4666 | $str |
4667 | 4667 | ); |
@@ -4703,9 +4703,9 @@ discard block |
||
4703 | 4703 | return ''; |
4704 | 4704 | } |
4705 | 4705 | |
4706 | - $strLength -= (int) $bomByteLength; |
|
4706 | + $strLength -= (int)$bomByteLength; |
|
4707 | 4707 | |
4708 | - $str = (string) $strTmp; |
|
4708 | + $str = (string)$strTmp; |
|
4709 | 4709 | } |
4710 | 4710 | } |
4711 | 4711 | |
@@ -4729,7 +4729,7 @@ discard block |
||
4729 | 4729 | if (\is_array($what) === true) { |
4730 | 4730 | /** @noinspection ForeachSourceInspection */ |
4731 | 4731 | foreach ($what as $item) { |
4732 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
4732 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
4733 | 4733 | } |
4734 | 4734 | } |
4735 | 4735 | |
@@ -4761,7 +4761,7 @@ discard block |
||
4761 | 4761 | */ |
4762 | 4762 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
4763 | 4763 | { |
4764 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4764 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4765 | 4765 | } |
4766 | 4766 | |
4767 | 4767 | /** |
@@ -4792,7 +4792,7 @@ discard block |
||
4792 | 4792 | $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
4793 | 4793 | |
4794 | 4794 | do { |
4795 | - $str = (string) \preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4795 | + $str = (string)\preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4796 | 4796 | } while ($count !== 0); |
4797 | 4797 | |
4798 | 4798 | return $str; |
@@ -4811,17 +4811,17 @@ discard block |
||
4811 | 4811 | { |
4812 | 4812 | if ($substring && \strpos($str, $substring) === 0) { |
4813 | 4813 | if ($encoding === 'UTF-8') { |
4814 | - return (string) \mb_substr( |
|
4814 | + return (string)\mb_substr( |
|
4815 | 4815 | $str, |
4816 | - (int) \mb_strlen($substring) |
|
4816 | + (int)\mb_strlen($substring) |
|
4817 | 4817 | ); |
4818 | 4818 | } |
4819 | 4819 | |
4820 | 4820 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4821 | 4821 | |
4822 | - return (string) self::substr( |
|
4822 | + return (string)self::substr( |
|
4823 | 4823 | $str, |
4824 | - (int) self::strlen($substring, $encoding), |
|
4824 | + (int)self::strlen($substring, $encoding), |
|
4825 | 4825 | null, |
4826 | 4826 | $encoding |
4827 | 4827 | ); |
@@ -4843,19 +4843,19 @@ discard block |
||
4843 | 4843 | { |
4844 | 4844 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
4845 | 4845 | if ($encoding === 'UTF-8') { |
4846 | - return (string) \mb_substr( |
|
4846 | + return (string)\mb_substr( |
|
4847 | 4847 | $str, |
4848 | 4848 | 0, |
4849 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
4849 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
4850 | 4850 | ); |
4851 | 4851 | } |
4852 | 4852 | |
4853 | 4853 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4854 | 4854 | |
4855 | - return (string) self::substr( |
|
4855 | + return (string)self::substr( |
|
4856 | 4856 | $str, |
4857 | 4857 | 0, |
4858 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
4858 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
4859 | 4859 | $encoding |
4860 | 4860 | ); |
4861 | 4861 | } |
@@ -4939,7 +4939,7 @@ discard block |
||
4939 | 4939 | $save = \mb_substitute_character(); |
4940 | 4940 | \mb_substitute_character($replacementCharHelper); |
4941 | 4941 | // the polyfill maybe return false, so cast to string |
4942 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4942 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4943 | 4943 | \mb_substitute_character($save); |
4944 | 4944 | } |
4945 | 4945 | |
@@ -4979,7 +4979,7 @@ discard block |
||
4979 | 4979 | |
4980 | 4980 | if (self::$SUPPORT['mbstring'] === true) { |
4981 | 4981 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4982 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4982 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4983 | 4983 | } |
4984 | 4984 | |
4985 | 4985 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -4994,7 +4994,7 @@ discard block |
||
4994 | 4994 | { |
4995 | 4995 | echo '<pre>'; |
4996 | 4996 | foreach (self::$SUPPORT as $key => &$value) { |
4997 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
4997 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
4998 | 4998 | } |
4999 | 4999 | unset($value); |
5000 | 5000 | echo '</pre>'; |
@@ -5023,7 +5023,7 @@ discard block |
||
5023 | 5023 | return $char; |
5024 | 5024 | } |
5025 | 5025 | |
5026 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
5026 | + return '&#'.self::ord($char, $encoding).';'; |
|
5027 | 5027 | } |
5028 | 5028 | |
5029 | 5029 | /** |
@@ -5114,18 +5114,18 @@ discard block |
||
5114 | 5114 | $lang, |
5115 | 5115 | $tryToKeepStringLength |
5116 | 5116 | ); |
5117 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5117 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5118 | 5118 | |
5119 | 5119 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5120 | 5120 | |
5121 | - $str = (string) \preg_replace_callback( |
|
5121 | + $str = (string)\preg_replace_callback( |
|
5122 | 5122 | '/[-_\s]+(.)?/u', |
5123 | 5123 | /** |
5124 | 5124 | * @param array $match |
5125 | 5125 | * |
5126 | 5126 | * @return string |
5127 | 5127 | */ |
5128 | - static function (array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5128 | + static function(array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5129 | 5129 | if (isset($match[1])) { |
5130 | 5130 | if ($useMbFunction === true) { |
5131 | 5131 | if ($encoding === 'UTF-8') { |
@@ -5143,14 +5143,14 @@ discard block |
||
5143 | 5143 | $str |
5144 | 5144 | ); |
5145 | 5145 | |
5146 | - return (string) \preg_replace_callback( |
|
5146 | + return (string)\preg_replace_callback( |
|
5147 | 5147 | '/[\d]+(.)?/u', |
5148 | 5148 | /** |
5149 | 5149 | * @param array $match |
5150 | 5150 | * |
5151 | 5151 | * @return string |
5152 | 5152 | */ |
5153 | - static function (array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5153 | + static function(array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5154 | 5154 | if ($useMbFunction === true) { |
5155 | 5155 | if ($encoding === 'UTF-8') { |
5156 | 5156 | return \mb_strtoupper($match[0]); |
@@ -5328,7 +5328,7 @@ discard block |
||
5328 | 5328 | ): string { |
5329 | 5329 | if (self::$SUPPORT['mbstring'] === true) { |
5330 | 5330 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5331 | - $str = (string) \mb_ereg_replace('\B(\p{Lu})', '-\1', \trim($str)); |
|
5331 | + $str = (string)\mb_ereg_replace('\B(\p{Lu})', '-\1', \trim($str)); |
|
5332 | 5332 | |
5333 | 5333 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5334 | 5334 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5338,10 +5338,10 @@ discard block |
||
5338 | 5338 | } |
5339 | 5339 | |
5340 | 5340 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5341 | - return (string) \mb_ereg_replace('[\-_\s]+', $delimiter, $str); |
|
5341 | + return (string)\mb_ereg_replace('[\-_\s]+', $delimiter, $str); |
|
5342 | 5342 | } |
5343 | 5343 | |
5344 | - $str = (string) \preg_replace('/\B(\p{Lu})/u', '-\1', \trim($str)); |
|
5344 | + $str = (string)\preg_replace('/\B(\p{Lu})/u', '-\1', \trim($str)); |
|
5345 | 5345 | |
5346 | 5346 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5347 | 5347 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5350,7 +5350,7 @@ discard block |
||
5350 | 5350 | $str = self::strtolower($str, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
5351 | 5351 | } |
5352 | 5352 | |
5353 | - return (string) \preg_replace('/[\-_\s]+/u', $delimiter, $str); |
|
5353 | + return (string)\preg_replace('/[\-_\s]+/u', $delimiter, $str); |
|
5354 | 5354 | } |
5355 | 5355 | |
5356 | 5356 | /** |
@@ -5365,7 +5365,7 @@ discard block |
||
5365 | 5365 | public static function str_detect_encoding($str) |
5366 | 5366 | { |
5367 | 5367 | // init |
5368 | - $str = (string) $str; |
|
5368 | + $str = (string)$str; |
|
5369 | 5369 | |
5370 | 5370 | // |
5371 | 5371 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5467,7 +5467,7 @@ discard block |
||
5467 | 5467 | foreach (self::$ENCODINGS as $encodingTmp) { |
5468 | 5468 | // INFO: //IGNORE but still throw notice |
5469 | 5469 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5470 | - if ((string) @\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str) === $str) { |
|
5470 | + if ((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str) === $str) { |
|
5471 | 5471 | return $encodingTmp; |
5472 | 5472 | } |
5473 | 5473 | } |
@@ -5555,7 +5555,7 @@ discard block |
||
5555 | 5555 | return $str; |
5556 | 5556 | } |
5557 | 5557 | |
5558 | - return $substring . $str; |
|
5558 | + return $substring.$str; |
|
5559 | 5559 | } |
5560 | 5560 | |
5561 | 5561 | /** |
@@ -5809,27 +5809,27 @@ discard block |
||
5809 | 5809 | string $encoding = 'UTF-8' |
5810 | 5810 | ): string { |
5811 | 5811 | if ($encoding === 'UTF-8') { |
5812 | - $len = (int) \mb_strlen($str); |
|
5812 | + $len = (int)\mb_strlen($str); |
|
5813 | 5813 | if ($index > $len) { |
5814 | 5814 | return $str; |
5815 | 5815 | } |
5816 | 5816 | |
5817 | 5817 | /** @noinspection UnnecessaryCastingInspection */ |
5818 | - return (string) \mb_substr($str, 0, $index) . |
|
5819 | - $substring . |
|
5820 | - (string) \mb_substr($str, $index, $len); |
|
5818 | + return (string)\mb_substr($str, 0, $index). |
|
5819 | + $substring. |
|
5820 | + (string)\mb_substr($str, $index, $len); |
|
5821 | 5821 | } |
5822 | 5822 | |
5823 | 5823 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5824 | 5824 | |
5825 | - $len = (int) self::strlen($str, $encoding); |
|
5825 | + $len = (int)self::strlen($str, $encoding); |
|
5826 | 5826 | if ($index > $len) { |
5827 | 5827 | return $str; |
5828 | 5828 | } |
5829 | 5829 | |
5830 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
5831 | - $substring . |
|
5832 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5830 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
5831 | + $substring. |
|
5832 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
5833 | 5833 | } |
5834 | 5834 | |
5835 | 5835 | /** |
@@ -5859,15 +5859,15 @@ discard block |
||
5859 | 5859 | */ |
5860 | 5860 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
5861 | 5861 | { |
5862 | - $search = (array) $search; |
|
5862 | + $search = (array)$search; |
|
5863 | 5863 | |
5864 | 5864 | /** @noinspection AlterInForeachInspection */ |
5865 | 5865 | foreach ($search as &$s) { |
5866 | - $s = (string) $s; |
|
5866 | + $s = (string)$s; |
|
5867 | 5867 | if ($s === '') { |
5868 | 5868 | $s = '/^(?<=.)$/'; |
5869 | 5869 | } else { |
5870 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5870 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5871 | 5871 | } |
5872 | 5872 | } |
5873 | 5873 | |
@@ -5899,11 +5899,11 @@ discard block |
||
5899 | 5899 | } |
5900 | 5900 | |
5901 | 5901 | if ($search === '') { |
5902 | - return $str . $replacement; |
|
5902 | + return $str.$replacement; |
|
5903 | 5903 | } |
5904 | 5904 | |
5905 | 5905 | if (\stripos($str, $search) === 0) { |
5906 | - return $replacement . \substr($str, \strlen($search)); |
|
5906 | + return $replacement.\substr($str, \strlen($search)); |
|
5907 | 5907 | } |
5908 | 5908 | |
5909 | 5909 | return $str; |
@@ -5931,11 +5931,11 @@ discard block |
||
5931 | 5931 | } |
5932 | 5932 | |
5933 | 5933 | if ($search === '') { |
5934 | - return $str . $replacement; |
|
5934 | + return $str.$replacement; |
|
5935 | 5935 | } |
5936 | 5936 | |
5937 | 5937 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
5938 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
5938 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
5939 | 5939 | } |
5940 | 5940 | |
5941 | 5941 | return $str; |
@@ -6012,15 +6012,15 @@ discard block |
||
6012 | 6012 | } |
6013 | 6013 | |
6014 | 6014 | if ($encoding === 'UTF-8') { |
6015 | - return (string) \mb_substr( |
|
6015 | + return (string)\mb_substr( |
|
6016 | 6016 | $str, |
6017 | - $offset + (int) \mb_strlen($separator) |
|
6017 | + $offset + (int)\mb_strlen($separator) |
|
6018 | 6018 | ); |
6019 | 6019 | } |
6020 | 6020 | |
6021 | - return (string) self::substr( |
|
6021 | + return (string)self::substr( |
|
6022 | 6022 | $str, |
6023 | - $offset + (int) self::strlen($separator, $encoding), |
|
6023 | + $offset + (int)self::strlen($separator, $encoding), |
|
6024 | 6024 | null, |
6025 | 6025 | $encoding |
6026 | 6026 | ); |
@@ -6047,15 +6047,15 @@ discard block |
||
6047 | 6047 | } |
6048 | 6048 | |
6049 | 6049 | if ($encoding === 'UTF-8') { |
6050 | - return (string) \mb_substr( |
|
6050 | + return (string)\mb_substr( |
|
6051 | 6051 | $str, |
6052 | - $offset + (int) self::strlen($separator) |
|
6052 | + $offset + (int)self::strlen($separator) |
|
6053 | 6053 | ); |
6054 | 6054 | } |
6055 | 6055 | |
6056 | - return (string) self::substr( |
|
6056 | + return (string)self::substr( |
|
6057 | 6057 | $str, |
6058 | - $offset + (int) self::strlen($separator, $encoding), |
|
6058 | + $offset + (int)self::strlen($separator, $encoding), |
|
6059 | 6059 | null, |
6060 | 6060 | $encoding |
6061 | 6061 | ); |
@@ -6082,10 +6082,10 @@ discard block |
||
6082 | 6082 | } |
6083 | 6083 | |
6084 | 6084 | if ($encoding === 'UTF-8') { |
6085 | - return (string) \mb_substr($str, 0, $offset); |
|
6085 | + return (string)\mb_substr($str, 0, $offset); |
|
6086 | 6086 | } |
6087 | 6087 | |
6088 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6088 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6089 | 6089 | } |
6090 | 6090 | |
6091 | 6091 | /** |
@@ -6109,7 +6109,7 @@ discard block |
||
6109 | 6109 | return ''; |
6110 | 6110 | } |
6111 | 6111 | |
6112 | - return (string) \mb_substr($str, 0, $offset); |
|
6112 | + return (string)\mb_substr($str, 0, $offset); |
|
6113 | 6113 | } |
6114 | 6114 | |
6115 | 6115 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6117,7 +6117,7 @@ discard block |
||
6117 | 6117 | return ''; |
6118 | 6118 | } |
6119 | 6119 | |
6120 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6120 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6121 | 6121 | } |
6122 | 6122 | |
6123 | 6123 | /** |
@@ -6205,12 +6205,12 @@ discard block |
||
6205 | 6205 | } |
6206 | 6206 | |
6207 | 6207 | if ($encoding === 'UTF-8') { |
6208 | - return (string) \mb_substr($str, -$n); |
|
6208 | + return (string)\mb_substr($str, -$n); |
|
6209 | 6209 | } |
6210 | 6210 | |
6211 | 6211 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6212 | 6212 | |
6213 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6213 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6214 | 6214 | } |
6215 | 6215 | |
6216 | 6216 | /** |
@@ -6234,21 +6234,21 @@ discard block |
||
6234 | 6234 | } |
6235 | 6235 | |
6236 | 6236 | if ($encoding === 'UTF-8') { |
6237 | - if ((int) \mb_strlen($str) <= $length) { |
|
6237 | + if ((int)\mb_strlen($str) <= $length) { |
|
6238 | 6238 | return $str; |
6239 | 6239 | } |
6240 | 6240 | |
6241 | 6241 | /** @noinspection UnnecessaryCastingInspection */ |
6242 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($strAddOn)) . $strAddOn; |
|
6242 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($strAddOn)).$strAddOn; |
|
6243 | 6243 | } |
6244 | 6244 | |
6245 | 6245 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6246 | 6246 | |
6247 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6247 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6248 | 6248 | return $str; |
6249 | 6249 | } |
6250 | 6250 | |
6251 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($strAddOn), $encoding)) . $strAddOn; |
|
6251 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($strAddOn), $encoding)).$strAddOn; |
|
6252 | 6252 | } |
6253 | 6253 | |
6254 | 6254 | /** |
@@ -6273,12 +6273,12 @@ discard block |
||
6273 | 6273 | |
6274 | 6274 | if ($encoding === 'UTF-8') { |
6275 | 6275 | /** @noinspection UnnecessaryCastingInspection */ |
6276 | - if ((int) \mb_strlen($str) <= $length) { |
|
6276 | + if ((int)\mb_strlen($str) <= $length) { |
|
6277 | 6277 | return $str; |
6278 | 6278 | } |
6279 | 6279 | |
6280 | 6280 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6281 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6281 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6282 | 6282 | } |
6283 | 6283 | |
6284 | 6284 | $str = \mb_substr($str, 0, $length); |
@@ -6288,20 +6288,20 @@ discard block |
||
6288 | 6288 | $new_str = \implode(' ', $array); |
6289 | 6289 | |
6290 | 6290 | if ($new_str === '') { |
6291 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6291 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6292 | 6292 | } |
6293 | 6293 | } else { |
6294 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6294 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6295 | 6295 | return $str; |
6296 | 6296 | } |
6297 | 6297 | |
6298 | 6298 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6299 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6299 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6300 | 6300 | } |
6301 | 6301 | |
6302 | 6302 | $str = self::substr($str, 0, $length, $encoding); |
6303 | 6303 | if ($str === false) { |
6304 | - return '' . $strAddOn; |
|
6304 | + return ''.$strAddOn; |
|
6305 | 6305 | } |
6306 | 6306 | |
6307 | 6307 | $array = \explode(' ', $str); |
@@ -6309,11 +6309,11 @@ discard block |
||
6309 | 6309 | $new_str = \implode(' ', $array); |
6310 | 6310 | |
6311 | 6311 | if ($new_str === '') { |
6312 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6312 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6313 | 6313 | } |
6314 | 6314 | } |
6315 | 6315 | |
6316 | - return $new_str . $strAddOn; |
|
6316 | + return $new_str.$strAddOn; |
|
6317 | 6317 | } |
6318 | 6318 | |
6319 | 6319 | /** |
@@ -6331,7 +6331,7 @@ discard block |
||
6331 | 6331 | $longestCommonPrefix = ''; |
6332 | 6332 | |
6333 | 6333 | if ($encoding === 'UTF-8') { |
6334 | - $maxLength = (int) \min( |
|
6334 | + $maxLength = (int)\min( |
|
6335 | 6335 | \mb_strlen($str), |
6336 | 6336 | \mb_strlen($otherStr) |
6337 | 6337 | ); |
@@ -6352,7 +6352,7 @@ discard block |
||
6352 | 6352 | } else { |
6353 | 6353 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6354 | 6354 | |
6355 | - $maxLength = (int) \min( |
|
6355 | + $maxLength = (int)\min( |
|
6356 | 6356 | self::strlen($str, $encoding), |
6357 | 6357 | self::strlen($otherStr, $encoding) |
6358 | 6358 | ); |
@@ -6395,13 +6395,13 @@ discard block |
||
6395 | 6395 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6396 | 6396 | |
6397 | 6397 | if ($encoding === 'UTF-8') { |
6398 | - $strLength = (int) \mb_strlen($str); |
|
6399 | - $otherLength = (int) \mb_strlen($otherStr); |
|
6398 | + $strLength = (int)\mb_strlen($str); |
|
6399 | + $otherLength = (int)\mb_strlen($otherStr); |
|
6400 | 6400 | } else { |
6401 | 6401 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6402 | 6402 | |
6403 | - $strLength = (int) self::strlen($str, $encoding); |
|
6404 | - $otherLength = (int) self::strlen($otherStr, $encoding); |
|
6403 | + $strLength = (int)self::strlen($str, $encoding); |
|
6404 | + $otherLength = (int)self::strlen($otherStr, $encoding); |
|
6405 | 6405 | } |
6406 | 6406 | |
6407 | 6407 | // Return if either string is empty |
@@ -6454,10 +6454,10 @@ discard block |
||
6454 | 6454 | } |
6455 | 6455 | |
6456 | 6456 | if ($encoding === 'UTF-8') { |
6457 | - return (string) \mb_substr($str, $end - $len, $len); |
|
6457 | + return (string)\mb_substr($str, $end - $len, $len); |
|
6458 | 6458 | } |
6459 | 6459 | |
6460 | - return (string) self::substr($str, $end - $len, $len, $encoding); |
|
6460 | + return (string)self::substr($str, $end - $len, $len, $encoding); |
|
6461 | 6461 | } |
6462 | 6462 | |
6463 | 6463 | /** |
@@ -6476,7 +6476,7 @@ discard block |
||
6476 | 6476 | } |
6477 | 6477 | |
6478 | 6478 | if ($encoding === 'UTF-8') { |
6479 | - $maxLength = (int) \min( |
|
6479 | + $maxLength = (int)\min( |
|
6480 | 6480 | \mb_strlen($str, $encoding), |
6481 | 6481 | \mb_strlen($otherStr, $encoding) |
6482 | 6482 | ); |
@@ -6490,7 +6490,7 @@ discard block |
||
6490 | 6490 | && |
6491 | 6491 | $char === \mb_substr($otherStr, -$i, 1) |
6492 | 6492 | ) { |
6493 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6493 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6494 | 6494 | } else { |
6495 | 6495 | break; |
6496 | 6496 | } |
@@ -6498,7 +6498,7 @@ discard block |
||
6498 | 6498 | } else { |
6499 | 6499 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6500 | 6500 | |
6501 | - $maxLength = (int) \min( |
|
6501 | + $maxLength = (int)\min( |
|
6502 | 6502 | self::strlen($str, $encoding), |
6503 | 6503 | self::strlen($otherStr, $encoding) |
6504 | 6504 | ); |
@@ -6512,7 +6512,7 @@ discard block |
||
6512 | 6512 | && |
6513 | 6513 | $char === self::substr($otherStr, -$i, 1, $encoding) |
6514 | 6514 | ) { |
6515 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6515 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6516 | 6516 | } else { |
6517 | 6517 | break; |
6518 | 6518 | } |
@@ -6532,7 +6532,7 @@ discard block |
||
6532 | 6532 | */ |
6533 | 6533 | public static function str_matches_pattern(string $str, string $pattern): bool |
6534 | 6534 | { |
6535 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
6535 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
6536 | 6536 | } |
6537 | 6537 | |
6538 | 6538 | /** |
@@ -6549,7 +6549,7 @@ discard block |
||
6549 | 6549 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
6550 | 6550 | { |
6551 | 6551 | // init |
6552 | - $length = (int) self::strlen($str, $encoding); |
|
6552 | + $length = (int)self::strlen($str, $encoding); |
|
6553 | 6553 | |
6554 | 6554 | if ($offset >= 0) { |
6555 | 6555 | return $length > $offset; |
@@ -6575,7 +6575,7 @@ discard block |
||
6575 | 6575 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
6576 | 6576 | { |
6577 | 6577 | // init |
6578 | - $length = (int) self::strlen($str); |
|
6578 | + $length = (int)self::strlen($str); |
|
6579 | 6579 | |
6580 | 6580 | if ( |
6581 | 6581 | ($index >= 0 && $length <= $index) |
@@ -6614,7 +6614,7 @@ discard block |
||
6614 | 6614 | return $str; |
6615 | 6615 | } |
6616 | 6616 | |
6617 | - if ($pad_type !== (int) $pad_type) { |
|
6617 | + if ($pad_type !== (int)$pad_type) { |
|
6618 | 6618 | if ($pad_type === 'left') { |
6619 | 6619 | $pad_type = \STR_PAD_LEFT; |
6620 | 6620 | } elseif ($pad_type === 'right') { |
@@ -6623,23 +6623,23 @@ discard block |
||
6623 | 6623 | $pad_type = \STR_PAD_BOTH; |
6624 | 6624 | } else { |
6625 | 6625 | throw new \InvalidArgumentException( |
6626 | - 'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
6626 | + 'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
6627 | 6627 | ); |
6628 | 6628 | } |
6629 | 6629 | } |
6630 | 6630 | |
6631 | 6631 | if ($encoding === 'UTF-8') { |
6632 | - $str_length = (int) \mb_strlen($str); |
|
6632 | + $str_length = (int)\mb_strlen($str); |
|
6633 | 6633 | |
6634 | 6634 | if ($pad_length >= $str_length) { |
6635 | 6635 | switch ($pad_type) { |
6636 | 6636 | case \STR_PAD_LEFT: |
6637 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6637 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6638 | 6638 | |
6639 | 6639 | $diff = ($pad_length - $str_length); |
6640 | 6640 | |
6641 | - $pre = (string) \mb_substr( |
|
6642 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6641 | + $pre = (string)\mb_substr( |
|
6642 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6643 | 6643 | 0, |
6644 | 6644 | $diff |
6645 | 6645 | ); |
@@ -6650,16 +6650,16 @@ discard block |
||
6650 | 6650 | case \STR_PAD_BOTH: |
6651 | 6651 | $diff = ($pad_length - $str_length); |
6652 | 6652 | |
6653 | - $ps_length_left = (int) \floor($diff / 2); |
|
6653 | + $ps_length_left = (int)\floor($diff / 2); |
|
6654 | 6654 | |
6655 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6655 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6656 | 6656 | |
6657 | - $pre = (string) \mb_substr( |
|
6657 | + $pre = (string)\mb_substr( |
|
6658 | 6658 | \str_repeat($pad_string, $ps_length_left), |
6659 | 6659 | 0, |
6660 | 6660 | $ps_length_left |
6661 | 6661 | ); |
6662 | - $post = (string) \mb_substr( |
|
6662 | + $post = (string)\mb_substr( |
|
6663 | 6663 | \str_repeat($pad_string, $ps_length_right), |
6664 | 6664 | 0, |
6665 | 6665 | $ps_length_right |
@@ -6669,19 +6669,19 @@ discard block |
||
6669 | 6669 | |
6670 | 6670 | case \STR_PAD_RIGHT: |
6671 | 6671 | default: |
6672 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6672 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6673 | 6673 | |
6674 | 6674 | $diff = ($pad_length - $str_length); |
6675 | 6675 | |
6676 | - $post = (string) \mb_substr( |
|
6677 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6676 | + $post = (string)\mb_substr( |
|
6677 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6678 | 6678 | 0, |
6679 | 6679 | $diff |
6680 | 6680 | ); |
6681 | 6681 | $pre = ''; |
6682 | 6682 | } |
6683 | 6683 | |
6684 | - return $pre . $str . $post; |
|
6684 | + return $pre.$str.$post; |
|
6685 | 6685 | } |
6686 | 6686 | |
6687 | 6687 | return $str; |
@@ -6689,17 +6689,17 @@ discard block |
||
6689 | 6689 | |
6690 | 6690 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6691 | 6691 | |
6692 | - $str_length = (int) self::strlen($str, $encoding); |
|
6692 | + $str_length = (int)self::strlen($str, $encoding); |
|
6693 | 6693 | |
6694 | 6694 | if ($pad_length >= $str_length) { |
6695 | 6695 | switch ($pad_type) { |
6696 | 6696 | case \STR_PAD_LEFT: |
6697 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6697 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6698 | 6698 | |
6699 | 6699 | $diff = ($pad_length - $str_length); |
6700 | 6700 | |
6701 | - $pre = (string) self::substr( |
|
6702 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6701 | + $pre = (string)self::substr( |
|
6702 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6703 | 6703 | 0, |
6704 | 6704 | $diff, |
6705 | 6705 | $encoding |
@@ -6711,17 +6711,17 @@ discard block |
||
6711 | 6711 | case \STR_PAD_BOTH: |
6712 | 6712 | $diff = ($pad_length - $str_length); |
6713 | 6713 | |
6714 | - $ps_length_left = (int) \floor($diff / 2); |
|
6714 | + $ps_length_left = (int)\floor($diff / 2); |
|
6715 | 6715 | |
6716 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6716 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6717 | 6717 | |
6718 | - $pre = (string) self::substr( |
|
6718 | + $pre = (string)self::substr( |
|
6719 | 6719 | \str_repeat($pad_string, $ps_length_left), |
6720 | 6720 | 0, |
6721 | 6721 | $ps_length_left, |
6722 | 6722 | $encoding |
6723 | 6723 | ); |
6724 | - $post = (string) self::substr( |
|
6724 | + $post = (string)self::substr( |
|
6725 | 6725 | \str_repeat($pad_string, $ps_length_right), |
6726 | 6726 | 0, |
6727 | 6727 | $ps_length_right, |
@@ -6732,12 +6732,12 @@ discard block |
||
6732 | 6732 | |
6733 | 6733 | case \STR_PAD_RIGHT: |
6734 | 6734 | default: |
6735 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6735 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6736 | 6736 | |
6737 | 6737 | $diff = ($pad_length - $str_length); |
6738 | 6738 | |
6739 | - $post = (string) self::substr( |
|
6740 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6739 | + $post = (string)self::substr( |
|
6740 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6741 | 6741 | 0, |
6742 | 6742 | $diff, |
6743 | 6743 | $encoding |
@@ -6745,7 +6745,7 @@ discard block |
||
6745 | 6745 | $pre = ''; |
6746 | 6746 | } |
6747 | 6747 | |
6748 | - return $pre . $str . $post; |
|
6748 | + return $pre.$str.$post; |
|
6749 | 6749 | } |
6750 | 6750 | |
6751 | 6751 | return $str; |
@@ -6904,11 +6904,11 @@ discard block |
||
6904 | 6904 | } |
6905 | 6905 | |
6906 | 6906 | if ($search === '') { |
6907 | - return $str . $replacement; |
|
6907 | + return $str.$replacement; |
|
6908 | 6908 | } |
6909 | 6909 | |
6910 | 6910 | if (\strpos($str, $search) === 0) { |
6911 | - return $replacement . \substr($str, \strlen($search)); |
|
6911 | + return $replacement.\substr($str, \strlen($search)); |
|
6912 | 6912 | } |
6913 | 6913 | |
6914 | 6914 | return $str; |
@@ -6936,11 +6936,11 @@ discard block |
||
6936 | 6936 | } |
6937 | 6937 | |
6938 | 6938 | if ($search === '') { |
6939 | - return $str . $replacement; |
|
6939 | + return $str.$replacement; |
|
6940 | 6940 | } |
6941 | 6941 | |
6942 | 6942 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6943 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6943 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6944 | 6944 | } |
6945 | 6945 | |
6946 | 6946 | return $str; |
@@ -6969,7 +6969,7 @@ discard block |
||
6969 | 6969 | $subject, |
6970 | 6970 | $replace, |
6971 | 6971 | $pos, |
6972 | - (int) self::strlen($search) |
|
6972 | + (int)self::strlen($search) |
|
6973 | 6973 | ); |
6974 | 6974 | } |
6975 | 6975 | |
@@ -7001,7 +7001,7 @@ discard block |
||
7001 | 7001 | $subject, |
7002 | 7002 | $replace, |
7003 | 7003 | $pos, |
7004 | - (int) self::strlen($search) |
|
7004 | + (int)self::strlen($search) |
|
7005 | 7005 | ); |
7006 | 7006 | } |
7007 | 7007 | |
@@ -7021,7 +7021,7 @@ discard block |
||
7021 | 7021 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
7022 | 7022 | { |
7023 | 7023 | if ($encoding === 'UTF-8') { |
7024 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
7024 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
7025 | 7025 | /** @noinspection NonSecureShuffleUsageInspection */ |
7026 | 7026 | \shuffle($indexes); |
7027 | 7027 | |
@@ -7037,7 +7037,7 @@ discard block |
||
7037 | 7037 | } else { |
7038 | 7038 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7039 | 7039 | |
7040 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
7040 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
7041 | 7041 | /** @noinspection NonSecureShuffleUsageInspection */ |
7042 | 7042 | \shuffle($indexes); |
7043 | 7043 | |
@@ -7078,11 +7078,11 @@ discard block |
||
7078 | 7078 | ) { |
7079 | 7079 | if ($encoding === 'UTF-8') { |
7080 | 7080 | if ($end === null) { |
7081 | - $length = (int) \mb_strlen($str); |
|
7081 | + $length = (int)\mb_strlen($str); |
|
7082 | 7082 | } elseif ($end >= 0 && $end <= $start) { |
7083 | 7083 | return ''; |
7084 | 7084 | } elseif ($end < 0) { |
7085 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7085 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7086 | 7086 | } else { |
7087 | 7087 | $length = $end - $start; |
7088 | 7088 | } |
@@ -7093,11 +7093,11 @@ discard block |
||
7093 | 7093 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7094 | 7094 | |
7095 | 7095 | if ($end === null) { |
7096 | - $length = (int) self::strlen($str, $encoding); |
|
7096 | + $length = (int)self::strlen($str, $encoding); |
|
7097 | 7097 | } elseif ($end >= 0 && $end <= $start) { |
7098 | 7098 | return ''; |
7099 | 7099 | } elseif ($end < 0) { |
7100 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7100 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7101 | 7101 | } else { |
7102 | 7102 | $length = $end - $start; |
7103 | 7103 | } |
@@ -7129,35 +7129,35 @@ discard block |
||
7129 | 7129 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7130 | 7130 | } |
7131 | 7131 | |
7132 | - $str = (string) \preg_replace_callback( |
|
7132 | + $str = (string)\preg_replace_callback( |
|
7133 | 7133 | '/([\d|\p{Lu}])/u', |
7134 | 7134 | /** |
7135 | 7135 | * @param string[] $matches |
7136 | 7136 | * |
7137 | 7137 | * @return string |
7138 | 7138 | */ |
7139 | - static function (array $matches) use ($encoding): string { |
|
7139 | + static function(array $matches) use ($encoding): string { |
|
7140 | 7140 | $match = $matches[1]; |
7141 | - $matchInt = (int) $match; |
|
7141 | + $matchInt = (int)$match; |
|
7142 | 7142 | |
7143 | - if ((string) $matchInt === $match) { |
|
7144 | - return '_' . $match . '_'; |
|
7143 | + if ((string)$matchInt === $match) { |
|
7144 | + return '_'.$match.'_'; |
|
7145 | 7145 | } |
7146 | 7146 | |
7147 | 7147 | if ($encoding === 'UTF-8') { |
7148 | - return '_' . \mb_strtolower($match); |
|
7148 | + return '_'.\mb_strtolower($match); |
|
7149 | 7149 | } |
7150 | 7150 | |
7151 | - return '_' . self::strtolower($match, $encoding); |
|
7151 | + return '_'.self::strtolower($match, $encoding); |
|
7152 | 7152 | }, |
7153 | 7153 | $str |
7154 | 7154 | ); |
7155 | 7155 | |
7156 | - $str = (string) \preg_replace( |
|
7156 | + $str = (string)\preg_replace( |
|
7157 | 7157 | [ |
7158 | - '/\s+/u', // convert spaces to "_" |
|
7159 | - '/^\s+|\s+$/u', // trim leading & trailing spaces |
|
7160 | - '/_+/', // remove double "_" |
|
7158 | + '/\s+/u', // convert spaces to "_" |
|
7159 | + '/^\s+|\s+$/u', // trim leading & trailing spaces |
|
7160 | + '/_+/', // remove double "_" |
|
7161 | 7161 | ], |
7162 | 7162 | [ |
7163 | 7163 | '_', |
@@ -7233,7 +7233,7 @@ discard block |
||
7233 | 7233 | } |
7234 | 7234 | |
7235 | 7235 | // init |
7236 | - $str = (string) $str; |
|
7236 | + $str = (string)$str; |
|
7237 | 7237 | |
7238 | 7238 | if ($str === '') { |
7239 | 7239 | return []; |
@@ -7280,7 +7280,7 @@ discard block |
||
7280 | 7280 | ($str[$i] & "\xE0") === "\xC0" |
7281 | 7281 | ) { |
7282 | 7282 | if (($str[$i + 1] & "\xC0") === "\x80") { |
7283 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
7283 | + $ret[] = $str[$i].$str[$i + 1]; |
|
7284 | 7284 | |
7285 | 7285 | ++$i; |
7286 | 7286 | } |
@@ -7294,7 +7294,7 @@ discard block |
||
7294 | 7294 | && |
7295 | 7295 | ($str[$i + 2] & "\xC0") === "\x80" |
7296 | 7296 | ) { |
7297 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
7297 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
7298 | 7298 | |
7299 | 7299 | $i += 2; |
7300 | 7300 | } |
@@ -7310,7 +7310,7 @@ discard block |
||
7310 | 7310 | && |
7311 | 7311 | ($str[$i + 3] & "\xC0") === "\x80" |
7312 | 7312 | ) { |
7313 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
7313 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
7314 | 7314 | |
7315 | 7315 | $i += 3; |
7316 | 7316 | } |
@@ -7322,7 +7322,7 @@ discard block |
||
7322 | 7322 | $ret = \array_chunk($ret, $length); |
7323 | 7323 | |
7324 | 7324 | return \array_map( |
7325 | - static function (array &$item): string { |
|
7325 | + static function(array &$item): string { |
|
7326 | 7326 | return \implode('', $item); |
7327 | 7327 | }, |
7328 | 7328 | $ret |
@@ -7385,7 +7385,7 @@ discard block |
||
7385 | 7385 | $limit = -1; |
7386 | 7386 | } |
7387 | 7387 | |
7388 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7388 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7389 | 7389 | |
7390 | 7390 | if ($array === false) { |
7391 | 7391 | return []; |
@@ -7469,9 +7469,9 @@ discard block |
||
7469 | 7469 | return ''; |
7470 | 7470 | } |
7471 | 7471 | |
7472 | - return (string) \mb_substr( |
|
7472 | + return (string)\mb_substr( |
|
7473 | 7473 | $str, |
7474 | - $offset + (int) \mb_strlen($separator) |
|
7474 | + $offset + (int)\mb_strlen($separator) |
|
7475 | 7475 | ); |
7476 | 7476 | } |
7477 | 7477 | |
@@ -7480,9 +7480,9 @@ discard block |
||
7480 | 7480 | return ''; |
7481 | 7481 | } |
7482 | 7482 | |
7483 | - return (string) \mb_substr( |
|
7483 | + return (string)\mb_substr( |
|
7484 | 7484 | $str, |
7485 | - $offset + (int) self::strlen($separator, $encoding), |
|
7485 | + $offset + (int)self::strlen($separator, $encoding), |
|
7486 | 7486 | null, |
7487 | 7487 | $encoding |
7488 | 7488 | ); |
@@ -7509,9 +7509,9 @@ discard block |
||
7509 | 7509 | return ''; |
7510 | 7510 | } |
7511 | 7511 | |
7512 | - return (string) \mb_substr( |
|
7512 | + return (string)\mb_substr( |
|
7513 | 7513 | $str, |
7514 | - $offset + (int) \mb_strlen($separator) |
|
7514 | + $offset + (int)\mb_strlen($separator) |
|
7515 | 7515 | ); |
7516 | 7516 | } |
7517 | 7517 | |
@@ -7520,9 +7520,9 @@ discard block |
||
7520 | 7520 | return ''; |
7521 | 7521 | } |
7522 | 7522 | |
7523 | - return (string) self::substr( |
|
7523 | + return (string)self::substr( |
|
7524 | 7524 | $str, |
7525 | - $offset + (int) self::strlen($separator, $encoding), |
|
7525 | + $offset + (int)self::strlen($separator, $encoding), |
|
7526 | 7526 | null, |
7527 | 7527 | $encoding |
7528 | 7528 | ); |
@@ -7552,7 +7552,7 @@ discard block |
||
7552 | 7552 | return ''; |
7553 | 7553 | } |
7554 | 7554 | |
7555 | - return (string) \mb_substr( |
|
7555 | + return (string)\mb_substr( |
|
7556 | 7556 | $str, |
7557 | 7557 | 0, |
7558 | 7558 | $offset |
@@ -7564,7 +7564,7 @@ discard block |
||
7564 | 7564 | return ''; |
7565 | 7565 | } |
7566 | 7566 | |
7567 | - return (string) self::substr( |
|
7567 | + return (string)self::substr( |
|
7568 | 7568 | $str, |
7569 | 7569 | 0, |
7570 | 7570 | $offset, |
@@ -7593,7 +7593,7 @@ discard block |
||
7593 | 7593 | return ''; |
7594 | 7594 | } |
7595 | 7595 | |
7596 | - return (string) \mb_substr( |
|
7596 | + return (string)\mb_substr( |
|
7597 | 7597 | $str, |
7598 | 7598 | 0, |
7599 | 7599 | $offset |
@@ -7607,7 +7607,7 @@ discard block |
||
7607 | 7607 | |
7608 | 7608 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7609 | 7609 | |
7610 | - return (string) self::substr( |
|
7610 | + return (string)self::substr( |
|
7611 | 7611 | $str, |
7612 | 7612 | 0, |
7613 | 7613 | $offset, |
@@ -7715,7 +7715,7 @@ discard block |
||
7715 | 7715 | */ |
7716 | 7716 | public static function str_surround(string $str, string $substring): string |
7717 | 7717 | { |
7718 | - return $substring . $str . $substring; |
|
7718 | + return $substring.$str.$substring; |
|
7719 | 7719 | } |
7720 | 7720 | |
7721 | 7721 | /** |
@@ -7759,9 +7759,9 @@ discard block |
||
7759 | 7759 | |
7760 | 7760 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
7761 | 7761 | |
7762 | - return (string) \preg_replace_callback( |
|
7762 | + return (string)\preg_replace_callback( |
|
7763 | 7763 | '/([\S]+)/u', |
7764 | - static function (array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7764 | + static function(array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7765 | 7765 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
7766 | 7766 | return $match[0]; |
7767 | 7767 | } |
@@ -7847,16 +7847,16 @@ discard block |
||
7847 | 7847 | } |
7848 | 7848 | |
7849 | 7849 | // the main substitutions |
7850 | - $str = (string) \preg_replace_callback( |
|
7850 | + $str = (string)\preg_replace_callback( |
|
7851 | 7851 | '~\b (_*) (?: # 1. Leading underscore and |
7852 | 7852 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
7853 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) # URL, domain, or email |
|
7853 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) # URL, domain, or email |
|
7854 | 7854 | | |
7855 | - ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' ) # 3. or small word (case-insensitive) |
|
7855 | + ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' ) # 3. or small word (case-insensitive) |
|
7856 | 7856 | | |
7857 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 4. or word w/o internal caps |
|
7857 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 4. or word w/o internal caps |
|
7858 | 7858 | | |
7859 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 5. or some other word |
|
7859 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 5. or some other word |
|
7860 | 7860 | ) (_*) \b # 6. With trailing underscore |
7861 | 7861 | ~ux', |
7862 | 7862 | /** |
@@ -7864,7 +7864,7 @@ discard block |
||
7864 | 7864 | * |
7865 | 7865 | * @return string |
7866 | 7866 | */ |
7867 | - static function (array $matches) use ($encoding): string { |
|
7867 | + static function(array $matches) use ($encoding): string { |
|
7868 | 7868 | // preserve leading underscore |
7869 | 7869 | $str = $matches[1]; |
7870 | 7870 | if ($matches[2]) { |
@@ -7889,26 +7889,26 @@ discard block |
||
7889 | 7889 | ); |
7890 | 7890 | |
7891 | 7891 | // Exceptions for small words: capitalize at start of title... |
7892 | - $str = (string) \preg_replace_callback( |
|
7892 | + $str = (string)\preg_replace_callback( |
|
7893 | 7893 | '~( \A [[:punct:]]* # start of title... |
7894 | 7894 | | [:.;?!][ ]+ # or of subsentence... |
7895 | 7895 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
7896 | - ( ' . $smallWordsRx . ' ) \b # ...followed by small word |
|
7896 | + ( ' . $smallWordsRx.' ) \b # ...followed by small word |
|
7897 | 7897 | ~uxi', |
7898 | 7898 | /** |
7899 | 7899 | * @param string[] $matches |
7900 | 7900 | * |
7901 | 7901 | * @return string |
7902 | 7902 | */ |
7903 | - static function (array $matches) use ($encoding): string { |
|
7904 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7903 | + static function(array $matches) use ($encoding): string { |
|
7904 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7905 | 7905 | }, |
7906 | 7906 | $str |
7907 | 7907 | ); |
7908 | 7908 | |
7909 | 7909 | // ...and end of title |
7910 | - $str = (string) \preg_replace_callback( |
|
7911 | - '~\b ( ' . $smallWordsRx . ' ) # small word... |
|
7910 | + $str = (string)\preg_replace_callback( |
|
7911 | + '~\b ( '.$smallWordsRx.' ) # small word... |
|
7912 | 7912 | (?= [[:punct:]]* \Z # ...at the end of the title... |
7913 | 7913 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
7914 | 7914 | ~uxi', |
@@ -7917,7 +7917,7 @@ discard block |
||
7917 | 7917 | * |
7918 | 7918 | * @return string |
7919 | 7919 | */ |
7920 | - static function (array $matches) use ($encoding): string { |
|
7920 | + static function(array $matches) use ($encoding): string { |
|
7921 | 7921 | return static::str_upper_first($matches[1], $encoding); |
7922 | 7922 | }, |
7923 | 7923 | $str |
@@ -7925,10 +7925,10 @@ discard block |
||
7925 | 7925 | |
7926 | 7926 | // Exceptions for small words in hyphenated compound words. |
7927 | 7927 | // e.g. "in-flight" -> In-Flight |
7928 | - $str = (string) \preg_replace_callback( |
|
7928 | + $str = (string)\preg_replace_callback( |
|
7929 | 7929 | '~\b |
7930 | 7930 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
7931 | - ( ' . $smallWordsRx . ' ) |
|
7931 | + ( ' . $smallWordsRx.' ) |
|
7932 | 7932 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
7933 | 7933 | ~uxi', |
7934 | 7934 | /** |
@@ -7936,18 +7936,18 @@ discard block |
||
7936 | 7936 | * |
7937 | 7937 | * @return string |
7938 | 7938 | */ |
7939 | - static function (array $matches) use ($encoding): string { |
|
7939 | + static function(array $matches) use ($encoding): string { |
|
7940 | 7940 | return static::str_upper_first($matches[1], $encoding); |
7941 | 7941 | }, |
7942 | 7942 | $str |
7943 | 7943 | ); |
7944 | 7944 | |
7945 | 7945 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
7946 | - $str = (string) \preg_replace_callback( |
|
7946 | + $str = (string)\preg_replace_callback( |
|
7947 | 7947 | '~\b |
7948 | 7948 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
7949 | 7949 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
7950 | - ( ' . $smallWordsRx . ' ) # ...followed by small word |
|
7950 | + ( ' . $smallWordsRx.' ) # ...followed by small word |
|
7951 | 7951 | (?! - ) # Negative lookahead for another - |
7952 | 7952 | ~uxi', |
7953 | 7953 | /** |
@@ -7955,8 +7955,8 @@ discard block |
||
7955 | 7955 | * |
7956 | 7956 | * @return string |
7957 | 7957 | */ |
7958 | - static function (array $matches) use ($encoding): string { |
|
7959 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7958 | + static function(array $matches) use ($encoding): string { |
|
7959 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7960 | 7960 | }, |
7961 | 7961 | $str |
7962 | 7962 | ); |
@@ -8059,7 +8059,7 @@ discard block |
||
8059 | 8059 | ); |
8060 | 8060 | |
8061 | 8061 | foreach ($tmpReturn as &$item) { |
8062 | - $item = (string) $item; |
|
8062 | + $item = (string)$item; |
|
8063 | 8063 | } |
8064 | 8064 | |
8065 | 8065 | return $tmpReturn; |
@@ -8104,39 +8104,39 @@ discard block |
||
8104 | 8104 | } |
8105 | 8105 | |
8106 | 8106 | if ($encoding === 'UTF-8') { |
8107 | - if ($length >= (int) \mb_strlen($str)) { |
|
8107 | + if ($length >= (int)\mb_strlen($str)) { |
|
8108 | 8108 | return $str; |
8109 | 8109 | } |
8110 | 8110 | |
8111 | 8111 | if ($substring !== '') { |
8112 | - $length -= (int) \mb_strlen($substring); |
|
8112 | + $length -= (int)\mb_strlen($substring); |
|
8113 | 8113 | |
8114 | 8114 | /** @noinspection UnnecessaryCastingInspection */ |
8115 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
8115 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
8116 | 8116 | } |
8117 | 8117 | |
8118 | 8118 | /** @noinspection UnnecessaryCastingInspection */ |
8119 | - return (string) \mb_substr($str, 0, $length); |
|
8119 | + return (string)\mb_substr($str, 0, $length); |
|
8120 | 8120 | } |
8121 | 8121 | |
8122 | 8122 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8123 | 8123 | |
8124 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8124 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8125 | 8125 | return $str; |
8126 | 8126 | } |
8127 | 8127 | |
8128 | 8128 | if ($substring !== '') { |
8129 | - $length -= (int) self::strlen($substring, $encoding); |
|
8129 | + $length -= (int)self::strlen($substring, $encoding); |
|
8130 | 8130 | } |
8131 | 8131 | |
8132 | 8132 | return ( |
8133 | - (string) self::substr( |
|
8133 | + (string)self::substr( |
|
8134 | 8134 | $str, |
8135 | 8135 | 0, |
8136 | 8136 | $length, |
8137 | 8137 | $encoding |
8138 | 8138 | ) |
8139 | - ) . $substring; |
|
8139 | + ).$substring; |
|
8140 | 8140 | } |
8141 | 8141 | |
8142 | 8142 | /** |
@@ -8166,12 +8166,12 @@ discard block |
||
8166 | 8166 | } |
8167 | 8167 | |
8168 | 8168 | if ($encoding === 'UTF-8') { |
8169 | - if ($length >= (int) \mb_strlen($str)) { |
|
8169 | + if ($length >= (int)\mb_strlen($str)) { |
|
8170 | 8170 | return $str; |
8171 | 8171 | } |
8172 | 8172 | |
8173 | 8173 | // need to further trim the string so we can append the substring |
8174 | - $length -= (int) \mb_strlen($substring); |
|
8174 | + $length -= (int)\mb_strlen($substring); |
|
8175 | 8175 | if ($length <= 0) { |
8176 | 8176 | return $substring; |
8177 | 8177 | } |
@@ -8193,18 +8193,18 @@ discard block |
||
8193 | 8193 | || |
8194 | 8194 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8195 | 8195 | ) { |
8196 | - $truncated = (string) \mb_substr($truncated, 0, (int) $lastPos); |
|
8196 | + $truncated = (string)\mb_substr($truncated, 0, (int)$lastPos); |
|
8197 | 8197 | } |
8198 | 8198 | } |
8199 | 8199 | } else { |
8200 | 8200 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8201 | 8201 | |
8202 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8202 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8203 | 8203 | return $str; |
8204 | 8204 | } |
8205 | 8205 | |
8206 | 8206 | // need to further trim the string so we can append the substring |
8207 | - $length -= (int) self::strlen($substring, $encoding); |
|
8207 | + $length -= (int)self::strlen($substring, $encoding); |
|
8208 | 8208 | if ($length <= 0) { |
8209 | 8209 | return $substring; |
8210 | 8210 | } |
@@ -8226,12 +8226,12 @@ discard block |
||
8226 | 8226 | || |
8227 | 8227 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8228 | 8228 | ) { |
8229 | - $truncated = (string) self::substr($truncated, 0, (int) $lastPos, $encoding); |
|
8229 | + $truncated = (string)self::substr($truncated, 0, (int)$lastPos, $encoding); |
|
8230 | 8230 | } |
8231 | 8231 | } |
8232 | 8232 | } |
8233 | 8233 | |
8234 | - return $truncated . $substring; |
|
8234 | + return $truncated.$substring; |
|
8235 | 8235 | } |
8236 | 8236 | |
8237 | 8237 | /** |
@@ -8321,13 +8321,13 @@ discard block |
||
8321 | 8321 | } |
8322 | 8322 | } elseif ($format === 2) { |
8323 | 8323 | $numberOfWords = []; |
8324 | - $offset = (int) self::strlen($strParts[0]); |
|
8324 | + $offset = (int)self::strlen($strParts[0]); |
|
8325 | 8325 | for ($i = 1; $i < $len; $i += 2) { |
8326 | 8326 | $numberOfWords[$offset] = $strParts[$i]; |
8327 | - $offset += (int) self::strlen($strParts[$i]) + (int) self::strlen($strParts[$i + 1]); |
|
8327 | + $offset += (int)self::strlen($strParts[$i]) + (int)self::strlen($strParts[$i + 1]); |
|
8328 | 8328 | } |
8329 | 8329 | } else { |
8330 | - $numberOfWords = (int) (($len - 1) / 2); |
|
8330 | + $numberOfWords = (int)(($len - 1) / 2); |
|
8331 | 8331 | } |
8332 | 8332 | |
8333 | 8333 | return $numberOfWords; |
@@ -8424,21 +8424,21 @@ discard block |
||
8424 | 8424 | } |
8425 | 8425 | |
8426 | 8426 | if ($charList === '') { |
8427 | - return (int) self::strlen($str, $encoding); |
|
8427 | + return (int)self::strlen($str, $encoding); |
|
8428 | 8428 | } |
8429 | 8429 | |
8430 | 8430 | if ($offset !== null || $length !== null) { |
8431 | 8431 | if ($encoding === 'UTF-8') { |
8432 | 8432 | if ($length === null) { |
8433 | 8433 | /** @noinspection UnnecessaryCastingInspection */ |
8434 | - $strTmp = \mb_substr($str, (int) $offset); |
|
8434 | + $strTmp = \mb_substr($str, (int)$offset); |
|
8435 | 8435 | } else { |
8436 | 8436 | /** @noinspection UnnecessaryCastingInspection */ |
8437 | - $strTmp = \mb_substr($str, (int) $offset, $length); |
|
8437 | + $strTmp = \mb_substr($str, (int)$offset, $length); |
|
8438 | 8438 | } |
8439 | 8439 | } else { |
8440 | 8440 | /** @noinspection UnnecessaryCastingInspection */ |
8441 | - $strTmp = self::substr($str, (int) $offset, $length, $encoding); |
|
8441 | + $strTmp = self::substr($str, (int)$offset, $length, $encoding); |
|
8442 | 8442 | } |
8443 | 8443 | |
8444 | 8444 | if ($strTmp === false) { |
@@ -8453,7 +8453,7 @@ discard block |
||
8453 | 8453 | } |
8454 | 8454 | |
8455 | 8455 | $matches = []; |
8456 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $matches)) { |
|
8456 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $matches)) { |
|
8457 | 8457 | $return = self::strlen($matches[1], $encoding); |
8458 | 8458 | if ($return === false) { |
8459 | 8459 | return 0; |
@@ -8462,7 +8462,7 @@ discard block |
||
8462 | 8462 | return $return; |
8463 | 8463 | } |
8464 | 8464 | |
8465 | - return (int) self::strlen($str, $encoding); |
|
8465 | + return (int)self::strlen($str, $encoding); |
|
8466 | 8466 | } |
8467 | 8467 | |
8468 | 8468 | /** |
@@ -8584,7 +8584,7 @@ discard block |
||
8584 | 8584 | return ''; |
8585 | 8585 | } |
8586 | 8586 | |
8587 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
8587 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
8588 | 8588 | } |
8589 | 8589 | |
8590 | 8590 | /** |
@@ -8649,7 +8649,7 @@ discard block |
||
8649 | 8649 | // fallback for ascii only |
8650 | 8650 | // |
8651 | 8651 | |
8652 | - if (self::is_ascii($haystack . $needle)) { |
|
8652 | + if (self::is_ascii($haystack.$needle)) { |
|
8653 | 8653 | return \stripos($haystack, $needle, $offset); |
8654 | 8654 | } |
8655 | 8655 | |
@@ -8716,7 +8716,7 @@ discard block |
||
8716 | 8716 | && |
8717 | 8717 | self::$SUPPORT['mbstring'] === false |
8718 | 8718 | ) { |
8719 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8719 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8720 | 8720 | } |
8721 | 8721 | |
8722 | 8722 | if ( |
@@ -8730,11 +8730,11 @@ discard block |
||
8730 | 8730 | } |
8731 | 8731 | } |
8732 | 8732 | |
8733 | - if (self::is_ascii($needle . $haystack)) { |
|
8733 | + if (self::is_ascii($needle.$haystack)) { |
|
8734 | 8734 | return \stristr($haystack, $needle, $before_needle); |
8735 | 8735 | } |
8736 | 8736 | |
8737 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
8737 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
8738 | 8738 | |
8739 | 8739 | if (!isset($match[1])) { |
8740 | 8740 | return false; |
@@ -8744,7 +8744,7 @@ discard block |
||
8744 | 8744 | return $match[1]; |
8745 | 8745 | } |
8746 | 8746 | |
8747 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
8747 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
8748 | 8748 | } |
8749 | 8749 | |
8750 | 8750 | /** |
@@ -8811,7 +8811,7 @@ discard block |
||
8811 | 8811 | && |
8812 | 8812 | self::$SUPPORT['iconv'] === false |
8813 | 8813 | ) { |
8814 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8814 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8815 | 8815 | } |
8816 | 8816 | |
8817 | 8817 | // |
@@ -8927,8 +8927,8 @@ discard block |
||
8927 | 8927 | } |
8928 | 8928 | |
8929 | 8929 | return \strnatcmp( |
8930 | - (string) self::strtonatfold($str1), |
|
8931 | - (string) self::strtonatfold($str2) |
|
8930 | + (string)self::strtonatfold($str1), |
|
8931 | + (string)self::strtonatfold($str2) |
|
8932 | 8932 | ); |
8933 | 8933 | } |
8934 | 8934 | |
@@ -8986,11 +8986,11 @@ discard block |
||
8986 | 8986 | } |
8987 | 8987 | |
8988 | 8988 | if ($encoding === 'UTF-8') { |
8989 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
8990 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
8989 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
8990 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
8991 | 8991 | } else { |
8992 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
8993 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
8992 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
8993 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
8994 | 8994 | } |
8995 | 8995 | |
8996 | 8996 | return self::strcmp($str1, $str2); |
@@ -9012,8 +9012,8 @@ discard block |
||
9012 | 9012 | return false; |
9013 | 9013 | } |
9014 | 9014 | |
9015 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
9016 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
9015 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
9016 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
9017 | 9017 | } |
9018 | 9018 | |
9019 | 9019 | return false; |
@@ -9046,10 +9046,10 @@ discard block |
||
9046 | 9046 | } |
9047 | 9047 | |
9048 | 9048 | // iconv and mbstring do not support integer $needle |
9049 | - if ((int) $needle === $needle) { |
|
9050 | - $needle = (string) self::chr($needle); |
|
9049 | + if ((int)$needle === $needle) { |
|
9050 | + $needle = (string)self::chr($needle); |
|
9051 | 9051 | } |
9052 | - $needle = (string) $needle; |
|
9052 | + $needle = (string)$needle; |
|
9053 | 9053 | |
9054 | 9054 | if ($needle === '') { |
9055 | 9055 | return false; |
@@ -9096,7 +9096,7 @@ discard block |
||
9096 | 9096 | && |
9097 | 9097 | self::$SUPPORT['mbstring'] === false |
9098 | 9098 | ) { |
9099 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9099 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9100 | 9100 | } |
9101 | 9101 | |
9102 | 9102 | // |
@@ -9137,7 +9137,7 @@ discard block |
||
9137 | 9137 | // fallback for ascii only |
9138 | 9138 | // |
9139 | 9139 | |
9140 | - if (self::is_ascii($haystack . $needle)) { |
|
9140 | + if (self::is_ascii($haystack.$needle)) { |
|
9141 | 9141 | return \strpos($haystack, $needle, $offset); |
9142 | 9142 | } |
9143 | 9143 | |
@@ -9149,7 +9149,7 @@ discard block |
||
9149 | 9149 | if ($haystackTmp === false) { |
9150 | 9150 | $haystackTmp = ''; |
9151 | 9151 | } |
9152 | - $haystack = (string) $haystackTmp; |
|
9152 | + $haystack = (string)$haystackTmp; |
|
9153 | 9153 | |
9154 | 9154 | if ($offset < 0) { |
9155 | 9155 | $offset = 0; |
@@ -9161,7 +9161,7 @@ discard block |
||
9161 | 9161 | } |
9162 | 9162 | |
9163 | 9163 | if ($pos) { |
9164 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9164 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9165 | 9165 | } |
9166 | 9166 | |
9167 | 9167 | return $offset + 0; |
@@ -9272,7 +9272,7 @@ discard block |
||
9272 | 9272 | && |
9273 | 9273 | self::$SUPPORT['mbstring'] === false |
9274 | 9274 | ) { |
9275 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9275 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9276 | 9276 | } |
9277 | 9277 | |
9278 | 9278 | // |
@@ -9284,7 +9284,7 @@ discard block |
||
9284 | 9284 | if ($needleTmp === false) { |
9285 | 9285 | return false; |
9286 | 9286 | } |
9287 | - $needle = (string) $needleTmp; |
|
9287 | + $needle = (string)$needleTmp; |
|
9288 | 9288 | |
9289 | 9289 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
9290 | 9290 | if ($pos === false) { |
@@ -9306,7 +9306,7 @@ discard block |
||
9306 | 9306 | if ($needleTmp === false) { |
9307 | 9307 | return false; |
9308 | 9308 | } |
9309 | - $needle = (string) $needleTmp; |
|
9309 | + $needle = (string)$needleTmp; |
|
9310 | 9310 | |
9311 | 9311 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
9312 | 9312 | if ($pos === false) { |
@@ -9342,7 +9342,7 @@ discard block |
||
9342 | 9342 | if ($encoding === 'UTF-8') { |
9343 | 9343 | if (self::$SUPPORT['intl'] === true) { |
9344 | 9344 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
9345 | - $i = (int) \grapheme_strlen($str); |
|
9345 | + $i = (int)\grapheme_strlen($str); |
|
9346 | 9346 | while ($i--) { |
9347 | 9347 | $reversedTmp = \grapheme_substr($str, $i, 1); |
9348 | 9348 | if ($reversedTmp !== false) { |
@@ -9350,7 +9350,7 @@ discard block |
||
9350 | 9350 | } |
9351 | 9351 | } |
9352 | 9352 | } else { |
9353 | - $i = (int) \mb_strlen($str); |
|
9353 | + $i = (int)\mb_strlen($str); |
|
9354 | 9354 | while ($i--) { |
9355 | 9355 | $reversedTmp = \mb_substr($str, $i, 1); |
9356 | 9356 | if ($reversedTmp !== false) { |
@@ -9361,7 +9361,7 @@ discard block |
||
9361 | 9361 | } else { |
9362 | 9362 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9363 | 9363 | |
9364 | - $i = (int) self::strlen($str, $encoding); |
|
9364 | + $i = (int)self::strlen($str, $encoding); |
|
9365 | 9365 | while ($i--) { |
9366 | 9366 | $reversedTmp = self::substr($str, $i, 1, $encoding); |
9367 | 9367 | if ($reversedTmp !== false) { |
@@ -9435,7 +9435,7 @@ discard block |
||
9435 | 9435 | if ($needleTmp === false) { |
9436 | 9436 | return false; |
9437 | 9437 | } |
9438 | - $needle = (string) $needleTmp; |
|
9438 | + $needle = (string)$needleTmp; |
|
9439 | 9439 | |
9440 | 9440 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
9441 | 9441 | if ($pos === false) { |
@@ -9474,10 +9474,10 @@ discard block |
||
9474 | 9474 | } |
9475 | 9475 | |
9476 | 9476 | // iconv and mbstring do not support integer $needle |
9477 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9478 | - $needle = (string) self::chr($needle); |
|
9477 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9478 | + $needle = (string)self::chr($needle); |
|
9479 | 9479 | } |
9480 | - $needle = (string) $needle; |
|
9480 | + $needle = (string)$needle; |
|
9481 | 9481 | |
9482 | 9482 | if ($needle === '') { |
9483 | 9483 | return false; |
@@ -9522,7 +9522,7 @@ discard block |
||
9522 | 9522 | && |
9523 | 9523 | self::$SUPPORT['mbstring'] === false |
9524 | 9524 | ) { |
9525 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9525 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9526 | 9526 | } |
9527 | 9527 | |
9528 | 9528 | // |
@@ -9546,7 +9546,7 @@ discard block |
||
9546 | 9546 | // fallback for ascii only |
9547 | 9547 | // |
9548 | 9548 | |
9549 | - if (self::is_ascii($haystack . $needle)) { |
|
9549 | + if (self::is_ascii($haystack.$needle)) { |
|
9550 | 9550 | return \strripos($haystack, $needle, $offset); |
9551 | 9551 | } |
9552 | 9552 | |
@@ -9622,10 +9622,10 @@ discard block |
||
9622 | 9622 | } |
9623 | 9623 | |
9624 | 9624 | // iconv and mbstring do not support integer $needle |
9625 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9626 | - $needle = (string) self::chr($needle); |
|
9625 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9626 | + $needle = (string)self::chr($needle); |
|
9627 | 9627 | } |
9628 | - $needle = (string) $needle; |
|
9628 | + $needle = (string)$needle; |
|
9629 | 9629 | |
9630 | 9630 | if ($needle === '') { |
9631 | 9631 | return false; |
@@ -9670,7 +9670,7 @@ discard block |
||
9670 | 9670 | && |
9671 | 9671 | self::$SUPPORT['mbstring'] === false |
9672 | 9672 | ) { |
9673 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9673 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9674 | 9674 | } |
9675 | 9675 | |
9676 | 9676 | // |
@@ -9694,7 +9694,7 @@ discard block |
||
9694 | 9694 | // fallback for ascii only |
9695 | 9695 | // |
9696 | 9696 | |
9697 | - if (self::is_ascii($haystack . $needle)) { |
|
9697 | + if (self::is_ascii($haystack.$needle)) { |
|
9698 | 9698 | return \strrpos($haystack, $needle, $offset); |
9699 | 9699 | } |
9700 | 9700 | |
@@ -9714,7 +9714,7 @@ discard block |
||
9714 | 9714 | if ($haystackTmp === false) { |
9715 | 9715 | $haystackTmp = ''; |
9716 | 9716 | } |
9717 | - $haystack = (string) $haystackTmp; |
|
9717 | + $haystack = (string)$haystackTmp; |
|
9718 | 9718 | } |
9719 | 9719 | |
9720 | 9720 | $pos = \strrpos($haystack, $needle); |
@@ -9727,7 +9727,7 @@ discard block |
||
9727 | 9727 | return false; |
9728 | 9728 | } |
9729 | 9729 | |
9730 | - return $offset + (int) self::strlen($strTmp); |
|
9730 | + return $offset + (int)self::strlen($strTmp); |
|
9731 | 9731 | } |
9732 | 9732 | |
9733 | 9733 | /** |
@@ -9787,12 +9787,12 @@ discard block |
||
9787 | 9787 | if ($offset || $length !== null) { |
9788 | 9788 | if ($encoding === 'UTF-8') { |
9789 | 9789 | if ($length === null) { |
9790 | - $str = (string) \mb_substr($str, $offset); |
|
9790 | + $str = (string)\mb_substr($str, $offset); |
|
9791 | 9791 | } else { |
9792 | - $str = (string) \mb_substr($str, $offset, $length); |
|
9792 | + $str = (string)\mb_substr($str, $offset, $length); |
|
9793 | 9793 | } |
9794 | 9794 | } else { |
9795 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
9795 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
9796 | 9796 | } |
9797 | 9797 | } |
9798 | 9798 | |
@@ -9802,7 +9802,7 @@ discard block |
||
9802 | 9802 | |
9803 | 9803 | $matches = []; |
9804 | 9804 | |
9805 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
9805 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
9806 | 9806 | } |
9807 | 9807 | |
9808 | 9808 | /** |
@@ -9871,7 +9871,7 @@ discard block |
||
9871 | 9871 | && |
9872 | 9872 | self::$SUPPORT['mbstring'] === false |
9873 | 9873 | ) { |
9874 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9874 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9875 | 9875 | } |
9876 | 9876 | |
9877 | 9877 | // |
@@ -9893,7 +9893,7 @@ discard block |
||
9893 | 9893 | // fallback for ascii only |
9894 | 9894 | // |
9895 | 9895 | |
9896 | - if (self::is_ascii($haystack . $needle)) { |
|
9896 | + if (self::is_ascii($haystack.$needle)) { |
|
9897 | 9897 | return \strstr($haystack, $needle, $before_needle); |
9898 | 9898 | } |
9899 | 9899 | |
@@ -9901,7 +9901,7 @@ discard block |
||
9901 | 9901 | // fallback via vanilla php |
9902 | 9902 | // |
9903 | 9903 | |
9904 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
9904 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
9905 | 9905 | |
9906 | 9906 | if (!isset($match[1])) { |
9907 | 9907 | return false; |
@@ -9911,7 +9911,7 @@ discard block |
||
9911 | 9911 | return $match[1]; |
9912 | 9912 | } |
9913 | 9913 | |
9914 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
9914 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
9915 | 9915 | } |
9916 | 9916 | |
9917 | 9917 | /** |
@@ -10025,7 +10025,7 @@ discard block |
||
10025 | 10025 | bool $tryToKeepStringLength = false |
10026 | 10026 | ): string { |
10027 | 10027 | // init |
10028 | - $str = (string) $str; |
|
10028 | + $str = (string)$str; |
|
10029 | 10029 | |
10030 | 10030 | if ($str === '') { |
10031 | 10031 | return ''; |
@@ -10054,19 +10054,19 @@ discard block |
||
10054 | 10054 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10055 | 10055 | } |
10056 | 10056 | |
10057 | - $langCode = $lang . '-Lower'; |
|
10057 | + $langCode = $lang.'-Lower'; |
|
10058 | 10058 | if (!\in_array($langCode, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10059 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, \E_USER_WARNING); |
|
10059 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, \E_USER_WARNING); |
|
10060 | 10060 | |
10061 | 10061 | $langCode = 'Any-Lower'; |
10062 | 10062 | } |
10063 | 10063 | |
10064 | 10064 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10065 | 10065 | /** @noinspection UnnecessaryCastingInspection */ |
10066 | - return (string) \transliterator_transliterate($langCode, $str); |
|
10066 | + return (string)\transliterator_transliterate($langCode, $str); |
|
10067 | 10067 | } |
10068 | 10068 | |
10069 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
10069 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
10070 | 10070 | } |
10071 | 10071 | |
10072 | 10072 | // always fallback via symfony polyfill |
@@ -10095,7 +10095,7 @@ discard block |
||
10095 | 10095 | bool $tryToKeepStringLength = false |
10096 | 10096 | ): string { |
10097 | 10097 | // init |
10098 | - $str = (string) $str; |
|
10098 | + $str = (string)$str; |
|
10099 | 10099 | |
10100 | 10100 | if ($str === '') { |
10101 | 10101 | return ''; |
@@ -10124,19 +10124,19 @@ discard block |
||
10124 | 10124 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10125 | 10125 | } |
10126 | 10126 | |
10127 | - $langCode = $lang . '-Upper'; |
|
10127 | + $langCode = $lang.'-Upper'; |
|
10128 | 10128 | if (!\in_array($langCode, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10129 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
10129 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
10130 | 10130 | |
10131 | 10131 | $langCode = 'Any-Upper'; |
10132 | 10132 | } |
10133 | 10133 | |
10134 | 10134 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10135 | 10135 | /** @noinspection UnnecessaryCastingInspection */ |
10136 | - return (string) \transliterator_transliterate($langCode, $str); |
|
10136 | + return (string)\transliterator_transliterate($langCode, $str); |
|
10137 | 10137 | } |
10138 | 10138 | |
10139 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
10139 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
10140 | 10140 | } |
10141 | 10141 | |
10142 | 10142 | // always fallback via symfony polyfill |
@@ -10180,7 +10180,7 @@ discard block |
||
10180 | 10180 | |
10181 | 10181 | $from = \array_combine($from, $to); |
10182 | 10182 | if ($from === false) { |
10183 | - 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) . ')'); |
|
10183 | + 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).')'); |
|
10184 | 10184 | } |
10185 | 10185 | } |
10186 | 10186 | |
@@ -10237,9 +10237,9 @@ discard block |
||
10237 | 10237 | } |
10238 | 10238 | |
10239 | 10239 | $wide = 0; |
10240 | - $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); |
|
10240 | + $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); |
|
10241 | 10241 | |
10242 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
10242 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
10243 | 10243 | } |
10244 | 10244 | |
10245 | 10245 | /** |
@@ -10339,9 +10339,9 @@ discard block |
||
10339 | 10339 | } |
10340 | 10340 | |
10341 | 10341 | if ($length === null) { |
10342 | - $length = (int) $str_length; |
|
10342 | + $length = (int)$str_length; |
|
10343 | 10343 | } else { |
10344 | - $length = (int) $length; |
|
10344 | + $length = (int)$length; |
|
10345 | 10345 | } |
10346 | 10346 | |
10347 | 10347 | if ( |
@@ -10349,7 +10349,7 @@ discard block |
||
10349 | 10349 | && |
10350 | 10350 | self::$SUPPORT['mbstring'] === false |
10351 | 10351 | ) { |
10352 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10352 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10353 | 10353 | } |
10354 | 10354 | |
10355 | 10355 | // |
@@ -10437,16 +10437,16 @@ discard block |
||
10437 | 10437 | ) { |
10438 | 10438 | if ($encoding === 'UTF-8') { |
10439 | 10439 | if ($length === null) { |
10440 | - $str1 = (string) \mb_substr($str1, $offset); |
|
10440 | + $str1 = (string)\mb_substr($str1, $offset); |
|
10441 | 10441 | } else { |
10442 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
10442 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
10443 | 10443 | } |
10444 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
10444 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
10445 | 10445 | } else { |
10446 | 10446 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10447 | 10447 | |
10448 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
10449 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
10448 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
10449 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
10450 | 10450 | } |
10451 | 10451 | } |
10452 | 10452 | |
@@ -10508,13 +10508,13 @@ discard block |
||
10508 | 10508 | if ($lengthTmp === false) { |
10509 | 10509 | return false; |
10510 | 10510 | } |
10511 | - $length = (int) $lengthTmp; |
|
10511 | + $length = (int)$lengthTmp; |
|
10512 | 10512 | } |
10513 | 10513 | |
10514 | 10514 | if ($encoding === 'UTF-8') { |
10515 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
10515 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
10516 | 10516 | } else { |
10517 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
10517 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
10518 | 10518 | } |
10519 | 10519 | } |
10520 | 10520 | |
@@ -10523,7 +10523,7 @@ discard block |
||
10523 | 10523 | && |
10524 | 10524 | self::$SUPPORT['mbstring'] === false |
10525 | 10525 | ) { |
10526 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10526 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10527 | 10527 | } |
10528 | 10528 | |
10529 | 10529 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10534,7 +10534,7 @@ discard block |
||
10534 | 10534 | return \mb_substr_count($haystack, $needle, $encoding); |
10535 | 10535 | } |
10536 | 10536 | |
10537 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10537 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10538 | 10538 | |
10539 | 10539 | return \count($matches); |
10540 | 10540 | } |
@@ -10581,7 +10581,7 @@ discard block |
||
10581 | 10581 | if ($lengthTmp === false) { |
10582 | 10582 | return false; |
10583 | 10583 | } |
10584 | - $length = (int) $lengthTmp; |
|
10584 | + $length = (int)$lengthTmp; |
|
10585 | 10585 | } |
10586 | 10586 | |
10587 | 10587 | if ( |
@@ -10602,7 +10602,7 @@ discard block |
||
10602 | 10602 | if ($haystackTmp === false) { |
10603 | 10603 | $haystackTmp = ''; |
10604 | 10604 | } |
10605 | - $haystack = (string) $haystackTmp; |
|
10605 | + $haystack = (string)$haystackTmp; |
|
10606 | 10606 | } |
10607 | 10607 | |
10608 | 10608 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10641,10 +10641,10 @@ discard block |
||
10641 | 10641 | |
10642 | 10642 | if ($encoding === 'UTF-8') { |
10643 | 10643 | if ($caseSensitive) { |
10644 | - return (int) \mb_substr_count($str, $substring); |
|
10644 | + return (int)\mb_substr_count($str, $substring); |
|
10645 | 10645 | } |
10646 | 10646 | |
10647 | - return (int) \mb_substr_count( |
|
10647 | + return (int)\mb_substr_count( |
|
10648 | 10648 | \mb_strtoupper($str), |
10649 | 10649 | \mb_strtoupper($substring) |
10650 | 10650 | |
@@ -10654,10 +10654,10 @@ discard block |
||
10654 | 10654 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10655 | 10655 | |
10656 | 10656 | if ($caseSensitive) { |
10657 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
10657 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
10658 | 10658 | } |
10659 | 10659 | |
10660 | - return (int) \mb_substr_count( |
|
10660 | + return (int)\mb_substr_count( |
|
10661 | 10661 | self::strtocasefold($str, true, false, $encoding, null, false), |
10662 | 10662 | self::strtocasefold($substring, true, false, $encoding, null, false), |
10663 | 10663 | $encoding |
@@ -10683,7 +10683,7 @@ discard block |
||
10683 | 10683 | } |
10684 | 10684 | |
10685 | 10685 | if (self::str_istarts_with($haystack, $needle) === true) { |
10686 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10686 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10687 | 10687 | } |
10688 | 10688 | |
10689 | 10689 | return $haystack; |
@@ -10740,7 +10740,7 @@ discard block |
||
10740 | 10740 | } |
10741 | 10741 | |
10742 | 10742 | if (self::str_iends_with($haystack, $needle) === true) { |
10743 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
10743 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
10744 | 10744 | } |
10745 | 10745 | |
10746 | 10746 | return $haystack; |
@@ -10765,7 +10765,7 @@ discard block |
||
10765 | 10765 | } |
10766 | 10766 | |
10767 | 10767 | if (self::str_starts_with($haystack, $needle) === true) { |
10768 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10768 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10769 | 10769 | } |
10770 | 10770 | |
10771 | 10771 | return $haystack; |
@@ -10817,7 +10817,7 @@ discard block |
||
10817 | 10817 | if (\is_array($offset) === true) { |
10818 | 10818 | $offset = \array_slice($offset, 0, $num); |
10819 | 10819 | foreach ($offset as &$valueTmp) { |
10820 | - $valueTmp = (int) $valueTmp === $valueTmp ? $valueTmp : 0; |
|
10820 | + $valueTmp = (int)$valueTmp === $valueTmp ? $valueTmp : 0; |
|
10821 | 10821 | } |
10822 | 10822 | unset($valueTmp); |
10823 | 10823 | } else { |
@@ -10830,7 +10830,7 @@ discard block |
||
10830 | 10830 | } elseif (\is_array($length) === true) { |
10831 | 10831 | $length = \array_slice($length, 0, $num); |
10832 | 10832 | foreach ($length as &$valueTmpV2) { |
10833 | - $valueTmpV2 = (int) $valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10833 | + $valueTmpV2 = (int)$valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10834 | 10834 | } |
10835 | 10835 | unset($valueTmpV2); |
10836 | 10836 | } else { |
@@ -10850,8 +10850,8 @@ discard block |
||
10850 | 10850 | } |
10851 | 10851 | |
10852 | 10852 | // init |
10853 | - $str = (string) $str; |
|
10854 | - $replacement = (string) $replacement; |
|
10853 | + $str = (string)$str; |
|
10854 | + $replacement = (string)$replacement; |
|
10855 | 10855 | |
10856 | 10856 | if (\is_array($length) === true) { |
10857 | 10857 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -10866,16 +10866,16 @@ discard block |
||
10866 | 10866 | } |
10867 | 10867 | |
10868 | 10868 | if (self::$SUPPORT['mbstring'] === true) { |
10869 | - $string_length = (int) self::strlen($str, $encoding); |
|
10869 | + $string_length = (int)self::strlen($str, $encoding); |
|
10870 | 10870 | |
10871 | 10871 | if ($offset < 0) { |
10872 | - $offset = (int) \max(0, $string_length + $offset); |
|
10872 | + $offset = (int)\max(0, $string_length + $offset); |
|
10873 | 10873 | } elseif ($offset > $string_length) { |
10874 | 10874 | $offset = $string_length; |
10875 | 10875 | } |
10876 | 10876 | |
10877 | 10877 | if ($length !== null && $length < 0) { |
10878 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
10878 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
10879 | 10879 | } elseif ($length === null || $length > $string_length) { |
10880 | 10880 | $length = $string_length; |
10881 | 10881 | } |
@@ -10886,9 +10886,9 @@ discard block |
||
10886 | 10886 | } |
10887 | 10887 | |
10888 | 10888 | /** @noinspection AdditionOperationOnArraysInspection */ |
10889 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
10890 | - $replacement . |
|
10891 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10889 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
10890 | + $replacement. |
|
10891 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10892 | 10892 | } |
10893 | 10893 | |
10894 | 10894 | // |
@@ -10897,8 +10897,7 @@ discard block |
||
10897 | 10897 | |
10898 | 10898 | if (self::is_ascii($str)) { |
10899 | 10899 | return ($length === null) ? |
10900 | - \substr_replace($str, $replacement, $offset) : |
|
10901 | - \substr_replace($str, $replacement, $offset, $length); |
|
10900 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
10902 | 10901 | } |
10903 | 10902 | |
10904 | 10903 | // |
@@ -10914,7 +10913,7 @@ discard block |
||
10914 | 10913 | // e.g.: non mbstring support + invalid chars |
10915 | 10914 | return ''; |
10916 | 10915 | } |
10917 | - $length = (int) $lengthTmp; |
|
10916 | + $length = (int)$lengthTmp; |
|
10918 | 10917 | } |
10919 | 10918 | |
10920 | 10919 | \array_splice($smatches[0], $offset, $length, $rmatches[0]); |
@@ -10949,14 +10948,14 @@ discard block |
||
10949 | 10948 | && |
10950 | 10949 | \substr($haystack, -\strlen($needle)) === $needle |
10951 | 10950 | ) { |
10952 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
10951 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
10953 | 10952 | } |
10954 | 10953 | |
10955 | 10954 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
10956 | - return (string) self::substr( |
|
10955 | + return (string)self::substr( |
|
10957 | 10956 | $haystack, |
10958 | 10957 | 0, |
10959 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
10958 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
10960 | 10959 | $encoding |
10961 | 10960 | ); |
10962 | 10961 | } |
@@ -10986,10 +10985,10 @@ discard block |
||
10986 | 10985 | } |
10987 | 10986 | |
10988 | 10987 | if ($encoding === 'UTF-8') { |
10989 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10988 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10990 | 10989 | } |
10991 | 10990 | |
10992 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10991 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10993 | 10992 | } |
10994 | 10993 | |
10995 | 10994 | /** |
@@ -11181,7 +11180,7 @@ discard block |
||
11181 | 11180 | // INFO: https://unicode.org/cldr/utility/character.jsp?a=%E2%84%8C |
11182 | 11181 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11183 | 11182 | /** @noinspection UnnecessaryCastingInspection */ |
11184 | - $str = (string) \transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11183 | + $str = (string)\transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11185 | 11184 | |
11186 | 11185 | // check again, if we only have ASCII, now ... |
11187 | 11186 | if (self::is_ascii($str) === true) { |
@@ -11304,7 +11303,7 @@ discard block |
||
11304 | 11303 | public static function to_boolean($str): bool |
11305 | 11304 | { |
11306 | 11305 | // init |
11307 | - $str = (string) $str; |
|
11306 | + $str = (string)$str; |
|
11308 | 11307 | |
11309 | 11308 | if ($str === '') { |
11310 | 11309 | return false; |
@@ -11332,10 +11331,10 @@ discard block |
||
11332 | 11331 | } |
11333 | 11332 | |
11334 | 11333 | if (\is_numeric($str)) { |
11335 | - return ((float) $str + 0) > 0; |
|
11334 | + return ((float)$str + 0) > 0; |
|
11336 | 11335 | } |
11337 | 11336 | |
11338 | - return (bool) \trim($str); |
|
11337 | + return (bool)\trim($str); |
|
11339 | 11338 | } |
11340 | 11339 | |
11341 | 11340 | /** |
@@ -11356,11 +11355,11 @@ discard block |
||
11356 | 11355 | |
11357 | 11356 | $fallback_char_escaped = \preg_quote($fallback_char, '/'); |
11358 | 11357 | |
11359 | - $string = (string) \preg_replace( |
|
11358 | + $string = (string)\preg_replace( |
|
11360 | 11359 | [ |
11361 | - '/[^' . $fallback_char_escaped . '\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
11362 | - '/[\s]+/u', // 2) convert spaces to $fallback_char |
|
11363 | - '/[' . $fallback_char_escaped . ']+/u', // 3) remove double $fallback_char's |
|
11360 | + '/[^'.$fallback_char_escaped.'\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
11361 | + '/[\s]+/u', // 2) convert spaces to $fallback_char |
|
11362 | + '/['.$fallback_char_escaped.']+/u', // 3) remove double $fallback_char's |
|
11364 | 11363 | ], |
11365 | 11364 | [ |
11366 | 11365 | '', |
@@ -11391,7 +11390,7 @@ discard block |
||
11391 | 11390 | return $str; |
11392 | 11391 | } |
11393 | 11392 | |
11394 | - $str = (string) $str; |
|
11393 | + $str = (string)$str; |
|
11395 | 11394 | if ($str === '') { |
11396 | 11395 | return ''; |
11397 | 11396 | } |
@@ -11438,7 +11437,7 @@ discard block |
||
11438 | 11437 | return $str; |
11439 | 11438 | } |
11440 | 11439 | |
11441 | - $str = (string) $str; |
|
11440 | + $str = (string)$str; |
|
11442 | 11441 | if ($str === '') { |
11443 | 11442 | return $str; |
11444 | 11443 | } |
@@ -11456,7 +11455,7 @@ discard block |
||
11456 | 11455 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
11457 | 11456 | |
11458 | 11457 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11459 | - $buf .= $c1 . $c2; |
|
11458 | + $buf .= $c1.$c2; |
|
11460 | 11459 | ++$i; |
11461 | 11460 | } else { // not valid UTF8 - convert it |
11462 | 11461 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11467,7 +11466,7 @@ discard block |
||
11467 | 11466 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
11468 | 11467 | |
11469 | 11468 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11470 | - $buf .= $c1 . $c2 . $c3; |
|
11469 | + $buf .= $c1.$c2.$c3; |
|
11471 | 11470 | $i += 2; |
11472 | 11471 | } else { // not valid UTF8 - convert it |
11473 | 11472 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11479,7 +11478,7 @@ discard block |
||
11479 | 11478 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
11480 | 11479 | |
11481 | 11480 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11482 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
11481 | + $buf .= $c1.$c2.$c3.$c4; |
|
11483 | 11482 | $i += 3; |
11484 | 11483 | } else { // not valid UTF8 - convert it |
11485 | 11484 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11505,13 +11504,13 @@ discard block |
||
11505 | 11504 | * |
11506 | 11505 | * @return string |
11507 | 11506 | */ |
11508 | - static function (array $matches): string { |
|
11507 | + static function(array $matches): string { |
|
11509 | 11508 | if (isset($matches[3])) { |
11510 | - $cp = (int) \hexdec($matches[3]); |
|
11509 | + $cp = (int)\hexdec($matches[3]); |
|
11511 | 11510 | } else { |
11512 | 11511 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
11513 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
11514 | - + (int) \hexdec($matches[2]) |
|
11512 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
11513 | + + (int)\hexdec($matches[2]) |
|
11515 | 11514 | + 0x10000 |
11516 | 11515 | - (0xD800 << 10) |
11517 | 11516 | - 0xDC00; |
@@ -11522,12 +11521,12 @@ discard block |
||
11522 | 11521 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
11523 | 11522 | |
11524 | 11523 | if ($cp < 0x80) { |
11525 | - return (string) self::chr($cp); |
|
11524 | + return (string)self::chr($cp); |
|
11526 | 11525 | } |
11527 | 11526 | |
11528 | 11527 | if ($cp < 0xA0) { |
11529 | 11528 | /** @noinspection UnnecessaryCastingInspection */ |
11530 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
11529 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
11531 | 11530 | } |
11532 | 11531 | |
11533 | 11532 | return self::decimal_to_chr($cp); |
@@ -11575,7 +11574,7 @@ discard block |
||
11575 | 11574 | |
11576 | 11575 | if (self::$SUPPORT['mbstring'] === true) { |
11577 | 11576 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11578 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
11577 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
11579 | 11578 | } |
11580 | 11579 | |
11581 | 11580 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -11612,15 +11611,15 @@ discard block |
||
11612 | 11611 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
11613 | 11612 | |
11614 | 11613 | if ($encoding === 'UTF-8') { |
11615 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
11614 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
11616 | 11615 | |
11617 | 11616 | if ($useMbFunction === true) { |
11618 | 11617 | $strPartOne = \mb_strtoupper( |
11619 | - (string) \mb_substr($str, 0, 1) |
|
11618 | + (string)\mb_substr($str, 0, 1) |
|
11620 | 11619 | ); |
11621 | 11620 | } else { |
11622 | 11621 | $strPartOne = self::strtoupper( |
11623 | - (string) \mb_substr($str, 0, 1), |
|
11622 | + (string)\mb_substr($str, 0, 1), |
|
11624 | 11623 | $encoding, |
11625 | 11624 | false, |
11626 | 11625 | $lang, |
@@ -11630,16 +11629,16 @@ discard block |
||
11630 | 11629 | } else { |
11631 | 11630 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11632 | 11631 | |
11633 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
11632 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
11634 | 11633 | |
11635 | 11634 | if ($useMbFunction === true) { |
11636 | 11635 | $strPartOne = \mb_strtoupper( |
11637 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
11636 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
11638 | 11637 | $encoding |
11639 | 11638 | ); |
11640 | 11639 | } else { |
11641 | 11640 | $strPartOne = self::strtoupper( |
11642 | - (string) self::substr($str, 0, 1, $encoding), |
|
11641 | + (string)self::substr($str, 0, 1, $encoding), |
|
11643 | 11642 | $encoding, |
11644 | 11643 | false, |
11645 | 11644 | $lang, |
@@ -11648,7 +11647,7 @@ discard block |
||
11648 | 11647 | } |
11649 | 11648 | } |
11650 | 11649 | |
11651 | - return $strPartOne . $strPartTwo; |
|
11650 | + return $strPartOne.$strPartTwo; |
|
11652 | 11651 | } |
11653 | 11652 | |
11654 | 11653 | /** |
@@ -11699,7 +11698,7 @@ discard block |
||
11699 | 11698 | $str = self::clean($str); |
11700 | 11699 | } |
11701 | 11700 | |
11702 | - $usePhpDefaultFunctions = !(bool) ($charlist . \implode('', $exceptions)); |
|
11701 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
11703 | 11702 | |
11704 | 11703 | if ( |
11705 | 11704 | $usePhpDefaultFunctions === true |
@@ -12086,7 +12085,7 @@ discard block |
||
12086 | 12085 | if ( |
12087 | 12086 | $keepUtf8Chars === true |
12088 | 12087 | && |
12089 | - self::strlen($return) >= (int) self::strlen($str_backup) |
|
12088 | + self::strlen($return) >= (int)self::strlen($str_backup) |
|
12090 | 12089 | ) { |
12091 | 12090 | return $str_backup; |
12092 | 12091 | } |
@@ -12162,17 +12161,17 @@ discard block |
||
12162 | 12161 | return ''; |
12163 | 12162 | } |
12164 | 12163 | |
12165 | - \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches); |
|
12164 | + \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches); |
|
12166 | 12165 | |
12167 | 12166 | if ( |
12168 | 12167 | !isset($matches[0]) |
12169 | 12168 | || |
12170 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
12169 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
12171 | 12170 | ) { |
12172 | 12171 | return $str; |
12173 | 12172 | } |
12174 | 12173 | |
12175 | - return \rtrim($matches[0]) . $strAddOn; |
|
12174 | + return \rtrim($matches[0]).$strAddOn; |
|
12176 | 12175 | } |
12177 | 12176 | |
12178 | 12177 | /** |
@@ -12243,7 +12242,7 @@ discard block |
||
12243 | 12242 | $strReturn .= $break; |
12244 | 12243 | } |
12245 | 12244 | |
12246 | - return $strReturn . \implode('', $chars); |
|
12245 | + return $strReturn.\implode('', $chars); |
|
12247 | 12246 | } |
12248 | 12247 | |
12249 | 12248 | /** |
@@ -12256,7 +12255,7 @@ discard block |
||
12256 | 12255 | */ |
12257 | 12256 | public static function wordwrap_per_line(string $str, int $limit): string |
12258 | 12257 | { |
12259 | - $strings = (array) \preg_split('/\\r\\n|\\r|\\n/', $str); |
|
12258 | + $strings = (array)\preg_split('/\\r\\n|\\r|\\n/', $str); |
|
12260 | 12259 | |
12261 | 12260 | $string = ''; |
12262 | 12261 | foreach ($strings as &$value) { |
@@ -12335,7 +12334,7 @@ discard block |
||
12335 | 12334 | /** @noinspection PhpIncludeInspection */ |
12336 | 12335 | /** @noinspection UsingInclusionReturnValueInspection */ |
12337 | 12336 | /** @psalm-suppress UnresolvableInclude */ |
12338 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
12337 | + return include __DIR__.'/data/'.$file.'.php'; |
|
12339 | 12338 | } |
12340 | 12339 | |
12341 | 12340 | /** |
@@ -12347,7 +12346,7 @@ discard block |
||
12347 | 12346 | */ |
12348 | 12347 | private static function getDataIfExists(string $file) |
12349 | 12348 | { |
12350 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
12349 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
12351 | 12350 | if (\file_exists($file)) { |
12352 | 12351 | /** @noinspection PhpIncludeInspection */ |
12353 | 12352 | /** @noinspection UsingInclusionReturnValueInspection */ |
@@ -12369,7 +12368,7 @@ discard block |
||
12369 | 12368 | |
12370 | 12369 | \uksort( |
12371 | 12370 | self::$EMOJI, |
12372 | - static function (string $a, string $b): int { |
|
12371 | + static function(string $a, string $b): int { |
|
12373 | 12372 | return \strlen($b) <=> \strlen($a); |
12374 | 12373 | } |
12375 | 12374 | ); |
@@ -12379,7 +12378,7 @@ discard block |
||
12379 | 12378 | |
12380 | 12379 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
12381 | 12380 | $tmpKey = \crc32($key); |
12382 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmpKey . '_-_' . \strrev((string) $tmpKey) . '_-_8FTU_ELBATROP_-_'; |
|
12381 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmpKey.'_-_'.\strrev((string)$tmpKey).'_-_8FTU_ELBATROP_-_'; |
|
12383 | 12382 | } |
12384 | 12383 | |
12385 | 12384 | return true; |
@@ -12403,7 +12402,7 @@ discard block |
||
12403 | 12402 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
12404 | 12403 | return \defined('MB_OVERLOAD_STRING') |
12405 | 12404 | && |
12406 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12405 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12407 | 12406 | } |
12408 | 12407 | |
12409 | 12408 | /** |
@@ -12453,7 +12452,7 @@ discard block |
||
12453 | 12452 | { |
12454 | 12453 | static $RX_CLASS_CACHE = []; |
12455 | 12454 | |
12456 | - $cacheKey = $s . $class; |
|
12455 | + $cacheKey = $s.$class; |
|
12457 | 12456 | |
12458 | 12457 | if (isset($RX_CLASS_CACHE[$cacheKey])) { |
12459 | 12458 | return $RX_CLASS_CACHE[$cacheKey]; |
@@ -12465,7 +12464,7 @@ discard block |
||
12465 | 12464 | /** @noinspection AlterInForeachInspection */ |
12466 | 12465 | foreach (self::str_split($s) as &$s) { |
12467 | 12466 | if ($s === '-') { |
12468 | - $classArray[0] = '-' . $classArray[0]; |
|
12467 | + $classArray[0] = '-'.$classArray[0]; |
|
12469 | 12468 | } elseif (!isset($s[2])) { |
12470 | 12469 | $classArray[0] .= \preg_quote($s, '/'); |
12471 | 12470 | } elseif (self::strlen($s) === 1) { |
@@ -12476,13 +12475,13 @@ discard block |
||
12476 | 12475 | } |
12477 | 12476 | |
12478 | 12477 | if ($classArray[0]) { |
12479 | - $classArray[0] = '[' . $classArray[0] . ']'; |
|
12478 | + $classArray[0] = '['.$classArray[0].']'; |
|
12480 | 12479 | } |
12481 | 12480 | |
12482 | 12481 | if (\count($classArray) === 1) { |
12483 | 12482 | $return = $classArray[0]; |
12484 | 12483 | } else { |
12485 | - $return = '(?:' . \implode('|', $classArray) . ')'; |
|
12484 | + $return = '(?:'.\implode('|', $classArray).')'; |
|
12486 | 12485 | } |
12487 | 12486 | |
12488 | 12487 | $RX_CLASS_CACHE[$cacheKey] = $return; |
@@ -12556,7 +12555,7 @@ discard block |
||
12556 | 12555 | $continue = false; |
12557 | 12556 | |
12558 | 12557 | if ($delimiter === '-') { |
12559 | - foreach ((array) $specialCases['names'] as &$beginning) { |
|
12558 | + foreach ((array)$specialCases['names'] as &$beginning) { |
|
12560 | 12559 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12561 | 12560 | $continue = true; |
12562 | 12561 | } |
@@ -12564,7 +12563,7 @@ discard block |
||
12564 | 12563 | unset($beginning); |
12565 | 12564 | } |
12566 | 12565 | |
12567 | - foreach ((array) $specialCases['prefixes'] as &$beginning) { |
|
12566 | + foreach ((array)$specialCases['prefixes'] as &$beginning) { |
|
12568 | 12567 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12569 | 12568 | $continue = true; |
12570 | 12569 | } |
@@ -12624,8 +12623,8 @@ discard block |
||
12624 | 12623 | $buf .= self::$WIN1252_TO_UTF8[$ordC1]; |
12625 | 12624 | } else { |
12626 | 12625 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
12627 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
12628 | - $buf .= $cc1 . $cc2; |
|
12626 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
12627 | + $buf .= $cc1.$cc2; |
|
12629 | 12628 | } |
12630 | 12629 | |
12631 | 12630 | return $buf; |
@@ -12640,7 +12639,7 @@ discard block |
||
12640 | 12639 | { |
12641 | 12640 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
12642 | 12641 | if (\preg_match($pattern, $str)) { |
12643 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
12642 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
12644 | 12643 | } |
12645 | 12644 | |
12646 | 12645 | return $str; |