@@ -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 | // |
@@ -271,10 +271,10 @@ discard block |
||
271 | 271 | } |
272 | 272 | |
273 | 273 | if ($encoding === 'UTF-8') { |
274 | - return (string) \mb_substr($str, $pos, 1); |
|
274 | + return (string)\mb_substr($str, $pos, 1); |
|
275 | 275 | } |
276 | 276 | |
277 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
277 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | public static function add_bom_to_string(string $str): string |
295 | 295 | { |
296 | 296 | if (!self::string_has_bom($str)) { |
297 | - $str = self::bom() . $str; |
|
297 | + $str = self::bom().$str; |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | return $str; |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | $return = []; |
330 | 330 | foreach ($array as $key => &$value) { |
331 | 331 | $key = $case === \CASE_LOWER |
332 | - ? self::strtolower((string) $key, $encoding) |
|
333 | - : self::strtoupper((string) $key, $encoding); |
|
332 | + ? self::strtolower((string)$key, $encoding) |
|
333 | + : self::strtoupper((string)$key, $encoding); |
|
334 | 334 | |
335 | 335 | $return[$key] = $value; |
336 | 336 | } |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | return ''; |
367 | 367 | } |
368 | 368 | |
369 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
369 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
370 | 370 | $end_position = \mb_strpos($str, $end, $substr_index); |
371 | 371 | if ( |
372 | 372 | $end_position === false |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | return ''; |
377 | 377 | } |
378 | 378 | |
379 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
379 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | return ''; |
387 | 387 | } |
388 | 388 | |
389 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
389 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
390 | 390 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
391 | 391 | if ( |
392 | 392 | $end_position === false |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | return ''; |
397 | 397 | } |
398 | 398 | |
399 | - return (string) self::substr( |
|
399 | + return (string)self::substr( |
|
400 | 400 | $str, |
401 | 401 | $substr_index, |
402 | 402 | $end_position - $substr_index, |
@@ -480,10 +480,10 @@ discard block |
||
480 | 480 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
481 | 481 | { |
482 | 482 | if ($encoding === 'UTF-8') { |
483 | - return (string) \mb_substr($str, $index, 1); |
|
483 | + return (string)\mb_substr($str, $index, 1); |
|
484 | 484 | } |
485 | 485 | |
486 | - return (string) self::substr($str, $index, 1, $encoding); |
|
486 | + return (string)self::substr($str, $index, 1, $encoding); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | /** |
@@ -601,14 +601,14 @@ discard block |
||
601 | 601 | /** |
602 | 602 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
603 | 603 | */ |
604 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
604 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
605 | 605 | } |
606 | 606 | |
607 | 607 | if (!\is_int($code_point) || $code_point <= 0) { |
608 | 608 | return null; |
609 | 609 | } |
610 | 610 | |
611 | - $cache_key = $code_point . '_' . $encoding; |
|
611 | + $cache_key = $code_point.'_'.$encoding; |
|
612 | 612 | if (isset($CHAR_CACHE[$cache_key])) { |
613 | 613 | return $CHAR_CACHE[$cache_key]; |
614 | 614 | } |
@@ -654,27 +654,27 @@ discard block |
||
654 | 654 | self::$CHR = self::getData('chr'); |
655 | 655 | } |
656 | 656 | |
657 | - $code_point = (int) $code_point; |
|
657 | + $code_point = (int)$code_point; |
|
658 | 658 | if ($code_point <= 0x7FF) { |
659 | 659 | /** |
660 | 660 | * @psalm-suppress PossiblyNullArrayAccess |
661 | 661 | */ |
662 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
662 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
663 | 663 | self::$CHR[($code_point & 0x3F) + 0x80]; |
664 | 664 | } elseif ($code_point <= 0xFFFF) { |
665 | 665 | /** |
666 | 666 | * @psalm-suppress PossiblyNullArrayAccess |
667 | 667 | */ |
668 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
669 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
668 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
669 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
670 | 670 | self::$CHR[($code_point & 0x3F) + 0x80]; |
671 | 671 | } else { |
672 | 672 | /** |
673 | 673 | * @psalm-suppress PossiblyNullArrayAccess |
674 | 674 | */ |
675 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
676 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
677 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
675 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
676 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
677 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
678 | 678 | self::$CHR[($code_point & 0x3F) + 0x80]; |
679 | 679 | } |
680 | 680 | |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | |
732 | 732 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
733 | 733 | return \array_map( |
734 | - static function (string $data): int { |
|
734 | + static function(string $data): int { |
|
735 | 735 | // "mb_" is available if overload is used, so use it ... |
736 | 736 | return \mb_strlen($data, 'CP850'); // 8-BIT |
737 | 737 | }, |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | $char = ''; |
819 | 819 | } |
820 | 820 | |
821 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
821 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
822 | 822 | } |
823 | 823 | |
824 | 824 | /** |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
916 | 916 | /x'; |
917 | 917 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
918 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
918 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
919 | 919 | |
920 | 920 | if ($replace_diamond_question_mark) { |
921 | 921 | $str = self::replace_diamond_question_mark($str); |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | public static function cleanup($str): string |
955 | 955 | { |
956 | 956 | // init |
957 | - $str = (string) $str; |
|
957 | + $str = (string)$str; |
|
958 | 958 | |
959 | 959 | if ($str === '') { |
960 | 960 | return ''; |
@@ -1056,7 +1056,7 @@ discard block |
||
1056 | 1056 | { |
1057 | 1057 | if (self::$SUPPORT['mbstring'] === true) { |
1058 | 1058 | /** @noinspection PhpComposerExtensionStubsInspection */ |
1059 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
1059 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
1060 | 1060 | } |
1061 | 1061 | |
1062 | 1062 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -1161,9 +1161,9 @@ discard block |
||
1161 | 1161 | // - 0-9 (U+0061 - U+007A) |
1162 | 1162 | // - ISO 10646 characters U+00A1 and higher |
1163 | 1163 | // We strip out any character not in the above list. |
1164 | - $str = (string) \preg_replace('/[^\x{002D}\x{0030}-\x{0039}\x{0041}-\x{005A}\x{005F}\x{0061}-\x{007A}\x{00A1}-\x{FFFF}]/u', '', $str); |
|
1164 | + $str = (string)\preg_replace('/[^\x{002D}\x{0030}-\x{0039}\x{0041}-\x{005A}\x{005F}\x{0061}-\x{007A}\x{00A1}-\x{FFFF}]/u', '', $str); |
|
1165 | 1165 | // Identifiers cannot start with a digit, two hyphens, or a hyphen followed by a digit. |
1166 | - $str = (string) \preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
1166 | + $str = (string)\preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
1167 | 1167 | |
1168 | 1168 | return \trim($str, '-'); |
1169 | 1169 | } |
@@ -1179,7 +1179,7 @@ discard block |
||
1179 | 1179 | */ |
1180 | 1180 | public static function css_stripe_media_queries(string $str): string |
1181 | 1181 | { |
1182 | - return (string) \preg_replace( |
|
1182 | + return (string)\preg_replace( |
|
1183 | 1183 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
1184 | 1184 | '', |
1185 | 1185 | $str |
@@ -1218,7 +1218,7 @@ discard block |
||
1218 | 1218 | */ |
1219 | 1219 | public static function decimal_to_chr($int): string |
1220 | 1220 | { |
1221 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
1221 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
1222 | 1222 | } |
1223 | 1223 | |
1224 | 1224 | /** |
@@ -1268,7 +1268,7 @@ discard block |
||
1268 | 1268 | $flagOffset = 0x1F1E6; |
1269 | 1269 | $asciiOffset = 0x41; |
1270 | 1270 | |
1271 | - return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? '') . |
|
1271 | + return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? ''). |
|
1272 | 1272 | (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
1273 | 1273 | } |
1274 | 1274 | |
@@ -1299,16 +1299,16 @@ discard block |
||
1299 | 1299 | self::initEmojiData(); |
1300 | 1300 | |
1301 | 1301 | if ($use_reversible_string_mappings) { |
1302 | - return (string) \str_replace( |
|
1303 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1304 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1302 | + return (string)\str_replace( |
|
1303 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1304 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1305 | 1305 | $str |
1306 | 1306 | ); |
1307 | 1307 | } |
1308 | 1308 | |
1309 | - return (string) \str_replace( |
|
1310 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1311 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1309 | + return (string)\str_replace( |
|
1310 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1311 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1312 | 1312 | $str |
1313 | 1313 | ); |
1314 | 1314 | } |
@@ -1340,16 +1340,16 @@ discard block |
||
1340 | 1340 | self::initEmojiData(); |
1341 | 1341 | |
1342 | 1342 | if ($use_reversible_string_mappings) { |
1343 | - return (string) \str_replace( |
|
1344 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1345 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1343 | + return (string)\str_replace( |
|
1344 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1345 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1346 | 1346 | $str |
1347 | 1347 | ); |
1348 | 1348 | } |
1349 | 1349 | |
1350 | - return (string) \str_replace( |
|
1351 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1352 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1350 | + return (string)\str_replace( |
|
1351 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1352 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1353 | 1353 | $str |
1354 | 1354 | ); |
1355 | 1355 | } |
@@ -1415,7 +1415,7 @@ discard block |
||
1415 | 1415 | if ($to_encoding === 'JSON') { |
1416 | 1416 | $return = self::json_encode($str); |
1417 | 1417 | if ($return === false) { |
1418 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1418 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1419 | 1419 | } |
1420 | 1420 | |
1421 | 1421 | return $return; |
@@ -1506,7 +1506,7 @@ discard block |
||
1506 | 1506 | /** |
1507 | 1507 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
1508 | 1508 | */ |
1509 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
1509 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
1510 | 1510 | } |
1511 | 1511 | |
1512 | 1512 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1608,31 +1608,31 @@ discard block |
||
1608 | 1608 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1609 | 1609 | |
1610 | 1610 | if ($length === null) { |
1611 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2); |
|
1611 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2); |
|
1612 | 1612 | } |
1613 | 1613 | |
1614 | 1614 | if ($search === '') { |
1615 | 1615 | if ($encoding === 'UTF-8') { |
1616 | 1616 | if ($length > 0) { |
1617 | - $string_length = (int) \mb_strlen($str); |
|
1617 | + $string_length = (int)\mb_strlen($str); |
|
1618 | 1618 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1619 | 1619 | } else { |
1620 | 1620 | $end = 0; |
1621 | 1621 | } |
1622 | 1622 | |
1623 | - $pos = (int) \min( |
|
1623 | + $pos = (int)\min( |
|
1624 | 1624 | \mb_strpos($str, ' ', $end), |
1625 | 1625 | \mb_strpos($str, '.', $end) |
1626 | 1626 | ); |
1627 | 1627 | } else { |
1628 | 1628 | if ($length > 0) { |
1629 | - $string_length = (int) self::strlen($str, $encoding); |
|
1629 | + $string_length = (int)self::strlen($str, $encoding); |
|
1630 | 1630 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1631 | 1631 | } else { |
1632 | 1632 | $end = 0; |
1633 | 1633 | } |
1634 | 1634 | |
1635 | - $pos = (int) \min( |
|
1635 | + $pos = (int)\min( |
|
1636 | 1636 | self::strpos($str, ' ', $end, $encoding), |
1637 | 1637 | self::strpos($str, '.', $end, $encoding) |
1638 | 1638 | ); |
@@ -1649,18 +1649,18 @@ discard block |
||
1649 | 1649 | return ''; |
1650 | 1650 | } |
1651 | 1651 | |
1652 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1652 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1653 | 1653 | } |
1654 | 1654 | |
1655 | 1655 | return $str; |
1656 | 1656 | } |
1657 | 1657 | |
1658 | 1658 | if ($encoding === 'UTF-8') { |
1659 | - $word_position = (int) \mb_stripos($str, $search); |
|
1660 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1659 | + $word_position = (int)\mb_stripos($str, $search); |
|
1660 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1661 | 1661 | } else { |
1662 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
1663 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1662 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
1663 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1664 | 1664 | } |
1665 | 1665 | |
1666 | 1666 | $pos_start = 0; |
@@ -1672,12 +1672,12 @@ discard block |
||
1672 | 1672 | } |
1673 | 1673 | if ($half_text !== false) { |
1674 | 1674 | if ($encoding === 'UTF-8') { |
1675 | - $pos_start = (int) \max( |
|
1675 | + $pos_start = (int)\max( |
|
1676 | 1676 | \mb_strrpos($half_text, ' '), |
1677 | 1677 | \mb_strrpos($half_text, '.') |
1678 | 1678 | ); |
1679 | 1679 | } else { |
1680 | - $pos_start = (int) \max( |
|
1680 | + $pos_start = (int)\max( |
|
1681 | 1681 | self::strrpos($half_text, ' ', 0, $encoding), |
1682 | 1682 | self::strrpos($half_text, '.', 0, $encoding) |
1683 | 1683 | ); |
@@ -1687,19 +1687,19 @@ discard block |
||
1687 | 1687 | |
1688 | 1688 | if ($word_position && $half_side > 0) { |
1689 | 1689 | $offset = $pos_start + $length - 1; |
1690 | - $real_length = (int) self::strlen($str, $encoding); |
|
1690 | + $real_length = (int)self::strlen($str, $encoding); |
|
1691 | 1691 | |
1692 | 1692 | if ($offset > $real_length) { |
1693 | 1693 | $offset = $real_length; |
1694 | 1694 | } |
1695 | 1695 | |
1696 | 1696 | if ($encoding === 'UTF-8') { |
1697 | - $pos_end = (int) \min( |
|
1697 | + $pos_end = (int)\min( |
|
1698 | 1698 | \mb_strpos($str, ' ', $offset), |
1699 | 1699 | \mb_strpos($str, '.', $offset) |
1700 | 1700 | ) - $pos_start; |
1701 | 1701 | } else { |
1702 | - $pos_end = (int) \min( |
|
1702 | + $pos_end = (int)\min( |
|
1703 | 1703 | self::strpos($str, ' ', $offset, $encoding), |
1704 | 1704 | self::strpos($str, '.', $offset, $encoding) |
1705 | 1705 | ) - $pos_start; |
@@ -1707,12 +1707,12 @@ discard block |
||
1707 | 1707 | |
1708 | 1708 | if (!$pos_end || $pos_end <= 0) { |
1709 | 1709 | if ($encoding === 'UTF-8') { |
1710 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1710 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1711 | 1711 | } else { |
1712 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1712 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1713 | 1713 | } |
1714 | 1714 | if ($str_sub !== false) { |
1715 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
1715 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
1716 | 1716 | } else { |
1717 | 1717 | $extract = ''; |
1718 | 1718 | } |
@@ -1723,26 +1723,26 @@ discard block |
||
1723 | 1723 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
1724 | 1724 | } |
1725 | 1725 | if ($str_sub !== false) { |
1726 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1726 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1727 | 1727 | } else { |
1728 | 1728 | $extract = ''; |
1729 | 1729 | } |
1730 | 1730 | } |
1731 | 1731 | } else { |
1732 | 1732 | $offset = $length - 1; |
1733 | - $true_length = (int) self::strlen($str, $encoding); |
|
1733 | + $true_length = (int)self::strlen($str, $encoding); |
|
1734 | 1734 | |
1735 | 1735 | if ($offset > $true_length) { |
1736 | 1736 | $offset = $true_length; |
1737 | 1737 | } |
1738 | 1738 | |
1739 | 1739 | if ($encoding === 'UTF-8') { |
1740 | - $pos_end = (int) \min( |
|
1740 | + $pos_end = (int)\min( |
|
1741 | 1741 | \mb_strpos($str, ' ', $offset), |
1742 | 1742 | \mb_strpos($str, '.', $offset) |
1743 | 1743 | ); |
1744 | 1744 | } else { |
1745 | - $pos_end = (int) \min( |
|
1745 | + $pos_end = (int)\min( |
|
1746 | 1746 | self::strpos($str, ' ', $offset, $encoding), |
1747 | 1747 | self::strpos($str, '.', $offset, $encoding) |
1748 | 1748 | ); |
@@ -1755,7 +1755,7 @@ discard block |
||
1755 | 1755 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
1756 | 1756 | } |
1757 | 1757 | if ($str_sub !== false) { |
1758 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1758 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1759 | 1759 | } else { |
1760 | 1760 | $extract = ''; |
1761 | 1761 | } |
@@ -1888,7 +1888,7 @@ discard block |
||
1888 | 1888 | { |
1889 | 1889 | $file_content = \file_get_contents($file_path); |
1890 | 1890 | if ($file_content === false) { |
1891 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1891 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1892 | 1892 | } |
1893 | 1893 | |
1894 | 1894 | return self::string_has_bom($file_content); |
@@ -1954,7 +1954,7 @@ discard block |
||
1954 | 1954 | ) { |
1955 | 1955 | // Prevent leading combining chars |
1956 | 1956 | // for NFC-safe concatenations. |
1957 | - $var = $leading_combining . $var; |
|
1957 | + $var = $leading_combining.$var; |
|
1958 | 1958 | } |
1959 | 1959 | } |
1960 | 1960 | |
@@ -2275,10 +2275,10 @@ discard block |
||
2275 | 2275 | } |
2276 | 2276 | |
2277 | 2277 | if ($encoding === 'UTF-8') { |
2278 | - return (string) \mb_substr($str, 0, $n); |
|
2278 | + return (string)\mb_substr($str, 0, $n); |
|
2279 | 2279 | } |
2280 | 2280 | |
2281 | - return (string) self::substr($str, 0, $n, $encoding); |
|
2281 | + return (string)self::substr($str, 0, $n, $encoding); |
|
2282 | 2282 | } |
2283 | 2283 | |
2284 | 2284 | /** |
@@ -2296,7 +2296,7 @@ discard block |
||
2296 | 2296 | */ |
2297 | 2297 | public static function fits_inside(string $str, int $box_size): bool |
2298 | 2298 | { |
2299 | - return (int) self::strlen($str) <= $box_size; |
|
2299 | + return (int)self::strlen($str) <= $box_size; |
|
2300 | 2300 | } |
2301 | 2301 | |
2302 | 2302 | /** |
@@ -2379,7 +2379,7 @@ discard block |
||
2379 | 2379 | return $str; |
2380 | 2380 | } |
2381 | 2381 | |
2382 | - $str = (string) $str; |
|
2382 | + $str = (string)$str; |
|
2383 | 2383 | $last = ''; |
2384 | 2384 | while ($last !== $str) { |
2385 | 2385 | $last = $str; |
@@ -2588,7 +2588,7 @@ discard block |
||
2588 | 2588 | return $fallback; |
2589 | 2589 | } |
2590 | 2590 | /** @noinspection OffsetOperationsInspection */ |
2591 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2591 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2592 | 2592 | |
2593 | 2593 | // DEBUG |
2594 | 2594 | //var_dump($type_code); |
@@ -2646,7 +2646,7 @@ discard block |
||
2646 | 2646 | // |
2647 | 2647 | |
2648 | 2648 | if ($encoding === 'UTF-8') { |
2649 | - $max_length = (int) \mb_strlen($possible_chars); |
|
2649 | + $max_length = (int)\mb_strlen($possible_chars); |
|
2650 | 2650 | if ($max_length === 0) { |
2651 | 2651 | return ''; |
2652 | 2652 | } |
@@ -2667,7 +2667,7 @@ discard block |
||
2667 | 2667 | } else { |
2668 | 2668 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2669 | 2669 | |
2670 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
2670 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
2671 | 2671 | if ($max_length === 0) { |
2672 | 2672 | return ''; |
2673 | 2673 | } |
@@ -2705,16 +2705,16 @@ discard block |
||
2705 | 2705 | $rand_int = \mt_rand(0, \mt_getrandmax()); |
2706 | 2706 | } |
2707 | 2707 | |
2708 | - $unique_helper = $rand_int . |
|
2709 | - \session_id() . |
|
2710 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2711 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2708 | + $unique_helper = $rand_int. |
|
2709 | + \session_id(). |
|
2710 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2711 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2712 | 2712 | $extra_entropy; |
2713 | 2713 | |
2714 | 2714 | $unique_string = \uniqid($unique_helper, true); |
2715 | 2715 | |
2716 | 2716 | if ($use_md5) { |
2717 | - $unique_string = \md5($unique_string . $unique_helper); |
|
2717 | + $unique_string = \md5($unique_string.$unique_helper); |
|
2718 | 2718 | } |
2719 | 2719 | |
2720 | 2720 | return $unique_string; |
@@ -2813,7 +2813,7 @@ discard block |
||
2813 | 2813 | public static function hex_to_chr(string $hexdec) |
2814 | 2814 | { |
2815 | 2815 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Invalid characters passed for attempted conversion, these have been ignored */ |
2816 | - return self::decimal_to_chr((int) @\hexdec($hexdec)); |
|
2816 | + return self::decimal_to_chr((int)@\hexdec($hexdec)); |
|
2817 | 2817 | } |
2818 | 2818 | |
2819 | 2819 | /** |
@@ -2833,7 +2833,7 @@ discard block |
||
2833 | 2833 | public static function hex_to_int($hexdec) |
2834 | 2834 | { |
2835 | 2835 | // init |
2836 | - $hexdec = (string) $hexdec; |
|
2836 | + $hexdec = (string)$hexdec; |
|
2837 | 2837 | |
2838 | 2838 | if ($hexdec === '') { |
2839 | 2839 | return false; |
@@ -2933,7 +2933,7 @@ discard block |
||
2933 | 2933 | return \implode( |
2934 | 2934 | '', |
2935 | 2935 | \array_map( |
2936 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2936 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2937 | 2937 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
2938 | 2938 | }, |
2939 | 2939 | self::str_split($str) |
@@ -3048,7 +3048,7 @@ discard block |
||
3048 | 3048 | /** |
3049 | 3049 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
3050 | 3050 | */ |
3051 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
3051 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
3052 | 3052 | } |
3053 | 3053 | |
3054 | 3054 | do { |
@@ -3057,7 +3057,7 @@ discard block |
||
3057 | 3057 | if (\strpos($str, '&') !== false) { |
3058 | 3058 | if (\strpos($str, '&#') !== false) { |
3059 | 3059 | // decode also numeric & UTF16 two byte entities |
3060 | - $str = (string) \preg_replace( |
|
3060 | + $str = (string)\preg_replace( |
|
3061 | 3061 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
3062 | 3062 | '$1;', |
3063 | 3063 | $str |
@@ -3107,7 +3107,7 @@ discard block |
||
3107 | 3107 | */ |
3108 | 3108 | public static function html_stripe_empty_tags(string $str): string |
3109 | 3109 | { |
3110 | - return (string) \preg_replace( |
|
3110 | + return (string)\preg_replace( |
|
3111 | 3111 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
3112 | 3112 | '', |
3113 | 3113 | $str |
@@ -3437,9 +3437,9 @@ discard block |
||
3437 | 3437 | { |
3438 | 3438 | $hex = \dechex($int); |
3439 | 3439 | |
3440 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
3440 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
3441 | 3441 | |
3442 | - return $prefix . $hex . ''; |
|
3442 | + return $prefix.$hex.''; |
|
3443 | 3443 | } |
3444 | 3444 | |
3445 | 3445 | /** |
@@ -3768,7 +3768,7 @@ discard block |
||
3768 | 3768 | */ |
3769 | 3769 | public static function is_binary($input, bool $strict = false): bool |
3770 | 3770 | { |
3771 | - $input = (string) $input; |
|
3771 | + $input = (string)$input; |
|
3772 | 3772 | if ($input === '') { |
3773 | 3773 | return false; |
3774 | 3774 | } |
@@ -4128,7 +4128,7 @@ discard block |
||
4128 | 4128 | public static function is_utf16($str, bool $check_if_string_is_binary = true) |
4129 | 4129 | { |
4130 | 4130 | // init |
4131 | - $str = (string) $str; |
|
4131 | + $str = (string)$str; |
|
4132 | 4132 | $str_chars = []; |
4133 | 4133 | |
4134 | 4134 | if ( |
@@ -4222,7 +4222,7 @@ discard block |
||
4222 | 4222 | public static function is_utf32($str, bool $check_if_string_is_binary = true) |
4223 | 4223 | { |
4224 | 4224 | // init |
4225 | - $str = (string) $str; |
|
4225 | + $str = (string)$str; |
|
4226 | 4226 | $str_chars = []; |
4227 | 4227 | |
4228 | 4228 | if ( |
@@ -4320,7 +4320,7 @@ discard block |
||
4320 | 4320 | return true; |
4321 | 4321 | } |
4322 | 4322 | |
4323 | - return self::is_utf8_string((string) $str, $strict); |
|
4323 | + return self::is_utf8_string((string)$str, $strict); |
|
4324 | 4324 | } |
4325 | 4325 | |
4326 | 4326 | /** |
@@ -4478,15 +4478,15 @@ discard block |
||
4478 | 4478 | $use_mb_functions = ($lang === null && !$try_to_keep_the_string_length); |
4479 | 4479 | |
4480 | 4480 | if ($encoding === 'UTF-8') { |
4481 | - $str_part_two = (string) \mb_substr($str, 1); |
|
4481 | + $str_part_two = (string)\mb_substr($str, 1); |
|
4482 | 4482 | |
4483 | 4483 | if ($use_mb_functions) { |
4484 | 4484 | $str_part_one = \mb_strtolower( |
4485 | - (string) \mb_substr($str, 0, 1) |
|
4485 | + (string)\mb_substr($str, 0, 1) |
|
4486 | 4486 | ); |
4487 | 4487 | } else { |
4488 | 4488 | $str_part_one = self::strtolower( |
4489 | - (string) \mb_substr($str, 0, 1), |
|
4489 | + (string)\mb_substr($str, 0, 1), |
|
4490 | 4490 | $encoding, |
4491 | 4491 | false, |
4492 | 4492 | $lang, |
@@ -4496,10 +4496,10 @@ discard block |
||
4496 | 4496 | } else { |
4497 | 4497 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4498 | 4498 | |
4499 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
4499 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
4500 | 4500 | |
4501 | 4501 | $str_part_one = self::strtolower( |
4502 | - (string) self::substr($str, 0, 1, $encoding), |
|
4502 | + (string)self::substr($str, 0, 1, $encoding), |
|
4503 | 4503 | $encoding, |
4504 | 4504 | false, |
4505 | 4505 | $lang, |
@@ -4507,7 +4507,7 @@ discard block |
||
4507 | 4507 | ); |
4508 | 4508 | } |
4509 | 4509 | |
4510 | - return $str_part_one . $str_part_two; |
|
4510 | + return $str_part_one.$str_part_two; |
|
4511 | 4511 | } |
4512 | 4512 | |
4513 | 4513 | /** |
@@ -4656,7 +4656,7 @@ discard block |
||
4656 | 4656 | } |
4657 | 4657 | |
4658 | 4658 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4659 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4659 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4660 | 4660 | } |
4661 | 4661 | |
4662 | 4662 | if ($chars !== null) { |
@@ -4693,7 +4693,7 @@ discard block |
||
4693 | 4693 | |
4694 | 4694 | $codepoint_max = \max($codepoints); |
4695 | 4695 | |
4696 | - return self::chr((int) $codepoint_max); |
|
4696 | + return self::chr((int)$codepoint_max); |
|
4697 | 4697 | } |
4698 | 4698 | |
4699 | 4699 | /** |
@@ -4713,7 +4713,7 @@ discard block |
||
4713 | 4713 | { |
4714 | 4714 | $bytes = self::chr_size_list($str); |
4715 | 4715 | if ($bytes !== []) { |
4716 | - return (int) \max($bytes); |
|
4716 | + return (int)\max($bytes); |
|
4717 | 4717 | } |
4718 | 4718 | |
4719 | 4719 | return 0; |
@@ -4759,7 +4759,7 @@ discard block |
||
4759 | 4759 | |
4760 | 4760 | $codepoint_min = \min($codepoints); |
4761 | 4761 | |
4762 | - return self::chr((int) $codepoint_min); |
|
4762 | + return self::chr((int)$codepoint_min); |
|
4763 | 4763 | } |
4764 | 4764 | |
4765 | 4765 | /** |
@@ -4807,7 +4807,7 @@ discard block |
||
4807 | 4807 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4808 | 4808 | |
4809 | 4809 | // init |
4810 | - $encoding = (string) $encoding; |
|
4810 | + $encoding = (string)$encoding; |
|
4811 | 4811 | |
4812 | 4812 | if (!$encoding) { |
4813 | 4813 | return $fallback; |
@@ -4869,7 +4869,7 @@ discard block |
||
4869 | 4869 | |
4870 | 4870 | $encoding_original = $encoding; |
4871 | 4871 | $encoding = \strtoupper($encoding); |
4872 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4872 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4873 | 4873 | |
4874 | 4874 | $equivalences = [ |
4875 | 4875 | 'ISO8859' => 'ISO-8859-1', |
@@ -5036,13 +5036,13 @@ discard block |
||
5036 | 5036 | static $CHAR_CACHE = []; |
5037 | 5037 | |
5038 | 5038 | // init |
5039 | - $chr = (string) $chr; |
|
5039 | + $chr = (string)$chr; |
|
5040 | 5040 | |
5041 | 5041 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
5042 | 5042 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5043 | 5043 | } |
5044 | 5044 | |
5045 | - $cache_key = $chr . '_' . $encoding; |
|
5045 | + $cache_key = $chr.'_'.$encoding; |
|
5046 | 5046 | if (isset($CHAR_CACHE[$cache_key])) { |
5047 | 5047 | return $CHAR_CACHE[$cache_key]; |
5048 | 5048 | } |
@@ -5077,7 +5077,7 @@ discard block |
||
5077 | 5077 | // |
5078 | 5078 | |
5079 | 5079 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
5080 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
5080 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
5081 | 5081 | /** @noinspection OffsetOperationsInspection */ |
5082 | 5082 | $code = $chr ? $chr[1] : 0; |
5083 | 5083 | |
@@ -5085,21 +5085,21 @@ discard block |
||
5085 | 5085 | if ($code >= 0xF0 && isset($chr[4])) { |
5086 | 5086 | /** @noinspection UnnecessaryCastingInspection */ |
5087 | 5087 | /** @noinspection OffsetOperationsInspection */ |
5088 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
5088 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
5089 | 5089 | } |
5090 | 5090 | |
5091 | 5091 | /** @noinspection OffsetOperationsInspection */ |
5092 | 5092 | if ($code >= 0xE0 && isset($chr[3])) { |
5093 | 5093 | /** @noinspection UnnecessaryCastingInspection */ |
5094 | 5094 | /** @noinspection OffsetOperationsInspection */ |
5095 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
5095 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
5096 | 5096 | } |
5097 | 5097 | |
5098 | 5098 | /** @noinspection OffsetOperationsInspection */ |
5099 | 5099 | if ($code >= 0xC0 && isset($chr[2])) { |
5100 | 5100 | /** @noinspection UnnecessaryCastingInspection */ |
5101 | 5101 | /** @noinspection OffsetOperationsInspection */ |
5102 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
5102 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
5103 | 5103 | } |
5104 | 5104 | |
5105 | 5105 | return $CHAR_CACHE[$cache_key] = $code; |
@@ -5161,7 +5161,7 @@ discard block |
||
5161 | 5161 | public static function pcre_utf8_support(): bool |
5162 | 5162 | { |
5163 | 5163 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5164 | - return (bool) @\preg_match('//u', ''); |
|
5164 | + return (bool)@\preg_match('//u', ''); |
|
5165 | 5165 | } |
5166 | 5166 | |
5167 | 5167 | /** |
@@ -5202,14 +5202,14 @@ discard block |
||
5202 | 5202 | * @psalm-suppress DocblockTypeContradiction |
5203 | 5203 | */ |
5204 | 5204 | if (!\is_numeric($step)) { |
5205 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
5205 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
5206 | 5206 | } |
5207 | 5207 | |
5208 | 5208 | /** |
5209 | 5209 | * @psalm-suppress RedundantConditionGivenDocblockType - false-positive from psalm? |
5210 | 5210 | */ |
5211 | 5211 | if ($step <= 0) { |
5212 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
5212 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
5213 | 5213 | } |
5214 | 5214 | } |
5215 | 5215 | |
@@ -5221,16 +5221,16 @@ discard block |
||
5221 | 5221 | $is_xdigit = false; |
5222 | 5222 | |
5223 | 5223 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5224 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
5224 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
5225 | 5225 | $is_digit = true; |
5226 | - $start = (int) $var1; |
|
5226 | + $start = (int)$var1; |
|
5227 | 5227 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
5228 | 5228 | $is_xdigit = true; |
5229 | - $start = (int) self::hex_to_int((string) $var1); |
|
5229 | + $start = (int)self::hex_to_int((string)$var1); |
|
5230 | 5230 | } elseif (!$use_ctype && \is_numeric($var1)) { |
5231 | - $start = (int) $var1; |
|
5231 | + $start = (int)$var1; |
|
5232 | 5232 | } else { |
5233 | - $start = self::ord((string) $var1); |
|
5233 | + $start = self::ord((string)$var1); |
|
5234 | 5234 | } |
5235 | 5235 | |
5236 | 5236 | if (!$start) { |
@@ -5238,13 +5238,13 @@ discard block |
||
5238 | 5238 | } |
5239 | 5239 | |
5240 | 5240 | if ($is_digit) { |
5241 | - $end = (int) $var2; |
|
5241 | + $end = (int)$var2; |
|
5242 | 5242 | } elseif ($is_xdigit) { |
5243 | - $end = (int) self::hex_to_int((string) $var2); |
|
5243 | + $end = (int)self::hex_to_int((string)$var2); |
|
5244 | 5244 | } elseif (!$use_ctype && \is_numeric($var2)) { |
5245 | - $end = (int) $var2; |
|
5245 | + $end = (int)$var2; |
|
5246 | 5246 | } else { |
5247 | - $end = self::ord((string) $var2); |
|
5247 | + $end = self::ord((string)$var2); |
|
5248 | 5248 | } |
5249 | 5249 | |
5250 | 5250 | if (!$end) { |
@@ -5253,7 +5253,7 @@ discard block |
||
5253 | 5253 | |
5254 | 5254 | $array = []; |
5255 | 5255 | foreach (\range($start, $end, $step) as $i) { |
5256 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
5256 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
5257 | 5257 | } |
5258 | 5258 | |
5259 | 5259 | return $array; |
@@ -5349,8 +5349,8 @@ discard block |
||
5349 | 5349 | $delimiter = '/'; |
5350 | 5350 | } |
5351 | 5351 | |
5352 | - return (string) \preg_replace( |
|
5353 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
5352 | + return (string)\preg_replace( |
|
5353 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
5354 | 5354 | $replacement, |
5355 | 5355 | $str |
5356 | 5356 | ); |
@@ -5400,9 +5400,9 @@ discard block |
||
5400 | 5400 | return ''; |
5401 | 5401 | } |
5402 | 5402 | |
5403 | - $str_length -= (int) $bom_byte_length; |
|
5403 | + $str_length -= (int)$bom_byte_length; |
|
5404 | 5404 | |
5405 | - $str = (string) $str_tmp; |
|
5405 | + $str = (string)$str_tmp; |
|
5406 | 5406 | } |
5407 | 5407 | } |
5408 | 5408 | |
@@ -5433,7 +5433,7 @@ discard block |
||
5433 | 5433 | */ |
5434 | 5434 | if (\is_array($what)) { |
5435 | 5435 | foreach ($what as $item) { |
5436 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
5436 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
5437 | 5437 | } |
5438 | 5438 | } |
5439 | 5439 | |
@@ -5471,7 +5471,7 @@ discard block |
||
5471 | 5471 | */ |
5472 | 5472 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
5473 | 5473 | { |
5474 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
5474 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
5475 | 5475 | } |
5476 | 5476 | |
5477 | 5477 | /** |
@@ -5535,17 +5535,17 @@ discard block |
||
5535 | 5535 | \strpos($str, $substring) === 0 |
5536 | 5536 | ) { |
5537 | 5537 | if ($encoding === 'UTF-8') { |
5538 | - return (string) \mb_substr( |
|
5538 | + return (string)\mb_substr( |
|
5539 | 5539 | $str, |
5540 | - (int) \mb_strlen($substring) |
|
5540 | + (int)\mb_strlen($substring) |
|
5541 | 5541 | ); |
5542 | 5542 | } |
5543 | 5543 | |
5544 | 5544 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5545 | 5545 | |
5546 | - return (string) self::substr( |
|
5546 | + return (string)self::substr( |
|
5547 | 5547 | $str, |
5548 | - (int) self::strlen($substring, $encoding), |
|
5548 | + (int)self::strlen($substring, $encoding), |
|
5549 | 5549 | null, |
5550 | 5550 | $encoding |
5551 | 5551 | ); |
@@ -5573,19 +5573,19 @@ discard block |
||
5573 | 5573 | ): string { |
5574 | 5574 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
5575 | 5575 | if ($encoding === 'UTF-8') { |
5576 | - return (string) \mb_substr( |
|
5576 | + return (string)\mb_substr( |
|
5577 | 5577 | $str, |
5578 | 5578 | 0, |
5579 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
5579 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
5580 | 5580 | ); |
5581 | 5581 | } |
5582 | 5582 | |
5583 | 5583 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5584 | 5584 | |
5585 | - return (string) self::substr( |
|
5585 | + return (string)self::substr( |
|
5586 | 5586 | $str, |
5587 | 5587 | 0, |
5588 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
5588 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
5589 | 5589 | $encoding |
5590 | 5590 | ); |
5591 | 5591 | } |
@@ -5688,7 +5688,7 @@ discard block |
||
5688 | 5688 | /** @noinspection PhpUsageOfSilenceOperatorInspection - ignore "Unknown character" warnings, it's working anyway */ |
5689 | 5689 | @\mb_substitute_character($replacement_char_helper); |
5690 | 5690 | // the polyfill maybe return false, so cast to string |
5691 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
5691 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
5692 | 5692 | \mb_substitute_character($save); |
5693 | 5693 | } |
5694 | 5694 | |
@@ -5734,7 +5734,7 @@ discard block |
||
5734 | 5734 | } |
5735 | 5735 | |
5736 | 5736 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5737 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
5737 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
5738 | 5738 | } |
5739 | 5739 | |
5740 | 5740 | if ($chars !== null) { |
@@ -5764,7 +5764,7 @@ discard block |
||
5764 | 5764 | $html .= '<pre>'; |
5765 | 5765 | /** @noinspection AlterInForeachInspection */ |
5766 | 5766 | foreach (self::$SUPPORT as $key => &$value) { |
5767 | - $html .= $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
5767 | + $html .= $key.' - '.\print_r($value, true)."\n<br>"; |
|
5768 | 5768 | } |
5769 | 5769 | $html .= '</pre>'; |
5770 | 5770 | |
@@ -5806,7 +5806,7 @@ discard block |
||
5806 | 5806 | return $char; |
5807 | 5807 | } |
5808 | 5808 | |
5809 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
5809 | + return '&#'.self::ord($char, $encoding).';'; |
|
5810 | 5810 | } |
5811 | 5811 | |
5812 | 5812 | /** |
@@ -5910,11 +5910,11 @@ discard block |
||
5910 | 5910 | $lang, |
5911 | 5911 | $try_to_keep_the_string_length |
5912 | 5912 | ); |
5913 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5913 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5914 | 5914 | |
5915 | 5915 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
5916 | 5916 | |
5917 | - $str = (string) \preg_replace_callback( |
|
5917 | + $str = (string)\preg_replace_callback( |
|
5918 | 5918 | '/[-_\\s]+(.)?/u', |
5919 | 5919 | /** |
5920 | 5920 | * @param array $match |
@@ -5923,7 +5923,7 @@ discard block |
||
5923 | 5923 | * |
5924 | 5924 | * @return string |
5925 | 5925 | */ |
5926 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5926 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5927 | 5927 | if (isset($match[1])) { |
5928 | 5928 | if ($use_mb_functions) { |
5929 | 5929 | if ($encoding === 'UTF-8') { |
@@ -5941,7 +5941,7 @@ discard block |
||
5941 | 5941 | $str |
5942 | 5942 | ); |
5943 | 5943 | |
5944 | - return (string) \preg_replace_callback( |
|
5944 | + return (string)\preg_replace_callback( |
|
5945 | 5945 | '/[\\p{N}]+(.)?/u', |
5946 | 5946 | /** |
5947 | 5947 | * @param array $match |
@@ -5950,7 +5950,7 @@ discard block |
||
5950 | 5950 | * |
5951 | 5951 | * @return string |
5952 | 5952 | */ |
5953 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5953 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5954 | 5954 | if ($use_mb_functions) { |
5955 | 5955 | if ($encoding === 'UTF-8') { |
5956 | 5956 | return \mb_strtoupper($match[0]); |
@@ -6149,7 +6149,7 @@ discard block |
||
6149 | 6149 | ): string { |
6150 | 6150 | if (self::$SUPPORT['mbstring'] === true) { |
6151 | 6151 | /** @noinspection PhpComposerExtensionStubsInspection */ |
6152 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
6152 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
6153 | 6153 | |
6154 | 6154 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
6155 | 6155 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -6159,10 +6159,10 @@ discard block |
||
6159 | 6159 | } |
6160 | 6160 | |
6161 | 6161 | /** @noinspection PhpComposerExtensionStubsInspection */ |
6162 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
6162 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
6163 | 6163 | } |
6164 | 6164 | |
6165 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
6165 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
6166 | 6166 | |
6167 | 6167 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
6168 | 6168 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -6171,7 +6171,7 @@ discard block |
||
6171 | 6171 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
6172 | 6172 | } |
6173 | 6173 | |
6174 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
6174 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
6175 | 6175 | } |
6176 | 6176 | |
6177 | 6177 | /** |
@@ -6195,7 +6195,7 @@ discard block |
||
6195 | 6195 | public static function str_detect_encoding($str) |
6196 | 6196 | { |
6197 | 6197 | // init |
6198 | - $str = (string) $str; |
|
6198 | + $str = (string)$str; |
|
6199 | 6199 | |
6200 | 6200 | // |
6201 | 6201 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -6297,7 +6297,7 @@ discard block |
||
6297 | 6297 | foreach (self::$ENCODINGS as $encoding_tmp) { |
6298 | 6298 | // INFO: //IGNORE but still throw notice |
6299 | 6299 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
6300 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
6300 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
6301 | 6301 | return $encoding_tmp; |
6302 | 6302 | } |
6303 | 6303 | } |
@@ -6405,7 +6405,7 @@ discard block |
||
6405 | 6405 | return $str; |
6406 | 6406 | } |
6407 | 6407 | |
6408 | - return $substring . $str; |
|
6408 | + return $substring.$str; |
|
6409 | 6409 | } |
6410 | 6410 | |
6411 | 6411 | /** |
@@ -6701,27 +6701,27 @@ discard block |
||
6701 | 6701 | string $encoding = 'UTF-8' |
6702 | 6702 | ): string { |
6703 | 6703 | if ($encoding === 'UTF-8') { |
6704 | - $len = (int) \mb_strlen($str); |
|
6704 | + $len = (int)\mb_strlen($str); |
|
6705 | 6705 | if ($index > $len) { |
6706 | 6706 | return $str; |
6707 | 6707 | } |
6708 | 6708 | |
6709 | 6709 | /** @noinspection UnnecessaryCastingInspection */ |
6710 | - return (string) \mb_substr($str, 0, $index) . |
|
6711 | - $substring . |
|
6712 | - (string) \mb_substr($str, $index, $len); |
|
6710 | + return (string)\mb_substr($str, 0, $index). |
|
6711 | + $substring. |
|
6712 | + (string)\mb_substr($str, $index, $len); |
|
6713 | 6713 | } |
6714 | 6714 | |
6715 | 6715 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6716 | 6716 | |
6717 | - $len = (int) self::strlen($str, $encoding); |
|
6717 | + $len = (int)self::strlen($str, $encoding); |
|
6718 | 6718 | if ($index > $len) { |
6719 | 6719 | return $str; |
6720 | 6720 | } |
6721 | 6721 | |
6722 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
6723 | - $substring . |
|
6724 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
6722 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
6723 | + $substring. |
|
6724 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
6725 | 6725 | } |
6726 | 6726 | |
6727 | 6727 | /** |
@@ -6761,15 +6761,15 @@ discard block |
||
6761 | 6761 | */ |
6762 | 6762 | public static function str_ireplace($search, $replacement, $subject, &$count = null) |
6763 | 6763 | { |
6764 | - $search = (array) $search; |
|
6764 | + $search = (array)$search; |
|
6765 | 6765 | |
6766 | 6766 | /** @noinspection AlterInForeachInspection */ |
6767 | 6767 | foreach ($search as &$s) { |
6768 | - $s = (string) $s; |
|
6768 | + $s = (string)$s; |
|
6769 | 6769 | if ($s === '') { |
6770 | 6770 | $s = '/^(?<=.)$/'; |
6771 | 6771 | } else { |
6772 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
6772 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
6773 | 6773 | } |
6774 | 6774 | } |
6775 | 6775 | |
@@ -6817,12 +6817,12 @@ discard block |
||
6817 | 6817 | } |
6818 | 6818 | |
6819 | 6819 | if ($search === '') { |
6820 | - return $str . $replacement; |
|
6820 | + return $str.$replacement; |
|
6821 | 6821 | } |
6822 | 6822 | |
6823 | 6823 | $searchLength = \strlen($search); |
6824 | 6824 | if (\strncasecmp($str, $search, $searchLength) === 0) { |
6825 | - return $replacement . \substr($str, $searchLength); |
|
6825 | + return $replacement.\substr($str, $searchLength); |
|
6826 | 6826 | } |
6827 | 6827 | |
6828 | 6828 | return $str; |
@@ -6853,11 +6853,11 @@ discard block |
||
6853 | 6853 | } |
6854 | 6854 | |
6855 | 6855 | if ($search === '') { |
6856 | - return $str . $replacement; |
|
6856 | + return $str.$replacement; |
|
6857 | 6857 | } |
6858 | 6858 | |
6859 | 6859 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6860 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6860 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6861 | 6861 | } |
6862 | 6862 | |
6863 | 6863 | return $str; |
@@ -6949,15 +6949,15 @@ discard block |
||
6949 | 6949 | } |
6950 | 6950 | |
6951 | 6951 | if ($encoding === 'UTF-8') { |
6952 | - return (string) \mb_substr( |
|
6952 | + return (string)\mb_substr( |
|
6953 | 6953 | $str, |
6954 | - $offset + (int) \mb_strlen($separator) |
|
6954 | + $offset + (int)\mb_strlen($separator) |
|
6955 | 6955 | ); |
6956 | 6956 | } |
6957 | 6957 | |
6958 | - return (string) self::substr( |
|
6958 | + return (string)self::substr( |
|
6959 | 6959 | $str, |
6960 | - $offset + (int) self::strlen($separator, $encoding), |
|
6960 | + $offset + (int)self::strlen($separator, $encoding), |
|
6961 | 6961 | null, |
6962 | 6962 | $encoding |
6963 | 6963 | ); |
@@ -6989,15 +6989,15 @@ discard block |
||
6989 | 6989 | } |
6990 | 6990 | |
6991 | 6991 | if ($encoding === 'UTF-8') { |
6992 | - return (string) \mb_substr( |
|
6992 | + return (string)\mb_substr( |
|
6993 | 6993 | $str, |
6994 | - $offset + (int) self::strlen($separator) |
|
6994 | + $offset + (int)self::strlen($separator) |
|
6995 | 6995 | ); |
6996 | 6996 | } |
6997 | 6997 | |
6998 | - return (string) self::substr( |
|
6998 | + return (string)self::substr( |
|
6999 | 6999 | $str, |
7000 | - $offset + (int) self::strlen($separator, $encoding), |
|
7000 | + $offset + (int)self::strlen($separator, $encoding), |
|
7001 | 7001 | null, |
7002 | 7002 | $encoding |
7003 | 7003 | ); |
@@ -7029,10 +7029,10 @@ discard block |
||
7029 | 7029 | } |
7030 | 7030 | |
7031 | 7031 | if ($encoding === 'UTF-8') { |
7032 | - return (string) \mb_substr($str, 0, $offset); |
|
7032 | + return (string)\mb_substr($str, 0, $offset); |
|
7033 | 7033 | } |
7034 | 7034 | |
7035 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
7035 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
7036 | 7036 | } |
7037 | 7037 | |
7038 | 7038 | /** |
@@ -7061,7 +7061,7 @@ discard block |
||
7061 | 7061 | return ''; |
7062 | 7062 | } |
7063 | 7063 | |
7064 | - return (string) \mb_substr($str, 0, $offset); |
|
7064 | + return (string)\mb_substr($str, 0, $offset); |
|
7065 | 7065 | } |
7066 | 7066 | |
7067 | 7067 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -7069,7 +7069,7 @@ discard block |
||
7069 | 7069 | return ''; |
7070 | 7070 | } |
7071 | 7071 | |
7072 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
7072 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
7073 | 7073 | } |
7074 | 7074 | |
7075 | 7075 | /** |
@@ -7171,12 +7171,12 @@ discard block |
||
7171 | 7171 | } |
7172 | 7172 | |
7173 | 7173 | if ($encoding === 'UTF-8') { |
7174 | - return (string) \mb_substr($str, -$n); |
|
7174 | + return (string)\mb_substr($str, -$n); |
|
7175 | 7175 | } |
7176 | 7176 | |
7177 | 7177 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7178 | 7178 | |
7179 | - return (string) self::substr($str, -$n, null, $encoding); |
|
7179 | + return (string)self::substr($str, -$n, null, $encoding); |
|
7180 | 7180 | } |
7181 | 7181 | |
7182 | 7182 | /** |
@@ -7202,21 +7202,21 @@ discard block |
||
7202 | 7202 | } |
7203 | 7203 | |
7204 | 7204 | if ($encoding === 'UTF-8') { |
7205 | - if ((int) \mb_strlen($str) <= $length) { |
|
7205 | + if ((int)\mb_strlen($str) <= $length) { |
|
7206 | 7206 | return $str; |
7207 | 7207 | } |
7208 | 7208 | |
7209 | 7209 | /** @noinspection UnnecessaryCastingInspection */ |
7210 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
7210 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
7211 | 7211 | } |
7212 | 7212 | |
7213 | 7213 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7214 | 7214 | |
7215 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
7215 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
7216 | 7216 | return $str; |
7217 | 7217 | } |
7218 | 7218 | |
7219 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
7219 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
7220 | 7220 | } |
7221 | 7221 | |
7222 | 7222 | /** |
@@ -7245,12 +7245,12 @@ discard block |
||
7245 | 7245 | |
7246 | 7246 | if ($encoding === 'UTF-8') { |
7247 | 7247 | /** @noinspection UnnecessaryCastingInspection */ |
7248 | - if ((int) \mb_strlen($str) <= $length) { |
|
7248 | + if ((int)\mb_strlen($str) <= $length) { |
|
7249 | 7249 | return $str; |
7250 | 7250 | } |
7251 | 7251 | |
7252 | 7252 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
7253 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
7253 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
7254 | 7254 | } |
7255 | 7255 | |
7256 | 7256 | $str = \mb_substr($str, 0, $length); |
@@ -7259,33 +7259,33 @@ discard block |
||
7259 | 7259 | $new_str = \implode(' ', $array); |
7260 | 7260 | |
7261 | 7261 | if ($new_str === '') { |
7262 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
7262 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
7263 | 7263 | } |
7264 | 7264 | } else { |
7265 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
7265 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
7266 | 7266 | return $str; |
7267 | 7267 | } |
7268 | 7268 | |
7269 | 7269 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
7270 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
7270 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
7271 | 7271 | } |
7272 | 7272 | |
7273 | 7273 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
7274 | 7274 | $str = self::substr($str, 0, $length, $encoding); |
7275 | 7275 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
7276 | 7276 | if ($str === false) { |
7277 | - return '' . $str_add_on; |
|
7277 | + return ''.$str_add_on; |
|
7278 | 7278 | } |
7279 | 7279 | |
7280 | 7280 | $array = \explode(' ', $str, -1); |
7281 | 7281 | $new_str = \implode(' ', $array); |
7282 | 7282 | |
7283 | 7283 | if ($new_str === '') { |
7284 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
7284 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
7285 | 7285 | } |
7286 | 7286 | } |
7287 | 7287 | |
7288 | - return $new_str . $str_add_on; |
|
7288 | + return $new_str.$str_add_on; |
|
7289 | 7289 | } |
7290 | 7290 | |
7291 | 7291 | /** |
@@ -7308,7 +7308,7 @@ discard block |
||
7308 | 7308 | $longest_common_prefix = ''; |
7309 | 7309 | |
7310 | 7310 | if ($encoding === 'UTF-8') { |
7311 | - $max_length = (int) \min( |
|
7311 | + $max_length = (int)\min( |
|
7312 | 7312 | \mb_strlen($str1), |
7313 | 7313 | \mb_strlen($str2) |
7314 | 7314 | ); |
@@ -7329,7 +7329,7 @@ discard block |
||
7329 | 7329 | } else { |
7330 | 7330 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7331 | 7331 | |
7332 | - $max_length = (int) \min( |
|
7332 | + $max_length = (int)\min( |
|
7333 | 7333 | self::strlen($str1, $encoding), |
7334 | 7334 | self::strlen($str2, $encoding) |
7335 | 7335 | ); |
@@ -7378,13 +7378,13 @@ discard block |
||
7378 | 7378 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
7379 | 7379 | |
7380 | 7380 | if ($encoding === 'UTF-8') { |
7381 | - $str_length = (int) \mb_strlen($str1); |
|
7382 | - $other_length = (int) \mb_strlen($str2); |
|
7381 | + $str_length = (int)\mb_strlen($str1); |
|
7382 | + $other_length = (int)\mb_strlen($str2); |
|
7383 | 7383 | } else { |
7384 | 7384 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7385 | 7385 | |
7386 | - $str_length = (int) self::strlen($str1, $encoding); |
|
7387 | - $other_length = (int) self::strlen($str2, $encoding); |
|
7386 | + $str_length = (int)self::strlen($str1, $encoding); |
|
7387 | + $other_length = (int)self::strlen($str2, $encoding); |
|
7388 | 7388 | } |
7389 | 7389 | |
7390 | 7390 | // Return if either string is empty |
@@ -7437,10 +7437,10 @@ discard block |
||
7437 | 7437 | } |
7438 | 7438 | |
7439 | 7439 | if ($encoding === 'UTF-8') { |
7440 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
7440 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
7441 | 7441 | } |
7442 | 7442 | |
7443 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
7443 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
7444 | 7444 | } |
7445 | 7445 | |
7446 | 7446 | /** |
@@ -7464,7 +7464,7 @@ discard block |
||
7464 | 7464 | } |
7465 | 7465 | |
7466 | 7466 | if ($encoding === 'UTF-8') { |
7467 | - $max_length = (int) \min( |
|
7467 | + $max_length = (int)\min( |
|
7468 | 7468 | \mb_strlen($str1, $encoding), |
7469 | 7469 | \mb_strlen($str2, $encoding) |
7470 | 7470 | ); |
@@ -7478,7 +7478,7 @@ discard block |
||
7478 | 7478 | && |
7479 | 7479 | $char === \mb_substr($str2, -$i, 1) |
7480 | 7480 | ) { |
7481 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
7481 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
7482 | 7482 | } else { |
7483 | 7483 | break; |
7484 | 7484 | } |
@@ -7486,7 +7486,7 @@ discard block |
||
7486 | 7486 | } else { |
7487 | 7487 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7488 | 7488 | |
7489 | - $max_length = (int) \min( |
|
7489 | + $max_length = (int)\min( |
|
7490 | 7490 | self::strlen($str1, $encoding), |
7491 | 7491 | self::strlen($str2, $encoding) |
7492 | 7492 | ); |
@@ -7500,7 +7500,7 @@ discard block |
||
7500 | 7500 | && |
7501 | 7501 | $char === self::substr($str2, -$i, 1, $encoding) |
7502 | 7502 | ) { |
7503 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
7503 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
7504 | 7504 | } else { |
7505 | 7505 | break; |
7506 | 7506 | } |
@@ -7523,7 +7523,7 @@ discard block |
||
7523 | 7523 | */ |
7524 | 7524 | public static function str_matches_pattern(string $str, string $pattern): bool |
7525 | 7525 | { |
7526 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
7526 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
7527 | 7527 | } |
7528 | 7528 | |
7529 | 7529 | /** |
@@ -7543,7 +7543,7 @@ discard block |
||
7543 | 7543 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
7544 | 7544 | { |
7545 | 7545 | // init |
7546 | - $length = (int) self::strlen($str, $encoding); |
|
7546 | + $length = (int)self::strlen($str, $encoding); |
|
7547 | 7547 | |
7548 | 7548 | if ($offset >= 0) { |
7549 | 7549 | return $length > $offset; |
@@ -7572,7 +7572,7 @@ discard block |
||
7572 | 7572 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
7573 | 7573 | { |
7574 | 7574 | // init |
7575 | - $length = (int) self::strlen($str); |
|
7575 | + $length = (int)self::strlen($str); |
|
7576 | 7576 | |
7577 | 7577 | if ( |
7578 | 7578 | ($index >= 0 && $length <= $index) |
@@ -7616,7 +7616,7 @@ discard block |
||
7616 | 7616 | return $str; |
7617 | 7617 | } |
7618 | 7618 | |
7619 | - if ($pad_type !== (int) $pad_type) { |
|
7619 | + if ($pad_type !== (int)$pad_type) { |
|
7620 | 7620 | if ($pad_type === 'left') { |
7621 | 7621 | $pad_type = \STR_PAD_LEFT; |
7622 | 7622 | } elseif ($pad_type === 'right') { |
@@ -7625,23 +7625,23 @@ discard block |
||
7625 | 7625 | $pad_type = \STR_PAD_BOTH; |
7626 | 7626 | } else { |
7627 | 7627 | throw new \InvalidArgumentException( |
7628 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
7628 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
7629 | 7629 | ); |
7630 | 7630 | } |
7631 | 7631 | } |
7632 | 7632 | |
7633 | 7633 | if ($encoding === 'UTF-8') { |
7634 | - $str_length = (int) \mb_strlen($str); |
|
7634 | + $str_length = (int)\mb_strlen($str); |
|
7635 | 7635 | |
7636 | 7636 | if ($pad_length >= $str_length) { |
7637 | 7637 | switch ($pad_type) { |
7638 | 7638 | case \STR_PAD_LEFT: |
7639 | - $ps_length = (int) \mb_strlen($pad_string); |
|
7639 | + $ps_length = (int)\mb_strlen($pad_string); |
|
7640 | 7640 | |
7641 | 7641 | $diff = ($pad_length - $str_length); |
7642 | 7642 | |
7643 | - $pre = (string) \mb_substr( |
|
7644 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7643 | + $pre = (string)\mb_substr( |
|
7644 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7645 | 7645 | 0, |
7646 | 7646 | $diff |
7647 | 7647 | ); |
@@ -7652,16 +7652,16 @@ discard block |
||
7652 | 7652 | case \STR_PAD_BOTH: |
7653 | 7653 | $diff = ($pad_length - $str_length); |
7654 | 7654 | |
7655 | - $ps_length_left = (int) \floor($diff / 2); |
|
7655 | + $ps_length_left = (int)\floor($diff / 2); |
|
7656 | 7656 | |
7657 | - $ps_length_right = (int) \ceil($diff / 2); |
|
7657 | + $ps_length_right = (int)\ceil($diff / 2); |
|
7658 | 7658 | |
7659 | - $pre = (string) \mb_substr( |
|
7659 | + $pre = (string)\mb_substr( |
|
7660 | 7660 | \str_repeat($pad_string, $ps_length_left), |
7661 | 7661 | 0, |
7662 | 7662 | $ps_length_left |
7663 | 7663 | ); |
7664 | - $post = (string) \mb_substr( |
|
7664 | + $post = (string)\mb_substr( |
|
7665 | 7665 | \str_repeat($pad_string, $ps_length_right), |
7666 | 7666 | 0, |
7667 | 7667 | $ps_length_right |
@@ -7671,19 +7671,19 @@ discard block |
||
7671 | 7671 | |
7672 | 7672 | case \STR_PAD_RIGHT: |
7673 | 7673 | default: |
7674 | - $ps_length = (int) \mb_strlen($pad_string); |
|
7674 | + $ps_length = (int)\mb_strlen($pad_string); |
|
7675 | 7675 | |
7676 | 7676 | $diff = ($pad_length - $str_length); |
7677 | 7677 | |
7678 | - $post = (string) \mb_substr( |
|
7679 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7678 | + $post = (string)\mb_substr( |
|
7679 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7680 | 7680 | 0, |
7681 | 7681 | $diff |
7682 | 7682 | ); |
7683 | 7683 | $pre = ''; |
7684 | 7684 | } |
7685 | 7685 | |
7686 | - return $pre . $str . $post; |
|
7686 | + return $pre.$str.$post; |
|
7687 | 7687 | } |
7688 | 7688 | |
7689 | 7689 | return $str; |
@@ -7691,17 +7691,17 @@ discard block |
||
7691 | 7691 | |
7692 | 7692 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7693 | 7693 | |
7694 | - $str_length = (int) self::strlen($str, $encoding); |
|
7694 | + $str_length = (int)self::strlen($str, $encoding); |
|
7695 | 7695 | |
7696 | 7696 | if ($pad_length >= $str_length) { |
7697 | 7697 | switch ($pad_type) { |
7698 | 7698 | case \STR_PAD_LEFT: |
7699 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
7699 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
7700 | 7700 | |
7701 | 7701 | $diff = ($pad_length - $str_length); |
7702 | 7702 | |
7703 | - $pre = (string) self::substr( |
|
7704 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7703 | + $pre = (string)self::substr( |
|
7704 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7705 | 7705 | 0, |
7706 | 7706 | $diff, |
7707 | 7707 | $encoding |
@@ -7713,17 +7713,17 @@ discard block |
||
7713 | 7713 | case \STR_PAD_BOTH: |
7714 | 7714 | $diff = ($pad_length - $str_length); |
7715 | 7715 | |
7716 | - $ps_length_left = (int) \floor($diff / 2); |
|
7716 | + $ps_length_left = (int)\floor($diff / 2); |
|
7717 | 7717 | |
7718 | - $ps_length_right = (int) \ceil($diff / 2); |
|
7718 | + $ps_length_right = (int)\ceil($diff / 2); |
|
7719 | 7719 | |
7720 | - $pre = (string) self::substr( |
|
7720 | + $pre = (string)self::substr( |
|
7721 | 7721 | \str_repeat($pad_string, $ps_length_left), |
7722 | 7722 | 0, |
7723 | 7723 | $ps_length_left, |
7724 | 7724 | $encoding |
7725 | 7725 | ); |
7726 | - $post = (string) self::substr( |
|
7726 | + $post = (string)self::substr( |
|
7727 | 7727 | \str_repeat($pad_string, $ps_length_right), |
7728 | 7728 | 0, |
7729 | 7729 | $ps_length_right, |
@@ -7734,12 +7734,12 @@ discard block |
||
7734 | 7734 | |
7735 | 7735 | case \STR_PAD_RIGHT: |
7736 | 7736 | default: |
7737 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
7737 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
7738 | 7738 | |
7739 | 7739 | $diff = ($pad_length - $str_length); |
7740 | 7740 | |
7741 | - $post = (string) self::substr( |
|
7742 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7741 | + $post = (string)self::substr( |
|
7742 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7743 | 7743 | 0, |
7744 | 7744 | $diff, |
7745 | 7745 | $encoding |
@@ -7747,7 +7747,7 @@ discard block |
||
7747 | 7747 | $pre = ''; |
7748 | 7748 | } |
7749 | 7749 | |
7750 | - return $pre . $str . $post; |
|
7750 | + return $pre.$str.$post; |
|
7751 | 7751 | } |
7752 | 7752 | |
7753 | 7753 | return $str; |
@@ -7958,12 +7958,12 @@ discard block |
||
7958 | 7958 | } |
7959 | 7959 | |
7960 | 7960 | if ($search === '') { |
7961 | - return $str . $replacement; |
|
7961 | + return $str.$replacement; |
|
7962 | 7962 | } |
7963 | 7963 | |
7964 | 7964 | $searchLength = \strlen($search); |
7965 | 7965 | if (\strncmp($str, $search, $searchLength) === 0) { |
7966 | - return $replacement . \substr($str, $searchLength); |
|
7966 | + return $replacement.\substr($str, $searchLength); |
|
7967 | 7967 | } |
7968 | 7968 | |
7969 | 7969 | return $str; |
@@ -7997,11 +7997,11 @@ discard block |
||
7997 | 7997 | } |
7998 | 7998 | |
7999 | 7999 | if ($search === '') { |
8000 | - return $str . $replacement; |
|
8000 | + return $str.$replacement; |
|
8001 | 8001 | } |
8002 | 8002 | |
8003 | 8003 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
8004 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
8004 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
8005 | 8005 | } |
8006 | 8006 | |
8007 | 8007 | return $str; |
@@ -8035,7 +8035,7 @@ discard block |
||
8035 | 8035 | $subject, |
8036 | 8036 | $replace, |
8037 | 8037 | $pos, |
8038 | - (int) self::strlen($search) |
|
8038 | + (int)self::strlen($search) |
|
8039 | 8039 | ); |
8040 | 8040 | } |
8041 | 8041 | |
@@ -8069,7 +8069,7 @@ discard block |
||
8069 | 8069 | $subject, |
8070 | 8070 | $replace, |
8071 | 8071 | $pos, |
8072 | - (int) self::strlen($search) |
|
8072 | + (int)self::strlen($search) |
|
8073 | 8073 | ); |
8074 | 8074 | } |
8075 | 8075 | |
@@ -8092,7 +8092,7 @@ discard block |
||
8092 | 8092 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
8093 | 8093 | { |
8094 | 8094 | if ($encoding === 'UTF-8') { |
8095 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
8095 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
8096 | 8096 | /** @noinspection NonSecureShuffleUsageInspection */ |
8097 | 8097 | \shuffle($indexes); |
8098 | 8098 | |
@@ -8108,7 +8108,7 @@ discard block |
||
8108 | 8108 | } else { |
8109 | 8109 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8110 | 8110 | |
8111 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
8111 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
8112 | 8112 | /** @noinspection NonSecureShuffleUsageInspection */ |
8113 | 8113 | \shuffle($indexes); |
8114 | 8114 | |
@@ -8151,11 +8151,11 @@ discard block |
||
8151 | 8151 | ) { |
8152 | 8152 | if ($encoding === 'UTF-8') { |
8153 | 8153 | if ($end === null) { |
8154 | - $length = (int) \mb_strlen($str); |
|
8154 | + $length = (int)\mb_strlen($str); |
|
8155 | 8155 | } elseif ($end >= 0 && $end <= $start) { |
8156 | 8156 | return ''; |
8157 | 8157 | } elseif ($end < 0) { |
8158 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
8158 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
8159 | 8159 | } else { |
8160 | 8160 | $length = $end - $start; |
8161 | 8161 | } |
@@ -8166,11 +8166,11 @@ discard block |
||
8166 | 8166 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8167 | 8167 | |
8168 | 8168 | if ($end === null) { |
8169 | - $length = (int) self::strlen($str, $encoding); |
|
8169 | + $length = (int)self::strlen($str, $encoding); |
|
8170 | 8170 | } elseif ($end >= 0 && $end <= $start) { |
8171 | 8171 | return ''; |
8172 | 8172 | } elseif ($end < 0) { |
8173 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
8173 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
8174 | 8174 | } else { |
8175 | 8175 | $length = $end - $start; |
8176 | 8176 | } |
@@ -8205,7 +8205,7 @@ discard block |
||
8205 | 8205 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8206 | 8206 | } |
8207 | 8207 | |
8208 | - $str = (string) \preg_replace_callback( |
|
8208 | + $str = (string)\preg_replace_callback( |
|
8209 | 8209 | '/([\\p{N}|\\p{Lu}])/u', |
8210 | 8210 | /** |
8211 | 8211 | * @param string[] $matches |
@@ -8214,28 +8214,28 @@ discard block |
||
8214 | 8214 | * |
8215 | 8215 | * @return string |
8216 | 8216 | */ |
8217 | - static function (array $matches) use ($encoding): string { |
|
8217 | + static function(array $matches) use ($encoding): string { |
|
8218 | 8218 | $match = $matches[1]; |
8219 | - $match_int = (int) $match; |
|
8219 | + $match_int = (int)$match; |
|
8220 | 8220 | |
8221 | - if ((string) $match_int === $match) { |
|
8222 | - return '_' . $match . '_'; |
|
8221 | + if ((string)$match_int === $match) { |
|
8222 | + return '_'.$match.'_'; |
|
8223 | 8223 | } |
8224 | 8224 | |
8225 | 8225 | if ($encoding === 'UTF-8') { |
8226 | - return '_' . \mb_strtolower($match); |
|
8226 | + return '_'.\mb_strtolower($match); |
|
8227 | 8227 | } |
8228 | 8228 | |
8229 | - return '_' . self::strtolower($match, $encoding); |
|
8229 | + return '_'.self::strtolower($match, $encoding); |
|
8230 | 8230 | }, |
8231 | 8231 | $str |
8232 | 8232 | ); |
8233 | 8233 | |
8234 | - $str = (string) \preg_replace( |
|
8234 | + $str = (string)\preg_replace( |
|
8235 | 8235 | [ |
8236 | - '/\\s+/u', // convert spaces to "_" |
|
8236 | + '/\\s+/u', // convert spaces to "_" |
|
8237 | 8237 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
8238 | - '/_+/', // remove double "_" |
|
8238 | + '/_+/', // remove double "_" |
|
8239 | 8239 | ], |
8240 | 8240 | [ |
8241 | 8241 | '_', |
@@ -8366,7 +8366,7 @@ discard block |
||
8366 | 8366 | } |
8367 | 8367 | |
8368 | 8368 | // init |
8369 | - $input = (string) $input; |
|
8369 | + $input = (string)$input; |
|
8370 | 8370 | |
8371 | 8371 | if ($input === '') { |
8372 | 8372 | return []; |
@@ -8423,7 +8423,7 @@ discard block |
||
8423 | 8423 | ($input[$i] & "\xE0") === "\xC0" |
8424 | 8424 | ) { |
8425 | 8425 | if (($input[$i + 1] & "\xC0") === "\x80") { |
8426 | - $ret[] = $input[$i] . $input[$i + 1]; |
|
8426 | + $ret[] = $input[$i].$input[$i + 1]; |
|
8427 | 8427 | |
8428 | 8428 | ++$i; |
8429 | 8429 | } |
@@ -8437,7 +8437,7 @@ discard block |
||
8437 | 8437 | && |
8438 | 8438 | ($input[$i + 2] & "\xC0") === "\x80" |
8439 | 8439 | ) { |
8440 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2]; |
|
8440 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2]; |
|
8441 | 8441 | |
8442 | 8442 | $i += 2; |
8443 | 8443 | } |
@@ -8453,7 +8453,7 @@ discard block |
||
8453 | 8453 | && |
8454 | 8454 | ($input[$i + 3] & "\xC0") === "\x80" |
8455 | 8455 | ) { |
8456 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2] . $input[$i + 3]; |
|
8456 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2].$input[$i + 3]; |
|
8457 | 8457 | |
8458 | 8458 | $i += 3; |
8459 | 8459 | } |
@@ -8465,7 +8465,7 @@ discard block |
||
8465 | 8465 | $ret = \array_chunk($ret, $length); |
8466 | 8466 | |
8467 | 8467 | return \array_map( |
8468 | - static function (array $item): string { |
|
8468 | + static function(array $item): string { |
|
8469 | 8469 | return \implode('', $item); |
8470 | 8470 | }, |
8471 | 8471 | $ret |
@@ -8531,7 +8531,7 @@ discard block |
||
8531 | 8531 | $limit = -1; |
8532 | 8532 | } |
8533 | 8533 | |
8534 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
8534 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
8535 | 8535 | |
8536 | 8536 | if ($array === false) { |
8537 | 8537 | return []; |
@@ -8632,9 +8632,9 @@ discard block |
||
8632 | 8632 | return ''; |
8633 | 8633 | } |
8634 | 8634 | |
8635 | - return (string) \mb_substr( |
|
8635 | + return (string)\mb_substr( |
|
8636 | 8636 | $str, |
8637 | - $offset + (int) \mb_strlen($separator) |
|
8637 | + $offset + (int)\mb_strlen($separator) |
|
8638 | 8638 | ); |
8639 | 8639 | } |
8640 | 8640 | |
@@ -8643,9 +8643,9 @@ discard block |
||
8643 | 8643 | return ''; |
8644 | 8644 | } |
8645 | 8645 | |
8646 | - return (string) \mb_substr( |
|
8646 | + return (string)\mb_substr( |
|
8647 | 8647 | $str, |
8648 | - $offset + (int) self::strlen($separator, $encoding), |
|
8648 | + $offset + (int)self::strlen($separator, $encoding), |
|
8649 | 8649 | null, |
8650 | 8650 | $encoding |
8651 | 8651 | ); |
@@ -8677,9 +8677,9 @@ discard block |
||
8677 | 8677 | return ''; |
8678 | 8678 | } |
8679 | 8679 | |
8680 | - return (string) \mb_substr( |
|
8680 | + return (string)\mb_substr( |
|
8681 | 8681 | $str, |
8682 | - $offset + (int) \mb_strlen($separator) |
|
8682 | + $offset + (int)\mb_strlen($separator) |
|
8683 | 8683 | ); |
8684 | 8684 | } |
8685 | 8685 | |
@@ -8688,9 +8688,9 @@ discard block |
||
8688 | 8688 | return ''; |
8689 | 8689 | } |
8690 | 8690 | |
8691 | - return (string) self::substr( |
|
8691 | + return (string)self::substr( |
|
8692 | 8692 | $str, |
8693 | - $offset + (int) self::strlen($separator, $encoding), |
|
8693 | + $offset + (int)self::strlen($separator, $encoding), |
|
8694 | 8694 | null, |
8695 | 8695 | $encoding |
8696 | 8696 | ); |
@@ -8722,7 +8722,7 @@ discard block |
||
8722 | 8722 | return ''; |
8723 | 8723 | } |
8724 | 8724 | |
8725 | - return (string) \mb_substr( |
|
8725 | + return (string)\mb_substr( |
|
8726 | 8726 | $str, |
8727 | 8727 | 0, |
8728 | 8728 | $offset |
@@ -8734,7 +8734,7 @@ discard block |
||
8734 | 8734 | return ''; |
8735 | 8735 | } |
8736 | 8736 | |
8737 | - return (string) self::substr( |
|
8737 | + return (string)self::substr( |
|
8738 | 8738 | $str, |
8739 | 8739 | 0, |
8740 | 8740 | $offset, |
@@ -8765,7 +8765,7 @@ discard block |
||
8765 | 8765 | return ''; |
8766 | 8766 | } |
8767 | 8767 | |
8768 | - return (string) \mb_substr( |
|
8768 | + return (string)\mb_substr( |
|
8769 | 8769 | $str, |
8770 | 8770 | 0, |
8771 | 8771 | $offset |
@@ -8779,7 +8779,7 @@ discard block |
||
8779 | 8779 | |
8780 | 8780 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8781 | 8781 | |
8782 | - return (string) self::substr( |
|
8782 | + return (string)self::substr( |
|
8783 | 8783 | $str, |
8784 | 8784 | 0, |
8785 | 8785 | $offset, |
@@ -8894,7 +8894,7 @@ discard block |
||
8894 | 8894 | */ |
8895 | 8895 | public static function str_surround(string $str, string $substring): string |
8896 | 8896 | { |
8897 | - return $substring . $str . $substring; |
|
8897 | + return $substring.$str.$substring; |
|
8898 | 8898 | } |
8899 | 8899 | |
8900 | 8900 | /** |
@@ -8958,9 +8958,9 @@ discard block |
||
8958 | 8958 | $word_define_chars = ''; |
8959 | 8959 | } |
8960 | 8960 | |
8961 | - $str = (string) \preg_replace_callback( |
|
8962 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
8963 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
8961 | + $str = (string)\preg_replace_callback( |
|
8962 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
8963 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
8964 | 8964 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
8965 | 8965 | return $match[0]; |
8966 | 8966 | } |
@@ -9127,16 +9127,16 @@ discard block |
||
9127 | 9127 | |
9128 | 9128 | // the main substitutions |
9129 | 9129 | /** @noinspection RegExpDuplicateAlternationBranch - false-positive - https://youtrack.jetbrains.com/issue/WI-51002 */ |
9130 | - $str = (string) \preg_replace_callback( |
|
9130 | + $str = (string)\preg_replace_callback( |
|
9131 | 9131 | '~\\b (_*) (?: # 1. Leading underscore and |
9132 | 9132 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
9133 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
9133 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
9134 | 9134 | | |
9135 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
9135 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
9136 | 9136 | | |
9137 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
9137 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
9138 | 9138 | | |
9139 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
9139 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
9140 | 9140 | ) (_*) \\b # 6. With trailing underscore |
9141 | 9141 | ~ux', |
9142 | 9142 | /** |
@@ -9146,7 +9146,7 @@ discard block |
||
9146 | 9146 | * |
9147 | 9147 | * @return string |
9148 | 9148 | */ |
9149 | - static function (array $matches) use ($encoding): string { |
|
9149 | + static function(array $matches) use ($encoding): string { |
|
9150 | 9150 | // preserve leading underscore |
9151 | 9151 | $str = $matches[1]; |
9152 | 9152 | if ($matches[2]) { |
@@ -9171,11 +9171,11 @@ discard block |
||
9171 | 9171 | ); |
9172 | 9172 | |
9173 | 9173 | // Exceptions for small words: capitalize at start of title... |
9174 | - $str = (string) \preg_replace_callback( |
|
9174 | + $str = (string)\preg_replace_callback( |
|
9175 | 9175 | '~( \\A [[:punct:]]* # start of title... |
9176 | 9176 | | [:.;?!][ ]+ # or of subsentence... |
9177 | 9177 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
9178 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
9178 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
9179 | 9179 | ~uxi', |
9180 | 9180 | /** |
9181 | 9181 | * @param string[] $matches |
@@ -9184,15 +9184,15 @@ discard block |
||
9184 | 9184 | * |
9185 | 9185 | * @return string |
9186 | 9186 | */ |
9187 | - static function (array $matches) use ($encoding): string { |
|
9188 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
9187 | + static function(array $matches) use ($encoding): string { |
|
9188 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
9189 | 9189 | }, |
9190 | 9190 | $str |
9191 | 9191 | ); |
9192 | 9192 | |
9193 | 9193 | // ...and end of title |
9194 | - $str = (string) \preg_replace_callback( |
|
9195 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
9194 | + $str = (string)\preg_replace_callback( |
|
9195 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
9196 | 9196 | (?= [[:punct:]]* \Z # ...at the end of the title... |
9197 | 9197 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
9198 | 9198 | ~uxi', |
@@ -9203,7 +9203,7 @@ discard block |
||
9203 | 9203 | * |
9204 | 9204 | * @return string |
9205 | 9205 | */ |
9206 | - static function (array $matches) use ($encoding): string { |
|
9206 | + static function(array $matches) use ($encoding): string { |
|
9207 | 9207 | return static::ucfirst($matches[1], $encoding); |
9208 | 9208 | }, |
9209 | 9209 | $str |
@@ -9211,10 +9211,10 @@ discard block |
||
9211 | 9211 | |
9212 | 9212 | // Exceptions for small words in hyphenated compound words. |
9213 | 9213 | // e.g. "in-flight" -> In-Flight |
9214 | - $str = (string) \preg_replace_callback( |
|
9214 | + $str = (string)\preg_replace_callback( |
|
9215 | 9215 | '~\\b |
9216 | 9216 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
9217 | - ( ' . $small_words_rx . ' ) |
|
9217 | + ( ' . $small_words_rx.' ) |
|
9218 | 9218 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
9219 | 9219 | ~uxi', |
9220 | 9220 | /** |
@@ -9224,18 +9224,18 @@ discard block |
||
9224 | 9224 | * |
9225 | 9225 | * @return string |
9226 | 9226 | */ |
9227 | - static function (array $matches) use ($encoding): string { |
|
9227 | + static function(array $matches) use ($encoding): string { |
|
9228 | 9228 | return static::ucfirst($matches[1], $encoding); |
9229 | 9229 | }, |
9230 | 9230 | $str |
9231 | 9231 | ); |
9232 | 9232 | |
9233 | 9233 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
9234 | - $str = (string) \preg_replace_callback( |
|
9234 | + $str = (string)\preg_replace_callback( |
|
9235 | 9235 | '~\\b |
9236 | 9236 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
9237 | 9237 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
9238 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
9238 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
9239 | 9239 | (?! - ) # Negative lookahead for another - |
9240 | 9240 | ~uxi', |
9241 | 9241 | /** |
@@ -9245,8 +9245,8 @@ discard block |
||
9245 | 9245 | * |
9246 | 9246 | * @return string |
9247 | 9247 | */ |
9248 | - static function (array $matches) use ($encoding): string { |
|
9249 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
9248 | + static function(array $matches) use ($encoding): string { |
|
9249 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
9250 | 9250 | }, |
9251 | 9251 | $str |
9252 | 9252 | ); |
@@ -9365,7 +9365,7 @@ discard block |
||
9365 | 9365 | ); |
9366 | 9366 | |
9367 | 9367 | foreach ($tmp_return as &$item) { |
9368 | - $item = (string) $item; |
|
9368 | + $item = (string)$item; |
|
9369 | 9369 | } |
9370 | 9370 | |
9371 | 9371 | return $tmp_return; |
@@ -9419,39 +9419,39 @@ discard block |
||
9419 | 9419 | } |
9420 | 9420 | |
9421 | 9421 | if ($encoding === 'UTF-8') { |
9422 | - if ($length >= (int) \mb_strlen($str)) { |
|
9422 | + if ($length >= (int)\mb_strlen($str)) { |
|
9423 | 9423 | return $str; |
9424 | 9424 | } |
9425 | 9425 | |
9426 | 9426 | if ($substring !== '') { |
9427 | - $length -= (int) \mb_strlen($substring); |
|
9427 | + $length -= (int)\mb_strlen($substring); |
|
9428 | 9428 | |
9429 | 9429 | /** @noinspection UnnecessaryCastingInspection */ |
9430 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
9430 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
9431 | 9431 | } |
9432 | 9432 | |
9433 | 9433 | /** @noinspection UnnecessaryCastingInspection */ |
9434 | - return (string) \mb_substr($str, 0, $length); |
|
9434 | + return (string)\mb_substr($str, 0, $length); |
|
9435 | 9435 | } |
9436 | 9436 | |
9437 | 9437 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9438 | 9438 | |
9439 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
9439 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
9440 | 9440 | return $str; |
9441 | 9441 | } |
9442 | 9442 | |
9443 | 9443 | if ($substring !== '') { |
9444 | - $length -= (int) self::strlen($substring, $encoding); |
|
9444 | + $length -= (int)self::strlen($substring, $encoding); |
|
9445 | 9445 | } |
9446 | 9446 | |
9447 | 9447 | return ( |
9448 | - (string) self::substr( |
|
9448 | + (string)self::substr( |
|
9449 | 9449 | $str, |
9450 | 9450 | 0, |
9451 | 9451 | $length, |
9452 | 9452 | $encoding |
9453 | 9453 | ) |
9454 | - ) . $substring; |
|
9454 | + ).$substring; |
|
9455 | 9455 | } |
9456 | 9456 | |
9457 | 9457 | /** |
@@ -9485,12 +9485,12 @@ discard block |
||
9485 | 9485 | } |
9486 | 9486 | |
9487 | 9487 | if ($encoding === 'UTF-8') { |
9488 | - if ($length >= (int) \mb_strlen($str)) { |
|
9488 | + if ($length >= (int)\mb_strlen($str)) { |
|
9489 | 9489 | return $str; |
9490 | 9490 | } |
9491 | 9491 | |
9492 | 9492 | // need to further trim the string so we can append the substring |
9493 | - $length -= (int) \mb_strlen($substring); |
|
9493 | + $length -= (int)\mb_strlen($substring); |
|
9494 | 9494 | if ($length <= 0) { |
9495 | 9495 | return $substring; |
9496 | 9496 | } |
@@ -9516,18 +9516,18 @@ discard block |
||
9516 | 9516 | !$ignore_do_not_split_words_for_one_word |
9517 | 9517 | ) |
9518 | 9518 | ) { |
9519 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
9519 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
9520 | 9520 | } |
9521 | 9521 | } |
9522 | 9522 | } else { |
9523 | 9523 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9524 | 9524 | |
9525 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
9525 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
9526 | 9526 | return $str; |
9527 | 9527 | } |
9528 | 9528 | |
9529 | 9529 | // need to further trim the string so we can append the substring |
9530 | - $length -= (int) self::strlen($substring, $encoding); |
|
9530 | + $length -= (int)self::strlen($substring, $encoding); |
|
9531 | 9531 | if ($length <= 0) { |
9532 | 9532 | return $substring; |
9533 | 9533 | } |
@@ -9553,12 +9553,12 @@ discard block |
||
9553 | 9553 | !$ignore_do_not_split_words_for_one_word |
9554 | 9554 | ) |
9555 | 9555 | ) { |
9556 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
9556 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
9557 | 9557 | } |
9558 | 9558 | } |
9559 | 9559 | } |
9560 | 9560 | |
9561 | - return $truncated . $substring; |
|
9561 | + return $truncated.$substring; |
|
9562 | 9562 | } |
9563 | 9563 | |
9564 | 9564 | /** |
@@ -9685,13 +9685,13 @@ discard block |
||
9685 | 9685 | } |
9686 | 9686 | } elseif ($format === 2) { |
9687 | 9687 | $number_of_words = []; |
9688 | - $offset = (int) self::strlen($str_parts[0]); |
|
9688 | + $offset = (int)self::strlen($str_parts[0]); |
|
9689 | 9689 | for ($i = 1; $i < $len; $i += 2) { |
9690 | 9690 | $number_of_words[$offset] = $str_parts[$i]; |
9691 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
9691 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
9692 | 9692 | } |
9693 | 9693 | } else { |
9694 | - $number_of_words = (int) (($len - 1) / 2); |
|
9694 | + $number_of_words = (int)(($len - 1) / 2); |
|
9695 | 9695 | } |
9696 | 9696 | |
9697 | 9697 | return $number_of_words; |
@@ -9824,7 +9824,7 @@ discard block |
||
9824 | 9824 | } |
9825 | 9825 | |
9826 | 9826 | if ($char_list === '') { |
9827 | - return (int) self::strlen($str, $encoding); |
|
9827 | + return (int)self::strlen($str, $encoding); |
|
9828 | 9828 | } |
9829 | 9829 | |
9830 | 9830 | if ($offset || $length !== null) { |
@@ -9851,7 +9851,7 @@ discard block |
||
9851 | 9851 | } |
9852 | 9852 | |
9853 | 9853 | $matches = []; |
9854 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
9854 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
9855 | 9855 | $return = self::strlen($matches[1], $encoding); |
9856 | 9856 | if ($return === false) { |
9857 | 9857 | return 0; |
@@ -9860,7 +9860,7 @@ discard block |
||
9860 | 9860 | return $return; |
9861 | 9861 | } |
9862 | 9862 | |
9863 | - return (int) self::strlen($str, $encoding); |
|
9863 | + return (int)self::strlen($str, $encoding); |
|
9864 | 9864 | } |
9865 | 9865 | |
9866 | 9866 | /** |
@@ -9923,7 +9923,7 @@ discard block |
||
9923 | 9923 | |
9924 | 9924 | $str = ''; |
9925 | 9925 | foreach ($intOrHex as $strPart) { |
9926 | - $str .= '&#' . (int) $strPart . ';'; |
|
9926 | + $str .= '&#'.(int)$strPart.';'; |
|
9927 | 9927 | } |
9928 | 9928 | |
9929 | 9929 | return self::html_entity_decode($str, \ENT_QUOTES | \ENT_HTML5); |
@@ -10020,7 +10020,7 @@ discard block |
||
10020 | 10020 | return ''; |
10021 | 10021 | } |
10022 | 10022 | |
10023 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
10023 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
10024 | 10024 | } |
10025 | 10025 | |
10026 | 10026 | /** |
@@ -10099,7 +10099,7 @@ discard block |
||
10099 | 10099 | // fallback for ascii only |
10100 | 10100 | // |
10101 | 10101 | |
10102 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10102 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10103 | 10103 | return \stripos($haystack, $needle, $offset); |
10104 | 10104 | } |
10105 | 10105 | |
@@ -10188,7 +10188,7 @@ discard block |
||
10188 | 10188 | /** |
10189 | 10189 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10190 | 10190 | */ |
10191 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10191 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10192 | 10192 | } |
10193 | 10193 | |
10194 | 10194 | if ( |
@@ -10202,11 +10202,11 @@ discard block |
||
10202 | 10202 | } |
10203 | 10203 | } |
10204 | 10204 | |
10205 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
10205 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
10206 | 10206 | return \stristr($haystack, $needle, $before_needle); |
10207 | 10207 | } |
10208 | 10208 | |
10209 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
10209 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
10210 | 10210 | |
10211 | 10211 | if (!isset($match[1])) { |
10212 | 10212 | return false; |
@@ -10216,7 +10216,7 @@ discard block |
||
10216 | 10216 | return $match[1]; |
10217 | 10217 | } |
10218 | 10218 | |
10219 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
10219 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
10220 | 10220 | } |
10221 | 10221 | |
10222 | 10222 | /** |
@@ -10299,7 +10299,7 @@ discard block |
||
10299 | 10299 | /** |
10300 | 10300 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10301 | 10301 | */ |
10302 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10302 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10303 | 10303 | } |
10304 | 10304 | |
10305 | 10305 | // |
@@ -10437,8 +10437,8 @@ discard block |
||
10437 | 10437 | } |
10438 | 10438 | |
10439 | 10439 | return \strnatcmp( |
10440 | - (string) self::strtonatfold($str1), |
|
10441 | - (string) self::strtonatfold($str2) |
|
10440 | + (string)self::strtonatfold($str1), |
|
10441 | + (string)self::strtonatfold($str2) |
|
10442 | 10442 | ); |
10443 | 10443 | } |
10444 | 10444 | |
@@ -10508,11 +10508,11 @@ discard block |
||
10508 | 10508 | } |
10509 | 10509 | |
10510 | 10510 | if ($encoding === 'UTF-8') { |
10511 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
10512 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
10511 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
10512 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
10513 | 10513 | } else { |
10514 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
10515 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
10514 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
10515 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
10516 | 10516 | } |
10517 | 10517 | |
10518 | 10518 | return self::strcmp($str1, $str2); |
@@ -10539,8 +10539,8 @@ discard block |
||
10539 | 10539 | return false; |
10540 | 10540 | } |
10541 | 10541 | |
10542 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
10543 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
10542 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
10543 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
10544 | 10544 | } |
10545 | 10545 | |
10546 | 10546 | return false; |
@@ -10585,10 +10585,10 @@ discard block |
||
10585 | 10585 | } |
10586 | 10586 | |
10587 | 10587 | // iconv and mbstring do not support integer $needle |
10588 | - if ((int) $needle === $needle) { |
|
10589 | - $needle = (string) self::chr($needle); |
|
10588 | + if ((int)$needle === $needle) { |
|
10589 | + $needle = (string)self::chr($needle); |
|
10590 | 10590 | } |
10591 | - $needle = (string) $needle; |
|
10591 | + $needle = (string)$needle; |
|
10592 | 10592 | |
10593 | 10593 | if ($haystack === '') { |
10594 | 10594 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -10648,7 +10648,7 @@ discard block |
||
10648 | 10648 | /** |
10649 | 10649 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10650 | 10650 | */ |
10651 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10651 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10652 | 10652 | } |
10653 | 10653 | |
10654 | 10654 | // |
@@ -10689,7 +10689,7 @@ discard block |
||
10689 | 10689 | // fallback for ascii only |
10690 | 10690 | // |
10691 | 10691 | |
10692 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10692 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10693 | 10693 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Offset not contained in string */ |
10694 | 10694 | return @\strpos($haystack, $needle, $offset); |
10695 | 10695 | } |
@@ -10702,7 +10702,7 @@ discard block |
||
10702 | 10702 | if ($haystack_tmp === false) { |
10703 | 10703 | $haystack_tmp = ''; |
10704 | 10704 | } |
10705 | - $haystack = (string) $haystack_tmp; |
|
10705 | + $haystack = (string)$haystack_tmp; |
|
10706 | 10706 | |
10707 | 10707 | if ($offset < 0) { |
10708 | 10708 | $offset = 0; |
@@ -10714,7 +10714,7 @@ discard block |
||
10714 | 10714 | } |
10715 | 10715 | |
10716 | 10716 | if ($pos) { |
10717 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
10717 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
10718 | 10718 | } |
10719 | 10719 | |
10720 | 10720 | return $offset + 0; |
@@ -10869,7 +10869,7 @@ discard block |
||
10869 | 10869 | /** |
10870 | 10870 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10871 | 10871 | */ |
10872 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10872 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10873 | 10873 | } |
10874 | 10874 | |
10875 | 10875 | // |
@@ -10881,7 +10881,7 @@ discard block |
||
10881 | 10881 | if ($needle_tmp === false) { |
10882 | 10882 | return false; |
10883 | 10883 | } |
10884 | - $needle = (string) $needle_tmp; |
|
10884 | + $needle = (string)$needle_tmp; |
|
10885 | 10885 | |
10886 | 10886 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
10887 | 10887 | if ($pos === false) { |
@@ -10903,7 +10903,7 @@ discard block |
||
10903 | 10903 | if ($needle_tmp === false) { |
10904 | 10904 | return false; |
10905 | 10905 | } |
10906 | - $needle = (string) $needle_tmp; |
|
10906 | + $needle = (string)$needle_tmp; |
|
10907 | 10907 | |
10908 | 10908 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
10909 | 10909 | if ($pos === false) { |
@@ -10944,7 +10944,7 @@ discard block |
||
10944 | 10944 | if ($encoding === 'UTF-8') { |
10945 | 10945 | if (self::$SUPPORT['intl'] === true) { |
10946 | 10946 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
10947 | - $i = (int) \grapheme_strlen($str); |
|
10947 | + $i = (int)\grapheme_strlen($str); |
|
10948 | 10948 | while ($i--) { |
10949 | 10949 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
10950 | 10950 | if ($reversed_tmp !== false) { |
@@ -10952,7 +10952,7 @@ discard block |
||
10952 | 10952 | } |
10953 | 10953 | } |
10954 | 10954 | } else { |
10955 | - $i = (int) \mb_strlen($str); |
|
10955 | + $i = (int)\mb_strlen($str); |
|
10956 | 10956 | while ($i--) { |
10957 | 10957 | $reversed_tmp = \mb_substr($str, $i, 1); |
10958 | 10958 | if ($reversed_tmp !== false) { |
@@ -10963,7 +10963,7 @@ discard block |
||
10963 | 10963 | } else { |
10964 | 10964 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10965 | 10965 | |
10966 | - $i = (int) self::strlen($str, $encoding); |
|
10966 | + $i = (int)self::strlen($str, $encoding); |
|
10967 | 10967 | while ($i--) { |
10968 | 10968 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
10969 | 10969 | if ($reversed_tmp !== false) { |
@@ -11042,7 +11042,7 @@ discard block |
||
11042 | 11042 | if ($needle_tmp === false) { |
11043 | 11043 | return false; |
11044 | 11044 | } |
11045 | - $needle = (string) $needle_tmp; |
|
11045 | + $needle = (string)$needle_tmp; |
|
11046 | 11046 | |
11047 | 11047 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
11048 | 11048 | if ($pos === false) { |
@@ -11091,10 +11091,10 @@ discard block |
||
11091 | 11091 | } |
11092 | 11092 | |
11093 | 11093 | // iconv and mbstring do not support integer $needle |
11094 | - if ((int) $needle === $needle && $needle >= 0) { |
|
11095 | - $needle = (string) self::chr($needle); |
|
11094 | + if ((int)$needle === $needle && $needle >= 0) { |
|
11095 | + $needle = (string)self::chr($needle); |
|
11096 | 11096 | } |
11097 | - $needle = (string) $needle; |
|
11097 | + $needle = (string)$needle; |
|
11098 | 11098 | |
11099 | 11099 | if ($haystack === '') { |
11100 | 11100 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -11150,7 +11150,7 @@ discard block |
||
11150 | 11150 | /** |
11151 | 11151 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11152 | 11152 | */ |
11153 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11153 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11154 | 11154 | } |
11155 | 11155 | |
11156 | 11156 | // |
@@ -11174,7 +11174,7 @@ discard block |
||
11174 | 11174 | // fallback for ascii only |
11175 | 11175 | // |
11176 | 11176 | |
11177 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
11177 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
11178 | 11178 | return \strripos($haystack, $needle, $offset); |
11179 | 11179 | } |
11180 | 11180 | |
@@ -11263,10 +11263,10 @@ discard block |
||
11263 | 11263 | } |
11264 | 11264 | |
11265 | 11265 | // iconv and mbstring do not support integer $needle |
11266 | - if ((int) $needle === $needle && $needle >= 0) { |
|
11267 | - $needle = (string) self::chr($needle); |
|
11266 | + if ((int)$needle === $needle && $needle >= 0) { |
|
11267 | + $needle = (string)self::chr($needle); |
|
11268 | 11268 | } |
11269 | - $needle = (string) $needle; |
|
11269 | + $needle = (string)$needle; |
|
11270 | 11270 | |
11271 | 11271 | if ($haystack === '') { |
11272 | 11272 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -11322,7 +11322,7 @@ discard block |
||
11322 | 11322 | /** |
11323 | 11323 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11324 | 11324 | */ |
11325 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11325 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11326 | 11326 | } |
11327 | 11327 | |
11328 | 11328 | // |
@@ -11346,7 +11346,7 @@ discard block |
||
11346 | 11346 | // fallback for ascii only |
11347 | 11347 | // |
11348 | 11348 | |
11349 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
11349 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
11350 | 11350 | return \strrpos($haystack, $needle, $offset); |
11351 | 11351 | } |
11352 | 11352 | |
@@ -11366,7 +11366,7 @@ discard block |
||
11366 | 11366 | if ($haystack_tmp === false) { |
11367 | 11367 | $haystack_tmp = ''; |
11368 | 11368 | } |
11369 | - $haystack = (string) $haystack_tmp; |
|
11369 | + $haystack = (string)$haystack_tmp; |
|
11370 | 11370 | } |
11371 | 11371 | |
11372 | 11372 | $pos = \strrpos($haystack, $needle); |
@@ -11380,7 +11380,7 @@ discard block |
||
11380 | 11380 | return false; |
11381 | 11381 | } |
11382 | 11382 | |
11383 | - return $offset + (int) self::strlen($str_tmp); |
|
11383 | + return $offset + (int)self::strlen($str_tmp); |
|
11384 | 11384 | } |
11385 | 11385 | |
11386 | 11386 | /** |
@@ -11448,12 +11448,12 @@ discard block |
||
11448 | 11448 | if ($offset || $length !== null) { |
11449 | 11449 | if ($encoding === 'UTF-8') { |
11450 | 11450 | if ($length === null) { |
11451 | - $str = (string) \mb_substr($str, $offset); |
|
11451 | + $str = (string)\mb_substr($str, $offset); |
|
11452 | 11452 | } else { |
11453 | - $str = (string) \mb_substr($str, $offset, $length); |
|
11453 | + $str = (string)\mb_substr($str, $offset, $length); |
|
11454 | 11454 | } |
11455 | 11455 | } else { |
11456 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
11456 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
11457 | 11457 | } |
11458 | 11458 | } |
11459 | 11459 | |
@@ -11463,7 +11463,7 @@ discard block |
||
11463 | 11463 | |
11464 | 11464 | $matches = []; |
11465 | 11465 | |
11466 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
11466 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
11467 | 11467 | } |
11468 | 11468 | |
11469 | 11469 | /** |
@@ -11557,7 +11557,7 @@ discard block |
||
11557 | 11557 | /** |
11558 | 11558 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11559 | 11559 | */ |
11560 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11560 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11561 | 11561 | } |
11562 | 11562 | |
11563 | 11563 | // |
@@ -11579,7 +11579,7 @@ discard block |
||
11579 | 11579 | // fallback for ascii only |
11580 | 11580 | // |
11581 | 11581 | |
11582 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
11582 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
11583 | 11583 | return \strstr($haystack, $needle, $before_needle); |
11584 | 11584 | } |
11585 | 11585 | |
@@ -11587,7 +11587,7 @@ discard block |
||
11587 | 11587 | // fallback via vanilla php |
11588 | 11588 | // |
11589 | 11589 | |
11590 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
11590 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
11591 | 11591 | |
11592 | 11592 | if (!isset($match[1])) { |
11593 | 11593 | return false; |
@@ -11597,7 +11597,7 @@ discard block |
||
11597 | 11597 | return $match[1]; |
11598 | 11598 | } |
11599 | 11599 | |
11600 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
11600 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
11601 | 11601 | } |
11602 | 11602 | |
11603 | 11603 | /** |
@@ -11727,7 +11727,7 @@ discard block |
||
11727 | 11727 | bool $try_to_keep_the_string_length = false |
11728 | 11728 | ): string { |
11729 | 11729 | // init |
11730 | - $str = (string) $str; |
|
11730 | + $str = (string)$str; |
|
11731 | 11731 | |
11732 | 11732 | if ($str === '') { |
11733 | 11733 | return ''; |
@@ -11756,25 +11756,25 @@ discard block |
||
11756 | 11756 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
11757 | 11757 | } |
11758 | 11758 | |
11759 | - $language_code = $lang . '-Lower'; |
|
11759 | + $language_code = $lang.'-Lower'; |
|
11760 | 11760 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
11761 | 11761 | /** |
11762 | 11762 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11763 | 11763 | */ |
11764 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
11764 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
11765 | 11765 | |
11766 | 11766 | $language_code = 'Any-Lower'; |
11767 | 11767 | } |
11768 | 11768 | |
11769 | 11769 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11770 | 11770 | /** @noinspection UnnecessaryCastingInspection */ |
11771 | - return (string) \transliterator_transliterate($language_code, $str); |
|
11771 | + return (string)\transliterator_transliterate($language_code, $str); |
|
11772 | 11772 | } |
11773 | 11773 | |
11774 | 11774 | /** |
11775 | 11775 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11776 | 11776 | */ |
11777 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
11777 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
11778 | 11778 | } |
11779 | 11779 | |
11780 | 11780 | // always fallback via symfony polyfill |
@@ -11809,7 +11809,7 @@ discard block |
||
11809 | 11809 | bool $try_to_keep_the_string_length = false |
11810 | 11810 | ): string { |
11811 | 11811 | // init |
11812 | - $str = (string) $str; |
|
11812 | + $str = (string)$str; |
|
11813 | 11813 | |
11814 | 11814 | if ($str === '') { |
11815 | 11815 | return ''; |
@@ -11838,25 +11838,25 @@ discard block |
||
11838 | 11838 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
11839 | 11839 | } |
11840 | 11840 | |
11841 | - $language_code = $lang . '-Upper'; |
|
11841 | + $language_code = $lang.'-Upper'; |
|
11842 | 11842 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
11843 | 11843 | /** |
11844 | 11844 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11845 | 11845 | */ |
11846 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
11846 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
11847 | 11847 | |
11848 | 11848 | $language_code = 'Any-Upper'; |
11849 | 11849 | } |
11850 | 11850 | |
11851 | 11851 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11852 | 11852 | /** @noinspection UnnecessaryCastingInspection */ |
11853 | - return (string) \transliterator_transliterate($language_code, $str); |
|
11853 | + return (string)\transliterator_transliterate($language_code, $str); |
|
11854 | 11854 | } |
11855 | 11855 | |
11856 | 11856 | /** |
11857 | 11857 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11858 | 11858 | */ |
11859 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
11859 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
11860 | 11860 | } |
11861 | 11861 | |
11862 | 11862 | // always fallback via symfony polyfill |
@@ -11920,7 +11920,7 @@ discard block |
||
11920 | 11920 | $from = \array_combine($from, $to); |
11921 | 11921 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
11922 | 11922 | if ($from === false) { |
11923 | - 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) . ')'); |
|
11923 | + 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).')'); |
|
11924 | 11924 | } |
11925 | 11925 | } |
11926 | 11926 | |
@@ -11986,9 +11986,9 @@ discard block |
||
11986 | 11986 | } |
11987 | 11987 | |
11988 | 11988 | $wide = 0; |
11989 | - $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); |
|
11989 | + $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); |
|
11990 | 11990 | |
11991 | - return ($wide << 1) + (int) self::strlen($str); |
|
11991 | + return ($wide << 1) + (int)self::strlen($str); |
|
11992 | 11992 | } |
11993 | 11993 | |
11994 | 11994 | /** |
@@ -12087,7 +12087,7 @@ discard block |
||
12087 | 12087 | return ''; |
12088 | 12088 | } |
12089 | 12089 | |
12090 | - $length = $length ?? (int) $str_length; |
|
12090 | + $length = $length ?? (int)$str_length; |
|
12091 | 12091 | |
12092 | 12092 | if ( |
12093 | 12093 | $encoding !== 'UTF-8' |
@@ -12097,7 +12097,7 @@ discard block |
||
12097 | 12097 | /** |
12098 | 12098 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
12099 | 12099 | */ |
12100 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
12100 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
12101 | 12101 | } |
12102 | 12102 | |
12103 | 12103 | // |
@@ -12193,16 +12193,16 @@ discard block |
||
12193 | 12193 | ) { |
12194 | 12194 | if ($encoding === 'UTF-8') { |
12195 | 12195 | if ($length === null) { |
12196 | - $str1 = (string) \mb_substr($str1, $offset); |
|
12196 | + $str1 = (string)\mb_substr($str1, $offset); |
|
12197 | 12197 | } else { |
12198 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
12198 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
12199 | 12199 | } |
12200 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
12200 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
12201 | 12201 | } else { |
12202 | 12202 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
12203 | 12203 | |
12204 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
12205 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
12204 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
12205 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
12206 | 12206 | } |
12207 | 12207 | } |
12208 | 12208 | |
@@ -12277,13 +12277,13 @@ discard block |
||
12277 | 12277 | if ($length_tmp === false) { |
12278 | 12278 | return false; |
12279 | 12279 | } |
12280 | - $length = (int) $length_tmp; |
|
12280 | + $length = (int)$length_tmp; |
|
12281 | 12281 | } |
12282 | 12282 | |
12283 | 12283 | if ($encoding === 'UTF-8') { |
12284 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
12284 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
12285 | 12285 | } else { |
12286 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
12286 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
12287 | 12287 | } |
12288 | 12288 | } |
12289 | 12289 | |
@@ -12295,7 +12295,7 @@ discard block |
||
12295 | 12295 | /** |
12296 | 12296 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
12297 | 12297 | */ |
12298 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
12298 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
12299 | 12299 | } |
12300 | 12300 | |
12301 | 12301 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -12306,7 +12306,7 @@ discard block |
||
12306 | 12306 | return \mb_substr_count($haystack, $needle, $encoding); |
12307 | 12307 | } |
12308 | 12308 | |
12309 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
12309 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
12310 | 12310 | |
12311 | 12311 | return \count($matches); |
12312 | 12312 | } |
@@ -12356,7 +12356,7 @@ discard block |
||
12356 | 12356 | if ($length_tmp === false) { |
12357 | 12357 | return false; |
12358 | 12358 | } |
12359 | - $length = (int) $length_tmp; |
|
12359 | + $length = (int)$length_tmp; |
|
12360 | 12360 | } |
12361 | 12361 | |
12362 | 12362 | if ( |
@@ -12378,7 +12378,7 @@ discard block |
||
12378 | 12378 | if ($haystack_tmp === false) { |
12379 | 12379 | $haystack_tmp = ''; |
12380 | 12380 | } |
12381 | - $haystack = (string) $haystack_tmp; |
|
12381 | + $haystack = (string)$haystack_tmp; |
|
12382 | 12382 | } |
12383 | 12383 | |
12384 | 12384 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -12419,10 +12419,10 @@ discard block |
||
12419 | 12419 | |
12420 | 12420 | if ($encoding === 'UTF-8') { |
12421 | 12421 | if ($case_sensitive) { |
12422 | - return (int) \mb_substr_count($str, $substring); |
|
12422 | + return (int)\mb_substr_count($str, $substring); |
|
12423 | 12423 | } |
12424 | 12424 | |
12425 | - return (int) \mb_substr_count( |
|
12425 | + return (int)\mb_substr_count( |
|
12426 | 12426 | \mb_strtoupper($str), |
12427 | 12427 | \mb_strtoupper($substring) |
12428 | 12428 | ); |
@@ -12431,10 +12431,10 @@ discard block |
||
12431 | 12431 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
12432 | 12432 | |
12433 | 12433 | if ($case_sensitive) { |
12434 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
12434 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
12435 | 12435 | } |
12436 | 12436 | |
12437 | - return (int) \mb_substr_count( |
|
12437 | + return (int)\mb_substr_count( |
|
12438 | 12438 | self::strtocasefold($str, true, false, $encoding, null, false), |
12439 | 12439 | self::strtocasefold($substring, true, false, $encoding, null, false), |
12440 | 12440 | $encoding |
@@ -12468,7 +12468,7 @@ discard block |
||
12468 | 12468 | } |
12469 | 12469 | |
12470 | 12470 | if (self::str_istarts_with($haystack, $needle)) { |
12471 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
12471 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
12472 | 12472 | } |
12473 | 12473 | |
12474 | 12474 | return $haystack; |
@@ -12535,7 +12535,7 @@ discard block |
||
12535 | 12535 | } |
12536 | 12536 | |
12537 | 12537 | if (self::str_iends_with($haystack, $needle)) { |
12538 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
12538 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
12539 | 12539 | } |
12540 | 12540 | |
12541 | 12541 | return $haystack; |
@@ -12568,7 +12568,7 @@ discard block |
||
12568 | 12568 | } |
12569 | 12569 | |
12570 | 12570 | if (self::str_starts_with($haystack, $needle)) { |
12571 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
12571 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
12572 | 12572 | } |
12573 | 12573 | |
12574 | 12574 | return $haystack; |
@@ -12625,7 +12625,7 @@ discard block |
||
12625 | 12625 | if (\is_array($offset)) { |
12626 | 12626 | $offset = \array_slice($offset, 0, $num); |
12627 | 12627 | foreach ($offset as &$value_tmp) { |
12628 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
12628 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
12629 | 12629 | } |
12630 | 12630 | unset($value_tmp); |
12631 | 12631 | } else { |
@@ -12638,7 +12638,7 @@ discard block |
||
12638 | 12638 | } elseif (\is_array($length)) { |
12639 | 12639 | $length = \array_slice($length, 0, $num); |
12640 | 12640 | foreach ($length as &$value_tmp_V2) { |
12641 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
12641 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
12642 | 12642 | } |
12643 | 12643 | unset($value_tmp_V2); |
12644 | 12644 | } else { |
@@ -12658,8 +12658,8 @@ discard block |
||
12658 | 12658 | } |
12659 | 12659 | |
12660 | 12660 | // init |
12661 | - $str = (string) $str; |
|
12662 | - $replacement = (string) $replacement; |
|
12661 | + $str = (string)$str; |
|
12662 | + $replacement = (string)$replacement; |
|
12663 | 12663 | |
12664 | 12664 | if (\is_array($length)) { |
12665 | 12665 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -12674,16 +12674,16 @@ discard block |
||
12674 | 12674 | } |
12675 | 12675 | |
12676 | 12676 | if (self::$SUPPORT['mbstring'] === true) { |
12677 | - $string_length = (int) self::strlen($str, $encoding); |
|
12677 | + $string_length = (int)self::strlen($str, $encoding); |
|
12678 | 12678 | |
12679 | 12679 | if ($offset < 0) { |
12680 | - $offset = (int) \max(0, $string_length + $offset); |
|
12680 | + $offset = (int)\max(0, $string_length + $offset); |
|
12681 | 12681 | } elseif ($offset > $string_length) { |
12682 | 12682 | $offset = $string_length; |
12683 | 12683 | } |
12684 | 12684 | |
12685 | 12685 | if ($length !== null && $length < 0) { |
12686 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
12686 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
12687 | 12687 | } elseif ($length === null || $length > $string_length) { |
12688 | 12688 | $length = $string_length; |
12689 | 12689 | } |
@@ -12694,9 +12694,9 @@ discard block |
||
12694 | 12694 | } |
12695 | 12695 | |
12696 | 12696 | /** @noinspection AdditionOperationOnArraysInspection */ |
12697 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
12698 | - $replacement . |
|
12699 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
12697 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
12698 | + $replacement. |
|
12699 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
12700 | 12700 | } |
12701 | 12701 | |
12702 | 12702 | // |
@@ -12705,8 +12705,7 @@ discard block |
||
12705 | 12705 | |
12706 | 12706 | if (ASCII::is_ascii($str)) { |
12707 | 12707 | return ($length === null) ? |
12708 | - \substr_replace($str, $replacement, $offset) : |
|
12709 | - \substr_replace($str, $replacement, $offset, $length); |
|
12708 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
12710 | 12709 | } |
12711 | 12710 | |
12712 | 12711 | // |
@@ -12722,7 +12721,7 @@ discard block |
||
12722 | 12721 | // e.g.: non mbstring support + invalid chars |
12723 | 12722 | return ''; |
12724 | 12723 | } |
12725 | - $length = (int) $length_tmp; |
|
12724 | + $length = (int)$length_tmp; |
|
12726 | 12725 | } |
12727 | 12726 | |
12728 | 12727 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -12765,14 +12764,14 @@ discard block |
||
12765 | 12764 | && |
12766 | 12765 | \substr($haystack, -\strlen($needle)) === $needle |
12767 | 12766 | ) { |
12768 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
12767 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
12769 | 12768 | } |
12770 | 12769 | |
12771 | 12770 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
12772 | - return (string) self::substr( |
|
12771 | + return (string)self::substr( |
|
12773 | 12772 | $haystack, |
12774 | 12773 | 0, |
12775 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
12774 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
12776 | 12775 | $encoding |
12777 | 12776 | ); |
12778 | 12777 | } |
@@ -12807,10 +12806,10 @@ discard block |
||
12807 | 12806 | } |
12808 | 12807 | |
12809 | 12808 | if ($encoding === 'UTF-8') { |
12810 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
12809 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
12811 | 12810 | } |
12812 | 12811 | |
12813 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
12812 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
12814 | 12813 | } |
12815 | 12814 | |
12816 | 12815 | /** |
@@ -13022,7 +13021,7 @@ discard block |
||
13022 | 13021 | public static function to_boolean($str): bool |
13023 | 13022 | { |
13024 | 13023 | // init |
13025 | - $str = (string) $str; |
|
13024 | + $str = (string)$str; |
|
13026 | 13025 | |
13027 | 13026 | if ($str === '') { |
13028 | 13027 | return false; |
@@ -13050,10 +13049,10 @@ discard block |
||
13050 | 13049 | } |
13051 | 13050 | |
13052 | 13051 | if (\is_numeric($str)) { |
13053 | - return ((float) $str + 0) > 0; |
|
13052 | + return ((float)$str + 0) > 0; |
|
13054 | 13053 | } |
13055 | 13054 | |
13056 | - return (bool) \trim($str); |
|
13055 | + return (bool)\trim($str); |
|
13057 | 13056 | } |
13058 | 13057 | |
13059 | 13058 | /** |
@@ -13101,7 +13100,7 @@ discard block |
||
13101 | 13100 | return $str; |
13102 | 13101 | } |
13103 | 13102 | |
13104 | - $str = (string) $str; |
|
13103 | + $str = (string)$str; |
|
13105 | 13104 | if ($str === '') { |
13106 | 13105 | return ''; |
13107 | 13106 | } |
@@ -13209,7 +13208,7 @@ discard block |
||
13209 | 13208 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
13210 | 13209 | |
13211 | 13210 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
13212 | - $buf .= $c1 . $c2; |
|
13211 | + $buf .= $c1.$c2; |
|
13213 | 13212 | ++$i; |
13214 | 13213 | } else { // not valid UTF8 - convert it |
13215 | 13214 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13220,7 +13219,7 @@ discard block |
||
13220 | 13219 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
13221 | 13220 | |
13222 | 13221 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
13223 | - $buf .= $c1 . $c2 . $c3; |
|
13222 | + $buf .= $c1.$c2.$c3; |
|
13224 | 13223 | $i += 2; |
13225 | 13224 | } else { // not valid UTF8 - convert it |
13226 | 13225 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13232,7 +13231,7 @@ discard block |
||
13232 | 13231 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
13233 | 13232 | |
13234 | 13233 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
13235 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
13234 | + $buf .= $c1.$c2.$c3.$c4; |
|
13236 | 13235 | $i += 3; |
13237 | 13236 | } else { // not valid UTF8 - convert it |
13238 | 13237 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13260,13 +13259,13 @@ discard block |
||
13260 | 13259 | * |
13261 | 13260 | * @return string |
13262 | 13261 | */ |
13263 | - static function (array $matches): string { |
|
13262 | + static function(array $matches): string { |
|
13264 | 13263 | if (isset($matches[3])) { |
13265 | - $cp = (int) \hexdec($matches[3]); |
|
13264 | + $cp = (int)\hexdec($matches[3]); |
|
13266 | 13265 | } else { |
13267 | 13266 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
13268 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
13269 | - + (int) \hexdec($matches[2]) |
|
13267 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
13268 | + + (int)\hexdec($matches[2]) |
|
13270 | 13269 | + 0x10000 |
13271 | 13270 | - (0xD800 << 10) |
13272 | 13271 | - 0xDC00; |
@@ -13277,12 +13276,12 @@ discard block |
||
13277 | 13276 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
13278 | 13277 | |
13279 | 13278 | if ($cp < 0x80) { |
13280 | - return (string) self::chr($cp); |
|
13279 | + return (string)self::chr($cp); |
|
13281 | 13280 | } |
13282 | 13281 | |
13283 | 13282 | if ($cp < 0xA0) { |
13284 | 13283 | /** @noinspection UnnecessaryCastingInspection */ |
13285 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
13284 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
13286 | 13285 | } |
13287 | 13286 | |
13288 | 13287 | return self::decimal_to_chr($cp); |
@@ -13315,7 +13314,7 @@ discard block |
||
13315 | 13314 | public static function to_int(string $str) |
13316 | 13315 | { |
13317 | 13316 | if (\is_numeric($str)) { |
13318 | - return (int) $str; |
|
13317 | + return (int)$str; |
|
13319 | 13318 | } |
13320 | 13319 | |
13321 | 13320 | return null; |
@@ -13350,7 +13349,7 @@ discard block |
||
13350 | 13349 | || |
13351 | 13350 | $input_type === 'double' |
13352 | 13351 | ) { |
13353 | - return (string) $input; |
|
13352 | + return (string)$input; |
|
13354 | 13353 | } |
13355 | 13354 | |
13356 | 13355 | if ($input_type === 'object') { |
@@ -13360,7 +13359,7 @@ discard block |
||
13360 | 13359 | /** @noinspection NestedPositiveIfStatementsInspection */ |
13361 | 13360 | /** @noinspection MissingOrEmptyGroupStatementInspection */ |
13362 | 13361 | if (\method_exists($input, '__toString')) { |
13363 | - return (string) $input; |
|
13362 | + return (string)$input; |
|
13364 | 13363 | } |
13365 | 13364 | } |
13366 | 13365 | |
@@ -13401,7 +13400,7 @@ discard block |
||
13401 | 13400 | } |
13402 | 13401 | |
13403 | 13402 | /** @noinspection PhpComposerExtensionStubsInspection */ |
13404 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
13403 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
13405 | 13404 | } |
13406 | 13405 | |
13407 | 13406 | if ($chars !== null) { |
@@ -13452,15 +13451,15 @@ discard block |
||
13452 | 13451 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
13453 | 13452 | |
13454 | 13453 | if ($encoding === 'UTF-8') { |
13455 | - $str_part_two = (string) \mb_substr($str, 1); |
|
13454 | + $str_part_two = (string)\mb_substr($str, 1); |
|
13456 | 13455 | |
13457 | 13456 | if ($use_mb_functions) { |
13458 | 13457 | $str_part_one = \mb_strtoupper( |
13459 | - (string) \mb_substr($str, 0, 1) |
|
13458 | + (string)\mb_substr($str, 0, 1) |
|
13460 | 13459 | ); |
13461 | 13460 | } else { |
13462 | 13461 | $str_part_one = self::strtoupper( |
13463 | - (string) \mb_substr($str, 0, 1), |
|
13462 | + (string)\mb_substr($str, 0, 1), |
|
13464 | 13463 | $encoding, |
13465 | 13464 | false, |
13466 | 13465 | $lang, |
@@ -13470,16 +13469,16 @@ discard block |
||
13470 | 13469 | } else { |
13471 | 13470 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
13472 | 13471 | |
13473 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
13472 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
13474 | 13473 | |
13475 | 13474 | if ($use_mb_functions) { |
13476 | 13475 | $str_part_one = \mb_strtoupper( |
13477 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
13476 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
13478 | 13477 | $encoding |
13479 | 13478 | ); |
13480 | 13479 | } else { |
13481 | 13480 | $str_part_one = self::strtoupper( |
13482 | - (string) self::substr($str, 0, 1, $encoding), |
|
13481 | + (string)self::substr($str, 0, 1, $encoding), |
|
13483 | 13482 | $encoding, |
13484 | 13483 | false, |
13485 | 13484 | $lang, |
@@ -13488,7 +13487,7 @@ discard block |
||
13488 | 13487 | } |
13489 | 13488 | } |
13490 | 13489 | |
13491 | - return $str_part_one . $str_part_two; |
|
13490 | + return $str_part_one.$str_part_two; |
|
13492 | 13491 | } |
13493 | 13492 | |
13494 | 13493 | /** |
@@ -13549,7 +13548,7 @@ discard block |
||
13549 | 13548 | $str = self::clean($str); |
13550 | 13549 | } |
13551 | 13550 | |
13552 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
13551 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
13553 | 13552 | |
13554 | 13553 | if ( |
13555 | 13554 | $use_php_default_functions |
@@ -13950,7 +13949,7 @@ discard block |
||
13950 | 13949 | if ( |
13951 | 13950 | $keep_utf8_chars |
13952 | 13951 | && |
13953 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
13952 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
13954 | 13953 | ) { |
13955 | 13954 | return $str_backup; |
13956 | 13955 | } |
@@ -14041,17 +14040,17 @@ discard block |
||
14041 | 14040 | return ''; |
14042 | 14041 | } |
14043 | 14042 | |
14044 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
14043 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
14045 | 14044 | |
14046 | 14045 | if ( |
14047 | 14046 | !isset($matches[0]) |
14048 | 14047 | || |
14049 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
14048 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
14050 | 14049 | ) { |
14051 | 14050 | return $str; |
14052 | 14051 | } |
14053 | 14052 | |
14054 | - return \rtrim($matches[0]) . $str_add_on; |
|
14053 | + return \rtrim($matches[0]).$str_add_on; |
|
14055 | 14054 | } |
14056 | 14055 | |
14057 | 14056 | /** |
@@ -14146,7 +14145,7 @@ discard block |
||
14146 | 14145 | } |
14147 | 14146 | } |
14148 | 14147 | |
14149 | - return $str_return . \implode('', $charsArray); |
|
14148 | + return $str_return.\implode('', $charsArray); |
|
14150 | 14149 | } |
14151 | 14150 | |
14152 | 14151 | /** |
@@ -14200,7 +14199,7 @@ discard block |
||
14200 | 14199 | $final_break = ''; |
14201 | 14200 | } |
14202 | 14201 | |
14203 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
14202 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
14204 | 14203 | } |
14205 | 14204 | |
14206 | 14205 | /** |
@@ -14442,7 +14441,7 @@ discard block |
||
14442 | 14441 | /** @noinspection PhpIncludeInspection */ |
14443 | 14442 | /** @noinspection UsingInclusionReturnValueInspection */ |
14444 | 14443 | /** @psalm-suppress UnresolvableInclude */ |
14445 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
14444 | + return include __DIR__.'/data/'.$file.'.php'; |
|
14446 | 14445 | } |
14447 | 14446 | |
14448 | 14447 | /** |
@@ -14462,7 +14461,7 @@ discard block |
||
14462 | 14461 | */ |
14463 | 14462 | \uksort( |
14464 | 14463 | self::$EMOJI, |
14465 | - static function (string $a, string $b): int { |
|
14464 | + static function(string $a, string $b): int { |
|
14466 | 14465 | return \strlen($b) <=> \strlen($a); |
14467 | 14466 | } |
14468 | 14467 | ); |
@@ -14472,7 +14471,7 @@ discard block |
||
14472 | 14471 | |
14473 | 14472 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
14474 | 14473 | $tmp_key = \crc32($key); |
14475 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
14474 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
14476 | 14475 | } |
14477 | 14476 | |
14478 | 14477 | return true; |
@@ -14500,7 +14499,7 @@ discard block |
||
14500 | 14499 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
14501 | 14500 | return \defined('MB_OVERLOAD_STRING') |
14502 | 14501 | && |
14503 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
14502 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
14504 | 14503 | } |
14505 | 14504 | |
14506 | 14505 | /** |
@@ -14566,7 +14565,7 @@ discard block |
||
14566 | 14565 | */ |
14567 | 14566 | static $RX_CLASS_CACHE = []; |
14568 | 14567 | |
14569 | - $cache_key = $s . '_' . $class; |
|
14568 | + $cache_key = $s.'_'.$class; |
|
14570 | 14569 | |
14571 | 14570 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
14572 | 14571 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -14579,7 +14578,7 @@ discard block |
||
14579 | 14578 | /** @noinspection AlterInForeachInspection */ |
14580 | 14579 | foreach (self::str_split($s) as &$s) { |
14581 | 14580 | if ($s === '-') { |
14582 | - $class_array[0] = '-' . $class_array[0]; |
|
14581 | + $class_array[0] = '-'.$class_array[0]; |
|
14583 | 14582 | } elseif (!isset($s[2])) { |
14584 | 14583 | $class_array[0] .= \preg_quote($s, '/'); |
14585 | 14584 | } elseif (self::strlen($s) === 1) { |
@@ -14590,13 +14589,13 @@ discard block |
||
14590 | 14589 | } |
14591 | 14590 | |
14592 | 14591 | if ($class_array[0]) { |
14593 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
14592 | + $class_array[0] = '['.$class_array[0].']'; |
|
14594 | 14593 | } |
14595 | 14594 | |
14596 | 14595 | if (\count($class_array) === 1) { |
14597 | 14596 | $return = $class_array[0]; |
14598 | 14597 | } else { |
14599 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
14598 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
14600 | 14599 | } |
14601 | 14600 | |
14602 | 14601 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -14677,7 +14676,7 @@ discard block |
||
14677 | 14676 | |
14678 | 14677 | if ($delimiter === '-') { |
14679 | 14678 | /** @noinspection AlterInForeachInspection */ |
14680 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
14679 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
14681 | 14680 | if (\strncmp($name, $beginning, \strlen($beginning)) === 0) { |
14682 | 14681 | $continue = true; |
14683 | 14682 | |
@@ -14687,7 +14686,7 @@ discard block |
||
14687 | 14686 | } |
14688 | 14687 | |
14689 | 14688 | /** @noinspection AlterInForeachInspection */ |
14690 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
14689 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
14691 | 14690 | if (\strncmp($name, $beginning, \strlen($beginning)) === 0) { |
14692 | 14691 | $continue = true; |
14693 | 14692 | |
@@ -14763,8 +14762,8 @@ discard block |
||
14763 | 14762 | } else { |
14764 | 14763 | /** @noinspection OffsetOperationsInspection */ |
14765 | 14764 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
14766 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
14767 | - $buf .= $cc1 . $cc2; |
|
14765 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
14766 | + $buf .= $cc1.$cc2; |
|
14768 | 14767 | } |
14769 | 14768 | |
14770 | 14769 | return $buf; |
@@ -14787,7 +14786,7 @@ discard block |
||
14787 | 14786 | |
14788 | 14787 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
14789 | 14788 | if (\preg_match($pattern, $str)) { |
14790 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
14789 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
14791 | 14790 | } |
14792 | 14791 | |
14793 | 14792 | return $str; |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require __DIR__ . '/../vendor/autoload.php'; |
|
4 | -require __DIR__ . '/vendor/autoload.php'; |
|
3 | +require __DIR__.'/../vendor/autoload.php'; |
|
4 | +require __DIR__.'/vendor/autoload.php'; |
|
5 | 5 | |
6 | 6 | $readmeText = (new \voku\PhpReadmeHelper\GenerateApi())->generate( |
7 | - __DIR__ . '/../src/voku/helper/UTF8.php', |
|
8 | - __DIR__ . '/docs/base.md' |
|
7 | + __DIR__.'/../src/voku/helper/UTF8.php', |
|
8 | + __DIR__.'/docs/base.md' |
|
9 | 9 | ); |
10 | 10 | |
11 | -file_put_contents(__DIR__ . '/../README.md', $readmeText); |
|
11 | +file_put_contents(__DIR__.'/../README.md', $readmeText); |