@@ -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 | ]; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | return false; |
84 | 84 | } |
85 | 85 | |
86 | - $uri = (string) $_SERVER['REQUEST_URI']; |
|
86 | + $uri = (string)$_SERVER['REQUEST_URI']; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | $uriOrig = $uri; |
@@ -100,27 +100,27 @@ discard block |
||
100 | 100 | // When not, assumes Windows-1252 and redirects to the corresponding UTF-8 encoded URL |
101 | 101 | // |
102 | 102 | |
103 | - $uri = (string) \preg_replace_callback( |
|
103 | + $uri = (string)\preg_replace_callback( |
|
104 | 104 | '/[\x80-\xFF]+/', |
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($m[0]); |
112 | 112 | }, |
113 | 113 | $uri |
114 | 114 | ); |
115 | 115 | |
116 | - $uri = (string) \preg_replace_callback( |
|
116 | + $uri = (string)\preg_replace_callback( |
|
117 | 117 | '/(?:%[89A-F][0-9A-F])+/i', |
118 | 118 | /** |
119 | 119 | * @param array $m |
120 | 120 | * |
121 | 121 | * @return string |
122 | 122 | */ |
123 | - static function (array $m): string { |
|
123 | + static function(array $m): string { |
|
124 | 124 | return \rawurlencode(UTF8::rawurldecode($m[0])); |
125 | 125 | }, |
126 | 126 | $uri |
@@ -134,19 +134,19 @@ discard block |
||
134 | 134 | \headers_sent() === false |
135 | 135 | ) { |
136 | 136 | $severProtocol = ($_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'); |
137 | - \header($severProtocol . ' 301 Moved Permanently'); |
|
137 | + \header($severProtocol.' 301 Moved Permanently'); |
|
138 | 138 | |
139 | 139 | if (\strncmp($uri, '/', 1) === 0) { |
140 | - \header('Location: /' . \ltrim($uri, '/')); |
|
140 | + \header('Location: /'.\ltrim($uri, '/')); |
|
141 | 141 | } else { |
142 | - \header('Location: ' . $uri); |
|
142 | + \header('Location: '.$uri); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | exit(); |
146 | 146 | } |
147 | 147 | |
148 | 148 | if (\strncmp($uri, '/', 1) === 0) { |
149 | - $uri = '/' . \ltrim($uri, '/'); |
|
149 | + $uri = '/'.\ltrim($uri, '/'); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | return $uri; |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | return false; |
190 | 190 | } |
191 | 191 | |
192 | - $length = (int) $length; |
|
192 | + $length = (int)$length; |
|
193 | 193 | |
194 | 194 | if ($length <= 0) { |
195 | 195 | return false; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | */ |
230 | 230 | static $_IS_PHP; |
231 | 231 | |
232 | - $version = (string) $version; |
|
232 | + $version = (string)$version; |
|
233 | 233 | |
234 | 234 | if (!isset($_IS_PHP[$version])) { |
235 | 235 | $_IS_PHP[$version] = \version_compare(\PHP_VERSION, $version, '>='); |
@@ -629,22 +629,22 @@ discard block |
||
629 | 629 | * @psalm-suppress PossiblyNullArrayAccess |
630 | 630 | */ |
631 | 631 | $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
632 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
632 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
633 | 633 | } elseif ($code_point <= 0xFFFF) { |
634 | 634 | /** |
635 | 635 | * @psalm-suppress PossiblyNullArrayAccess |
636 | 636 | */ |
637 | 637 | $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
638 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
639 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
638 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
639 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
640 | 640 | } else { |
641 | 641 | /** |
642 | 642 | * @psalm-suppress PossiblyNullArrayAccess |
643 | 643 | */ |
644 | 644 | $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
645 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
646 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
647 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
645 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
646 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
647 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
648 | 648 | } |
649 | 649 | |
650 | 650 | if ($encoding !== 'UTF-8') { |
@@ -1131,7 +1131,7 @@ discard block |
||
1131 | 1131 | $asciiOffset = 0x41; |
1132 | 1132 | |
1133 | 1133 | return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? '') . |
1134 | - (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
|
1134 | + (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
|
1135 | 1135 | } |
1136 | 1136 | |
1137 | 1137 | /** |
@@ -2484,10 +2484,10 @@ discard block |
||
2484 | 2484 | } |
2485 | 2485 | |
2486 | 2486 | $unique_helper = $rand_int . |
2487 | - \session_id() . |
|
2488 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2489 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2490 | - $extra_entropy; |
|
2487 | + \session_id() . |
|
2488 | + ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2489 | + ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2490 | + $extra_entropy; |
|
2491 | 2491 | |
2492 | 2492 | $unique_string = \uniqid($unique_helper, true); |
2493 | 2493 | |
@@ -6346,8 +6346,8 @@ discard block |
||
6346 | 6346 | |
6347 | 6347 | /** @noinspection UnnecessaryCastingInspection */ |
6348 | 6348 | return (string) \mb_substr($str, 0, $index) . |
6349 | - $substring . |
|
6350 | - (string) \mb_substr($str, $index, $len); |
|
6349 | + $substring . |
|
6350 | + (string) \mb_substr($str, $index, $len); |
|
6351 | 6351 | } |
6352 | 6352 | |
6353 | 6353 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -6358,8 +6358,8 @@ discard block |
||
6358 | 6358 | } |
6359 | 6359 | |
6360 | 6360 | return ((string) self::substr($str, 0, $index, $encoding)) . |
6361 | - $substring . |
|
6362 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
6361 | + $substring . |
|
6362 | + ((string) self::substr($str, $index, $len, $encoding)); |
|
6363 | 6363 | } |
6364 | 6364 | |
6365 | 6365 | /** |
@@ -8532,11 +8532,11 @@ discard block |
||
8532 | 8532 | if ($use_mb_functions) { |
8533 | 8533 | if ($encoding === 'UTF-8') { |
8534 | 8534 | return \mb_strtoupper(\mb_substr($match[0], 0, 1)) |
8535 | - . \mb_strtolower(\mb_substr($match[0], 1)); |
|
8535 | + . \mb_strtolower(\mb_substr($match[0], 1)); |
|
8536 | 8536 | } |
8537 | 8537 | |
8538 | 8538 | return \mb_strtoupper(\mb_substr($match[0], 0, 1, $encoding), $encoding) |
8539 | - . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
8539 | + . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
8540 | 8540 | } |
8541 | 8541 | |
8542 | 8542 | return self::ucfirst( |
@@ -8938,13 +8938,13 @@ discard block |
||
8938 | 8938 | } |
8939 | 8939 | |
8940 | 8940 | return ( |
8941 | - (string) self::substr( |
|
8942 | - $str, |
|
8943 | - 0, |
|
8944 | - $length, |
|
8945 | - $encoding |
|
8946 | - ) |
|
8947 | - ) . $substring; |
|
8941 | + (string) self::substr( |
|
8942 | + $str, |
|
8943 | + 0, |
|
8944 | + $length, |
|
8945 | + $encoding |
|
8946 | + ) |
|
8947 | + ) . $substring; |
|
8948 | 8948 | } |
8949 | 8949 | |
8950 | 8950 | /** |
@@ -11979,8 +11979,8 @@ discard block |
||
11979 | 11979 | |
11980 | 11980 | /** @noinspection AdditionOperationOnArraysInspection */ |
11981 | 11981 | return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
11982 | - $replacement . |
|
11983 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
11982 | + $replacement . |
|
11983 | + ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
11984 | 11984 | } |
11985 | 11985 | |
11986 | 11986 | // |
@@ -247,10 +247,10 @@ discard block |
||
247 | 247 | } |
248 | 248 | |
249 | 249 | if ($encoding === 'UTF-8') { |
250 | - return (string) \mb_substr($str, $pos, 1); |
|
250 | + return (string)\mb_substr($str, $pos, 1); |
|
251 | 251 | } |
252 | 252 | |
253 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
253 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | /** |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | public static function add_bom_to_string(string $str): string |
269 | 269 | { |
270 | 270 | if (!self::string_has_bom($str)) { |
271 | - $str = self::bom() . $str; |
|
271 | + $str = self::bom().$str; |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | return $str; |
@@ -303,8 +303,8 @@ discard block |
||
303 | 303 | $return = []; |
304 | 304 | foreach ($array as $key => &$value) { |
305 | 305 | $key = $case === \CASE_LOWER |
306 | - ? self::strtolower((string) $key, $encoding) |
|
307 | - : self::strtoupper((string) $key, $encoding); |
|
306 | + ? self::strtolower((string)$key, $encoding) |
|
307 | + : self::strtoupper((string)$key, $encoding); |
|
308 | 308 | |
309 | 309 | $return[$key] = $value; |
310 | 310 | } |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | return ''; |
341 | 341 | } |
342 | 342 | |
343 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
343 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
344 | 344 | $end_position = \mb_strpos($str, $end, $substr_index); |
345 | 345 | if ( |
346 | 346 | $end_position === false |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | return ''; |
351 | 351 | } |
352 | 352 | |
353 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
353 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | return ''; |
361 | 361 | } |
362 | 362 | |
363 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
363 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
364 | 364 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
365 | 365 | if ( |
366 | 366 | $end_position === false |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | return ''; |
371 | 371 | } |
372 | 372 | |
373 | - return (string) self::substr( |
|
373 | + return (string)self::substr( |
|
374 | 374 | $str, |
375 | 375 | $substr_index, |
376 | 376 | $end_position - $substr_index, |
@@ -448,10 +448,10 @@ discard block |
||
448 | 448 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
449 | 449 | { |
450 | 450 | if ($encoding === 'UTF-8') { |
451 | - return (string) \mb_substr($str, $index, 1); |
|
451 | + return (string)\mb_substr($str, $index, 1); |
|
452 | 452 | } |
453 | 453 | |
454 | - return (string) self::substr($str, $index, 1, $encoding); |
|
454 | + return (string)self::substr($str, $index, 1, $encoding); |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | /** |
@@ -565,14 +565,14 @@ discard block |
||
565 | 565 | /** |
566 | 566 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
567 | 567 | */ |
568 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
568 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | if ($code_point <= 0) { |
572 | 572 | return null; |
573 | 573 | } |
574 | 574 | |
575 | - $cache_key = $code_point . '_' . $encoding; |
|
575 | + $cache_key = $code_point.'_'.$encoding; |
|
576 | 576 | if (isset($CHAR_CACHE[$cache_key])) { |
577 | 577 | return $CHAR_CACHE[$cache_key]; |
578 | 578 | } |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | self::$CHR = self::getData('chr'); |
619 | 619 | } |
620 | 620 | |
621 | - $code_point = (int) $code_point; |
|
621 | + $code_point = (int)$code_point; |
|
622 | 622 | if ($code_point <= 0x7F) { |
623 | 623 | /** |
624 | 624 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -628,22 +628,22 @@ discard block |
||
628 | 628 | /** |
629 | 629 | * @psalm-suppress PossiblyNullArrayAccess |
630 | 630 | */ |
631 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
631 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
632 | 632 | self::$CHR[($code_point & 0x3F) + 0x80]; |
633 | 633 | } elseif ($code_point <= 0xFFFF) { |
634 | 634 | /** |
635 | 635 | * @psalm-suppress PossiblyNullArrayAccess |
636 | 636 | */ |
637 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
638 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
637 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
638 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
639 | 639 | self::$CHR[($code_point & 0x3F) + 0x80]; |
640 | 640 | } else { |
641 | 641 | /** |
642 | 642 | * @psalm-suppress PossiblyNullArrayAccess |
643 | 643 | */ |
644 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
645 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
646 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
644 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
645 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
646 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
647 | 647 | self::$CHR[($code_point & 0x3F) + 0x80]; |
648 | 648 | } |
649 | 649 | |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | |
697 | 697 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
698 | 698 | return \array_map( |
699 | - static function (string $data): int { |
|
699 | + static function(string $data): int { |
|
700 | 700 | // "mb_" is available if overload is used, so use it ... |
701 | 701 | return \mb_strlen($data, 'CP850'); // 8-BIT |
702 | 702 | }, |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | $char = ''; |
778 | 778 | } |
779 | 779 | |
780 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
780 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
781 | 781 | } |
782 | 782 | |
783 | 783 | /** |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
871 | 871 | /x'; |
872 | 872 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
873 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
873 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
874 | 874 | |
875 | 875 | if ($replace_diamond_question_mark) { |
876 | 876 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -907,7 +907,7 @@ discard block |
||
907 | 907 | public static function cleanup($str): string |
908 | 908 | { |
909 | 909 | // init |
910 | - $str = (string) $str; |
|
910 | + $str = (string)$str; |
|
911 | 911 | |
912 | 912 | if ($str === '') { |
913 | 913 | return ''; |
@@ -1004,7 +1004,7 @@ discard block |
||
1004 | 1004 | { |
1005 | 1005 | if (self::$SUPPORT['mbstring'] === true) { |
1006 | 1006 | /** @noinspection PhpComposerExtensionStubsInspection */ |
1007 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
1007 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
1008 | 1008 | } |
1009 | 1009 | |
1010 | 1010 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -1049,7 +1049,7 @@ discard block |
||
1049 | 1049 | */ |
1050 | 1050 | public static function css_stripe_media_queries(string $str): string |
1051 | 1051 | { |
1052 | - return (string) \preg_replace( |
|
1052 | + return (string)\preg_replace( |
|
1053 | 1053 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
1054 | 1054 | '', |
1055 | 1055 | $str |
@@ -1080,7 +1080,7 @@ discard block |
||
1080 | 1080 | */ |
1081 | 1081 | public static function decimal_to_chr($int): string |
1082 | 1082 | { |
1083 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
1083 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
1084 | 1084 | } |
1085 | 1085 | |
1086 | 1086 | /** |
@@ -1130,7 +1130,7 @@ discard block |
||
1130 | 1130 | $flagOffset = 0x1F1E6; |
1131 | 1131 | $asciiOffset = 0x41; |
1132 | 1132 | |
1133 | - return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? '') . |
|
1133 | + return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? ''). |
|
1134 | 1134 | (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
1135 | 1135 | } |
1136 | 1136 | |
@@ -1153,16 +1153,16 @@ discard block |
||
1153 | 1153 | self::initEmojiData(); |
1154 | 1154 | |
1155 | 1155 | if ($use_reversible_string_mappings) { |
1156 | - return (string) \str_replace( |
|
1157 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1158 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1156 | + return (string)\str_replace( |
|
1157 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1158 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1159 | 1159 | $str |
1160 | 1160 | ); |
1161 | 1161 | } |
1162 | 1162 | |
1163 | - return (string) \str_replace( |
|
1164 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1165 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1163 | + return (string)\str_replace( |
|
1164 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1165 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1166 | 1166 | $str |
1167 | 1167 | ); |
1168 | 1168 | } |
@@ -1186,16 +1186,16 @@ discard block |
||
1186 | 1186 | self::initEmojiData(); |
1187 | 1187 | |
1188 | 1188 | if ($use_reversible_string_mappings) { |
1189 | - return (string) \str_replace( |
|
1190 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1191 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1189 | + return (string)\str_replace( |
|
1190 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1191 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1192 | 1192 | $str |
1193 | 1193 | ); |
1194 | 1194 | } |
1195 | 1195 | |
1196 | - return (string) \str_replace( |
|
1197 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1198 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1196 | + return (string)\str_replace( |
|
1197 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1198 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1199 | 1199 | $str |
1200 | 1200 | ); |
1201 | 1201 | } |
@@ -1251,7 +1251,7 @@ discard block |
||
1251 | 1251 | if ($to_encoding === 'JSON') { |
1252 | 1252 | $return = self::json_encode($str); |
1253 | 1253 | if ($return === false) { |
1254 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1254 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | return $return; |
@@ -1341,7 +1341,7 @@ discard block |
||
1341 | 1341 | /** |
1342 | 1342 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
1343 | 1343 | */ |
1344 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
1344 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
1345 | 1345 | } |
1346 | 1346 | |
1347 | 1347 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1441,31 +1441,31 @@ discard block |
||
1441 | 1441 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1442 | 1442 | |
1443 | 1443 | if ($length === null) { |
1444 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
1444 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
1445 | 1445 | } |
1446 | 1446 | |
1447 | 1447 | if ($search === '') { |
1448 | 1448 | if ($encoding === 'UTF-8') { |
1449 | 1449 | if ($length > 0) { |
1450 | - $string_length = (int) \mb_strlen($str); |
|
1450 | + $string_length = (int)\mb_strlen($str); |
|
1451 | 1451 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1452 | 1452 | } else { |
1453 | 1453 | $end = 0; |
1454 | 1454 | } |
1455 | 1455 | |
1456 | - $pos = (int) \min( |
|
1456 | + $pos = (int)\min( |
|
1457 | 1457 | \mb_strpos($str, ' ', $end), |
1458 | 1458 | \mb_strpos($str, '.', $end) |
1459 | 1459 | ); |
1460 | 1460 | } else { |
1461 | 1461 | if ($length > 0) { |
1462 | - $string_length = (int) self::strlen($str, $encoding); |
|
1462 | + $string_length = (int)self::strlen($str, $encoding); |
|
1463 | 1463 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1464 | 1464 | } else { |
1465 | 1465 | $end = 0; |
1466 | 1466 | } |
1467 | 1467 | |
1468 | - $pos = (int) \min( |
|
1468 | + $pos = (int)\min( |
|
1469 | 1469 | self::strpos($str, ' ', $end, $encoding), |
1470 | 1470 | self::strpos($str, '.', $end, $encoding) |
1471 | 1471 | ); |
@@ -1482,18 +1482,18 @@ discard block |
||
1482 | 1482 | return ''; |
1483 | 1483 | } |
1484 | 1484 | |
1485 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1485 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1486 | 1486 | } |
1487 | 1487 | |
1488 | 1488 | return $str; |
1489 | 1489 | } |
1490 | 1490 | |
1491 | 1491 | if ($encoding === 'UTF-8') { |
1492 | - $word_position = (int) \mb_stripos($str, $search); |
|
1493 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1492 | + $word_position = (int)\mb_stripos($str, $search); |
|
1493 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1494 | 1494 | } else { |
1495 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
1496 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1495 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
1496 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1497 | 1497 | } |
1498 | 1498 | |
1499 | 1499 | $pos_start = 0; |
@@ -1505,12 +1505,12 @@ discard block |
||
1505 | 1505 | } |
1506 | 1506 | if ($half_text !== false) { |
1507 | 1507 | if ($encoding === 'UTF-8') { |
1508 | - $pos_start = (int) \max( |
|
1508 | + $pos_start = (int)\max( |
|
1509 | 1509 | \mb_strrpos($half_text, ' '), |
1510 | 1510 | \mb_strrpos($half_text, '.') |
1511 | 1511 | ); |
1512 | 1512 | } else { |
1513 | - $pos_start = (int) \max( |
|
1513 | + $pos_start = (int)\max( |
|
1514 | 1514 | self::strrpos($half_text, ' ', 0, $encoding), |
1515 | 1515 | self::strrpos($half_text, '.', 0, $encoding) |
1516 | 1516 | ); |
@@ -1520,19 +1520,19 @@ discard block |
||
1520 | 1520 | |
1521 | 1521 | if ($word_position && $half_side > 0) { |
1522 | 1522 | $offset = $pos_start + $length - 1; |
1523 | - $real_length = (int) self::strlen($str, $encoding); |
|
1523 | + $real_length = (int)self::strlen($str, $encoding); |
|
1524 | 1524 | |
1525 | 1525 | if ($offset > $real_length) { |
1526 | 1526 | $offset = $real_length; |
1527 | 1527 | } |
1528 | 1528 | |
1529 | 1529 | if ($encoding === 'UTF-8') { |
1530 | - $pos_end = (int) \min( |
|
1530 | + $pos_end = (int)\min( |
|
1531 | 1531 | \mb_strpos($str, ' ', $offset), |
1532 | 1532 | \mb_strpos($str, '.', $offset) |
1533 | 1533 | ) - $pos_start; |
1534 | 1534 | } else { |
1535 | - $pos_end = (int) \min( |
|
1535 | + $pos_end = (int)\min( |
|
1536 | 1536 | self::strpos($str, ' ', $offset, $encoding), |
1537 | 1537 | self::strpos($str, '.', $offset, $encoding) |
1538 | 1538 | ) - $pos_start; |
@@ -1540,12 +1540,12 @@ discard block |
||
1540 | 1540 | |
1541 | 1541 | if (!$pos_end || $pos_end <= 0) { |
1542 | 1542 | if ($encoding === 'UTF-8') { |
1543 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1543 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1544 | 1544 | } else { |
1545 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1545 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1546 | 1546 | } |
1547 | 1547 | if ($str_sub !== false) { |
1548 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
1548 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
1549 | 1549 | } else { |
1550 | 1550 | $extract = ''; |
1551 | 1551 | } |
@@ -1556,26 +1556,26 @@ discard block |
||
1556 | 1556 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
1557 | 1557 | } |
1558 | 1558 | if ($str_sub !== false) { |
1559 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1559 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1560 | 1560 | } else { |
1561 | 1561 | $extract = ''; |
1562 | 1562 | } |
1563 | 1563 | } |
1564 | 1564 | } else { |
1565 | 1565 | $offset = $length - 1; |
1566 | - $true_length = (int) self::strlen($str, $encoding); |
|
1566 | + $true_length = (int)self::strlen($str, $encoding); |
|
1567 | 1567 | |
1568 | 1568 | if ($offset > $true_length) { |
1569 | 1569 | $offset = $true_length; |
1570 | 1570 | } |
1571 | 1571 | |
1572 | 1572 | if ($encoding === 'UTF-8') { |
1573 | - $pos_end = (int) \min( |
|
1573 | + $pos_end = (int)\min( |
|
1574 | 1574 | \mb_strpos($str, ' ', $offset), |
1575 | 1575 | \mb_strpos($str, '.', $offset) |
1576 | 1576 | ); |
1577 | 1577 | } else { |
1578 | - $pos_end = (int) \min( |
|
1578 | + $pos_end = (int)\min( |
|
1579 | 1579 | self::strpos($str, ' ', $offset, $encoding), |
1580 | 1580 | self::strpos($str, '.', $offset, $encoding) |
1581 | 1581 | ); |
@@ -1588,7 +1588,7 @@ discard block |
||
1588 | 1588 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
1589 | 1589 | } |
1590 | 1590 | if ($str_sub !== false) { |
1591 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1591 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1592 | 1592 | } else { |
1593 | 1593 | $extract = ''; |
1594 | 1594 | } |
@@ -1717,7 +1717,7 @@ discard block |
||
1717 | 1717 | { |
1718 | 1718 | $file_content = \file_get_contents($file_path); |
1719 | 1719 | if ($file_content === false) { |
1720 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1720 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1721 | 1721 | } |
1722 | 1722 | |
1723 | 1723 | return self::string_has_bom($file_content); |
@@ -1777,7 +1777,7 @@ discard block |
||
1777 | 1777 | ) { |
1778 | 1778 | // Prevent leading combining chars |
1779 | 1779 | // for NFC-safe concatenations. |
1780 | - $var = $leading_combining . $var; |
|
1780 | + $var = $leading_combining.$var; |
|
1781 | 1781 | } |
1782 | 1782 | } |
1783 | 1783 | |
@@ -2062,10 +2062,10 @@ discard block |
||
2062 | 2062 | } |
2063 | 2063 | |
2064 | 2064 | if ($encoding === 'UTF-8') { |
2065 | - return (string) \mb_substr($str, 0, $n); |
|
2065 | + return (string)\mb_substr($str, 0, $n); |
|
2066 | 2066 | } |
2067 | 2067 | |
2068 | - return (string) self::substr($str, 0, $n, $encoding); |
|
2068 | + return (string)self::substr($str, 0, $n, $encoding); |
|
2069 | 2069 | } |
2070 | 2070 | |
2071 | 2071 | /** |
@@ -2081,7 +2081,7 @@ discard block |
||
2081 | 2081 | */ |
2082 | 2082 | public static function fits_inside(string $str, int $box_size): bool |
2083 | 2083 | { |
2084 | - return (int) self::strlen($str) <= $box_size; |
|
2084 | + return (int)self::strlen($str) <= $box_size; |
|
2085 | 2085 | } |
2086 | 2086 | |
2087 | 2087 | /** |
@@ -2160,7 +2160,7 @@ discard block |
||
2160 | 2160 | return $str; |
2161 | 2161 | } |
2162 | 2162 | |
2163 | - $str = (string) $str; |
|
2163 | + $str = (string)$str; |
|
2164 | 2164 | $last = ''; |
2165 | 2165 | while ($last !== $str) { |
2166 | 2166 | $last = $str; |
@@ -2367,7 +2367,7 @@ discard block |
||
2367 | 2367 | return $fallback; |
2368 | 2368 | } |
2369 | 2369 | /** @noinspection OffsetOperationsInspection */ |
2370 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2370 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2371 | 2371 | |
2372 | 2372 | // DEBUG |
2373 | 2373 | //var_dump($type_code); |
@@ -2425,7 +2425,7 @@ discard block |
||
2425 | 2425 | // |
2426 | 2426 | |
2427 | 2427 | if ($encoding === 'UTF-8') { |
2428 | - $max_length = (int) \mb_strlen($possible_chars); |
|
2428 | + $max_length = (int)\mb_strlen($possible_chars); |
|
2429 | 2429 | if ($max_length === 0) { |
2430 | 2430 | return ''; |
2431 | 2431 | } |
@@ -2446,7 +2446,7 @@ discard block |
||
2446 | 2446 | } else { |
2447 | 2447 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2448 | 2448 | |
2449 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
2449 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
2450 | 2450 | if ($max_length === 0) { |
2451 | 2451 | return ''; |
2452 | 2452 | } |
@@ -2484,16 +2484,16 @@ discard block |
||
2484 | 2484 | $rand_int = \mt_rand(0, \mt_getrandmax()); |
2485 | 2485 | } |
2486 | 2486 | |
2487 | - $unique_helper = $rand_int . |
|
2488 | - \session_id() . |
|
2489 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2490 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2487 | + $unique_helper = $rand_int. |
|
2488 | + \session_id(). |
|
2489 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2490 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2491 | 2491 | $extra_entropy; |
2492 | 2492 | |
2493 | 2493 | $unique_string = \uniqid($unique_helper, true); |
2494 | 2494 | |
2495 | 2495 | if ($use_md5) { |
2496 | - $unique_string = \md5($unique_string . $unique_helper); |
|
2496 | + $unique_string = \md5($unique_string.$unique_helper); |
|
2497 | 2497 | } |
2498 | 2498 | |
2499 | 2499 | return $unique_string; |
@@ -2605,7 +2605,7 @@ discard block |
||
2605 | 2605 | public static function hex_to_int($hexdec) |
2606 | 2606 | { |
2607 | 2607 | // init |
2608 | - $hexdec = (string) $hexdec; |
|
2608 | + $hexdec = (string)$hexdec; |
|
2609 | 2609 | |
2610 | 2610 | if ($hexdec === '') { |
2611 | 2611 | return false; |
@@ -2702,7 +2702,7 @@ discard block |
||
2702 | 2702 | return \implode( |
2703 | 2703 | '', |
2704 | 2704 | \array_map( |
2705 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2705 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2706 | 2706 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
2707 | 2707 | }, |
2708 | 2708 | self::str_split($str) |
@@ -2814,7 +2814,7 @@ discard block |
||
2814 | 2814 | /** |
2815 | 2815 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
2816 | 2816 | */ |
2817 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2817 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2818 | 2818 | } |
2819 | 2819 | |
2820 | 2820 | do { |
@@ -2823,7 +2823,7 @@ discard block |
||
2823 | 2823 | if (\strpos($str, '&') !== false) { |
2824 | 2824 | if (\strpos($str, '&#') !== false) { |
2825 | 2825 | // decode also numeric & UTF16 two byte entities |
2826 | - $str = (string) \preg_replace( |
|
2826 | + $str = (string)\preg_replace( |
|
2827 | 2827 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
2828 | 2828 | '$1;', |
2829 | 2829 | $str |
@@ -2873,7 +2873,7 @@ discard block |
||
2873 | 2873 | */ |
2874 | 2874 | public static function html_stripe_empty_tags(string $str): string |
2875 | 2875 | { |
2876 | - return (string) \preg_replace( |
|
2876 | + return (string)\preg_replace( |
|
2877 | 2877 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
2878 | 2878 | '', |
2879 | 2879 | $str |
@@ -3193,9 +3193,9 @@ discard block |
||
3193 | 3193 | { |
3194 | 3194 | $hex = \dechex($int); |
3195 | 3195 | |
3196 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
3196 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
3197 | 3197 | |
3198 | - return $prefix . $hex . ''; |
|
3198 | + return $prefix.$hex.''; |
|
3199 | 3199 | } |
3200 | 3200 | |
3201 | 3201 | /** |
@@ -3516,7 +3516,7 @@ discard block |
||
3516 | 3516 | */ |
3517 | 3517 | public static function is_binary($input, bool $strict = false): bool |
3518 | 3518 | { |
3519 | - $input = (string) $input; |
|
3519 | + $input = (string)$input; |
|
3520 | 3520 | if ($input === '') { |
3521 | 3521 | return false; |
3522 | 3522 | } |
@@ -3860,7 +3860,7 @@ discard block |
||
3860 | 3860 | public static function is_utf16($str, bool $check_if_string_is_binary = true) |
3861 | 3861 | { |
3862 | 3862 | // init |
3863 | - $str = (string) $str; |
|
3863 | + $str = (string)$str; |
|
3864 | 3864 | $str_chars = []; |
3865 | 3865 | |
3866 | 3866 | if ( |
@@ -3946,7 +3946,7 @@ discard block |
||
3946 | 3946 | public static function is_utf32($str, bool $check_if_string_is_binary = true) |
3947 | 3947 | { |
3948 | 3948 | // init |
3949 | - $str = (string) $str; |
|
3949 | + $str = (string)$str; |
|
3950 | 3950 | $str_chars = []; |
3951 | 3951 | |
3952 | 3952 | if ( |
@@ -4038,7 +4038,7 @@ discard block |
||
4038 | 4038 | return true; |
4039 | 4039 | } |
4040 | 4040 | |
4041 | - return self::is_utf8_string((string) $str, $strict); |
|
4041 | + return self::is_utf8_string((string)$str, $strict); |
|
4042 | 4042 | } |
4043 | 4043 | |
4044 | 4044 | /** |
@@ -4188,15 +4188,15 @@ discard block |
||
4188 | 4188 | $use_mb_functions = ($lang === null && !$try_to_keep_the_string_length); |
4189 | 4189 | |
4190 | 4190 | if ($encoding === 'UTF-8') { |
4191 | - $str_part_two = (string) \mb_substr($str, 1); |
|
4191 | + $str_part_two = (string)\mb_substr($str, 1); |
|
4192 | 4192 | |
4193 | 4193 | if ($use_mb_functions) { |
4194 | 4194 | $str_part_one = \mb_strtolower( |
4195 | - (string) \mb_substr($str, 0, 1) |
|
4195 | + (string)\mb_substr($str, 0, 1) |
|
4196 | 4196 | ); |
4197 | 4197 | } else { |
4198 | 4198 | $str_part_one = self::strtolower( |
4199 | - (string) \mb_substr($str, 0, 1), |
|
4199 | + (string)\mb_substr($str, 0, 1), |
|
4200 | 4200 | $encoding, |
4201 | 4201 | false, |
4202 | 4202 | $lang, |
@@ -4206,10 +4206,10 @@ discard block |
||
4206 | 4206 | } else { |
4207 | 4207 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4208 | 4208 | |
4209 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
4209 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
4210 | 4210 | |
4211 | 4211 | $str_part_one = self::strtolower( |
4212 | - (string) self::substr($str, 0, 1, $encoding), |
|
4212 | + (string)self::substr($str, 0, 1, $encoding), |
|
4213 | 4213 | $encoding, |
4214 | 4214 | false, |
4215 | 4215 | $lang, |
@@ -4217,7 +4217,7 @@ discard block |
||
4217 | 4217 | ); |
4218 | 4218 | } |
4219 | 4219 | |
4220 | - return $str_part_one . $str_part_two; |
|
4220 | + return $str_part_one.$str_part_two; |
|
4221 | 4221 | } |
4222 | 4222 | |
4223 | 4223 | /** |
@@ -4364,7 +4364,7 @@ discard block |
||
4364 | 4364 | } |
4365 | 4365 | |
4366 | 4366 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4367 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4367 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4368 | 4368 | } |
4369 | 4369 | |
4370 | 4370 | if ($chars) { |
@@ -4417,7 +4417,7 @@ discard block |
||
4417 | 4417 | { |
4418 | 4418 | $bytes = self::chr_size_list($str); |
4419 | 4419 | if ($bytes !== []) { |
4420 | - return (int) \max($bytes); |
|
4420 | + return (int)\max($bytes); |
|
4421 | 4421 | } |
4422 | 4422 | |
4423 | 4423 | return 0; |
@@ -4499,7 +4499,7 @@ discard block |
||
4499 | 4499 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4500 | 4500 | |
4501 | 4501 | // init |
4502 | - $encoding = (string) $encoding; |
|
4502 | + $encoding = (string)$encoding; |
|
4503 | 4503 | |
4504 | 4504 | if (!$encoding) { |
4505 | 4505 | return $fallback; |
@@ -4561,7 +4561,7 @@ discard block |
||
4561 | 4561 | |
4562 | 4562 | $encoding_original = $encoding; |
4563 | 4563 | $encoding = \strtoupper($encoding); |
4564 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4564 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4565 | 4565 | |
4566 | 4566 | $equivalences = [ |
4567 | 4567 | 'ISO8859' => 'ISO-8859-1', |
@@ -4719,13 +4719,13 @@ discard block |
||
4719 | 4719 | static $CHAR_CACHE = []; |
4720 | 4720 | |
4721 | 4721 | // init |
4722 | - $chr = (string) $chr; |
|
4722 | + $chr = (string)$chr; |
|
4723 | 4723 | |
4724 | 4724 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
4725 | 4725 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4726 | 4726 | } |
4727 | 4727 | |
4728 | - $cache_key = $chr . '_' . $encoding; |
|
4728 | + $cache_key = $chr.'_'.$encoding; |
|
4729 | 4729 | if (isset($CHAR_CACHE[$cache_key])) { |
4730 | 4730 | return $CHAR_CACHE[$cache_key]; |
4731 | 4731 | } |
@@ -4760,7 +4760,7 @@ discard block |
||
4760 | 4760 | // |
4761 | 4761 | |
4762 | 4762 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
4763 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
4763 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
4764 | 4764 | /** @noinspection OffsetOperationsInspection */ |
4765 | 4765 | $code = $chr ? $chr[1] : 0; |
4766 | 4766 | |
@@ -4768,21 +4768,21 @@ discard block |
||
4768 | 4768 | if ($code >= 0xF0 && isset($chr[4])) { |
4769 | 4769 | /** @noinspection UnnecessaryCastingInspection */ |
4770 | 4770 | /** @noinspection OffsetOperationsInspection */ |
4771 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4771 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4772 | 4772 | } |
4773 | 4773 | |
4774 | 4774 | /** @noinspection OffsetOperationsInspection */ |
4775 | 4775 | if ($code >= 0xE0 && isset($chr[3])) { |
4776 | 4776 | /** @noinspection UnnecessaryCastingInspection */ |
4777 | 4777 | /** @noinspection OffsetOperationsInspection */ |
4778 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4778 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4779 | 4779 | } |
4780 | 4780 | |
4781 | 4781 | /** @noinspection OffsetOperationsInspection */ |
4782 | 4782 | if ($code >= 0xC0 && isset($chr[2])) { |
4783 | 4783 | /** @noinspection UnnecessaryCastingInspection */ |
4784 | 4784 | /** @noinspection OffsetOperationsInspection */ |
4785 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4785 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4786 | 4786 | } |
4787 | 4787 | |
4788 | 4788 | return $CHAR_CACHE[$cache_key] = $code; |
@@ -4839,7 +4839,7 @@ discard block |
||
4839 | 4839 | public static function pcre_utf8_support(): bool |
4840 | 4840 | { |
4841 | 4841 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4842 | - return (bool) @\preg_match('//u', ''); |
|
4842 | + return (bool)@\preg_match('//u', ''); |
|
4843 | 4843 | } |
4844 | 4844 | |
4845 | 4845 | /** |
@@ -4878,14 +4878,14 @@ discard block |
||
4878 | 4878 | * @psalm-suppress DocblockTypeContradiction |
4879 | 4879 | */ |
4880 | 4880 | if (!\is_numeric($step)) { |
4881 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
4881 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
4882 | 4882 | } |
4883 | 4883 | |
4884 | 4884 | /** |
4885 | 4885 | * @psalm-suppress RedundantConditionGivenDocblockType - false-positive from psalm? |
4886 | 4886 | */ |
4887 | 4887 | if ($step <= 0) { |
4888 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
4888 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
4889 | 4889 | } |
4890 | 4890 | } |
4891 | 4891 | |
@@ -4897,14 +4897,14 @@ discard block |
||
4897 | 4897 | $is_xdigit = false; |
4898 | 4898 | |
4899 | 4899 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4900 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
4900 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
4901 | 4901 | $is_digit = true; |
4902 | - $start = (int) $var1; |
|
4902 | + $start = (int)$var1; |
|
4903 | 4903 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
4904 | 4904 | $is_xdigit = true; |
4905 | - $start = (int) self::hex_to_int($var1); |
|
4905 | + $start = (int)self::hex_to_int($var1); |
|
4906 | 4906 | } elseif (!$use_ctype && \is_numeric($var1)) { |
4907 | - $start = (int) $var1; |
|
4907 | + $start = (int)$var1; |
|
4908 | 4908 | } else { |
4909 | 4909 | $start = self::ord($var1); |
4910 | 4910 | } |
@@ -4914,11 +4914,11 @@ discard block |
||
4914 | 4914 | } |
4915 | 4915 | |
4916 | 4916 | if ($is_digit) { |
4917 | - $end = (int) $var2; |
|
4917 | + $end = (int)$var2; |
|
4918 | 4918 | } elseif ($is_xdigit) { |
4919 | - $end = (int) self::hex_to_int($var2); |
|
4919 | + $end = (int)self::hex_to_int($var2); |
|
4920 | 4920 | } elseif (!$use_ctype && \is_numeric($var2)) { |
4921 | - $end = (int) $var2; |
|
4921 | + $end = (int)$var2; |
|
4922 | 4922 | } else { |
4923 | 4923 | $end = self::ord($var2); |
4924 | 4924 | } |
@@ -4929,7 +4929,7 @@ discard block |
||
4929 | 4929 | |
4930 | 4930 | $array = []; |
4931 | 4931 | foreach (\range($start, $end, $step) as $i) { |
4932 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
4932 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
4933 | 4933 | } |
4934 | 4934 | |
4935 | 4935 | return $array; |
@@ -5039,8 +5039,8 @@ discard block |
||
5039 | 5039 | $delimiter = '/'; |
5040 | 5040 | } |
5041 | 5041 | |
5042 | - return (string) \preg_replace( |
|
5043 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
5042 | + return (string)\preg_replace( |
|
5043 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
5044 | 5044 | $replacement, |
5045 | 5045 | $str |
5046 | 5046 | ); |
@@ -5088,9 +5088,9 @@ discard block |
||
5088 | 5088 | return ''; |
5089 | 5089 | } |
5090 | 5090 | |
5091 | - $str_length -= (int) $bom_byte_length; |
|
5091 | + $str_length -= (int)$bom_byte_length; |
|
5092 | 5092 | |
5093 | - $str = (string) $str_tmp; |
|
5093 | + $str = (string)$str_tmp; |
|
5094 | 5094 | } |
5095 | 5095 | } |
5096 | 5096 | |
@@ -5119,7 +5119,7 @@ discard block |
||
5119 | 5119 | */ |
5120 | 5120 | if (\is_array($what)) { |
5121 | 5121 | foreach ($what as $item) { |
5122 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
5122 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
5123 | 5123 | } |
5124 | 5124 | } |
5125 | 5125 | |
@@ -5157,7 +5157,7 @@ discard block |
||
5157 | 5157 | */ |
5158 | 5158 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
5159 | 5159 | { |
5160 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
5160 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
5161 | 5161 | } |
5162 | 5162 | |
5163 | 5163 | /** |
@@ -5212,17 +5212,17 @@ discard block |
||
5212 | 5212 | ): string { |
5213 | 5213 | if ($substring && \strpos($str, $substring) === 0) { |
5214 | 5214 | if ($encoding === 'UTF-8') { |
5215 | - return (string) \mb_substr( |
|
5215 | + return (string)\mb_substr( |
|
5216 | 5216 | $str, |
5217 | - (int) \mb_strlen($substring) |
|
5217 | + (int)\mb_strlen($substring) |
|
5218 | 5218 | ); |
5219 | 5219 | } |
5220 | 5220 | |
5221 | 5221 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5222 | 5222 | |
5223 | - return (string) self::substr( |
|
5223 | + return (string)self::substr( |
|
5224 | 5224 | $str, |
5225 | - (int) self::strlen($substring, $encoding), |
|
5225 | + (int)self::strlen($substring, $encoding), |
|
5226 | 5226 | null, |
5227 | 5227 | $encoding |
5228 | 5228 | ); |
@@ -5250,19 +5250,19 @@ discard block |
||
5250 | 5250 | ): string { |
5251 | 5251 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
5252 | 5252 | if ($encoding === 'UTF-8') { |
5253 | - return (string) \mb_substr( |
|
5253 | + return (string)\mb_substr( |
|
5254 | 5254 | $str, |
5255 | 5255 | 0, |
5256 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
5256 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
5257 | 5257 | ); |
5258 | 5258 | } |
5259 | 5259 | |
5260 | 5260 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5261 | 5261 | |
5262 | - return (string) self::substr( |
|
5262 | + return (string)self::substr( |
|
5263 | 5263 | $str, |
5264 | 5264 | 0, |
5265 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
5265 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
5266 | 5266 | $encoding |
5267 | 5267 | ); |
5268 | 5268 | } |
@@ -5362,7 +5362,7 @@ discard block |
||
5362 | 5362 | /** @noinspection PhpUsageOfSilenceOperatorInspection - ignore "Unknown character" warnings, it's working anyway */ |
5363 | 5363 | @\mb_substitute_character($replacement_char_helper); |
5364 | 5364 | // the polyfill maybe return false, so cast to string |
5365 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
5365 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
5366 | 5366 | \mb_substitute_character($save); |
5367 | 5367 | } |
5368 | 5368 | |
@@ -5406,7 +5406,7 @@ discard block |
||
5406 | 5406 | } |
5407 | 5407 | |
5408 | 5408 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5409 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
5409 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
5410 | 5410 | } |
5411 | 5411 | |
5412 | 5412 | if ($chars) { |
@@ -5436,7 +5436,7 @@ discard block |
||
5436 | 5436 | $html .= '<pre>'; |
5437 | 5437 | /** @noinspection AlterInForeachInspection */ |
5438 | 5438 | foreach (self::$SUPPORT as $key => &$value) { |
5439 | - $html .= $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
5439 | + $html .= $key.' - '.\print_r($value, true)."\n<br>"; |
|
5440 | 5440 | } |
5441 | 5441 | $html .= '</pre>'; |
5442 | 5442 | |
@@ -5476,7 +5476,7 @@ discard block |
||
5476 | 5476 | return $char; |
5477 | 5477 | } |
5478 | 5478 | |
5479 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
5479 | + return '&#'.self::ord($char, $encoding).';'; |
|
5480 | 5480 | } |
5481 | 5481 | |
5482 | 5482 | /** |
@@ -5580,11 +5580,11 @@ discard block |
||
5580 | 5580 | $lang, |
5581 | 5581 | $try_to_keep_the_string_length |
5582 | 5582 | ); |
5583 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5583 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5584 | 5584 | |
5585 | 5585 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
5586 | 5586 | |
5587 | - $str = (string) \preg_replace_callback( |
|
5587 | + $str = (string)\preg_replace_callback( |
|
5588 | 5588 | '/[-_\\s]+(.)?/u', |
5589 | 5589 | /** |
5590 | 5590 | * @param array $match |
@@ -5593,7 +5593,7 @@ discard block |
||
5593 | 5593 | * |
5594 | 5594 | * @return string |
5595 | 5595 | */ |
5596 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5596 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5597 | 5597 | if (isset($match[1])) { |
5598 | 5598 | if ($use_mb_functions) { |
5599 | 5599 | if ($encoding === 'UTF-8') { |
@@ -5611,7 +5611,7 @@ discard block |
||
5611 | 5611 | $str |
5612 | 5612 | ); |
5613 | 5613 | |
5614 | - return (string) \preg_replace_callback( |
|
5614 | + return (string)\preg_replace_callback( |
|
5615 | 5615 | '/[\\p{N}]+(.)?/u', |
5616 | 5616 | /** |
5617 | 5617 | * @param array $match |
@@ -5620,7 +5620,7 @@ discard block |
||
5620 | 5620 | * |
5621 | 5621 | * @return string |
5622 | 5622 | */ |
5623 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5623 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5624 | 5624 | if ($use_mb_functions) { |
5625 | 5625 | if ($encoding === 'UTF-8') { |
5626 | 5626 | return \mb_strtoupper($match[0]); |
@@ -5812,7 +5812,7 @@ discard block |
||
5812 | 5812 | ): string { |
5813 | 5813 | if (self::$SUPPORT['mbstring'] === true) { |
5814 | 5814 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5815 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5815 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5816 | 5816 | |
5817 | 5817 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
5818 | 5818 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -5822,10 +5822,10 @@ discard block |
||
5822 | 5822 | } |
5823 | 5823 | |
5824 | 5824 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5825 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5825 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5826 | 5826 | } |
5827 | 5827 | |
5828 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5828 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5829 | 5829 | |
5830 | 5830 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
5831 | 5831 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -5834,7 +5834,7 @@ discard block |
||
5834 | 5834 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
5835 | 5835 | } |
5836 | 5836 | |
5837 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5837 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5838 | 5838 | } |
5839 | 5839 | |
5840 | 5840 | /** |
@@ -5851,7 +5851,7 @@ discard block |
||
5851 | 5851 | public static function str_detect_encoding($str) |
5852 | 5852 | { |
5853 | 5853 | // init |
5854 | - $str = (string) $str; |
|
5854 | + $str = (string)$str; |
|
5855 | 5855 | |
5856 | 5856 | // |
5857 | 5857 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5953,7 +5953,7 @@ discard block |
||
5953 | 5953 | foreach (self::$ENCODINGS as $encoding_tmp) { |
5954 | 5954 | // INFO: //IGNORE but still throw notice |
5955 | 5955 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5956 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
5956 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
5957 | 5957 | return $encoding_tmp; |
5958 | 5958 | } |
5959 | 5959 | } |
@@ -6050,7 +6050,7 @@ discard block |
||
6050 | 6050 | return $str; |
6051 | 6051 | } |
6052 | 6052 | |
6053 | - return $substring . $str; |
|
6053 | + return $substring.$str; |
|
6054 | 6054 | } |
6055 | 6055 | |
6056 | 6056 | /** |
@@ -6341,27 +6341,27 @@ discard block |
||
6341 | 6341 | string $encoding = 'UTF-8' |
6342 | 6342 | ): string { |
6343 | 6343 | if ($encoding === 'UTF-8') { |
6344 | - $len = (int) \mb_strlen($str); |
|
6344 | + $len = (int)\mb_strlen($str); |
|
6345 | 6345 | if ($index > $len) { |
6346 | 6346 | return $str; |
6347 | 6347 | } |
6348 | 6348 | |
6349 | 6349 | /** @noinspection UnnecessaryCastingInspection */ |
6350 | - return (string) \mb_substr($str, 0, $index) . |
|
6351 | - $substring . |
|
6352 | - (string) \mb_substr($str, $index, $len); |
|
6350 | + return (string)\mb_substr($str, 0, $index). |
|
6351 | + $substring. |
|
6352 | + (string)\mb_substr($str, $index, $len); |
|
6353 | 6353 | } |
6354 | 6354 | |
6355 | 6355 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6356 | 6356 | |
6357 | - $len = (int) self::strlen($str, $encoding); |
|
6357 | + $len = (int)self::strlen($str, $encoding); |
|
6358 | 6358 | if ($index > $len) { |
6359 | 6359 | return $str; |
6360 | 6360 | } |
6361 | 6361 | |
6362 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
6363 | - $substring . |
|
6364 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
6362 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
6363 | + $substring. |
|
6364 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
6365 | 6365 | } |
6366 | 6366 | |
6367 | 6367 | /** |
@@ -6392,15 +6392,15 @@ discard block |
||
6392 | 6392 | */ |
6393 | 6393 | public static function str_ireplace($search, $replacement, $subject, &$count = null) |
6394 | 6394 | { |
6395 | - $search = (array) $search; |
|
6395 | + $search = (array)$search; |
|
6396 | 6396 | |
6397 | 6397 | /** @noinspection AlterInForeachInspection */ |
6398 | 6398 | foreach ($search as &$s) { |
6399 | - $s = (string) $s; |
|
6399 | + $s = (string)$s; |
|
6400 | 6400 | if ($s === '') { |
6401 | 6401 | $s = '/^(?<=.)$/'; |
6402 | 6402 | } else { |
6403 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
6403 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
6404 | 6404 | } |
6405 | 6405 | } |
6406 | 6406 | |
@@ -6436,11 +6436,11 @@ discard block |
||
6436 | 6436 | } |
6437 | 6437 | |
6438 | 6438 | if ($search === '') { |
6439 | - return $str . $replacement; |
|
6439 | + return $str.$replacement; |
|
6440 | 6440 | } |
6441 | 6441 | |
6442 | 6442 | if (\stripos($str, $search) === 0) { |
6443 | - return $replacement . \substr($str, \strlen($search)); |
|
6443 | + return $replacement.\substr($str, \strlen($search)); |
|
6444 | 6444 | } |
6445 | 6445 | |
6446 | 6446 | return $str; |
@@ -6471,11 +6471,11 @@ discard block |
||
6471 | 6471 | } |
6472 | 6472 | |
6473 | 6473 | if ($search === '') { |
6474 | - return $str . $replacement; |
|
6474 | + return $str.$replacement; |
|
6475 | 6475 | } |
6476 | 6476 | |
6477 | 6477 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6478 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6478 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6479 | 6479 | } |
6480 | 6480 | |
6481 | 6481 | return $str; |
@@ -6561,15 +6561,15 @@ discard block |
||
6561 | 6561 | } |
6562 | 6562 | |
6563 | 6563 | if ($encoding === 'UTF-8') { |
6564 | - return (string) \mb_substr( |
|
6564 | + return (string)\mb_substr( |
|
6565 | 6565 | $str, |
6566 | - $offset + (int) \mb_strlen($separator) |
|
6566 | + $offset + (int)\mb_strlen($separator) |
|
6567 | 6567 | ); |
6568 | 6568 | } |
6569 | 6569 | |
6570 | - return (string) self::substr( |
|
6570 | + return (string)self::substr( |
|
6571 | 6571 | $str, |
6572 | - $offset + (int) self::strlen($separator, $encoding), |
|
6572 | + $offset + (int)self::strlen($separator, $encoding), |
|
6573 | 6573 | null, |
6574 | 6574 | $encoding |
6575 | 6575 | ); |
@@ -6601,15 +6601,15 @@ discard block |
||
6601 | 6601 | } |
6602 | 6602 | |
6603 | 6603 | if ($encoding === 'UTF-8') { |
6604 | - return (string) \mb_substr( |
|
6604 | + return (string)\mb_substr( |
|
6605 | 6605 | $str, |
6606 | - $offset + (int) self::strlen($separator) |
|
6606 | + $offset + (int)self::strlen($separator) |
|
6607 | 6607 | ); |
6608 | 6608 | } |
6609 | 6609 | |
6610 | - return (string) self::substr( |
|
6610 | + return (string)self::substr( |
|
6611 | 6611 | $str, |
6612 | - $offset + (int) self::strlen($separator, $encoding), |
|
6612 | + $offset + (int)self::strlen($separator, $encoding), |
|
6613 | 6613 | null, |
6614 | 6614 | $encoding |
6615 | 6615 | ); |
@@ -6641,10 +6641,10 @@ discard block |
||
6641 | 6641 | } |
6642 | 6642 | |
6643 | 6643 | if ($encoding === 'UTF-8') { |
6644 | - return (string) \mb_substr($str, 0, $offset); |
|
6644 | + return (string)\mb_substr($str, 0, $offset); |
|
6645 | 6645 | } |
6646 | 6646 | |
6647 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6647 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6648 | 6648 | } |
6649 | 6649 | |
6650 | 6650 | /** |
@@ -6673,7 +6673,7 @@ discard block |
||
6673 | 6673 | return ''; |
6674 | 6674 | } |
6675 | 6675 | |
6676 | - return (string) \mb_substr($str, 0, $offset); |
|
6676 | + return (string)\mb_substr($str, 0, $offset); |
|
6677 | 6677 | } |
6678 | 6678 | |
6679 | 6679 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6681,7 +6681,7 @@ discard block |
||
6681 | 6681 | return ''; |
6682 | 6682 | } |
6683 | 6683 | |
6684 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6684 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6685 | 6685 | } |
6686 | 6686 | |
6687 | 6687 | /** |
@@ -6783,12 +6783,12 @@ discard block |
||
6783 | 6783 | } |
6784 | 6784 | |
6785 | 6785 | if ($encoding === 'UTF-8') { |
6786 | - return (string) \mb_substr($str, -$n); |
|
6786 | + return (string)\mb_substr($str, -$n); |
|
6787 | 6787 | } |
6788 | 6788 | |
6789 | 6789 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6790 | 6790 | |
6791 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6791 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6792 | 6792 | } |
6793 | 6793 | |
6794 | 6794 | /** |
@@ -6814,21 +6814,21 @@ discard block |
||
6814 | 6814 | } |
6815 | 6815 | |
6816 | 6816 | if ($encoding === 'UTF-8') { |
6817 | - if ((int) \mb_strlen($str) <= $length) { |
|
6817 | + if ((int)\mb_strlen($str) <= $length) { |
|
6818 | 6818 | return $str; |
6819 | 6819 | } |
6820 | 6820 | |
6821 | 6821 | /** @noinspection UnnecessaryCastingInspection */ |
6822 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
6822 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
6823 | 6823 | } |
6824 | 6824 | |
6825 | 6825 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6826 | 6826 | |
6827 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6827 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6828 | 6828 | return $str; |
6829 | 6829 | } |
6830 | 6830 | |
6831 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
6831 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
6832 | 6832 | } |
6833 | 6833 | |
6834 | 6834 | /** |
@@ -6855,12 +6855,12 @@ discard block |
||
6855 | 6855 | |
6856 | 6856 | if ($encoding === 'UTF-8') { |
6857 | 6857 | /** @noinspection UnnecessaryCastingInspection */ |
6858 | - if ((int) \mb_strlen($str) <= $length) { |
|
6858 | + if ((int)\mb_strlen($str) <= $length) { |
|
6859 | 6859 | return $str; |
6860 | 6860 | } |
6861 | 6861 | |
6862 | 6862 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6863 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6863 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6864 | 6864 | } |
6865 | 6865 | |
6866 | 6866 | $str = \mb_substr($str, 0, $length); |
@@ -6869,33 +6869,33 @@ discard block |
||
6869 | 6869 | $new_str = \implode(' ', $array); |
6870 | 6870 | |
6871 | 6871 | if ($new_str === '') { |
6872 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6872 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6873 | 6873 | } |
6874 | 6874 | } else { |
6875 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6875 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6876 | 6876 | return $str; |
6877 | 6877 | } |
6878 | 6878 | |
6879 | 6879 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6880 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6880 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6881 | 6881 | } |
6882 | 6882 | |
6883 | 6883 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6884 | 6884 | $str = self::substr($str, 0, $length, $encoding); |
6885 | 6885 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6886 | 6886 | if ($str === false) { |
6887 | - return '' . $str_add_on; |
|
6887 | + return ''.$str_add_on; |
|
6888 | 6888 | } |
6889 | 6889 | |
6890 | 6890 | $array = \explode(' ', $str, -1); |
6891 | 6891 | $new_str = \implode(' ', $array); |
6892 | 6892 | |
6893 | 6893 | if ($new_str === '') { |
6894 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6894 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6895 | 6895 | } |
6896 | 6896 | } |
6897 | 6897 | |
6898 | - return $new_str . $str_add_on; |
|
6898 | + return $new_str.$str_add_on; |
|
6899 | 6899 | } |
6900 | 6900 | |
6901 | 6901 | /** |
@@ -6918,7 +6918,7 @@ discard block |
||
6918 | 6918 | $longest_common_prefix = ''; |
6919 | 6919 | |
6920 | 6920 | if ($encoding === 'UTF-8') { |
6921 | - $max_length = (int) \min( |
|
6921 | + $max_length = (int)\min( |
|
6922 | 6922 | \mb_strlen($str1), |
6923 | 6923 | \mb_strlen($str2) |
6924 | 6924 | ); |
@@ -6939,7 +6939,7 @@ discard block |
||
6939 | 6939 | } else { |
6940 | 6940 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6941 | 6941 | |
6942 | - $max_length = (int) \min( |
|
6942 | + $max_length = (int)\min( |
|
6943 | 6943 | self::strlen($str1, $encoding), |
6944 | 6944 | self::strlen($str2, $encoding) |
6945 | 6945 | ); |
@@ -6988,13 +6988,13 @@ discard block |
||
6988 | 6988 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6989 | 6989 | |
6990 | 6990 | if ($encoding === 'UTF-8') { |
6991 | - $str_length = (int) \mb_strlen($str1); |
|
6992 | - $other_length = (int) \mb_strlen($str2); |
|
6991 | + $str_length = (int)\mb_strlen($str1); |
|
6992 | + $other_length = (int)\mb_strlen($str2); |
|
6993 | 6993 | } else { |
6994 | 6994 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6995 | 6995 | |
6996 | - $str_length = (int) self::strlen($str1, $encoding); |
|
6997 | - $other_length = (int) self::strlen($str2, $encoding); |
|
6996 | + $str_length = (int)self::strlen($str1, $encoding); |
|
6997 | + $other_length = (int)self::strlen($str2, $encoding); |
|
6998 | 6998 | } |
6999 | 6999 | |
7000 | 7000 | // Return if either string is empty |
@@ -7047,10 +7047,10 @@ discard block |
||
7047 | 7047 | } |
7048 | 7048 | |
7049 | 7049 | if ($encoding === 'UTF-8') { |
7050 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
7050 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
7051 | 7051 | } |
7052 | 7052 | |
7053 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
7053 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
7054 | 7054 | } |
7055 | 7055 | |
7056 | 7056 | /** |
@@ -7074,7 +7074,7 @@ discard block |
||
7074 | 7074 | } |
7075 | 7075 | |
7076 | 7076 | if ($encoding === 'UTF-8') { |
7077 | - $max_length = (int) \min( |
|
7077 | + $max_length = (int)\min( |
|
7078 | 7078 | \mb_strlen($str1, $encoding), |
7079 | 7079 | \mb_strlen($str2, $encoding) |
7080 | 7080 | ); |
@@ -7088,7 +7088,7 @@ discard block |
||
7088 | 7088 | && |
7089 | 7089 | $char === \mb_substr($str2, -$i, 1) |
7090 | 7090 | ) { |
7091 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
7091 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
7092 | 7092 | } else { |
7093 | 7093 | break; |
7094 | 7094 | } |
@@ -7096,7 +7096,7 @@ discard block |
||
7096 | 7096 | } else { |
7097 | 7097 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7098 | 7098 | |
7099 | - $max_length = (int) \min( |
|
7099 | + $max_length = (int)\min( |
|
7100 | 7100 | self::strlen($str1, $encoding), |
7101 | 7101 | self::strlen($str2, $encoding) |
7102 | 7102 | ); |
@@ -7110,7 +7110,7 @@ discard block |
||
7110 | 7110 | && |
7111 | 7111 | $char === self::substr($str2, -$i, 1, $encoding) |
7112 | 7112 | ) { |
7113 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
7113 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
7114 | 7114 | } else { |
7115 | 7115 | break; |
7116 | 7116 | } |
@@ -7132,7 +7132,7 @@ discard block |
||
7132 | 7132 | */ |
7133 | 7133 | public static function str_matches_pattern(string $str, string $pattern): bool |
7134 | 7134 | { |
7135 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
7135 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
7136 | 7136 | } |
7137 | 7137 | |
7138 | 7138 | /** |
@@ -7151,7 +7151,7 @@ discard block |
||
7151 | 7151 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
7152 | 7152 | { |
7153 | 7153 | // init |
7154 | - $length = (int) self::strlen($str, $encoding); |
|
7154 | + $length = (int)self::strlen($str, $encoding); |
|
7155 | 7155 | |
7156 | 7156 | if ($offset >= 0) { |
7157 | 7157 | return $length > $offset; |
@@ -7180,7 +7180,7 @@ discard block |
||
7180 | 7180 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
7181 | 7181 | { |
7182 | 7182 | // init |
7183 | - $length = (int) self::strlen($str); |
|
7183 | + $length = (int)self::strlen($str); |
|
7184 | 7184 | |
7185 | 7185 | if ( |
7186 | 7186 | ($index >= 0 && $length <= $index) |
@@ -7222,7 +7222,7 @@ discard block |
||
7222 | 7222 | return $str; |
7223 | 7223 | } |
7224 | 7224 | |
7225 | - if ($pad_type !== (int) $pad_type) { |
|
7225 | + if ($pad_type !== (int)$pad_type) { |
|
7226 | 7226 | if ($pad_type === 'left') { |
7227 | 7227 | $pad_type = \STR_PAD_LEFT; |
7228 | 7228 | } elseif ($pad_type === 'right') { |
@@ -7231,23 +7231,23 @@ discard block |
||
7231 | 7231 | $pad_type = \STR_PAD_BOTH; |
7232 | 7232 | } else { |
7233 | 7233 | throw new \InvalidArgumentException( |
7234 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
7234 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
7235 | 7235 | ); |
7236 | 7236 | } |
7237 | 7237 | } |
7238 | 7238 | |
7239 | 7239 | if ($encoding === 'UTF-8') { |
7240 | - $str_length = (int) \mb_strlen($str); |
|
7240 | + $str_length = (int)\mb_strlen($str); |
|
7241 | 7241 | |
7242 | 7242 | if ($pad_length >= $str_length) { |
7243 | 7243 | switch ($pad_type) { |
7244 | 7244 | case \STR_PAD_LEFT: |
7245 | - $ps_length = (int) \mb_strlen($pad_string); |
|
7245 | + $ps_length = (int)\mb_strlen($pad_string); |
|
7246 | 7246 | |
7247 | 7247 | $diff = ($pad_length - $str_length); |
7248 | 7248 | |
7249 | - $pre = (string) \mb_substr( |
|
7250 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7249 | + $pre = (string)\mb_substr( |
|
7250 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7251 | 7251 | 0, |
7252 | 7252 | $diff |
7253 | 7253 | ); |
@@ -7258,16 +7258,16 @@ discard block |
||
7258 | 7258 | case \STR_PAD_BOTH: |
7259 | 7259 | $diff = ($pad_length - $str_length); |
7260 | 7260 | |
7261 | - $ps_length_left = (int) \floor($diff / 2); |
|
7261 | + $ps_length_left = (int)\floor($diff / 2); |
|
7262 | 7262 | |
7263 | - $ps_length_right = (int) \ceil($diff / 2); |
|
7263 | + $ps_length_right = (int)\ceil($diff / 2); |
|
7264 | 7264 | |
7265 | - $pre = (string) \mb_substr( |
|
7265 | + $pre = (string)\mb_substr( |
|
7266 | 7266 | \str_repeat($pad_string, $ps_length_left), |
7267 | 7267 | 0, |
7268 | 7268 | $ps_length_left |
7269 | 7269 | ); |
7270 | - $post = (string) \mb_substr( |
|
7270 | + $post = (string)\mb_substr( |
|
7271 | 7271 | \str_repeat($pad_string, $ps_length_right), |
7272 | 7272 | 0, |
7273 | 7273 | $ps_length_right |
@@ -7277,19 +7277,19 @@ discard block |
||
7277 | 7277 | |
7278 | 7278 | case \STR_PAD_RIGHT: |
7279 | 7279 | default: |
7280 | - $ps_length = (int) \mb_strlen($pad_string); |
|
7280 | + $ps_length = (int)\mb_strlen($pad_string); |
|
7281 | 7281 | |
7282 | 7282 | $diff = ($pad_length - $str_length); |
7283 | 7283 | |
7284 | - $post = (string) \mb_substr( |
|
7285 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7284 | + $post = (string)\mb_substr( |
|
7285 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7286 | 7286 | 0, |
7287 | 7287 | $diff |
7288 | 7288 | ); |
7289 | 7289 | $pre = ''; |
7290 | 7290 | } |
7291 | 7291 | |
7292 | - return $pre . $str . $post; |
|
7292 | + return $pre.$str.$post; |
|
7293 | 7293 | } |
7294 | 7294 | |
7295 | 7295 | return $str; |
@@ -7297,17 +7297,17 @@ discard block |
||
7297 | 7297 | |
7298 | 7298 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7299 | 7299 | |
7300 | - $str_length = (int) self::strlen($str, $encoding); |
|
7300 | + $str_length = (int)self::strlen($str, $encoding); |
|
7301 | 7301 | |
7302 | 7302 | if ($pad_length >= $str_length) { |
7303 | 7303 | switch ($pad_type) { |
7304 | 7304 | case \STR_PAD_LEFT: |
7305 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
7305 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
7306 | 7306 | |
7307 | 7307 | $diff = ($pad_length - $str_length); |
7308 | 7308 | |
7309 | - $pre = (string) self::substr( |
|
7310 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7309 | + $pre = (string)self::substr( |
|
7310 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7311 | 7311 | 0, |
7312 | 7312 | $diff, |
7313 | 7313 | $encoding |
@@ -7319,17 +7319,17 @@ discard block |
||
7319 | 7319 | case \STR_PAD_BOTH: |
7320 | 7320 | $diff = ($pad_length - $str_length); |
7321 | 7321 | |
7322 | - $ps_length_left = (int) \floor($diff / 2); |
|
7322 | + $ps_length_left = (int)\floor($diff / 2); |
|
7323 | 7323 | |
7324 | - $ps_length_right = (int) \ceil($diff / 2); |
|
7324 | + $ps_length_right = (int)\ceil($diff / 2); |
|
7325 | 7325 | |
7326 | - $pre = (string) self::substr( |
|
7326 | + $pre = (string)self::substr( |
|
7327 | 7327 | \str_repeat($pad_string, $ps_length_left), |
7328 | 7328 | 0, |
7329 | 7329 | $ps_length_left, |
7330 | 7330 | $encoding |
7331 | 7331 | ); |
7332 | - $post = (string) self::substr( |
|
7332 | + $post = (string)self::substr( |
|
7333 | 7333 | \str_repeat($pad_string, $ps_length_right), |
7334 | 7334 | 0, |
7335 | 7335 | $ps_length_right, |
@@ -7340,12 +7340,12 @@ discard block |
||
7340 | 7340 | |
7341 | 7341 | case \STR_PAD_RIGHT: |
7342 | 7342 | default: |
7343 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
7343 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
7344 | 7344 | |
7345 | 7345 | $diff = ($pad_length - $str_length); |
7346 | 7346 | |
7347 | - $post = (string) self::substr( |
|
7348 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7347 | + $post = (string)self::substr( |
|
7348 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7349 | 7349 | 0, |
7350 | 7350 | $diff, |
7351 | 7351 | $encoding |
@@ -7353,7 +7353,7 @@ discard block |
||
7353 | 7353 | $pre = ''; |
7354 | 7354 | } |
7355 | 7355 | |
7356 | - return $pre . $str . $post; |
|
7356 | + return $pre.$str.$post; |
|
7357 | 7357 | } |
7358 | 7358 | |
7359 | 7359 | return $str; |
@@ -7550,11 +7550,11 @@ discard block |
||
7550 | 7550 | } |
7551 | 7551 | |
7552 | 7552 | if ($search === '') { |
7553 | - return $str . $replacement; |
|
7553 | + return $str.$replacement; |
|
7554 | 7554 | } |
7555 | 7555 | |
7556 | 7556 | if (\strpos($str, $search) === 0) { |
7557 | - return $replacement . \substr($str, \strlen($search)); |
|
7557 | + return $replacement.\substr($str, \strlen($search)); |
|
7558 | 7558 | } |
7559 | 7559 | |
7560 | 7560 | return $str; |
@@ -7588,11 +7588,11 @@ discard block |
||
7588 | 7588 | } |
7589 | 7589 | |
7590 | 7590 | if ($search === '') { |
7591 | - return $str . $replacement; |
|
7591 | + return $str.$replacement; |
|
7592 | 7592 | } |
7593 | 7593 | |
7594 | 7594 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
7595 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
7595 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
7596 | 7596 | } |
7597 | 7597 | |
7598 | 7598 | return $str; |
@@ -7626,7 +7626,7 @@ discard block |
||
7626 | 7626 | $subject, |
7627 | 7627 | $replace, |
7628 | 7628 | $pos, |
7629 | - (int) self::strlen($search) |
|
7629 | + (int)self::strlen($search) |
|
7630 | 7630 | ); |
7631 | 7631 | } |
7632 | 7632 | |
@@ -7660,7 +7660,7 @@ discard block |
||
7660 | 7660 | $subject, |
7661 | 7661 | $replace, |
7662 | 7662 | $pos, |
7663 | - (int) self::strlen($search) |
|
7663 | + (int)self::strlen($search) |
|
7664 | 7664 | ); |
7665 | 7665 | } |
7666 | 7666 | |
@@ -7681,7 +7681,7 @@ discard block |
||
7681 | 7681 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
7682 | 7682 | { |
7683 | 7683 | if ($encoding === 'UTF-8') { |
7684 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
7684 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
7685 | 7685 | /** @noinspection NonSecureShuffleUsageInspection */ |
7686 | 7686 | \shuffle($indexes); |
7687 | 7687 | |
@@ -7697,7 +7697,7 @@ discard block |
||
7697 | 7697 | } else { |
7698 | 7698 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7699 | 7699 | |
7700 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
7700 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
7701 | 7701 | /** @noinspection NonSecureShuffleUsageInspection */ |
7702 | 7702 | \shuffle($indexes); |
7703 | 7703 | |
@@ -7740,11 +7740,11 @@ discard block |
||
7740 | 7740 | ) { |
7741 | 7741 | if ($encoding === 'UTF-8') { |
7742 | 7742 | if ($end === null) { |
7743 | - $length = (int) \mb_strlen($str); |
|
7743 | + $length = (int)\mb_strlen($str); |
|
7744 | 7744 | } elseif ($end >= 0 && $end <= $start) { |
7745 | 7745 | return ''; |
7746 | 7746 | } elseif ($end < 0) { |
7747 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7747 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7748 | 7748 | } else { |
7749 | 7749 | $length = $end - $start; |
7750 | 7750 | } |
@@ -7755,11 +7755,11 @@ discard block |
||
7755 | 7755 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7756 | 7756 | |
7757 | 7757 | if ($end === null) { |
7758 | - $length = (int) self::strlen($str, $encoding); |
|
7758 | + $length = (int)self::strlen($str, $encoding); |
|
7759 | 7759 | } elseif ($end >= 0 && $end <= $start) { |
7760 | 7760 | return ''; |
7761 | 7761 | } elseif ($end < 0) { |
7762 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7762 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7763 | 7763 | } else { |
7764 | 7764 | $length = $end - $start; |
7765 | 7765 | } |
@@ -7794,7 +7794,7 @@ discard block |
||
7794 | 7794 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7795 | 7795 | } |
7796 | 7796 | |
7797 | - $str = (string) \preg_replace_callback( |
|
7797 | + $str = (string)\preg_replace_callback( |
|
7798 | 7798 | '/([\\p{N}|\\p{Lu}])/u', |
7799 | 7799 | /** |
7800 | 7800 | * @param string[] $matches |
@@ -7803,28 +7803,28 @@ discard block |
||
7803 | 7803 | * |
7804 | 7804 | * @return string |
7805 | 7805 | */ |
7806 | - static function (array $matches) use ($encoding): string { |
|
7806 | + static function(array $matches) use ($encoding): string { |
|
7807 | 7807 | $match = $matches[1]; |
7808 | - $match_int = (int) $match; |
|
7808 | + $match_int = (int)$match; |
|
7809 | 7809 | |
7810 | - if ((string) $match_int === $match) { |
|
7811 | - return '_' . $match . '_'; |
|
7810 | + if ((string)$match_int === $match) { |
|
7811 | + return '_'.$match.'_'; |
|
7812 | 7812 | } |
7813 | 7813 | |
7814 | 7814 | if ($encoding === 'UTF-8') { |
7815 | - return '_' . \mb_strtolower($match); |
|
7815 | + return '_'.\mb_strtolower($match); |
|
7816 | 7816 | } |
7817 | 7817 | |
7818 | - return '_' . self::strtolower($match, $encoding); |
|
7818 | + return '_'.self::strtolower($match, $encoding); |
|
7819 | 7819 | }, |
7820 | 7820 | $str |
7821 | 7821 | ); |
7822 | 7822 | |
7823 | - $str = (string) \preg_replace( |
|
7823 | + $str = (string)\preg_replace( |
|
7824 | 7824 | [ |
7825 | - '/\\s+/u', // convert spaces to "_" |
|
7825 | + '/\\s+/u', // convert spaces to "_" |
|
7826 | 7826 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
7827 | - '/_+/', // remove double "_" |
|
7827 | + '/_+/', // remove double "_" |
|
7828 | 7828 | ], |
7829 | 7829 | [ |
7830 | 7830 | '_', |
@@ -7946,7 +7946,7 @@ discard block |
||
7946 | 7946 | } |
7947 | 7947 | |
7948 | 7948 | // init |
7949 | - $input = (string) $input; |
|
7949 | + $input = (string)$input; |
|
7950 | 7950 | |
7951 | 7951 | if ($input === '') { |
7952 | 7952 | return []; |
@@ -8003,7 +8003,7 @@ discard block |
||
8003 | 8003 | ($input[$i] & "\xE0") === "\xC0" |
8004 | 8004 | ) { |
8005 | 8005 | if (($input[$i + 1] & "\xC0") === "\x80") { |
8006 | - $ret[] = $input[$i] . $input[$i + 1]; |
|
8006 | + $ret[] = $input[$i].$input[$i + 1]; |
|
8007 | 8007 | |
8008 | 8008 | ++$i; |
8009 | 8009 | } |
@@ -8017,7 +8017,7 @@ discard block |
||
8017 | 8017 | && |
8018 | 8018 | ($input[$i + 2] & "\xC0") === "\x80" |
8019 | 8019 | ) { |
8020 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2]; |
|
8020 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2]; |
|
8021 | 8021 | |
8022 | 8022 | $i += 2; |
8023 | 8023 | } |
@@ -8033,7 +8033,7 @@ discard block |
||
8033 | 8033 | && |
8034 | 8034 | ($input[$i + 3] & "\xC0") === "\x80" |
8035 | 8035 | ) { |
8036 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2] . $input[$i + 3]; |
|
8036 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2].$input[$i + 3]; |
|
8037 | 8037 | |
8038 | 8038 | $i += 3; |
8039 | 8039 | } |
@@ -8045,7 +8045,7 @@ discard block |
||
8045 | 8045 | $ret = \array_chunk($ret, $length); |
8046 | 8046 | |
8047 | 8047 | return \array_map( |
8048 | - static function (array &$item): string { |
|
8048 | + static function(array &$item): string { |
|
8049 | 8049 | return \implode('', $item); |
8050 | 8050 | }, |
8051 | 8051 | $ret |
@@ -8111,7 +8111,7 @@ discard block |
||
8111 | 8111 | $limit = -1; |
8112 | 8112 | } |
8113 | 8113 | |
8114 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
8114 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
8115 | 8115 | |
8116 | 8116 | if ($array === false) { |
8117 | 8117 | return []; |
@@ -8201,9 +8201,9 @@ discard block |
||
8201 | 8201 | return ''; |
8202 | 8202 | } |
8203 | 8203 | |
8204 | - return (string) \mb_substr( |
|
8204 | + return (string)\mb_substr( |
|
8205 | 8205 | $str, |
8206 | - $offset + (int) \mb_strlen($separator) |
|
8206 | + $offset + (int)\mb_strlen($separator) |
|
8207 | 8207 | ); |
8208 | 8208 | } |
8209 | 8209 | |
@@ -8212,9 +8212,9 @@ discard block |
||
8212 | 8212 | return ''; |
8213 | 8213 | } |
8214 | 8214 | |
8215 | - return (string) \mb_substr( |
|
8215 | + return (string)\mb_substr( |
|
8216 | 8216 | $str, |
8217 | - $offset + (int) self::strlen($separator, $encoding), |
|
8217 | + $offset + (int)self::strlen($separator, $encoding), |
|
8218 | 8218 | null, |
8219 | 8219 | $encoding |
8220 | 8220 | ); |
@@ -8243,9 +8243,9 @@ discard block |
||
8243 | 8243 | return ''; |
8244 | 8244 | } |
8245 | 8245 | |
8246 | - return (string) \mb_substr( |
|
8246 | + return (string)\mb_substr( |
|
8247 | 8247 | $str, |
8248 | - $offset + (int) \mb_strlen($separator) |
|
8248 | + $offset + (int)\mb_strlen($separator) |
|
8249 | 8249 | ); |
8250 | 8250 | } |
8251 | 8251 | |
@@ -8254,9 +8254,9 @@ discard block |
||
8254 | 8254 | return ''; |
8255 | 8255 | } |
8256 | 8256 | |
8257 | - return (string) self::substr( |
|
8257 | + return (string)self::substr( |
|
8258 | 8258 | $str, |
8259 | - $offset + (int) self::strlen($separator, $encoding), |
|
8259 | + $offset + (int)self::strlen($separator, $encoding), |
|
8260 | 8260 | null, |
8261 | 8261 | $encoding |
8262 | 8262 | ); |
@@ -8288,7 +8288,7 @@ discard block |
||
8288 | 8288 | return ''; |
8289 | 8289 | } |
8290 | 8290 | |
8291 | - return (string) \mb_substr( |
|
8291 | + return (string)\mb_substr( |
|
8292 | 8292 | $str, |
8293 | 8293 | 0, |
8294 | 8294 | $offset |
@@ -8300,7 +8300,7 @@ discard block |
||
8300 | 8300 | return ''; |
8301 | 8301 | } |
8302 | 8302 | |
8303 | - return (string) self::substr( |
|
8303 | + return (string)self::substr( |
|
8304 | 8304 | $str, |
8305 | 8305 | 0, |
8306 | 8306 | $offset, |
@@ -8331,7 +8331,7 @@ discard block |
||
8331 | 8331 | return ''; |
8332 | 8332 | } |
8333 | 8333 | |
8334 | - return (string) \mb_substr( |
|
8334 | + return (string)\mb_substr( |
|
8335 | 8335 | $str, |
8336 | 8336 | 0, |
8337 | 8337 | $offset |
@@ -8345,7 +8345,7 @@ discard block |
||
8345 | 8345 | |
8346 | 8346 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8347 | 8347 | |
8348 | - return (string) self::substr( |
|
8348 | + return (string)self::substr( |
|
8349 | 8349 | $str, |
8350 | 8350 | 0, |
8351 | 8351 | $offset, |
@@ -8460,7 +8460,7 @@ discard block |
||
8460 | 8460 | */ |
8461 | 8461 | public static function str_surround(string $str, string $substring): string |
8462 | 8462 | { |
8463 | - return $substring . $str . $substring; |
|
8463 | + return $substring.$str.$substring; |
|
8464 | 8464 | } |
8465 | 8465 | |
8466 | 8466 | /** |
@@ -8524,9 +8524,9 @@ discard block |
||
8524 | 8524 | $word_define_chars = ''; |
8525 | 8525 | } |
8526 | 8526 | |
8527 | - $str = (string) \preg_replace_callback( |
|
8528 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
8529 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
8527 | + $str = (string)\preg_replace_callback( |
|
8528 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
8529 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
8530 | 8530 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
8531 | 8531 | return $match[0]; |
8532 | 8532 | } |
@@ -8626,16 +8626,16 @@ discard block |
||
8626 | 8626 | |
8627 | 8627 | // the main substitutions |
8628 | 8628 | /** @noinspection RegExpDuplicateAlternationBranch - false-positive - https://youtrack.jetbrains.com/issue/WI-51002 */ |
8629 | - $str = (string) \preg_replace_callback( |
|
8629 | + $str = (string)\preg_replace_callback( |
|
8630 | 8630 | '~\\b (_*) (?: # 1. Leading underscore and |
8631 | 8631 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
8632 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
8632 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
8633 | 8633 | | |
8634 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
8634 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
8635 | 8635 | | |
8636 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
8636 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
8637 | 8637 | | |
8638 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
8638 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
8639 | 8639 | ) (_*) \\b # 6. With trailing underscore |
8640 | 8640 | ~ux', |
8641 | 8641 | /** |
@@ -8645,7 +8645,7 @@ discard block |
||
8645 | 8645 | * |
8646 | 8646 | * @return string |
8647 | 8647 | */ |
8648 | - static function (array $matches) use ($encoding): string { |
|
8648 | + static function(array $matches) use ($encoding): string { |
|
8649 | 8649 | // preserve leading underscore |
8650 | 8650 | $str = $matches[1]; |
8651 | 8651 | if ($matches[2]) { |
@@ -8670,11 +8670,11 @@ discard block |
||
8670 | 8670 | ); |
8671 | 8671 | |
8672 | 8672 | // Exceptions for small words: capitalize at start of title... |
8673 | - $str = (string) \preg_replace_callback( |
|
8673 | + $str = (string)\preg_replace_callback( |
|
8674 | 8674 | '~( \\A [[:punct:]]* # start of title... |
8675 | 8675 | | [:.;?!][ ]+ # or of subsentence... |
8676 | 8676 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
8677 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
8677 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
8678 | 8678 | ~uxi', |
8679 | 8679 | /** |
8680 | 8680 | * @param string[] $matches |
@@ -8683,15 +8683,15 @@ discard block |
||
8683 | 8683 | * |
8684 | 8684 | * @return string |
8685 | 8685 | */ |
8686 | - static function (array $matches) use ($encoding): string { |
|
8687 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
8686 | + static function(array $matches) use ($encoding): string { |
|
8687 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
8688 | 8688 | }, |
8689 | 8689 | $str |
8690 | 8690 | ); |
8691 | 8691 | |
8692 | 8692 | // ...and end of title |
8693 | - $str = (string) \preg_replace_callback( |
|
8694 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
8693 | + $str = (string)\preg_replace_callback( |
|
8694 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
8695 | 8695 | (?= [[:punct:]]* \Z # ...at the end of the title... |
8696 | 8696 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
8697 | 8697 | ~uxi', |
@@ -8702,7 +8702,7 @@ discard block |
||
8702 | 8702 | * |
8703 | 8703 | * @return string |
8704 | 8704 | */ |
8705 | - static function (array $matches) use ($encoding): string { |
|
8705 | + static function(array $matches) use ($encoding): string { |
|
8706 | 8706 | return static::ucfirst($matches[1], $encoding); |
8707 | 8707 | }, |
8708 | 8708 | $str |
@@ -8710,10 +8710,10 @@ discard block |
||
8710 | 8710 | |
8711 | 8711 | // Exceptions for small words in hyphenated compound words. |
8712 | 8712 | // e.g. "in-flight" -> In-Flight |
8713 | - $str = (string) \preg_replace_callback( |
|
8713 | + $str = (string)\preg_replace_callback( |
|
8714 | 8714 | '~\\b |
8715 | 8715 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
8716 | - ( ' . $small_words_rx . ' ) |
|
8716 | + ( ' . $small_words_rx.' ) |
|
8717 | 8717 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
8718 | 8718 | ~uxi', |
8719 | 8719 | /** |
@@ -8723,18 +8723,18 @@ discard block |
||
8723 | 8723 | * |
8724 | 8724 | * @return string |
8725 | 8725 | */ |
8726 | - static function (array $matches) use ($encoding): string { |
|
8726 | + static function(array $matches) use ($encoding): string { |
|
8727 | 8727 | return static::ucfirst($matches[1], $encoding); |
8728 | 8728 | }, |
8729 | 8729 | $str |
8730 | 8730 | ); |
8731 | 8731 | |
8732 | 8732 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
8733 | - $str = (string) \preg_replace_callback( |
|
8733 | + $str = (string)\preg_replace_callback( |
|
8734 | 8734 | '~\\b |
8735 | 8735 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
8736 | 8736 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
8737 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
8737 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
8738 | 8738 | (?! - ) # Negative lookahead for another - |
8739 | 8739 | ~uxi', |
8740 | 8740 | /** |
@@ -8744,8 +8744,8 @@ discard block |
||
8744 | 8744 | * |
8745 | 8745 | * @return string |
8746 | 8746 | */ |
8747 | - static function (array $matches) use ($encoding): string { |
|
8748 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
8747 | + static function(array $matches) use ($encoding): string { |
|
8748 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
8749 | 8749 | }, |
8750 | 8750 | $str |
8751 | 8751 | ); |
@@ -8860,7 +8860,7 @@ discard block |
||
8860 | 8860 | ); |
8861 | 8861 | |
8862 | 8862 | foreach ($tmp_return as &$item) { |
8863 | - $item = (string) $item; |
|
8863 | + $item = (string)$item; |
|
8864 | 8864 | } |
8865 | 8865 | |
8866 | 8866 | return $tmp_return; |
@@ -8914,39 +8914,39 @@ discard block |
||
8914 | 8914 | } |
8915 | 8915 | |
8916 | 8916 | if ($encoding === 'UTF-8') { |
8917 | - if ($length >= (int) \mb_strlen($str)) { |
|
8917 | + if ($length >= (int)\mb_strlen($str)) { |
|
8918 | 8918 | return $str; |
8919 | 8919 | } |
8920 | 8920 | |
8921 | 8921 | if ($substring !== '') { |
8922 | - $length -= (int) \mb_strlen($substring); |
|
8922 | + $length -= (int)\mb_strlen($substring); |
|
8923 | 8923 | |
8924 | 8924 | /** @noinspection UnnecessaryCastingInspection */ |
8925 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
8925 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
8926 | 8926 | } |
8927 | 8927 | |
8928 | 8928 | /** @noinspection UnnecessaryCastingInspection */ |
8929 | - return (string) \mb_substr($str, 0, $length); |
|
8929 | + return (string)\mb_substr($str, 0, $length); |
|
8930 | 8930 | } |
8931 | 8931 | |
8932 | 8932 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8933 | 8933 | |
8934 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8934 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8935 | 8935 | return $str; |
8936 | 8936 | } |
8937 | 8937 | |
8938 | 8938 | if ($substring !== '') { |
8939 | - $length -= (int) self::strlen($substring, $encoding); |
|
8939 | + $length -= (int)self::strlen($substring, $encoding); |
|
8940 | 8940 | } |
8941 | 8941 | |
8942 | 8942 | return ( |
8943 | - (string) self::substr( |
|
8943 | + (string)self::substr( |
|
8944 | 8944 | $str, |
8945 | 8945 | 0, |
8946 | 8946 | $length, |
8947 | 8947 | $encoding |
8948 | 8948 | ) |
8949 | - ) . $substring; |
|
8949 | + ).$substring; |
|
8950 | 8950 | } |
8951 | 8951 | |
8952 | 8952 | /** |
@@ -8980,12 +8980,12 @@ discard block |
||
8980 | 8980 | } |
8981 | 8981 | |
8982 | 8982 | if ($encoding === 'UTF-8') { |
8983 | - if ($length >= (int) \mb_strlen($str)) { |
|
8983 | + if ($length >= (int)\mb_strlen($str)) { |
|
8984 | 8984 | return $str; |
8985 | 8985 | } |
8986 | 8986 | |
8987 | 8987 | // need to further trim the string so we can append the substring |
8988 | - $length -= (int) \mb_strlen($substring); |
|
8988 | + $length -= (int)\mb_strlen($substring); |
|
8989 | 8989 | if ($length <= 0) { |
8990 | 8990 | return $substring; |
8991 | 8991 | } |
@@ -9011,18 +9011,18 @@ discard block |
||
9011 | 9011 | !$ignore_do_not_split_words_for_one_word |
9012 | 9012 | ) |
9013 | 9013 | ) { |
9014 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
9014 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
9015 | 9015 | } |
9016 | 9016 | } |
9017 | 9017 | } else { |
9018 | 9018 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9019 | 9019 | |
9020 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
9020 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
9021 | 9021 | return $str; |
9022 | 9022 | } |
9023 | 9023 | |
9024 | 9024 | // need to further trim the string so we can append the substring |
9025 | - $length -= (int) self::strlen($substring, $encoding); |
|
9025 | + $length -= (int)self::strlen($substring, $encoding); |
|
9026 | 9026 | if ($length <= 0) { |
9027 | 9027 | return $substring; |
9028 | 9028 | } |
@@ -9048,12 +9048,12 @@ discard block |
||
9048 | 9048 | !$ignore_do_not_split_words_for_one_word |
9049 | 9049 | ) |
9050 | 9050 | ) { |
9051 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
9051 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
9052 | 9052 | } |
9053 | 9053 | } |
9054 | 9054 | } |
9055 | 9055 | |
9056 | - return $truncated . $substring; |
|
9056 | + return $truncated.$substring; |
|
9057 | 9057 | } |
9058 | 9058 | |
9059 | 9059 | /** |
@@ -9163,13 +9163,13 @@ discard block |
||
9163 | 9163 | } |
9164 | 9164 | } elseif ($format === 2) { |
9165 | 9165 | $number_of_words = []; |
9166 | - $offset = (int) self::strlen($str_parts[0]); |
|
9166 | + $offset = (int)self::strlen($str_parts[0]); |
|
9167 | 9167 | for ($i = 1; $i < $len; $i += 2) { |
9168 | 9168 | $number_of_words[$offset] = $str_parts[$i]; |
9169 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
9169 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
9170 | 9170 | } |
9171 | 9171 | } else { |
9172 | - $number_of_words = (int) (($len - 1) / 2); |
|
9172 | + $number_of_words = (int)(($len - 1) / 2); |
|
9173 | 9173 | } |
9174 | 9174 | |
9175 | 9175 | return $number_of_words; |
@@ -9298,21 +9298,21 @@ discard block |
||
9298 | 9298 | } |
9299 | 9299 | |
9300 | 9300 | if ($char_list === '') { |
9301 | - return (int) self::strlen($str, $encoding); |
|
9301 | + return (int)self::strlen($str, $encoding); |
|
9302 | 9302 | } |
9303 | 9303 | |
9304 | 9304 | if ($offset !== null || $length !== null) { |
9305 | 9305 | if ($encoding === 'UTF-8') { |
9306 | 9306 | if ($length === null) { |
9307 | 9307 | /** @noinspection UnnecessaryCastingInspection */ |
9308 | - $str_tmp = \mb_substr($str, (int) $offset); |
|
9308 | + $str_tmp = \mb_substr($str, (int)$offset); |
|
9309 | 9309 | } else { |
9310 | 9310 | /** @noinspection UnnecessaryCastingInspection */ |
9311 | - $str_tmp = \mb_substr($str, (int) $offset, $length); |
|
9311 | + $str_tmp = \mb_substr($str, (int)$offset, $length); |
|
9312 | 9312 | } |
9313 | 9313 | } else { |
9314 | 9314 | /** @noinspection UnnecessaryCastingInspection */ |
9315 | - $str_tmp = self::substr($str, (int) $offset, $length, $encoding); |
|
9315 | + $str_tmp = self::substr($str, (int)$offset, $length, $encoding); |
|
9316 | 9316 | } |
9317 | 9317 | |
9318 | 9318 | if ($str_tmp === false) { |
@@ -9328,7 +9328,7 @@ discard block |
||
9328 | 9328 | } |
9329 | 9329 | |
9330 | 9330 | $matches = []; |
9331 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
9331 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
9332 | 9332 | $return = self::strlen($matches[1], $encoding); |
9333 | 9333 | if ($return === false) { |
9334 | 9334 | return 0; |
@@ -9337,7 +9337,7 @@ discard block |
||
9337 | 9337 | return $return; |
9338 | 9338 | } |
9339 | 9339 | |
9340 | - return (int) self::strlen($str, $encoding); |
|
9340 | + return (int)self::strlen($str, $encoding); |
|
9341 | 9341 | } |
9342 | 9342 | |
9343 | 9343 | /** |
@@ -9392,7 +9392,7 @@ discard block |
||
9392 | 9392 | |
9393 | 9393 | $str = ''; |
9394 | 9394 | foreach ($array as $strPart) { |
9395 | - $str .= '&#' . (int) $strPart . ';'; |
|
9395 | + $str .= '&#'.(int)$strPart.';'; |
|
9396 | 9396 | } |
9397 | 9397 | |
9398 | 9398 | return self::html_entity_decode($str, \ENT_QUOTES | \ENT_HTML5); |
@@ -9481,7 +9481,7 @@ discard block |
||
9481 | 9481 | return ''; |
9482 | 9482 | } |
9483 | 9483 | |
9484 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
9484 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
9485 | 9485 | } |
9486 | 9486 | |
9487 | 9487 | /** |
@@ -9548,7 +9548,7 @@ discard block |
||
9548 | 9548 | // fallback for ascii only |
9549 | 9549 | // |
9550 | 9550 | |
9551 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9551 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9552 | 9552 | return \stripos($haystack, $needle, $offset); |
9553 | 9553 | } |
9554 | 9554 | |
@@ -9621,7 +9621,7 @@ discard block |
||
9621 | 9621 | /** |
9622 | 9622 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
9623 | 9623 | */ |
9624 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9624 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9625 | 9625 | } |
9626 | 9626 | |
9627 | 9627 | if ( |
@@ -9635,11 +9635,11 @@ discard block |
||
9635 | 9635 | } |
9636 | 9636 | } |
9637 | 9637 | |
9638 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
9638 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
9639 | 9639 | return \stristr($haystack, $needle, $before_needle); |
9640 | 9640 | } |
9641 | 9641 | |
9642 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
9642 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
9643 | 9643 | |
9644 | 9644 | if (!isset($match[1])) { |
9645 | 9645 | return false; |
@@ -9649,7 +9649,7 @@ discard block |
||
9649 | 9649 | return $match[1]; |
9650 | 9650 | } |
9651 | 9651 | |
9652 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
9652 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
9653 | 9653 | } |
9654 | 9654 | |
9655 | 9655 | /** |
@@ -9728,7 +9728,7 @@ discard block |
||
9728 | 9728 | /** |
9729 | 9729 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
9730 | 9730 | */ |
9731 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9731 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9732 | 9732 | } |
9733 | 9733 | |
9734 | 9734 | // |
@@ -9850,8 +9850,8 @@ discard block |
||
9850 | 9850 | } |
9851 | 9851 | |
9852 | 9852 | return \strnatcmp( |
9853 | - (string) self::strtonatfold($str1), |
|
9854 | - (string) self::strtonatfold($str2) |
|
9853 | + (string)self::strtonatfold($str1), |
|
9854 | + (string)self::strtonatfold($str2) |
|
9855 | 9855 | ); |
9856 | 9856 | } |
9857 | 9857 | |
@@ -9913,11 +9913,11 @@ discard block |
||
9913 | 9913 | } |
9914 | 9914 | |
9915 | 9915 | if ($encoding === 'UTF-8') { |
9916 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
9917 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
9916 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
9917 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
9918 | 9918 | } else { |
9919 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
9920 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
9919 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
9920 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
9921 | 9921 | } |
9922 | 9922 | |
9923 | 9923 | return self::strcmp($str1, $str2); |
@@ -9942,8 +9942,8 @@ discard block |
||
9942 | 9942 | return false; |
9943 | 9943 | } |
9944 | 9944 | |
9945 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
9946 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
9945 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
9946 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
9947 | 9947 | } |
9948 | 9948 | |
9949 | 9949 | return false; |
@@ -9978,10 +9978,10 @@ discard block |
||
9978 | 9978 | } |
9979 | 9979 | |
9980 | 9980 | // iconv and mbstring do not support integer $needle |
9981 | - if ((int) $needle === $needle) { |
|
9982 | - $needle = (string) self::chr($needle); |
|
9981 | + if ((int)$needle === $needle) { |
|
9982 | + $needle = (string)self::chr($needle); |
|
9983 | 9983 | } |
9984 | - $needle = (string) $needle; |
|
9984 | + $needle = (string)$needle; |
|
9985 | 9985 | |
9986 | 9986 | if ($needle === '') { |
9987 | 9987 | return false; |
@@ -10033,7 +10033,7 @@ discard block |
||
10033 | 10033 | /** |
10034 | 10034 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10035 | 10035 | */ |
10036 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10036 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10037 | 10037 | } |
10038 | 10038 | |
10039 | 10039 | // |
@@ -10074,7 +10074,7 @@ discard block |
||
10074 | 10074 | // fallback for ascii only |
10075 | 10075 | // |
10076 | 10076 | |
10077 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10077 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10078 | 10078 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Offset not contained in string */ |
10079 | 10079 | return @\strpos($haystack, $needle, $offset); |
10080 | 10080 | } |
@@ -10087,7 +10087,7 @@ discard block |
||
10087 | 10087 | if ($haystack_tmp === false) { |
10088 | 10088 | $haystack_tmp = ''; |
10089 | 10089 | } |
10090 | - $haystack = (string) $haystack_tmp; |
|
10090 | + $haystack = (string)$haystack_tmp; |
|
10091 | 10091 | |
10092 | 10092 | if ($offset < 0) { |
10093 | 10093 | $offset = 0; |
@@ -10099,7 +10099,7 @@ discard block |
||
10099 | 10099 | } |
10100 | 10100 | |
10101 | 10101 | if ($pos) { |
10102 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
10102 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
10103 | 10103 | } |
10104 | 10104 | |
10105 | 10105 | return $offset + 0; |
@@ -10252,7 +10252,7 @@ discard block |
||
10252 | 10252 | /** |
10253 | 10253 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10254 | 10254 | */ |
10255 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10255 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10256 | 10256 | } |
10257 | 10257 | |
10258 | 10258 | // |
@@ -10264,7 +10264,7 @@ discard block |
||
10264 | 10264 | if ($needle_tmp === false) { |
10265 | 10265 | return false; |
10266 | 10266 | } |
10267 | - $needle = (string) $needle_tmp; |
|
10267 | + $needle = (string)$needle_tmp; |
|
10268 | 10268 | |
10269 | 10269 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
10270 | 10270 | if ($pos === false) { |
@@ -10286,7 +10286,7 @@ discard block |
||
10286 | 10286 | if ($needle_tmp === false) { |
10287 | 10287 | return false; |
10288 | 10288 | } |
10289 | - $needle = (string) $needle_tmp; |
|
10289 | + $needle = (string)$needle_tmp; |
|
10290 | 10290 | |
10291 | 10291 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
10292 | 10292 | if ($pos === false) { |
@@ -10325,7 +10325,7 @@ discard block |
||
10325 | 10325 | if ($encoding === 'UTF-8') { |
10326 | 10326 | if (self::$SUPPORT['intl'] === true) { |
10327 | 10327 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
10328 | - $i = (int) \grapheme_strlen($str); |
|
10328 | + $i = (int)\grapheme_strlen($str); |
|
10329 | 10329 | while ($i--) { |
10330 | 10330 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
10331 | 10331 | if ($reversed_tmp !== false) { |
@@ -10333,7 +10333,7 @@ discard block |
||
10333 | 10333 | } |
10334 | 10334 | } |
10335 | 10335 | } else { |
10336 | - $i = (int) \mb_strlen($str); |
|
10336 | + $i = (int)\mb_strlen($str); |
|
10337 | 10337 | while ($i--) { |
10338 | 10338 | $reversed_tmp = \mb_substr($str, $i, 1); |
10339 | 10339 | if ($reversed_tmp !== false) { |
@@ -10344,7 +10344,7 @@ discard block |
||
10344 | 10344 | } else { |
10345 | 10345 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10346 | 10346 | |
10347 | - $i = (int) self::strlen($str, $encoding); |
|
10347 | + $i = (int)self::strlen($str, $encoding); |
|
10348 | 10348 | while ($i--) { |
10349 | 10349 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
10350 | 10350 | if ($reversed_tmp !== false) { |
@@ -10421,7 +10421,7 @@ discard block |
||
10421 | 10421 | if ($needle_tmp === false) { |
10422 | 10422 | return false; |
10423 | 10423 | } |
10424 | - $needle = (string) $needle_tmp; |
|
10424 | + $needle = (string)$needle_tmp; |
|
10425 | 10425 | |
10426 | 10426 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
10427 | 10427 | if ($pos === false) { |
@@ -10462,10 +10462,10 @@ discard block |
||
10462 | 10462 | } |
10463 | 10463 | |
10464 | 10464 | // iconv and mbstring do not support integer $needle |
10465 | - if ((int) $needle === $needle && $needle >= 0) { |
|
10466 | - $needle = (string) self::chr($needle); |
|
10465 | + if ((int)$needle === $needle && $needle >= 0) { |
|
10466 | + $needle = (string)self::chr($needle); |
|
10467 | 10467 | } |
10468 | - $needle = (string) $needle; |
|
10468 | + $needle = (string)$needle; |
|
10469 | 10469 | |
10470 | 10470 | if ($needle === '') { |
10471 | 10471 | return false; |
@@ -10513,7 +10513,7 @@ discard block |
||
10513 | 10513 | /** |
10514 | 10514 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10515 | 10515 | */ |
10516 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10516 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10517 | 10517 | } |
10518 | 10518 | |
10519 | 10519 | // |
@@ -10537,7 +10537,7 @@ discard block |
||
10537 | 10537 | // fallback for ascii only |
10538 | 10538 | // |
10539 | 10539 | |
10540 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10540 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10541 | 10541 | return \strripos($haystack, $needle, $offset); |
10542 | 10542 | } |
10543 | 10543 | |
@@ -10618,10 +10618,10 @@ discard block |
||
10618 | 10618 | } |
10619 | 10619 | |
10620 | 10620 | // iconv and mbstring do not support integer $needle |
10621 | - if ((int) $needle === $needle && $needle >= 0) { |
|
10622 | - $needle = (string) self::chr($needle); |
|
10621 | + if ((int)$needle === $needle && $needle >= 0) { |
|
10622 | + $needle = (string)self::chr($needle); |
|
10623 | 10623 | } |
10624 | - $needle = (string) $needle; |
|
10624 | + $needle = (string)$needle; |
|
10625 | 10625 | |
10626 | 10626 | if ($needle === '') { |
10627 | 10627 | return false; |
@@ -10669,7 +10669,7 @@ discard block |
||
10669 | 10669 | /** |
10670 | 10670 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10671 | 10671 | */ |
10672 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10672 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10673 | 10673 | } |
10674 | 10674 | |
10675 | 10675 | // |
@@ -10693,7 +10693,7 @@ discard block |
||
10693 | 10693 | // fallback for ascii only |
10694 | 10694 | // |
10695 | 10695 | |
10696 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10696 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10697 | 10697 | return \strrpos($haystack, $needle, $offset); |
10698 | 10698 | } |
10699 | 10699 | |
@@ -10713,7 +10713,7 @@ discard block |
||
10713 | 10713 | if ($haystack_tmp === false) { |
10714 | 10714 | $haystack_tmp = ''; |
10715 | 10715 | } |
10716 | - $haystack = (string) $haystack_tmp; |
|
10716 | + $haystack = (string)$haystack_tmp; |
|
10717 | 10717 | } |
10718 | 10718 | |
10719 | 10719 | $pos = \strrpos($haystack, $needle); |
@@ -10727,7 +10727,7 @@ discard block |
||
10727 | 10727 | return false; |
10728 | 10728 | } |
10729 | 10729 | |
10730 | - return $offset + (int) self::strlen($str_tmp); |
|
10730 | + return $offset + (int)self::strlen($str_tmp); |
|
10731 | 10731 | } |
10732 | 10732 | |
10733 | 10733 | /** |
@@ -10793,12 +10793,12 @@ discard block |
||
10793 | 10793 | if ($offset || $length !== null) { |
10794 | 10794 | if ($encoding === 'UTF-8') { |
10795 | 10795 | if ($length === null) { |
10796 | - $str = (string) \mb_substr($str, $offset); |
|
10796 | + $str = (string)\mb_substr($str, $offset); |
|
10797 | 10797 | } else { |
10798 | - $str = (string) \mb_substr($str, $offset, $length); |
|
10798 | + $str = (string)\mb_substr($str, $offset, $length); |
|
10799 | 10799 | } |
10800 | 10800 | } else { |
10801 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
10801 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
10802 | 10802 | } |
10803 | 10803 | } |
10804 | 10804 | |
@@ -10808,7 +10808,7 @@ discard block |
||
10808 | 10808 | |
10809 | 10809 | $matches = []; |
10810 | 10810 | |
10811 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
10811 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
10812 | 10812 | } |
10813 | 10813 | |
10814 | 10814 | /** |
@@ -10882,7 +10882,7 @@ discard block |
||
10882 | 10882 | /** |
10883 | 10883 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10884 | 10884 | */ |
10885 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10885 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10886 | 10886 | } |
10887 | 10887 | |
10888 | 10888 | // |
@@ -10904,7 +10904,7 @@ discard block |
||
10904 | 10904 | // fallback for ascii only |
10905 | 10905 | // |
10906 | 10906 | |
10907 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10907 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10908 | 10908 | return \strstr($haystack, $needle, $before_needle); |
10909 | 10909 | } |
10910 | 10910 | |
@@ -10912,7 +10912,7 @@ discard block |
||
10912 | 10912 | // fallback via vanilla php |
10913 | 10913 | // |
10914 | 10914 | |
10915 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
10915 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
10916 | 10916 | |
10917 | 10917 | if (!isset($match[1])) { |
10918 | 10918 | return false; |
@@ -10922,7 +10922,7 @@ discard block |
||
10922 | 10922 | return $match[1]; |
10923 | 10923 | } |
10924 | 10924 | |
10925 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
10925 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
10926 | 10926 | } |
10927 | 10927 | |
10928 | 10928 | /** |
@@ -11048,7 +11048,7 @@ discard block |
||
11048 | 11048 | bool $try_to_keep_the_string_length = false |
11049 | 11049 | ): string { |
11050 | 11050 | // init |
11051 | - $str = (string) $str; |
|
11051 | + $str = (string)$str; |
|
11052 | 11052 | |
11053 | 11053 | if ($str === '') { |
11054 | 11054 | return ''; |
@@ -11077,25 +11077,25 @@ discard block |
||
11077 | 11077 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
11078 | 11078 | } |
11079 | 11079 | |
11080 | - $language_code = $lang . '-Lower'; |
|
11080 | + $language_code = $lang.'-Lower'; |
|
11081 | 11081 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
11082 | 11082 | /** |
11083 | 11083 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11084 | 11084 | */ |
11085 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
11085 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
11086 | 11086 | |
11087 | 11087 | $language_code = 'Any-Lower'; |
11088 | 11088 | } |
11089 | 11089 | |
11090 | 11090 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11091 | 11091 | /** @noinspection UnnecessaryCastingInspection */ |
11092 | - return (string) \transliterator_transliterate($language_code, $str); |
|
11092 | + return (string)\transliterator_transliterate($language_code, $str); |
|
11093 | 11093 | } |
11094 | 11094 | |
11095 | 11095 | /** |
11096 | 11096 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11097 | 11097 | */ |
11098 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
11098 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
11099 | 11099 | } |
11100 | 11100 | |
11101 | 11101 | // always fallback via symfony polyfill |
@@ -11128,7 +11128,7 @@ discard block |
||
11128 | 11128 | bool $try_to_keep_the_string_length = false |
11129 | 11129 | ): string { |
11130 | 11130 | // init |
11131 | - $str = (string) $str; |
|
11131 | + $str = (string)$str; |
|
11132 | 11132 | |
11133 | 11133 | if ($str === '') { |
11134 | 11134 | return ''; |
@@ -11157,25 +11157,25 @@ discard block |
||
11157 | 11157 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
11158 | 11158 | } |
11159 | 11159 | |
11160 | - $language_code = $lang . '-Upper'; |
|
11160 | + $language_code = $lang.'-Upper'; |
|
11161 | 11161 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
11162 | 11162 | /** |
11163 | 11163 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11164 | 11164 | */ |
11165 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
11165 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
11166 | 11166 | |
11167 | 11167 | $language_code = 'Any-Upper'; |
11168 | 11168 | } |
11169 | 11169 | |
11170 | 11170 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11171 | 11171 | /** @noinspection UnnecessaryCastingInspection */ |
11172 | - return (string) \transliterator_transliterate($language_code, $str); |
|
11172 | + return (string)\transliterator_transliterate($language_code, $str); |
|
11173 | 11173 | } |
11174 | 11174 | |
11175 | 11175 | /** |
11176 | 11176 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11177 | 11177 | */ |
11178 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
11178 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
11179 | 11179 | } |
11180 | 11180 | |
11181 | 11181 | // always fallback via symfony polyfill |
@@ -11244,7 +11244,7 @@ discard block |
||
11244 | 11244 | $from = \array_combine($from, $to); |
11245 | 11245 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
11246 | 11246 | if ($from === false) { |
11247 | - 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) . ')'); |
|
11247 | + 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).')'); |
|
11248 | 11248 | } |
11249 | 11249 | } |
11250 | 11250 | |
@@ -11306,9 +11306,9 @@ discard block |
||
11306 | 11306 | } |
11307 | 11307 | |
11308 | 11308 | $wide = 0; |
11309 | - $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); |
|
11309 | + $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); |
|
11310 | 11310 | |
11311 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
11311 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
11312 | 11312 | } |
11313 | 11313 | |
11314 | 11314 | /** |
@@ -11406,9 +11406,9 @@ discard block |
||
11406 | 11406 | } |
11407 | 11407 | |
11408 | 11408 | if ($length === null) { |
11409 | - $length = (int) $str_length; |
|
11409 | + $length = (int)$str_length; |
|
11410 | 11410 | } else { |
11411 | - $length = (int) $length; |
|
11411 | + $length = (int)$length; |
|
11412 | 11412 | } |
11413 | 11413 | |
11414 | 11414 | if ( |
@@ -11419,7 +11419,7 @@ discard block |
||
11419 | 11419 | /** |
11420 | 11420 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11421 | 11421 | */ |
11422 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11422 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11423 | 11423 | } |
11424 | 11424 | |
11425 | 11425 | // |
@@ -11509,16 +11509,16 @@ discard block |
||
11509 | 11509 | ) { |
11510 | 11510 | if ($encoding === 'UTF-8') { |
11511 | 11511 | if ($length === null) { |
11512 | - $str1 = (string) \mb_substr($str1, $offset); |
|
11512 | + $str1 = (string)\mb_substr($str1, $offset); |
|
11513 | 11513 | } else { |
11514 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
11514 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
11515 | 11515 | } |
11516 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
11516 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
11517 | 11517 | } else { |
11518 | 11518 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11519 | 11519 | |
11520 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
11521 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
11520 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
11521 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
11522 | 11522 | } |
11523 | 11523 | } |
11524 | 11524 | |
@@ -11583,13 +11583,13 @@ discard block |
||
11583 | 11583 | if ($length_tmp === false) { |
11584 | 11584 | return false; |
11585 | 11585 | } |
11586 | - $length = (int) $length_tmp; |
|
11586 | + $length = (int)$length_tmp; |
|
11587 | 11587 | } |
11588 | 11588 | |
11589 | 11589 | if ($encoding === 'UTF-8') { |
11590 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
11590 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
11591 | 11591 | } else { |
11592 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
11592 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
11593 | 11593 | } |
11594 | 11594 | } |
11595 | 11595 | |
@@ -11601,7 +11601,7 @@ discard block |
||
11601 | 11601 | /** |
11602 | 11602 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11603 | 11603 | */ |
11604 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11604 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11605 | 11605 | } |
11606 | 11606 | |
11607 | 11607 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -11612,7 +11612,7 @@ discard block |
||
11612 | 11612 | return \mb_substr_count($haystack, $needle, $encoding); |
11613 | 11613 | } |
11614 | 11614 | |
11615 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
11615 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
11616 | 11616 | |
11617 | 11617 | return \count($matches); |
11618 | 11618 | } |
@@ -11662,7 +11662,7 @@ discard block |
||
11662 | 11662 | if ($length_tmp === false) { |
11663 | 11663 | return false; |
11664 | 11664 | } |
11665 | - $length = (int) $length_tmp; |
|
11665 | + $length = (int)$length_tmp; |
|
11666 | 11666 | } |
11667 | 11667 | |
11668 | 11668 | if ( |
@@ -11684,7 +11684,7 @@ discard block |
||
11684 | 11684 | if ($haystack_tmp === false) { |
11685 | 11685 | $haystack_tmp = ''; |
11686 | 11686 | } |
11687 | - $haystack = (string) $haystack_tmp; |
|
11687 | + $haystack = (string)$haystack_tmp; |
|
11688 | 11688 | } |
11689 | 11689 | |
11690 | 11690 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -11725,10 +11725,10 @@ discard block |
||
11725 | 11725 | |
11726 | 11726 | if ($encoding === 'UTF-8') { |
11727 | 11727 | if ($case_sensitive) { |
11728 | - return (int) \mb_substr_count($str, $substring); |
|
11728 | + return (int)\mb_substr_count($str, $substring); |
|
11729 | 11729 | } |
11730 | 11730 | |
11731 | - return (int) \mb_substr_count( |
|
11731 | + return (int)\mb_substr_count( |
|
11732 | 11732 | \mb_strtoupper($str), |
11733 | 11733 | \mb_strtoupper($substring) |
11734 | 11734 | ); |
@@ -11737,10 +11737,10 @@ discard block |
||
11737 | 11737 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11738 | 11738 | |
11739 | 11739 | if ($case_sensitive) { |
11740 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
11740 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
11741 | 11741 | } |
11742 | 11742 | |
11743 | - return (int) \mb_substr_count( |
|
11743 | + return (int)\mb_substr_count( |
|
11744 | 11744 | self::strtocasefold($str, true, false, $encoding, null, false), |
11745 | 11745 | self::strtocasefold($substring, true, false, $encoding, null, false), |
11746 | 11746 | $encoding |
@@ -11769,7 +11769,7 @@ discard block |
||
11769 | 11769 | } |
11770 | 11770 | |
11771 | 11771 | if (self::str_istarts_with($haystack, $needle)) { |
11772 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
11772 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
11773 | 11773 | } |
11774 | 11774 | |
11775 | 11775 | return $haystack; |
@@ -11831,7 +11831,7 @@ discard block |
||
11831 | 11831 | } |
11832 | 11832 | |
11833 | 11833 | if (self::str_iends_with($haystack, $needle)) { |
11834 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
11834 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
11835 | 11835 | } |
11836 | 11836 | |
11837 | 11837 | return $haystack; |
@@ -11859,7 +11859,7 @@ discard block |
||
11859 | 11859 | } |
11860 | 11860 | |
11861 | 11861 | if (self::str_starts_with($haystack, $needle)) { |
11862 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
11862 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
11863 | 11863 | } |
11864 | 11864 | |
11865 | 11865 | return $haystack; |
@@ -11914,7 +11914,7 @@ discard block |
||
11914 | 11914 | if (\is_array($offset)) { |
11915 | 11915 | $offset = \array_slice($offset, 0, $num); |
11916 | 11916 | foreach ($offset as &$value_tmp) { |
11917 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
11917 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
11918 | 11918 | } |
11919 | 11919 | unset($value_tmp); |
11920 | 11920 | } else { |
@@ -11927,7 +11927,7 @@ discard block |
||
11927 | 11927 | } elseif (\is_array($length)) { |
11928 | 11928 | $length = \array_slice($length, 0, $num); |
11929 | 11929 | foreach ($length as &$value_tmp_V2) { |
11930 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
11930 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
11931 | 11931 | } |
11932 | 11932 | unset($value_tmp_V2); |
11933 | 11933 | } else { |
@@ -11947,8 +11947,8 @@ discard block |
||
11947 | 11947 | } |
11948 | 11948 | |
11949 | 11949 | // init |
11950 | - $str = (string) $str; |
|
11951 | - $replacement = (string) $replacement; |
|
11950 | + $str = (string)$str; |
|
11951 | + $replacement = (string)$replacement; |
|
11952 | 11952 | |
11953 | 11953 | if (\is_array($length)) { |
11954 | 11954 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -11963,16 +11963,16 @@ discard block |
||
11963 | 11963 | } |
11964 | 11964 | |
11965 | 11965 | if (self::$SUPPORT['mbstring'] === true) { |
11966 | - $string_length = (int) self::strlen($str, $encoding); |
|
11966 | + $string_length = (int)self::strlen($str, $encoding); |
|
11967 | 11967 | |
11968 | 11968 | if ($offset < 0) { |
11969 | - $offset = (int) \max(0, $string_length + $offset); |
|
11969 | + $offset = (int)\max(0, $string_length + $offset); |
|
11970 | 11970 | } elseif ($offset > $string_length) { |
11971 | 11971 | $offset = $string_length; |
11972 | 11972 | } |
11973 | 11973 | |
11974 | 11974 | if ($length !== null && $length < 0) { |
11975 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
11975 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
11976 | 11976 | } elseif ($length === null || $length > $string_length) { |
11977 | 11977 | $length = $string_length; |
11978 | 11978 | } |
@@ -11983,9 +11983,9 @@ discard block |
||
11983 | 11983 | } |
11984 | 11984 | |
11985 | 11985 | /** @noinspection AdditionOperationOnArraysInspection */ |
11986 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
11987 | - $replacement . |
|
11988 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
11986 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
11987 | + $replacement. |
|
11988 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
11989 | 11989 | } |
11990 | 11990 | |
11991 | 11991 | // |
@@ -11994,8 +11994,7 @@ discard block |
||
11994 | 11994 | |
11995 | 11995 | if (ASCII::is_ascii($str)) { |
11996 | 11996 | return ($length === null) ? |
11997 | - \substr_replace($str, $replacement, $offset) : |
|
11998 | - \substr_replace($str, $replacement, $offset, $length); |
|
11997 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
11999 | 11998 | } |
12000 | 11999 | |
12001 | 12000 | // |
@@ -12011,7 +12010,7 @@ discard block |
||
12011 | 12010 | // e.g.: non mbstring support + invalid chars |
12012 | 12011 | return ''; |
12013 | 12012 | } |
12014 | - $length = (int) $length_tmp; |
|
12013 | + $length = (int)$length_tmp; |
|
12015 | 12014 | } |
12016 | 12015 | |
12017 | 12016 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -12049,14 +12048,14 @@ discard block |
||
12049 | 12048 | && |
12050 | 12049 | \substr($haystack, -\strlen($needle)) === $needle |
12051 | 12050 | ) { |
12052 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
12051 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
12053 | 12052 | } |
12054 | 12053 | |
12055 | 12054 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
12056 | - return (string) self::substr( |
|
12055 | + return (string)self::substr( |
|
12057 | 12056 | $haystack, |
12058 | 12057 | 0, |
12059 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
12058 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
12060 | 12059 | $encoding |
12061 | 12060 | ); |
12062 | 12061 | } |
@@ -12089,10 +12088,10 @@ discard block |
||
12089 | 12088 | } |
12090 | 12089 | |
12091 | 12090 | if ($encoding === 'UTF-8') { |
12092 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
12091 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
12093 | 12092 | } |
12094 | 12093 | |
12095 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
12094 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
12096 | 12095 | } |
12097 | 12096 | |
12098 | 12097 | /** |
@@ -12300,7 +12299,7 @@ discard block |
||
12300 | 12299 | public static function to_boolean($str): bool |
12301 | 12300 | { |
12302 | 12301 | // init |
12303 | - $str = (string) $str; |
|
12302 | + $str = (string)$str; |
|
12304 | 12303 | |
12305 | 12304 | if ($str === '') { |
12306 | 12305 | return false; |
@@ -12328,10 +12327,10 @@ discard block |
||
12328 | 12327 | } |
12329 | 12328 | |
12330 | 12329 | if (\is_numeric($str)) { |
12331 | - return ((float) $str + 0) > 0; |
|
12330 | + return ((float)$str + 0) > 0; |
|
12332 | 12331 | } |
12333 | 12332 | |
12334 | - return (bool) \trim($str); |
|
12333 | + return (bool)\trim($str); |
|
12335 | 12334 | } |
12336 | 12335 | |
12337 | 12336 | /** |
@@ -12377,7 +12376,7 @@ discard block |
||
12377 | 12376 | return $str; |
12378 | 12377 | } |
12379 | 12378 | |
12380 | - $str = (string) $str; |
|
12379 | + $str = (string)$str; |
|
12381 | 12380 | if ($str === '') { |
12382 | 12381 | return ''; |
12383 | 12382 | } |
@@ -12432,7 +12431,7 @@ discard block |
||
12432 | 12431 | return $str; |
12433 | 12432 | } |
12434 | 12433 | |
12435 | - $str = (string) $str; |
|
12434 | + $str = (string)$str; |
|
12436 | 12435 | if ($str === '') { |
12437 | 12436 | return $str; |
12438 | 12437 | } |
@@ -12450,7 +12449,7 @@ discard block |
||
12450 | 12449 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
12451 | 12450 | |
12452 | 12451 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
12453 | - $buf .= $c1 . $c2; |
|
12452 | + $buf .= $c1.$c2; |
|
12454 | 12453 | ++$i; |
12455 | 12454 | } else { // not valid UTF8 - convert it |
12456 | 12455 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12461,7 +12460,7 @@ discard block |
||
12461 | 12460 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
12462 | 12461 | |
12463 | 12462 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
12464 | - $buf .= $c1 . $c2 . $c3; |
|
12463 | + $buf .= $c1.$c2.$c3; |
|
12465 | 12464 | $i += 2; |
12466 | 12465 | } else { // not valid UTF8 - convert it |
12467 | 12466 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12473,7 +12472,7 @@ discard block |
||
12473 | 12472 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
12474 | 12473 | |
12475 | 12474 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
12476 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
12475 | + $buf .= $c1.$c2.$c3.$c4; |
|
12477 | 12476 | $i += 3; |
12478 | 12477 | } else { // not valid UTF8 - convert it |
12479 | 12478 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12501,13 +12500,13 @@ discard block |
||
12501 | 12500 | * |
12502 | 12501 | * @return string |
12503 | 12502 | */ |
12504 | - static function (array $matches): string { |
|
12503 | + static function(array $matches): string { |
|
12505 | 12504 | if (isset($matches[3])) { |
12506 | - $cp = (int) \hexdec($matches[3]); |
|
12505 | + $cp = (int)\hexdec($matches[3]); |
|
12507 | 12506 | } else { |
12508 | 12507 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
12509 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
12510 | - + (int) \hexdec($matches[2]) |
|
12508 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
12509 | + + (int)\hexdec($matches[2]) |
|
12511 | 12510 | + 0x10000 |
12512 | 12511 | - (0xD800 << 10) |
12513 | 12512 | - 0xDC00; |
@@ -12518,12 +12517,12 @@ discard block |
||
12518 | 12517 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
12519 | 12518 | |
12520 | 12519 | if ($cp < 0x80) { |
12521 | - return (string) self::chr($cp); |
|
12520 | + return (string)self::chr($cp); |
|
12522 | 12521 | } |
12523 | 12522 | |
12524 | 12523 | if ($cp < 0xA0) { |
12525 | 12524 | /** @noinspection UnnecessaryCastingInspection */ |
12526 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
12525 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
12527 | 12526 | } |
12528 | 12527 | |
12529 | 12528 | return self::decimal_to_chr($cp); |
@@ -12556,7 +12555,7 @@ discard block |
||
12556 | 12555 | public static function to_int(string $str) |
12557 | 12556 | { |
12558 | 12557 | if (\is_numeric($str)) { |
12559 | - return (int) $str; |
|
12558 | + return (int)$str; |
|
12560 | 12559 | } |
12561 | 12560 | |
12562 | 12561 | return null; |
@@ -12587,7 +12586,7 @@ discard block |
||
12587 | 12586 | || |
12588 | 12587 | $input_type === 'double' |
12589 | 12588 | ) { |
12590 | - return (string) $input; |
|
12589 | + return (string)$input; |
|
12591 | 12590 | } |
12592 | 12591 | |
12593 | 12592 | if ( |
@@ -12595,7 +12594,7 @@ discard block |
||
12595 | 12594 | && |
12596 | 12595 | \method_exists($input, '__toString') |
12597 | 12596 | ) { |
12598 | - return (string) $input; |
|
12597 | + return (string)$input; |
|
12599 | 12598 | } |
12600 | 12599 | |
12601 | 12600 | return null; |
@@ -12633,7 +12632,7 @@ discard block |
||
12633 | 12632 | } |
12634 | 12633 | |
12635 | 12634 | /** @noinspection PhpComposerExtensionStubsInspection */ |
12636 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
12635 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
12637 | 12636 | } |
12638 | 12637 | |
12639 | 12638 | if ($chars) { |
@@ -12682,15 +12681,15 @@ discard block |
||
12682 | 12681 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
12683 | 12682 | |
12684 | 12683 | if ($encoding === 'UTF-8') { |
12685 | - $str_part_two = (string) \mb_substr($str, 1); |
|
12684 | + $str_part_two = (string)\mb_substr($str, 1); |
|
12686 | 12685 | |
12687 | 12686 | if ($use_mb_functions) { |
12688 | 12687 | $str_part_one = \mb_strtoupper( |
12689 | - (string) \mb_substr($str, 0, 1) |
|
12688 | + (string)\mb_substr($str, 0, 1) |
|
12690 | 12689 | ); |
12691 | 12690 | } else { |
12692 | 12691 | $str_part_one = self::strtoupper( |
12693 | - (string) \mb_substr($str, 0, 1), |
|
12692 | + (string)\mb_substr($str, 0, 1), |
|
12694 | 12693 | $encoding, |
12695 | 12694 | false, |
12696 | 12695 | $lang, |
@@ -12700,16 +12699,16 @@ discard block |
||
12700 | 12699 | } else { |
12701 | 12700 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
12702 | 12701 | |
12703 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
12702 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
12704 | 12703 | |
12705 | 12704 | if ($use_mb_functions) { |
12706 | 12705 | $str_part_one = \mb_strtoupper( |
12707 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
12706 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
12708 | 12707 | $encoding |
12709 | 12708 | ); |
12710 | 12709 | } else { |
12711 | 12710 | $str_part_one = self::strtoupper( |
12712 | - (string) self::substr($str, 0, 1, $encoding), |
|
12711 | + (string)self::substr($str, 0, 1, $encoding), |
|
12713 | 12712 | $encoding, |
12714 | 12713 | false, |
12715 | 12714 | $lang, |
@@ -12718,7 +12717,7 @@ discard block |
||
12718 | 12717 | } |
12719 | 12718 | } |
12720 | 12719 | |
12721 | - return $str_part_one . $str_part_two; |
|
12720 | + return $str_part_one.$str_part_two; |
|
12722 | 12721 | } |
12723 | 12722 | |
12724 | 12723 | /** |
@@ -12777,7 +12776,7 @@ discard block |
||
12777 | 12776 | $str = self::clean($str); |
12778 | 12777 | } |
12779 | 12778 | |
12780 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
12779 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
12781 | 12780 | |
12782 | 12781 | if ( |
12783 | 12782 | $use_php_default_functions |
@@ -13190,7 +13189,7 @@ discard block |
||
13190 | 13189 | if ( |
13191 | 13190 | $keep_utf8_chars |
13192 | 13191 | && |
13193 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
13192 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
13194 | 13193 | ) { |
13195 | 13194 | return $str_backup; |
13196 | 13195 | } |
@@ -13277,17 +13276,17 @@ discard block |
||
13277 | 13276 | return ''; |
13278 | 13277 | } |
13279 | 13278 | |
13280 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
13279 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
13281 | 13280 | |
13282 | 13281 | if ( |
13283 | 13282 | !isset($matches[0]) |
13284 | 13283 | || |
13285 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
13284 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
13286 | 13285 | ) { |
13287 | 13286 | return $str; |
13288 | 13287 | } |
13289 | 13288 | |
13290 | - return \rtrim($matches[0]) . $str_add_on; |
|
13289 | + return \rtrim($matches[0]).$str_add_on; |
|
13291 | 13290 | } |
13292 | 13291 | |
13293 | 13292 | /** |
@@ -13380,7 +13379,7 @@ discard block |
||
13380 | 13379 | } |
13381 | 13380 | } |
13382 | 13381 | |
13383 | - return $str_return . \implode('', $charsArray); |
|
13382 | + return $str_return.\implode('', $charsArray); |
|
13384 | 13383 | } |
13385 | 13384 | |
13386 | 13385 | /** |
@@ -13434,7 +13433,7 @@ discard block |
||
13434 | 13433 | $final_break = ''; |
13435 | 13434 | } |
13436 | 13435 | |
13437 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
13436 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
13438 | 13437 | } |
13439 | 13438 | |
13440 | 13439 | /** |
@@ -13670,7 +13669,7 @@ discard block |
||
13670 | 13669 | /** @noinspection PhpIncludeInspection */ |
13671 | 13670 | /** @noinspection UsingInclusionReturnValueInspection */ |
13672 | 13671 | /** @psalm-suppress UnresolvableInclude */ |
13673 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
13672 | + return include __DIR__.'/data/'.$file.'.php'; |
|
13674 | 13673 | } |
13675 | 13674 | |
13676 | 13675 | /** |
@@ -13690,7 +13689,7 @@ discard block |
||
13690 | 13689 | */ |
13691 | 13690 | \uksort( |
13692 | 13691 | self::$EMOJI, |
13693 | - static function (string $a, string $b): int { |
|
13692 | + static function(string $a, string $b): int { |
|
13694 | 13693 | return \strlen($b) <=> \strlen($a); |
13695 | 13694 | } |
13696 | 13695 | ); |
@@ -13700,7 +13699,7 @@ discard block |
||
13700 | 13699 | |
13701 | 13700 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
13702 | 13701 | $tmp_key = \crc32($key); |
13703 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
13702 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
13704 | 13703 | } |
13705 | 13704 | |
13706 | 13705 | return true; |
@@ -13728,7 +13727,7 @@ discard block |
||
13728 | 13727 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
13729 | 13728 | return \defined('MB_OVERLOAD_STRING') |
13730 | 13729 | && |
13731 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
13730 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
13732 | 13731 | } |
13733 | 13732 | |
13734 | 13733 | /** |
@@ -13794,7 +13793,7 @@ discard block |
||
13794 | 13793 | */ |
13795 | 13794 | static $RX_CLASS_CACHE = []; |
13796 | 13795 | |
13797 | - $cache_key = $s . '_' . $class; |
|
13796 | + $cache_key = $s.'_'.$class; |
|
13798 | 13797 | |
13799 | 13798 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
13800 | 13799 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -13807,7 +13806,7 @@ discard block |
||
13807 | 13806 | /** @noinspection AlterInForeachInspection */ |
13808 | 13807 | foreach (self::str_split($s) as &$s) { |
13809 | 13808 | if ($s === '-') { |
13810 | - $class_array[0] = '-' . $class_array[0]; |
|
13809 | + $class_array[0] = '-'.$class_array[0]; |
|
13811 | 13810 | } elseif (!isset($s[2])) { |
13812 | 13811 | $class_array[0] .= \preg_quote($s, '/'); |
13813 | 13812 | } elseif (self::strlen($s) === 1) { |
@@ -13818,13 +13817,13 @@ discard block |
||
13818 | 13817 | } |
13819 | 13818 | |
13820 | 13819 | if ($class_array[0]) { |
13821 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
13820 | + $class_array[0] = '['.$class_array[0].']'; |
|
13822 | 13821 | } |
13823 | 13822 | |
13824 | 13823 | if (\count($class_array) === 1) { |
13825 | 13824 | $return = $class_array[0]; |
13826 | 13825 | } else { |
13827 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
13826 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
13828 | 13827 | } |
13829 | 13828 | |
13830 | 13829 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -13905,7 +13904,7 @@ discard block |
||
13905 | 13904 | |
13906 | 13905 | if ($delimiter === '-') { |
13907 | 13906 | /** @noinspection AlterInForeachInspection */ |
13908 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
13907 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
13909 | 13908 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
13910 | 13909 | $continue = true; |
13911 | 13910 | |
@@ -13915,7 +13914,7 @@ discard block |
||
13915 | 13914 | } |
13916 | 13915 | |
13917 | 13916 | /** @noinspection AlterInForeachInspection */ |
13918 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
13917 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
13919 | 13918 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
13920 | 13919 | $continue = true; |
13921 | 13920 | |
@@ -13985,8 +13984,8 @@ discard block |
||
13985 | 13984 | } else { |
13986 | 13985 | /** @noinspection OffsetOperationsInspection */ |
13987 | 13986 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
13988 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
13989 | - $buf .= $cc1 . $cc2; |
|
13987 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
13988 | + $buf .= $cc1.$cc2; |
|
13990 | 13989 | } |
13991 | 13990 | |
13992 | 13991 | return $buf; |
@@ -14005,7 +14004,7 @@ discard block |
||
14005 | 14004 | { |
14006 | 14005 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
14007 | 14006 | if (\preg_match($pattern, $str)) { |
14008 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
14007 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
14009 | 14008 | } |
14010 | 14009 | |
14011 | 14010 | return $str; |