@@ -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 | // |
@@ -249,10 +249,10 @@ discard block |
||
249 | 249 | } |
250 | 250 | |
251 | 251 | if ($encoding === 'UTF-8') { |
252 | - return (string) \mb_substr($str, $pos, 1); |
|
252 | + return (string)\mb_substr($str, $pos, 1); |
|
253 | 253 | } |
254 | 254 | |
255 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
255 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | public static function add_bom_to_string(string $str): string |
273 | 273 | { |
274 | 274 | if (!self::string_has_bom($str)) { |
275 | - $str = self::bom() . $str; |
|
275 | + $str = self::bom().$str; |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | return $str; |
@@ -307,8 +307,8 @@ discard block |
||
307 | 307 | $return = []; |
308 | 308 | foreach ($array as $key => &$value) { |
309 | 309 | $key = $case === \CASE_LOWER |
310 | - ? self::strtolower((string) $key, $encoding) |
|
311 | - : self::strtoupper((string) $key, $encoding); |
|
310 | + ? self::strtolower((string)$key, $encoding) |
|
311 | + : self::strtoupper((string)$key, $encoding); |
|
312 | 312 | |
313 | 313 | $return[$key] = $value; |
314 | 314 | } |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | return ''; |
345 | 345 | } |
346 | 346 | |
347 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
347 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
348 | 348 | $end_position = \mb_strpos($str, $end, $substr_index); |
349 | 349 | if ( |
350 | 350 | $end_position === false |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | return ''; |
355 | 355 | } |
356 | 356 | |
357 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
357 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | return ''; |
365 | 365 | } |
366 | 366 | |
367 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
367 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
368 | 368 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
369 | 369 | if ( |
370 | 370 | $end_position === false |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | return ''; |
375 | 375 | } |
376 | 376 | |
377 | - return (string) self::substr( |
|
377 | + return (string)self::substr( |
|
378 | 378 | $str, |
379 | 379 | $substr_index, |
380 | 380 | $end_position - $substr_index, |
@@ -458,10 +458,10 @@ discard block |
||
458 | 458 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
459 | 459 | { |
460 | 460 | if ($encoding === 'UTF-8') { |
461 | - return (string) \mb_substr($str, $index, 1); |
|
461 | + return (string)\mb_substr($str, $index, 1); |
|
462 | 462 | } |
463 | 463 | |
464 | - return (string) self::substr($str, $index, 1, $encoding); |
|
464 | + return (string)self::substr($str, $index, 1, $encoding); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | /** |
@@ -577,14 +577,14 @@ discard block |
||
577 | 577 | /** |
578 | 578 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
579 | 579 | */ |
580 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
580 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
581 | 581 | } |
582 | 582 | |
583 | 583 | if ($code_point <= 0) { |
584 | 584 | return null; |
585 | 585 | } |
586 | 586 | |
587 | - $cache_key = $code_point . '_' . $encoding; |
|
587 | + $cache_key = $code_point.'_'.$encoding; |
|
588 | 588 | if (isset($CHAR_CACHE[$cache_key])) { |
589 | 589 | return $CHAR_CACHE[$cache_key]; |
590 | 590 | } |
@@ -630,27 +630,27 @@ discard block |
||
630 | 630 | self::$CHR = self::getData('chr'); |
631 | 631 | } |
632 | 632 | |
633 | - $code_point = (int) $code_point; |
|
633 | + $code_point = (int)$code_point; |
|
634 | 634 | if ($code_point <= 0x7FF) { |
635 | 635 | /** |
636 | 636 | * @psalm-suppress PossiblyNullArrayAccess |
637 | 637 | */ |
638 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
638 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
639 | 639 | self::$CHR[($code_point & 0x3F) + 0x80]; |
640 | 640 | } elseif ($code_point <= 0xFFFF) { |
641 | 641 | /** |
642 | 642 | * @psalm-suppress PossiblyNullArrayAccess |
643 | 643 | */ |
644 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
645 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
644 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
645 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
646 | 646 | self::$CHR[($code_point & 0x3F) + 0x80]; |
647 | 647 | } else { |
648 | 648 | /** |
649 | 649 | * @psalm-suppress PossiblyNullArrayAccess |
650 | 650 | */ |
651 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
652 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
653 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
651 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
652 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
653 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
654 | 654 | self::$CHR[($code_point & 0x3F) + 0x80]; |
655 | 655 | } |
656 | 656 | |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | |
708 | 708 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
709 | 709 | return \array_map( |
710 | - static function (string $data): int { |
|
710 | + static function(string $data): int { |
|
711 | 711 | // "mb_" is available if overload is used, so use it ... |
712 | 712 | return \mb_strlen($data, 'CP850'); // 8-BIT |
713 | 713 | }, |
@@ -794,7 +794,7 @@ discard block |
||
794 | 794 | $char = ''; |
795 | 795 | } |
796 | 796 | |
797 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
797 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
798 | 798 | } |
799 | 799 | |
800 | 800 | /** |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
892 | 892 | /x'; |
893 | 893 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
894 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
894 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
895 | 895 | |
896 | 896 | if ($replace_diamond_question_mark) { |
897 | 897 | $str = self::replace_diamond_question_mark($str); |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | public static function cleanup($str): string |
931 | 931 | { |
932 | 932 | // init |
933 | - $str = (string) $str; |
|
933 | + $str = (string)$str; |
|
934 | 934 | |
935 | 935 | if ($str === '') { |
936 | 936 | return ''; |
@@ -1032,7 +1032,7 @@ discard block |
||
1032 | 1032 | { |
1033 | 1033 | if (self::$SUPPORT['mbstring'] === true) { |
1034 | 1034 | /** @noinspection PhpComposerExtensionStubsInspection */ |
1035 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
1035 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
1036 | 1036 | } |
1037 | 1037 | |
1038 | 1038 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -1137,9 +1137,9 @@ discard block |
||
1137 | 1137 | // - 0-9 (U+0061 - U+007A) |
1138 | 1138 | // - ISO 10646 characters U+00A1 and higher |
1139 | 1139 | // We strip out any character not in the above list. |
1140 | - $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); |
|
1140 | + $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); |
|
1141 | 1141 | // Identifiers cannot start with a digit, two hyphens, or a hyphen followed by a digit. |
1142 | - $str = (string) \preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
1142 | + $str = (string)\preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
1143 | 1143 | |
1144 | 1144 | return \trim($str, '-'); |
1145 | 1145 | } |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | */ |
1156 | 1156 | public static function css_stripe_media_queries(string $str): string |
1157 | 1157 | { |
1158 | - return (string) \preg_replace( |
|
1158 | + return (string)\preg_replace( |
|
1159 | 1159 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
1160 | 1160 | '', |
1161 | 1161 | $str |
@@ -1192,7 +1192,7 @@ discard block |
||
1192 | 1192 | */ |
1193 | 1193 | public static function decimal_to_chr($int): string |
1194 | 1194 | { |
1195 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
1195 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
1196 | 1196 | } |
1197 | 1197 | |
1198 | 1198 | /** |
@@ -1242,7 +1242,7 @@ discard block |
||
1242 | 1242 | $flagOffset = 0x1F1E6; |
1243 | 1243 | $asciiOffset = 0x41; |
1244 | 1244 | |
1245 | - return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? '') . |
|
1245 | + return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? ''). |
|
1246 | 1246 | (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
1247 | 1247 | } |
1248 | 1248 | |
@@ -1273,16 +1273,16 @@ discard block |
||
1273 | 1273 | self::initEmojiData(); |
1274 | 1274 | |
1275 | 1275 | if ($use_reversible_string_mappings) { |
1276 | - return (string) \str_replace( |
|
1277 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1278 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1276 | + return (string)\str_replace( |
|
1277 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1278 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1279 | 1279 | $str |
1280 | 1280 | ); |
1281 | 1281 | } |
1282 | 1282 | |
1283 | - return (string) \str_replace( |
|
1284 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1285 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1283 | + return (string)\str_replace( |
|
1284 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1285 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1286 | 1286 | $str |
1287 | 1287 | ); |
1288 | 1288 | } |
@@ -1314,16 +1314,16 @@ discard block |
||
1314 | 1314 | self::initEmojiData(); |
1315 | 1315 | |
1316 | 1316 | if ($use_reversible_string_mappings) { |
1317 | - return (string) \str_replace( |
|
1318 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1319 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1317 | + return (string)\str_replace( |
|
1318 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1319 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1320 | 1320 | $str |
1321 | 1321 | ); |
1322 | 1322 | } |
1323 | 1323 | |
1324 | - return (string) \str_replace( |
|
1325 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1326 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1324 | + return (string)\str_replace( |
|
1325 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1326 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1327 | 1327 | $str |
1328 | 1328 | ); |
1329 | 1329 | } |
@@ -1389,7 +1389,7 @@ discard block |
||
1389 | 1389 | if ($to_encoding === 'JSON') { |
1390 | 1390 | $return = self::json_encode($str); |
1391 | 1391 | if ($return === false) { |
1392 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1392 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1393 | 1393 | } |
1394 | 1394 | |
1395 | 1395 | return $return; |
@@ -1479,7 +1479,7 @@ discard block |
||
1479 | 1479 | /** |
1480 | 1480 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
1481 | 1481 | */ |
1482 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
1482 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
1483 | 1483 | } |
1484 | 1484 | |
1485 | 1485 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1579,31 +1579,31 @@ discard block |
||
1579 | 1579 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1580 | 1580 | |
1581 | 1581 | if ($length === null) { |
1582 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2); |
|
1582 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2); |
|
1583 | 1583 | } |
1584 | 1584 | |
1585 | 1585 | if ($search === '') { |
1586 | 1586 | if ($encoding === 'UTF-8') { |
1587 | 1587 | if ($length > 0) { |
1588 | - $string_length = (int) \mb_strlen($str); |
|
1588 | + $string_length = (int)\mb_strlen($str); |
|
1589 | 1589 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1590 | 1590 | } else { |
1591 | 1591 | $end = 0; |
1592 | 1592 | } |
1593 | 1593 | |
1594 | - $pos = (int) \min( |
|
1594 | + $pos = (int)\min( |
|
1595 | 1595 | \mb_strpos($str, ' ', $end), |
1596 | 1596 | \mb_strpos($str, '.', $end) |
1597 | 1597 | ); |
1598 | 1598 | } else { |
1599 | 1599 | if ($length > 0) { |
1600 | - $string_length = (int) self::strlen($str, $encoding); |
|
1600 | + $string_length = (int)self::strlen($str, $encoding); |
|
1601 | 1601 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1602 | 1602 | } else { |
1603 | 1603 | $end = 0; |
1604 | 1604 | } |
1605 | 1605 | |
1606 | - $pos = (int) \min( |
|
1606 | + $pos = (int)\min( |
|
1607 | 1607 | self::strpos($str, ' ', $end, $encoding), |
1608 | 1608 | self::strpos($str, '.', $end, $encoding) |
1609 | 1609 | ); |
@@ -1620,18 +1620,18 @@ discard block |
||
1620 | 1620 | return ''; |
1621 | 1621 | } |
1622 | 1622 | |
1623 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1623 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1624 | 1624 | } |
1625 | 1625 | |
1626 | 1626 | return $str; |
1627 | 1627 | } |
1628 | 1628 | |
1629 | 1629 | if ($encoding === 'UTF-8') { |
1630 | - $word_position = (int) \mb_stripos($str, $search); |
|
1631 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1630 | + $word_position = (int)\mb_stripos($str, $search); |
|
1631 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1632 | 1632 | } else { |
1633 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
1634 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1633 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
1634 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1635 | 1635 | } |
1636 | 1636 | |
1637 | 1637 | $pos_start = 0; |
@@ -1643,12 +1643,12 @@ discard block |
||
1643 | 1643 | } |
1644 | 1644 | if ($half_text !== false) { |
1645 | 1645 | if ($encoding === 'UTF-8') { |
1646 | - $pos_start = (int) \max( |
|
1646 | + $pos_start = (int)\max( |
|
1647 | 1647 | \mb_strrpos($half_text, ' '), |
1648 | 1648 | \mb_strrpos($half_text, '.') |
1649 | 1649 | ); |
1650 | 1650 | } else { |
1651 | - $pos_start = (int) \max( |
|
1651 | + $pos_start = (int)\max( |
|
1652 | 1652 | self::strrpos($half_text, ' ', 0, $encoding), |
1653 | 1653 | self::strrpos($half_text, '.', 0, $encoding) |
1654 | 1654 | ); |
@@ -1658,19 +1658,19 @@ discard block |
||
1658 | 1658 | |
1659 | 1659 | if ($word_position && $half_side > 0) { |
1660 | 1660 | $offset = $pos_start + $length - 1; |
1661 | - $real_length = (int) self::strlen($str, $encoding); |
|
1661 | + $real_length = (int)self::strlen($str, $encoding); |
|
1662 | 1662 | |
1663 | 1663 | if ($offset > $real_length) { |
1664 | 1664 | $offset = $real_length; |
1665 | 1665 | } |
1666 | 1666 | |
1667 | 1667 | if ($encoding === 'UTF-8') { |
1668 | - $pos_end = (int) \min( |
|
1668 | + $pos_end = (int)\min( |
|
1669 | 1669 | \mb_strpos($str, ' ', $offset), |
1670 | 1670 | \mb_strpos($str, '.', $offset) |
1671 | 1671 | ) - $pos_start; |
1672 | 1672 | } else { |
1673 | - $pos_end = (int) \min( |
|
1673 | + $pos_end = (int)\min( |
|
1674 | 1674 | self::strpos($str, ' ', $offset, $encoding), |
1675 | 1675 | self::strpos($str, '.', $offset, $encoding) |
1676 | 1676 | ) - $pos_start; |
@@ -1678,12 +1678,12 @@ discard block |
||
1678 | 1678 | |
1679 | 1679 | if (!$pos_end || $pos_end <= 0) { |
1680 | 1680 | if ($encoding === 'UTF-8') { |
1681 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1681 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1682 | 1682 | } else { |
1683 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1683 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1684 | 1684 | } |
1685 | 1685 | if ($str_sub !== false) { |
1686 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
1686 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
1687 | 1687 | } else { |
1688 | 1688 | $extract = ''; |
1689 | 1689 | } |
@@ -1694,26 +1694,26 @@ discard block |
||
1694 | 1694 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
1695 | 1695 | } |
1696 | 1696 | if ($str_sub !== false) { |
1697 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1697 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1698 | 1698 | } else { |
1699 | 1699 | $extract = ''; |
1700 | 1700 | } |
1701 | 1701 | } |
1702 | 1702 | } else { |
1703 | 1703 | $offset = $length - 1; |
1704 | - $true_length = (int) self::strlen($str, $encoding); |
|
1704 | + $true_length = (int)self::strlen($str, $encoding); |
|
1705 | 1705 | |
1706 | 1706 | if ($offset > $true_length) { |
1707 | 1707 | $offset = $true_length; |
1708 | 1708 | } |
1709 | 1709 | |
1710 | 1710 | if ($encoding === 'UTF-8') { |
1711 | - $pos_end = (int) \min( |
|
1711 | + $pos_end = (int)\min( |
|
1712 | 1712 | \mb_strpos($str, ' ', $offset), |
1713 | 1713 | \mb_strpos($str, '.', $offset) |
1714 | 1714 | ); |
1715 | 1715 | } else { |
1716 | - $pos_end = (int) \min( |
|
1716 | + $pos_end = (int)\min( |
|
1717 | 1717 | self::strpos($str, ' ', $offset, $encoding), |
1718 | 1718 | self::strpos($str, '.', $offset, $encoding) |
1719 | 1719 | ); |
@@ -1726,7 +1726,7 @@ discard block |
||
1726 | 1726 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
1727 | 1727 | } |
1728 | 1728 | if ($str_sub !== false) { |
1729 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1729 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1730 | 1730 | } else { |
1731 | 1731 | $extract = ''; |
1732 | 1732 | } |
@@ -1859,7 +1859,7 @@ discard block |
||
1859 | 1859 | { |
1860 | 1860 | $file_content = \file_get_contents($file_path); |
1861 | 1861 | if ($file_content === false) { |
1862 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1862 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1863 | 1863 | } |
1864 | 1864 | |
1865 | 1865 | return self::string_has_bom($file_content); |
@@ -1925,7 +1925,7 @@ discard block |
||
1925 | 1925 | ) { |
1926 | 1926 | // Prevent leading combining chars |
1927 | 1927 | // for NFC-safe concatenations. |
1928 | - $var = $leading_combining . $var; |
|
1928 | + $var = $leading_combining.$var; |
|
1929 | 1929 | } |
1930 | 1930 | } |
1931 | 1931 | |
@@ -2244,10 +2244,10 @@ discard block |
||
2244 | 2244 | } |
2245 | 2245 | |
2246 | 2246 | if ($encoding === 'UTF-8') { |
2247 | - return (string) \mb_substr($str, 0, $n); |
|
2247 | + return (string)\mb_substr($str, 0, $n); |
|
2248 | 2248 | } |
2249 | 2249 | |
2250 | - return (string) self::substr($str, 0, $n, $encoding); |
|
2250 | + return (string)self::substr($str, 0, $n, $encoding); |
|
2251 | 2251 | } |
2252 | 2252 | |
2253 | 2253 | /** |
@@ -2265,7 +2265,7 @@ discard block |
||
2265 | 2265 | */ |
2266 | 2266 | public static function fits_inside(string $str, int $box_size): bool |
2267 | 2267 | { |
2268 | - return (int) self::strlen($str) <= $box_size; |
|
2268 | + return (int)self::strlen($str) <= $box_size; |
|
2269 | 2269 | } |
2270 | 2270 | |
2271 | 2271 | /** |
@@ -2348,7 +2348,7 @@ discard block |
||
2348 | 2348 | return $str; |
2349 | 2349 | } |
2350 | 2350 | |
2351 | - $str = (string) $str; |
|
2351 | + $str = (string)$str; |
|
2352 | 2352 | $last = ''; |
2353 | 2353 | while ($last !== $str) { |
2354 | 2354 | $last = $str; |
@@ -2557,7 +2557,7 @@ discard block |
||
2557 | 2557 | return $fallback; |
2558 | 2558 | } |
2559 | 2559 | /** @noinspection OffsetOperationsInspection */ |
2560 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2560 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2561 | 2561 | |
2562 | 2562 | // DEBUG |
2563 | 2563 | //var_dump($type_code); |
@@ -2615,7 +2615,7 @@ discard block |
||
2615 | 2615 | // |
2616 | 2616 | |
2617 | 2617 | if ($encoding === 'UTF-8') { |
2618 | - $max_length = (int) \mb_strlen($possible_chars); |
|
2618 | + $max_length = (int)\mb_strlen($possible_chars); |
|
2619 | 2619 | if ($max_length === 0) { |
2620 | 2620 | return ''; |
2621 | 2621 | } |
@@ -2636,7 +2636,7 @@ discard block |
||
2636 | 2636 | } else { |
2637 | 2637 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2638 | 2638 | |
2639 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
2639 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
2640 | 2640 | if ($max_length === 0) { |
2641 | 2641 | return ''; |
2642 | 2642 | } |
@@ -2674,16 +2674,16 @@ discard block |
||
2674 | 2674 | $rand_int = \mt_rand(0, \mt_getrandmax()); |
2675 | 2675 | } |
2676 | 2676 | |
2677 | - $unique_helper = $rand_int . |
|
2678 | - \session_id() . |
|
2679 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2680 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2677 | + $unique_helper = $rand_int. |
|
2678 | + \session_id(). |
|
2679 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2680 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2681 | 2681 | $extra_entropy; |
2682 | 2682 | |
2683 | 2683 | $unique_string = \uniqid($unique_helper, true); |
2684 | 2684 | |
2685 | 2685 | if ($use_md5) { |
2686 | - $unique_string = \md5($unique_string . $unique_helper); |
|
2686 | + $unique_string = \md5($unique_string.$unique_helper); |
|
2687 | 2687 | } |
2688 | 2688 | |
2689 | 2689 | return $unique_string; |
@@ -2781,7 +2781,7 @@ discard block |
||
2781 | 2781 | public static function hex_to_chr(string $hexdec) |
2782 | 2782 | { |
2783 | 2783 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Invalid characters passed for attempted conversion, these have been ignored */ |
2784 | - return self::decimal_to_chr((int) @\hexdec($hexdec)); |
|
2784 | + return self::decimal_to_chr((int)@\hexdec($hexdec)); |
|
2785 | 2785 | } |
2786 | 2786 | |
2787 | 2787 | /** |
@@ -2801,7 +2801,7 @@ discard block |
||
2801 | 2801 | public static function hex_to_int($hexdec) |
2802 | 2802 | { |
2803 | 2803 | // init |
2804 | - $hexdec = (string) $hexdec; |
|
2804 | + $hexdec = (string)$hexdec; |
|
2805 | 2805 | |
2806 | 2806 | if ($hexdec === '') { |
2807 | 2807 | return false; |
@@ -2900,7 +2900,7 @@ discard block |
||
2900 | 2900 | return \implode( |
2901 | 2901 | '', |
2902 | 2902 | \array_map( |
2903 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2903 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2904 | 2904 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
2905 | 2905 | }, |
2906 | 2906 | self::str_split($str) |
@@ -3014,7 +3014,7 @@ discard block |
||
3014 | 3014 | /** |
3015 | 3015 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
3016 | 3016 | */ |
3017 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
3017 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
3018 | 3018 | } |
3019 | 3019 | |
3020 | 3020 | do { |
@@ -3023,7 +3023,7 @@ discard block |
||
3023 | 3023 | if (\strpos($str, '&') !== false) { |
3024 | 3024 | if (\strpos($str, '&#') !== false) { |
3025 | 3025 | // decode also numeric & UTF16 two byte entities |
3026 | - $str = (string) \preg_replace( |
|
3026 | + $str = (string)\preg_replace( |
|
3027 | 3027 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
3028 | 3028 | '$1;', |
3029 | 3029 | $str |
@@ -3073,7 +3073,7 @@ discard block |
||
3073 | 3073 | */ |
3074 | 3074 | public static function html_stripe_empty_tags(string $str): string |
3075 | 3075 | { |
3076 | - return (string) \preg_replace( |
|
3076 | + return (string)\preg_replace( |
|
3077 | 3077 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
3078 | 3078 | '', |
3079 | 3079 | $str |
@@ -3401,9 +3401,9 @@ discard block |
||
3401 | 3401 | { |
3402 | 3402 | $hex = \dechex($int); |
3403 | 3403 | |
3404 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
3404 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
3405 | 3405 | |
3406 | - return $prefix . $hex . ''; |
|
3406 | + return $prefix.$hex.''; |
|
3407 | 3407 | } |
3408 | 3408 | |
3409 | 3409 | /** |
@@ -3727,7 +3727,7 @@ discard block |
||
3727 | 3727 | */ |
3728 | 3728 | public static function is_binary($input, bool $strict = false): bool |
3729 | 3729 | { |
3730 | - $input = (string) $input; |
|
3730 | + $input = (string)$input; |
|
3731 | 3731 | if ($input === '') { |
3732 | 3732 | return false; |
3733 | 3733 | } |
@@ -4087,7 +4087,7 @@ discard block |
||
4087 | 4087 | public static function is_utf16($str, bool $check_if_string_is_binary = true) |
4088 | 4088 | { |
4089 | 4089 | // init |
4090 | - $str = (string) $str; |
|
4090 | + $str = (string)$str; |
|
4091 | 4091 | $str_chars = []; |
4092 | 4092 | |
4093 | 4093 | if ( |
@@ -4181,7 +4181,7 @@ discard block |
||
4181 | 4181 | public static function is_utf32($str, bool $check_if_string_is_binary = true) |
4182 | 4182 | { |
4183 | 4183 | // init |
4184 | - $str = (string) $str; |
|
4184 | + $str = (string)$str; |
|
4185 | 4185 | $str_chars = []; |
4186 | 4186 | |
4187 | 4187 | if ( |
@@ -4279,7 +4279,7 @@ discard block |
||
4279 | 4279 | return true; |
4280 | 4280 | } |
4281 | 4281 | |
4282 | - return self::is_utf8_string((string) $str, $strict); |
|
4282 | + return self::is_utf8_string((string)$str, $strict); |
|
4283 | 4283 | } |
4284 | 4284 | |
4285 | 4285 | /** |
@@ -4435,15 +4435,15 @@ discard block |
||
4435 | 4435 | $use_mb_functions = ($lang === null && !$try_to_keep_the_string_length); |
4436 | 4436 | |
4437 | 4437 | if ($encoding === 'UTF-8') { |
4438 | - $str_part_two = (string) \mb_substr($str, 1); |
|
4438 | + $str_part_two = (string)\mb_substr($str, 1); |
|
4439 | 4439 | |
4440 | 4440 | if ($use_mb_functions) { |
4441 | 4441 | $str_part_one = \mb_strtolower( |
4442 | - (string) \mb_substr($str, 0, 1) |
|
4442 | + (string)\mb_substr($str, 0, 1) |
|
4443 | 4443 | ); |
4444 | 4444 | } else { |
4445 | 4445 | $str_part_one = self::strtolower( |
4446 | - (string) \mb_substr($str, 0, 1), |
|
4446 | + (string)\mb_substr($str, 0, 1), |
|
4447 | 4447 | $encoding, |
4448 | 4448 | false, |
4449 | 4449 | $lang, |
@@ -4453,10 +4453,10 @@ discard block |
||
4453 | 4453 | } else { |
4454 | 4454 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4455 | 4455 | |
4456 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
4456 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
4457 | 4457 | |
4458 | 4458 | $str_part_one = self::strtolower( |
4459 | - (string) self::substr($str, 0, 1, $encoding), |
|
4459 | + (string)self::substr($str, 0, 1, $encoding), |
|
4460 | 4460 | $encoding, |
4461 | 4461 | false, |
4462 | 4462 | $lang, |
@@ -4464,7 +4464,7 @@ discard block |
||
4464 | 4464 | ); |
4465 | 4465 | } |
4466 | 4466 | |
4467 | - return $str_part_one . $str_part_two; |
|
4467 | + return $str_part_one.$str_part_two; |
|
4468 | 4468 | } |
4469 | 4469 | |
4470 | 4470 | /** |
@@ -4613,7 +4613,7 @@ discard block |
||
4613 | 4613 | } |
4614 | 4614 | |
4615 | 4615 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4616 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4616 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4617 | 4617 | } |
4618 | 4618 | |
4619 | 4619 | if ($chars !== null) { |
@@ -4650,7 +4650,7 @@ discard block |
||
4650 | 4650 | |
4651 | 4651 | $codepoint_max = \max($codepoints); |
4652 | 4652 | |
4653 | - return self::chr((int) $codepoint_max); |
|
4653 | + return self::chr((int)$codepoint_max); |
|
4654 | 4654 | } |
4655 | 4655 | |
4656 | 4656 | /** |
@@ -4670,7 +4670,7 @@ discard block |
||
4670 | 4670 | { |
4671 | 4671 | $bytes = self::chr_size_list($str); |
4672 | 4672 | if ($bytes !== []) { |
4673 | - return (int) \max($bytes); |
|
4673 | + return (int)\max($bytes); |
|
4674 | 4674 | } |
4675 | 4675 | |
4676 | 4676 | return 0; |
@@ -4714,7 +4714,7 @@ discard block |
||
4714 | 4714 | |
4715 | 4715 | $codepoint_min = \min($codepoints); |
4716 | 4716 | |
4717 | - return self::chr((int) $codepoint_min); |
|
4717 | + return self::chr((int)$codepoint_min); |
|
4718 | 4718 | } |
4719 | 4719 | |
4720 | 4720 | /** |
@@ -4762,7 +4762,7 @@ discard block |
||
4762 | 4762 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4763 | 4763 | |
4764 | 4764 | // init |
4765 | - $encoding = (string) $encoding; |
|
4765 | + $encoding = (string)$encoding; |
|
4766 | 4766 | |
4767 | 4767 | if (!$encoding) { |
4768 | 4768 | return $fallback; |
@@ -4824,7 +4824,7 @@ discard block |
||
4824 | 4824 | |
4825 | 4825 | $encoding_original = $encoding; |
4826 | 4826 | $encoding = \strtoupper($encoding); |
4827 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4827 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4828 | 4828 | |
4829 | 4829 | $equivalences = [ |
4830 | 4830 | 'ISO8859' => 'ISO-8859-1', |
@@ -4988,13 +4988,13 @@ discard block |
||
4988 | 4988 | static $CHAR_CACHE = []; |
4989 | 4989 | |
4990 | 4990 | // init |
4991 | - $chr = (string) $chr; |
|
4991 | + $chr = (string)$chr; |
|
4992 | 4992 | |
4993 | 4993 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
4994 | 4994 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4995 | 4995 | } |
4996 | 4996 | |
4997 | - $cache_key = $chr . '_' . $encoding; |
|
4997 | + $cache_key = $chr.'_'.$encoding; |
|
4998 | 4998 | if (isset($CHAR_CACHE[$cache_key])) { |
4999 | 4999 | return $CHAR_CACHE[$cache_key]; |
5000 | 5000 | } |
@@ -5029,7 +5029,7 @@ discard block |
||
5029 | 5029 | // |
5030 | 5030 | |
5031 | 5031 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
5032 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
5032 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
5033 | 5033 | /** @noinspection OffsetOperationsInspection */ |
5034 | 5034 | $code = $chr ? $chr[1] : 0; |
5035 | 5035 | |
@@ -5037,21 +5037,21 @@ discard block |
||
5037 | 5037 | if ($code >= 0xF0 && isset($chr[4])) { |
5038 | 5038 | /** @noinspection UnnecessaryCastingInspection */ |
5039 | 5039 | /** @noinspection OffsetOperationsInspection */ |
5040 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
5040 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
5041 | 5041 | } |
5042 | 5042 | |
5043 | 5043 | /** @noinspection OffsetOperationsInspection */ |
5044 | 5044 | if ($code >= 0xE0 && isset($chr[3])) { |
5045 | 5045 | /** @noinspection UnnecessaryCastingInspection */ |
5046 | 5046 | /** @noinspection OffsetOperationsInspection */ |
5047 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
5047 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
5048 | 5048 | } |
5049 | 5049 | |
5050 | 5050 | /** @noinspection OffsetOperationsInspection */ |
5051 | 5051 | if ($code >= 0xC0 && isset($chr[2])) { |
5052 | 5052 | /** @noinspection UnnecessaryCastingInspection */ |
5053 | 5053 | /** @noinspection OffsetOperationsInspection */ |
5054 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
5054 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
5055 | 5055 | } |
5056 | 5056 | |
5057 | 5057 | return $CHAR_CACHE[$cache_key] = $code; |
@@ -5113,7 +5113,7 @@ discard block |
||
5113 | 5113 | public static function pcre_utf8_support(): bool |
5114 | 5114 | { |
5115 | 5115 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5116 | - return (bool) @\preg_match('//u', ''); |
|
5116 | + return (bool)@\preg_match('//u', ''); |
|
5117 | 5117 | } |
5118 | 5118 | |
5119 | 5119 | /** |
@@ -5154,14 +5154,14 @@ discard block |
||
5154 | 5154 | * @psalm-suppress DocblockTypeContradiction |
5155 | 5155 | */ |
5156 | 5156 | if (!\is_numeric($step)) { |
5157 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
5157 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
5158 | 5158 | } |
5159 | 5159 | |
5160 | 5160 | /** |
5161 | 5161 | * @psalm-suppress RedundantConditionGivenDocblockType - false-positive from psalm? |
5162 | 5162 | */ |
5163 | 5163 | if ($step <= 0) { |
5164 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
5164 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
5165 | 5165 | } |
5166 | 5166 | } |
5167 | 5167 | |
@@ -5173,16 +5173,16 @@ discard block |
||
5173 | 5173 | $is_xdigit = false; |
5174 | 5174 | |
5175 | 5175 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5176 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
5176 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
5177 | 5177 | $is_digit = true; |
5178 | - $start = (int) $var1; |
|
5178 | + $start = (int)$var1; |
|
5179 | 5179 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
5180 | 5180 | $is_xdigit = true; |
5181 | - $start = (int) self::hex_to_int((string) $var1); |
|
5181 | + $start = (int)self::hex_to_int((string)$var1); |
|
5182 | 5182 | } elseif (!$use_ctype && \is_numeric($var1)) { |
5183 | - $start = (int) $var1; |
|
5183 | + $start = (int)$var1; |
|
5184 | 5184 | } else { |
5185 | - $start = self::ord((string) $var1); |
|
5185 | + $start = self::ord((string)$var1); |
|
5186 | 5186 | } |
5187 | 5187 | |
5188 | 5188 | if (!$start) { |
@@ -5190,13 +5190,13 @@ discard block |
||
5190 | 5190 | } |
5191 | 5191 | |
5192 | 5192 | if ($is_digit) { |
5193 | - $end = (int) $var2; |
|
5193 | + $end = (int)$var2; |
|
5194 | 5194 | } elseif ($is_xdigit) { |
5195 | - $end = (int) self::hex_to_int((string) $var2); |
|
5195 | + $end = (int)self::hex_to_int((string)$var2); |
|
5196 | 5196 | } elseif (!$use_ctype && \is_numeric($var2)) { |
5197 | - $end = (int) $var2; |
|
5197 | + $end = (int)$var2; |
|
5198 | 5198 | } else { |
5199 | - $end = self::ord((string) $var2); |
|
5199 | + $end = self::ord((string)$var2); |
|
5200 | 5200 | } |
5201 | 5201 | |
5202 | 5202 | if (!$end) { |
@@ -5205,7 +5205,7 @@ discard block |
||
5205 | 5205 | |
5206 | 5206 | $array = []; |
5207 | 5207 | foreach (\range($start, $end, $step) as $i) { |
5208 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
5208 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
5209 | 5209 | } |
5210 | 5210 | |
5211 | 5211 | return $array; |
@@ -5317,8 +5317,8 @@ discard block |
||
5317 | 5317 | $delimiter = '/'; |
5318 | 5318 | } |
5319 | 5319 | |
5320 | - return (string) \preg_replace( |
|
5321 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
5320 | + return (string)\preg_replace( |
|
5321 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
5322 | 5322 | $replacement, |
5323 | 5323 | $str |
5324 | 5324 | ); |
@@ -5368,9 +5368,9 @@ discard block |
||
5368 | 5368 | return ''; |
5369 | 5369 | } |
5370 | 5370 | |
5371 | - $str_length -= (int) $bom_byte_length; |
|
5371 | + $str_length -= (int)$bom_byte_length; |
|
5372 | 5372 | |
5373 | - $str = (string) $str_tmp; |
|
5373 | + $str = (string)$str_tmp; |
|
5374 | 5374 | } |
5375 | 5375 | } |
5376 | 5376 | |
@@ -5401,7 +5401,7 @@ discard block |
||
5401 | 5401 | */ |
5402 | 5402 | if (\is_array($what)) { |
5403 | 5403 | foreach ($what as $item) { |
5404 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
5404 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
5405 | 5405 | } |
5406 | 5406 | } |
5407 | 5407 | |
@@ -5439,7 +5439,7 @@ discard block |
||
5439 | 5439 | */ |
5440 | 5440 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
5441 | 5441 | { |
5442 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
5442 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
5443 | 5443 | } |
5444 | 5444 | |
5445 | 5445 | /** |
@@ -5496,17 +5496,17 @@ discard block |
||
5496 | 5496 | ): string { |
5497 | 5497 | if ($substring && \strpos($str, $substring) === 0) { |
5498 | 5498 | if ($encoding === 'UTF-8') { |
5499 | - return (string) \mb_substr( |
|
5499 | + return (string)\mb_substr( |
|
5500 | 5500 | $str, |
5501 | - (int) \mb_strlen($substring) |
|
5501 | + (int)\mb_strlen($substring) |
|
5502 | 5502 | ); |
5503 | 5503 | } |
5504 | 5504 | |
5505 | 5505 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5506 | 5506 | |
5507 | - return (string) self::substr( |
|
5507 | + return (string)self::substr( |
|
5508 | 5508 | $str, |
5509 | - (int) self::strlen($substring, $encoding), |
|
5509 | + (int)self::strlen($substring, $encoding), |
|
5510 | 5510 | null, |
5511 | 5511 | $encoding |
5512 | 5512 | ); |
@@ -5534,19 +5534,19 @@ discard block |
||
5534 | 5534 | ): string { |
5535 | 5535 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
5536 | 5536 | if ($encoding === 'UTF-8') { |
5537 | - return (string) \mb_substr( |
|
5537 | + return (string)\mb_substr( |
|
5538 | 5538 | $str, |
5539 | 5539 | 0, |
5540 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
5540 | + (int)\mb_strlen($str) - (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 | 5548 | 0, |
5549 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
5549 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
5550 | 5550 | $encoding |
5551 | 5551 | ); |
5552 | 5552 | } |
@@ -5648,7 +5648,7 @@ discard block |
||
5648 | 5648 | /** @noinspection PhpUsageOfSilenceOperatorInspection - ignore "Unknown character" warnings, it's working anyway */ |
5649 | 5649 | @\mb_substitute_character($replacement_char_helper); |
5650 | 5650 | // the polyfill maybe return false, so cast to string |
5651 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
5651 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
5652 | 5652 | \mb_substitute_character($save); |
5653 | 5653 | } |
5654 | 5654 | |
@@ -5694,7 +5694,7 @@ discard block |
||
5694 | 5694 | } |
5695 | 5695 | |
5696 | 5696 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5697 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
5697 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
5698 | 5698 | } |
5699 | 5699 | |
5700 | 5700 | if ($chars !== null) { |
@@ -5724,7 +5724,7 @@ discard block |
||
5724 | 5724 | $html .= '<pre>'; |
5725 | 5725 | /** @noinspection AlterInForeachInspection */ |
5726 | 5726 | foreach (self::$SUPPORT as $key => &$value) { |
5727 | - $html .= $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
5727 | + $html .= $key.' - '.\print_r($value, true)."\n<br>"; |
|
5728 | 5728 | } |
5729 | 5729 | $html .= '</pre>'; |
5730 | 5730 | |
@@ -5766,7 +5766,7 @@ discard block |
||
5766 | 5766 | return $char; |
5767 | 5767 | } |
5768 | 5768 | |
5769 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
5769 | + return '&#'.self::ord($char, $encoding).';'; |
|
5770 | 5770 | } |
5771 | 5771 | |
5772 | 5772 | /** |
@@ -5870,11 +5870,11 @@ discard block |
||
5870 | 5870 | $lang, |
5871 | 5871 | $try_to_keep_the_string_length |
5872 | 5872 | ); |
5873 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5873 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5874 | 5874 | |
5875 | 5875 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
5876 | 5876 | |
5877 | - $str = (string) \preg_replace_callback( |
|
5877 | + $str = (string)\preg_replace_callback( |
|
5878 | 5878 | '/[-_\\s]+(.)?/u', |
5879 | 5879 | /** |
5880 | 5880 | * @param array $match |
@@ -5883,7 +5883,7 @@ discard block |
||
5883 | 5883 | * |
5884 | 5884 | * @return string |
5885 | 5885 | */ |
5886 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5886 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5887 | 5887 | if (isset($match[1])) { |
5888 | 5888 | if ($use_mb_functions) { |
5889 | 5889 | if ($encoding === 'UTF-8') { |
@@ -5901,7 +5901,7 @@ discard block |
||
5901 | 5901 | $str |
5902 | 5902 | ); |
5903 | 5903 | |
5904 | - return (string) \preg_replace_callback( |
|
5904 | + return (string)\preg_replace_callback( |
|
5905 | 5905 | '/[\\p{N}]+(.)?/u', |
5906 | 5906 | /** |
5907 | 5907 | * @param array $match |
@@ -5910,7 +5910,7 @@ discard block |
||
5910 | 5910 | * |
5911 | 5911 | * @return string |
5912 | 5912 | */ |
5913 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5913 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5914 | 5914 | if ($use_mb_functions) { |
5915 | 5915 | if ($encoding === 'UTF-8') { |
5916 | 5916 | return \mb_strtoupper($match[0]); |
@@ -6102,7 +6102,7 @@ discard block |
||
6102 | 6102 | ): string { |
6103 | 6103 | if (self::$SUPPORT['mbstring'] === true) { |
6104 | 6104 | /** @noinspection PhpComposerExtensionStubsInspection */ |
6105 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
6105 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
6106 | 6106 | |
6107 | 6107 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
6108 | 6108 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -6112,10 +6112,10 @@ discard block |
||
6112 | 6112 | } |
6113 | 6113 | |
6114 | 6114 | /** @noinspection PhpComposerExtensionStubsInspection */ |
6115 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
6115 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
6116 | 6116 | } |
6117 | 6117 | |
6118 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
6118 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
6119 | 6119 | |
6120 | 6120 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
6121 | 6121 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -6124,7 +6124,7 @@ discard block |
||
6124 | 6124 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
6125 | 6125 | } |
6126 | 6126 | |
6127 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
6127 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
6128 | 6128 | } |
6129 | 6129 | |
6130 | 6130 | /** |
@@ -6146,7 +6146,7 @@ discard block |
||
6146 | 6146 | public static function str_detect_encoding($str) |
6147 | 6147 | { |
6148 | 6148 | // init |
6149 | - $str = (string) $str; |
|
6149 | + $str = (string)$str; |
|
6150 | 6150 | |
6151 | 6151 | // |
6152 | 6152 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -6248,7 +6248,7 @@ discard block |
||
6248 | 6248 | foreach (self::$ENCODINGS as $encoding_tmp) { |
6249 | 6249 | // INFO: //IGNORE but still throw notice |
6250 | 6250 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
6251 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
6251 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
6252 | 6252 | return $encoding_tmp; |
6253 | 6253 | } |
6254 | 6254 | } |
@@ -6350,7 +6350,7 @@ discard block |
||
6350 | 6350 | return $str; |
6351 | 6351 | } |
6352 | 6352 | |
6353 | - return $substring . $str; |
|
6353 | + return $substring.$str; |
|
6354 | 6354 | } |
6355 | 6355 | |
6356 | 6356 | /** |
@@ -6646,27 +6646,27 @@ discard block |
||
6646 | 6646 | string $encoding = 'UTF-8' |
6647 | 6647 | ): string { |
6648 | 6648 | if ($encoding === 'UTF-8') { |
6649 | - $len = (int) \mb_strlen($str); |
|
6649 | + $len = (int)\mb_strlen($str); |
|
6650 | 6650 | if ($index > $len) { |
6651 | 6651 | return $str; |
6652 | 6652 | } |
6653 | 6653 | |
6654 | 6654 | /** @noinspection UnnecessaryCastingInspection */ |
6655 | - return (string) \mb_substr($str, 0, $index) . |
|
6656 | - $substring . |
|
6657 | - (string) \mb_substr($str, $index, $len); |
|
6655 | + return (string)\mb_substr($str, 0, $index). |
|
6656 | + $substring. |
|
6657 | + (string)\mb_substr($str, $index, $len); |
|
6658 | 6658 | } |
6659 | 6659 | |
6660 | 6660 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6661 | 6661 | |
6662 | - $len = (int) self::strlen($str, $encoding); |
|
6662 | + $len = (int)self::strlen($str, $encoding); |
|
6663 | 6663 | if ($index > $len) { |
6664 | 6664 | return $str; |
6665 | 6665 | } |
6666 | 6666 | |
6667 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
6668 | - $substring . |
|
6669 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
6667 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
6668 | + $substring. |
|
6669 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
6670 | 6670 | } |
6671 | 6671 | |
6672 | 6672 | /** |
@@ -6705,15 +6705,15 @@ discard block |
||
6705 | 6705 | */ |
6706 | 6706 | public static function str_ireplace($search, $replacement, $subject, &$count = null) |
6707 | 6707 | { |
6708 | - $search = (array) $search; |
|
6708 | + $search = (array)$search; |
|
6709 | 6709 | |
6710 | 6710 | /** @noinspection AlterInForeachInspection */ |
6711 | 6711 | foreach ($search as &$s) { |
6712 | - $s = (string) $s; |
|
6712 | + $s = (string)$s; |
|
6713 | 6713 | if ($s === '') { |
6714 | 6714 | $s = '/^(?<=.)$/'; |
6715 | 6715 | } else { |
6716 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
6716 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
6717 | 6717 | } |
6718 | 6718 | } |
6719 | 6719 | |
@@ -6750,11 +6750,11 @@ discard block |
||
6750 | 6750 | } |
6751 | 6751 | |
6752 | 6752 | if ($search === '') { |
6753 | - return $str . $replacement; |
|
6753 | + return $str.$replacement; |
|
6754 | 6754 | } |
6755 | 6755 | |
6756 | 6756 | if (\stripos($str, $search) === 0) { |
6757 | - return $replacement . \substr($str, \strlen($search)); |
|
6757 | + return $replacement.\substr($str, \strlen($search)); |
|
6758 | 6758 | } |
6759 | 6759 | |
6760 | 6760 | return $str; |
@@ -6785,11 +6785,11 @@ discard block |
||
6785 | 6785 | } |
6786 | 6786 | |
6787 | 6787 | if ($search === '') { |
6788 | - return $str . $replacement; |
|
6788 | + return $str.$replacement; |
|
6789 | 6789 | } |
6790 | 6790 | |
6791 | 6791 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6792 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6792 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6793 | 6793 | } |
6794 | 6794 | |
6795 | 6795 | return $str; |
@@ -6880,15 +6880,15 @@ discard block |
||
6880 | 6880 | } |
6881 | 6881 | |
6882 | 6882 | if ($encoding === 'UTF-8') { |
6883 | - return (string) \mb_substr( |
|
6883 | + return (string)\mb_substr( |
|
6884 | 6884 | $str, |
6885 | - $offset + (int) \mb_strlen($separator) |
|
6885 | + $offset + (int)\mb_strlen($separator) |
|
6886 | 6886 | ); |
6887 | 6887 | } |
6888 | 6888 | |
6889 | - return (string) self::substr( |
|
6889 | + return (string)self::substr( |
|
6890 | 6890 | $str, |
6891 | - $offset + (int) self::strlen($separator, $encoding), |
|
6891 | + $offset + (int)self::strlen($separator, $encoding), |
|
6892 | 6892 | null, |
6893 | 6893 | $encoding |
6894 | 6894 | ); |
@@ -6920,15 +6920,15 @@ discard block |
||
6920 | 6920 | } |
6921 | 6921 | |
6922 | 6922 | if ($encoding === 'UTF-8') { |
6923 | - return (string) \mb_substr( |
|
6923 | + return (string)\mb_substr( |
|
6924 | 6924 | $str, |
6925 | - $offset + (int) self::strlen($separator) |
|
6925 | + $offset + (int)self::strlen($separator) |
|
6926 | 6926 | ); |
6927 | 6927 | } |
6928 | 6928 | |
6929 | - return (string) self::substr( |
|
6929 | + return (string)self::substr( |
|
6930 | 6930 | $str, |
6931 | - $offset + (int) self::strlen($separator, $encoding), |
|
6931 | + $offset + (int)self::strlen($separator, $encoding), |
|
6932 | 6932 | null, |
6933 | 6933 | $encoding |
6934 | 6934 | ); |
@@ -6960,10 +6960,10 @@ discard block |
||
6960 | 6960 | } |
6961 | 6961 | |
6962 | 6962 | if ($encoding === 'UTF-8') { |
6963 | - return (string) \mb_substr($str, 0, $offset); |
|
6963 | + return (string)\mb_substr($str, 0, $offset); |
|
6964 | 6964 | } |
6965 | 6965 | |
6966 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6966 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6967 | 6967 | } |
6968 | 6968 | |
6969 | 6969 | /** |
@@ -6992,7 +6992,7 @@ discard block |
||
6992 | 6992 | return ''; |
6993 | 6993 | } |
6994 | 6994 | |
6995 | - return (string) \mb_substr($str, 0, $offset); |
|
6995 | + return (string)\mb_substr($str, 0, $offset); |
|
6996 | 6996 | } |
6997 | 6997 | |
6998 | 6998 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -7000,7 +7000,7 @@ discard block |
||
7000 | 7000 | return ''; |
7001 | 7001 | } |
7002 | 7002 | |
7003 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
7003 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
7004 | 7004 | } |
7005 | 7005 | |
7006 | 7006 | /** |
@@ -7102,12 +7102,12 @@ discard block |
||
7102 | 7102 | } |
7103 | 7103 | |
7104 | 7104 | if ($encoding === 'UTF-8') { |
7105 | - return (string) \mb_substr($str, -$n); |
|
7105 | + return (string)\mb_substr($str, -$n); |
|
7106 | 7106 | } |
7107 | 7107 | |
7108 | 7108 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7109 | 7109 | |
7110 | - return (string) self::substr($str, -$n, null, $encoding); |
|
7110 | + return (string)self::substr($str, -$n, null, $encoding); |
|
7111 | 7111 | } |
7112 | 7112 | |
7113 | 7113 | /** |
@@ -7133,21 +7133,21 @@ discard block |
||
7133 | 7133 | } |
7134 | 7134 | |
7135 | 7135 | if ($encoding === 'UTF-8') { |
7136 | - if ((int) \mb_strlen($str) <= $length) { |
|
7136 | + if ((int)\mb_strlen($str) <= $length) { |
|
7137 | 7137 | return $str; |
7138 | 7138 | } |
7139 | 7139 | |
7140 | 7140 | /** @noinspection UnnecessaryCastingInspection */ |
7141 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
7141 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
7142 | 7142 | } |
7143 | 7143 | |
7144 | 7144 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7145 | 7145 | |
7146 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
7146 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
7147 | 7147 | return $str; |
7148 | 7148 | } |
7149 | 7149 | |
7150 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
7150 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
7151 | 7151 | } |
7152 | 7152 | |
7153 | 7153 | /** |
@@ -7176,12 +7176,12 @@ discard block |
||
7176 | 7176 | |
7177 | 7177 | if ($encoding === 'UTF-8') { |
7178 | 7178 | /** @noinspection UnnecessaryCastingInspection */ |
7179 | - if ((int) \mb_strlen($str) <= $length) { |
|
7179 | + if ((int)\mb_strlen($str) <= $length) { |
|
7180 | 7180 | return $str; |
7181 | 7181 | } |
7182 | 7182 | |
7183 | 7183 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
7184 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
7184 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
7185 | 7185 | } |
7186 | 7186 | |
7187 | 7187 | $str = \mb_substr($str, 0, $length); |
@@ -7190,33 +7190,33 @@ discard block |
||
7190 | 7190 | $new_str = \implode(' ', $array); |
7191 | 7191 | |
7192 | 7192 | if ($new_str === '') { |
7193 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
7193 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
7194 | 7194 | } |
7195 | 7195 | } else { |
7196 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
7196 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
7197 | 7197 | return $str; |
7198 | 7198 | } |
7199 | 7199 | |
7200 | 7200 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
7201 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
7201 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
7202 | 7202 | } |
7203 | 7203 | |
7204 | 7204 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
7205 | 7205 | $str = self::substr($str, 0, $length, $encoding); |
7206 | 7206 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
7207 | 7207 | if ($str === false) { |
7208 | - return '' . $str_add_on; |
|
7208 | + return ''.$str_add_on; |
|
7209 | 7209 | } |
7210 | 7210 | |
7211 | 7211 | $array = \explode(' ', $str, -1); |
7212 | 7212 | $new_str = \implode(' ', $array); |
7213 | 7213 | |
7214 | 7214 | if ($new_str === '') { |
7215 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
7215 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
7216 | 7216 | } |
7217 | 7217 | } |
7218 | 7218 | |
7219 | - return $new_str . $str_add_on; |
|
7219 | + return $new_str.$str_add_on; |
|
7220 | 7220 | } |
7221 | 7221 | |
7222 | 7222 | /** |
@@ -7239,7 +7239,7 @@ discard block |
||
7239 | 7239 | $longest_common_prefix = ''; |
7240 | 7240 | |
7241 | 7241 | if ($encoding === 'UTF-8') { |
7242 | - $max_length = (int) \min( |
|
7242 | + $max_length = (int)\min( |
|
7243 | 7243 | \mb_strlen($str1), |
7244 | 7244 | \mb_strlen($str2) |
7245 | 7245 | ); |
@@ -7260,7 +7260,7 @@ discard block |
||
7260 | 7260 | } else { |
7261 | 7261 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7262 | 7262 | |
7263 | - $max_length = (int) \min( |
|
7263 | + $max_length = (int)\min( |
|
7264 | 7264 | self::strlen($str1, $encoding), |
7265 | 7265 | self::strlen($str2, $encoding) |
7266 | 7266 | ); |
@@ -7309,13 +7309,13 @@ discard block |
||
7309 | 7309 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
7310 | 7310 | |
7311 | 7311 | if ($encoding === 'UTF-8') { |
7312 | - $str_length = (int) \mb_strlen($str1); |
|
7313 | - $other_length = (int) \mb_strlen($str2); |
|
7312 | + $str_length = (int)\mb_strlen($str1); |
|
7313 | + $other_length = (int)\mb_strlen($str2); |
|
7314 | 7314 | } else { |
7315 | 7315 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7316 | 7316 | |
7317 | - $str_length = (int) self::strlen($str1, $encoding); |
|
7318 | - $other_length = (int) self::strlen($str2, $encoding); |
|
7317 | + $str_length = (int)self::strlen($str1, $encoding); |
|
7318 | + $other_length = (int)self::strlen($str2, $encoding); |
|
7319 | 7319 | } |
7320 | 7320 | |
7321 | 7321 | // Return if either string is empty |
@@ -7368,10 +7368,10 @@ discard block |
||
7368 | 7368 | } |
7369 | 7369 | |
7370 | 7370 | if ($encoding === 'UTF-8') { |
7371 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
7371 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
7372 | 7372 | } |
7373 | 7373 | |
7374 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
7374 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
7375 | 7375 | } |
7376 | 7376 | |
7377 | 7377 | /** |
@@ -7395,7 +7395,7 @@ discard block |
||
7395 | 7395 | } |
7396 | 7396 | |
7397 | 7397 | if ($encoding === 'UTF-8') { |
7398 | - $max_length = (int) \min( |
|
7398 | + $max_length = (int)\min( |
|
7399 | 7399 | \mb_strlen($str1, $encoding), |
7400 | 7400 | \mb_strlen($str2, $encoding) |
7401 | 7401 | ); |
@@ -7409,7 +7409,7 @@ discard block |
||
7409 | 7409 | && |
7410 | 7410 | $char === \mb_substr($str2, -$i, 1) |
7411 | 7411 | ) { |
7412 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
7412 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
7413 | 7413 | } else { |
7414 | 7414 | break; |
7415 | 7415 | } |
@@ -7417,7 +7417,7 @@ discard block |
||
7417 | 7417 | } else { |
7418 | 7418 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7419 | 7419 | |
7420 | - $max_length = (int) \min( |
|
7420 | + $max_length = (int)\min( |
|
7421 | 7421 | self::strlen($str1, $encoding), |
7422 | 7422 | self::strlen($str2, $encoding) |
7423 | 7423 | ); |
@@ -7431,7 +7431,7 @@ discard block |
||
7431 | 7431 | && |
7432 | 7432 | $char === self::substr($str2, -$i, 1, $encoding) |
7433 | 7433 | ) { |
7434 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
7434 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
7435 | 7435 | } else { |
7436 | 7436 | break; |
7437 | 7437 | } |
@@ -7453,7 +7453,7 @@ discard block |
||
7453 | 7453 | */ |
7454 | 7454 | public static function str_matches_pattern(string $str, string $pattern): bool |
7455 | 7455 | { |
7456 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
7456 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
7457 | 7457 | } |
7458 | 7458 | |
7459 | 7459 | /** |
@@ -7472,7 +7472,7 @@ discard block |
||
7472 | 7472 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
7473 | 7473 | { |
7474 | 7474 | // init |
7475 | - $length = (int) self::strlen($str, $encoding); |
|
7475 | + $length = (int)self::strlen($str, $encoding); |
|
7476 | 7476 | |
7477 | 7477 | if ($offset >= 0) { |
7478 | 7478 | return $length > $offset; |
@@ -7501,7 +7501,7 @@ discard block |
||
7501 | 7501 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
7502 | 7502 | { |
7503 | 7503 | // init |
7504 | - $length = (int) self::strlen($str); |
|
7504 | + $length = (int)self::strlen($str); |
|
7505 | 7505 | |
7506 | 7506 | if ( |
7507 | 7507 | ($index >= 0 && $length <= $index) |
@@ -7545,7 +7545,7 @@ discard block |
||
7545 | 7545 | return $str; |
7546 | 7546 | } |
7547 | 7547 | |
7548 | - if ($pad_type !== (int) $pad_type) { |
|
7548 | + if ($pad_type !== (int)$pad_type) { |
|
7549 | 7549 | if ($pad_type === 'left') { |
7550 | 7550 | $pad_type = \STR_PAD_LEFT; |
7551 | 7551 | } elseif ($pad_type === 'right') { |
@@ -7554,23 +7554,23 @@ discard block |
||
7554 | 7554 | $pad_type = \STR_PAD_BOTH; |
7555 | 7555 | } else { |
7556 | 7556 | throw new \InvalidArgumentException( |
7557 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
7557 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
7558 | 7558 | ); |
7559 | 7559 | } |
7560 | 7560 | } |
7561 | 7561 | |
7562 | 7562 | if ($encoding === 'UTF-8') { |
7563 | - $str_length = (int) \mb_strlen($str); |
|
7563 | + $str_length = (int)\mb_strlen($str); |
|
7564 | 7564 | |
7565 | 7565 | if ($pad_length >= $str_length) { |
7566 | 7566 | switch ($pad_type) { |
7567 | 7567 | case \STR_PAD_LEFT: |
7568 | - $ps_length = (int) \mb_strlen($pad_string); |
|
7568 | + $ps_length = (int)\mb_strlen($pad_string); |
|
7569 | 7569 | |
7570 | 7570 | $diff = ($pad_length - $str_length); |
7571 | 7571 | |
7572 | - $pre = (string) \mb_substr( |
|
7573 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7572 | + $pre = (string)\mb_substr( |
|
7573 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7574 | 7574 | 0, |
7575 | 7575 | $diff |
7576 | 7576 | ); |
@@ -7581,16 +7581,16 @@ discard block |
||
7581 | 7581 | case \STR_PAD_BOTH: |
7582 | 7582 | $diff = ($pad_length - $str_length); |
7583 | 7583 | |
7584 | - $ps_length_left = (int) \floor($diff / 2); |
|
7584 | + $ps_length_left = (int)\floor($diff / 2); |
|
7585 | 7585 | |
7586 | - $ps_length_right = (int) \ceil($diff / 2); |
|
7586 | + $ps_length_right = (int)\ceil($diff / 2); |
|
7587 | 7587 | |
7588 | - $pre = (string) \mb_substr( |
|
7588 | + $pre = (string)\mb_substr( |
|
7589 | 7589 | \str_repeat($pad_string, $ps_length_left), |
7590 | 7590 | 0, |
7591 | 7591 | $ps_length_left |
7592 | 7592 | ); |
7593 | - $post = (string) \mb_substr( |
|
7593 | + $post = (string)\mb_substr( |
|
7594 | 7594 | \str_repeat($pad_string, $ps_length_right), |
7595 | 7595 | 0, |
7596 | 7596 | $ps_length_right |
@@ -7600,19 +7600,19 @@ discard block |
||
7600 | 7600 | |
7601 | 7601 | case \STR_PAD_RIGHT: |
7602 | 7602 | default: |
7603 | - $ps_length = (int) \mb_strlen($pad_string); |
|
7603 | + $ps_length = (int)\mb_strlen($pad_string); |
|
7604 | 7604 | |
7605 | 7605 | $diff = ($pad_length - $str_length); |
7606 | 7606 | |
7607 | - $post = (string) \mb_substr( |
|
7608 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7607 | + $post = (string)\mb_substr( |
|
7608 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7609 | 7609 | 0, |
7610 | 7610 | $diff |
7611 | 7611 | ); |
7612 | 7612 | $pre = ''; |
7613 | 7613 | } |
7614 | 7614 | |
7615 | - return $pre . $str . $post; |
|
7615 | + return $pre.$str.$post; |
|
7616 | 7616 | } |
7617 | 7617 | |
7618 | 7618 | return $str; |
@@ -7620,17 +7620,17 @@ discard block |
||
7620 | 7620 | |
7621 | 7621 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7622 | 7622 | |
7623 | - $str_length = (int) self::strlen($str, $encoding); |
|
7623 | + $str_length = (int)self::strlen($str, $encoding); |
|
7624 | 7624 | |
7625 | 7625 | if ($pad_length >= $str_length) { |
7626 | 7626 | switch ($pad_type) { |
7627 | 7627 | case \STR_PAD_LEFT: |
7628 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
7628 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
7629 | 7629 | |
7630 | 7630 | $diff = ($pad_length - $str_length); |
7631 | 7631 | |
7632 | - $pre = (string) self::substr( |
|
7633 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7632 | + $pre = (string)self::substr( |
|
7633 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7634 | 7634 | 0, |
7635 | 7635 | $diff, |
7636 | 7636 | $encoding |
@@ -7642,17 +7642,17 @@ discard block |
||
7642 | 7642 | case \STR_PAD_BOTH: |
7643 | 7643 | $diff = ($pad_length - $str_length); |
7644 | 7644 | |
7645 | - $ps_length_left = (int) \floor($diff / 2); |
|
7645 | + $ps_length_left = (int)\floor($diff / 2); |
|
7646 | 7646 | |
7647 | - $ps_length_right = (int) \ceil($diff / 2); |
|
7647 | + $ps_length_right = (int)\ceil($diff / 2); |
|
7648 | 7648 | |
7649 | - $pre = (string) self::substr( |
|
7649 | + $pre = (string)self::substr( |
|
7650 | 7650 | \str_repeat($pad_string, $ps_length_left), |
7651 | 7651 | 0, |
7652 | 7652 | $ps_length_left, |
7653 | 7653 | $encoding |
7654 | 7654 | ); |
7655 | - $post = (string) self::substr( |
|
7655 | + $post = (string)self::substr( |
|
7656 | 7656 | \str_repeat($pad_string, $ps_length_right), |
7657 | 7657 | 0, |
7658 | 7658 | $ps_length_right, |
@@ -7663,12 +7663,12 @@ discard block |
||
7663 | 7663 | |
7664 | 7664 | case \STR_PAD_RIGHT: |
7665 | 7665 | default: |
7666 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
7666 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
7667 | 7667 | |
7668 | 7668 | $diff = ($pad_length - $str_length); |
7669 | 7669 | |
7670 | - $post = (string) self::substr( |
|
7671 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7670 | + $post = (string)self::substr( |
|
7671 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7672 | 7672 | 0, |
7673 | 7673 | $diff, |
7674 | 7674 | $encoding |
@@ -7676,7 +7676,7 @@ discard block |
||
7676 | 7676 | $pre = ''; |
7677 | 7677 | } |
7678 | 7678 | |
7679 | - return $pre . $str . $post; |
|
7679 | + return $pre.$str.$post; |
|
7680 | 7680 | } |
7681 | 7681 | |
7682 | 7682 | return $str; |
@@ -7884,11 +7884,11 @@ discard block |
||
7884 | 7884 | } |
7885 | 7885 | |
7886 | 7886 | if ($search === '') { |
7887 | - return $str . $replacement; |
|
7887 | + return $str.$replacement; |
|
7888 | 7888 | } |
7889 | 7889 | |
7890 | 7890 | if (\strpos($str, $search) === 0) { |
7891 | - return $replacement . \substr($str, \strlen($search)); |
|
7891 | + return $replacement.\substr($str, \strlen($search)); |
|
7892 | 7892 | } |
7893 | 7893 | |
7894 | 7894 | return $str; |
@@ -7922,11 +7922,11 @@ discard block |
||
7922 | 7922 | } |
7923 | 7923 | |
7924 | 7924 | if ($search === '') { |
7925 | - return $str . $replacement; |
|
7925 | + return $str.$replacement; |
|
7926 | 7926 | } |
7927 | 7927 | |
7928 | 7928 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
7929 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
7929 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
7930 | 7930 | } |
7931 | 7931 | |
7932 | 7932 | return $str; |
@@ -7960,7 +7960,7 @@ discard block |
||
7960 | 7960 | $subject, |
7961 | 7961 | $replace, |
7962 | 7962 | $pos, |
7963 | - (int) self::strlen($search) |
|
7963 | + (int)self::strlen($search) |
|
7964 | 7964 | ); |
7965 | 7965 | } |
7966 | 7966 | |
@@ -7994,7 +7994,7 @@ discard block |
||
7994 | 7994 | $subject, |
7995 | 7995 | $replace, |
7996 | 7996 | $pos, |
7997 | - (int) self::strlen($search) |
|
7997 | + (int)self::strlen($search) |
|
7998 | 7998 | ); |
7999 | 7999 | } |
8000 | 8000 | |
@@ -8017,7 +8017,7 @@ discard block |
||
8017 | 8017 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
8018 | 8018 | { |
8019 | 8019 | if ($encoding === 'UTF-8') { |
8020 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
8020 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
8021 | 8021 | /** @noinspection NonSecureShuffleUsageInspection */ |
8022 | 8022 | \shuffle($indexes); |
8023 | 8023 | |
@@ -8033,7 +8033,7 @@ discard block |
||
8033 | 8033 | } else { |
8034 | 8034 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8035 | 8035 | |
8036 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
8036 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
8037 | 8037 | /** @noinspection NonSecureShuffleUsageInspection */ |
8038 | 8038 | \shuffle($indexes); |
8039 | 8039 | |
@@ -8076,11 +8076,11 @@ discard block |
||
8076 | 8076 | ) { |
8077 | 8077 | if ($encoding === 'UTF-8') { |
8078 | 8078 | if ($end === null) { |
8079 | - $length = (int) \mb_strlen($str); |
|
8079 | + $length = (int)\mb_strlen($str); |
|
8080 | 8080 | } elseif ($end >= 0 && $end <= $start) { |
8081 | 8081 | return ''; |
8082 | 8082 | } elseif ($end < 0) { |
8083 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
8083 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
8084 | 8084 | } else { |
8085 | 8085 | $length = $end - $start; |
8086 | 8086 | } |
@@ -8091,11 +8091,11 @@ discard block |
||
8091 | 8091 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8092 | 8092 | |
8093 | 8093 | if ($end === null) { |
8094 | - $length = (int) self::strlen($str, $encoding); |
|
8094 | + $length = (int)self::strlen($str, $encoding); |
|
8095 | 8095 | } elseif ($end >= 0 && $end <= $start) { |
8096 | 8096 | return ''; |
8097 | 8097 | } elseif ($end < 0) { |
8098 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
8098 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
8099 | 8099 | } else { |
8100 | 8100 | $length = $end - $start; |
8101 | 8101 | } |
@@ -8130,7 +8130,7 @@ discard block |
||
8130 | 8130 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8131 | 8131 | } |
8132 | 8132 | |
8133 | - $str = (string) \preg_replace_callback( |
|
8133 | + $str = (string)\preg_replace_callback( |
|
8134 | 8134 | '/([\\p{N}|\\p{Lu}])/u', |
8135 | 8135 | /** |
8136 | 8136 | * @param string[] $matches |
@@ -8139,28 +8139,28 @@ discard block |
||
8139 | 8139 | * |
8140 | 8140 | * @return string |
8141 | 8141 | */ |
8142 | - static function (array $matches) use ($encoding): string { |
|
8142 | + static function(array $matches) use ($encoding): string { |
|
8143 | 8143 | $match = $matches[1]; |
8144 | - $match_int = (int) $match; |
|
8144 | + $match_int = (int)$match; |
|
8145 | 8145 | |
8146 | - if ((string) $match_int === $match) { |
|
8147 | - return '_' . $match . '_'; |
|
8146 | + if ((string)$match_int === $match) { |
|
8147 | + return '_'.$match.'_'; |
|
8148 | 8148 | } |
8149 | 8149 | |
8150 | 8150 | if ($encoding === 'UTF-8') { |
8151 | - return '_' . \mb_strtolower($match); |
|
8151 | + return '_'.\mb_strtolower($match); |
|
8152 | 8152 | } |
8153 | 8153 | |
8154 | - return '_' . self::strtolower($match, $encoding); |
|
8154 | + return '_'.self::strtolower($match, $encoding); |
|
8155 | 8155 | }, |
8156 | 8156 | $str |
8157 | 8157 | ); |
8158 | 8158 | |
8159 | - $str = (string) \preg_replace( |
|
8159 | + $str = (string)\preg_replace( |
|
8160 | 8160 | [ |
8161 | - '/\\s+/u', // convert spaces to "_" |
|
8161 | + '/\\s+/u', // convert spaces to "_" |
|
8162 | 8162 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
8163 | - '/_+/', // remove double "_" |
|
8163 | + '/_+/', // remove double "_" |
|
8164 | 8164 | ], |
8165 | 8165 | [ |
8166 | 8166 | '_', |
@@ -8291,7 +8291,7 @@ discard block |
||
8291 | 8291 | } |
8292 | 8292 | |
8293 | 8293 | // init |
8294 | - $input = (string) $input; |
|
8294 | + $input = (string)$input; |
|
8295 | 8295 | |
8296 | 8296 | if ($input === '') { |
8297 | 8297 | return []; |
@@ -8348,7 +8348,7 @@ discard block |
||
8348 | 8348 | ($input[$i] & "\xE0") === "\xC0" |
8349 | 8349 | ) { |
8350 | 8350 | if (($input[$i + 1] & "\xC0") === "\x80") { |
8351 | - $ret[] = $input[$i] . $input[$i + 1]; |
|
8351 | + $ret[] = $input[$i].$input[$i + 1]; |
|
8352 | 8352 | |
8353 | 8353 | ++$i; |
8354 | 8354 | } |
@@ -8362,7 +8362,7 @@ discard block |
||
8362 | 8362 | && |
8363 | 8363 | ($input[$i + 2] & "\xC0") === "\x80" |
8364 | 8364 | ) { |
8365 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2]; |
|
8365 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2]; |
|
8366 | 8366 | |
8367 | 8367 | $i += 2; |
8368 | 8368 | } |
@@ -8378,7 +8378,7 @@ discard block |
||
8378 | 8378 | && |
8379 | 8379 | ($input[$i + 3] & "\xC0") === "\x80" |
8380 | 8380 | ) { |
8381 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2] . $input[$i + 3]; |
|
8381 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2].$input[$i + 3]; |
|
8382 | 8382 | |
8383 | 8383 | $i += 3; |
8384 | 8384 | } |
@@ -8390,7 +8390,7 @@ discard block |
||
8390 | 8390 | $ret = \array_chunk($ret, $length); |
8391 | 8391 | |
8392 | 8392 | return \array_map( |
8393 | - static function (array &$item): string { |
|
8393 | + static function(array &$item): string { |
|
8394 | 8394 | return \implode('', $item); |
8395 | 8395 | }, |
8396 | 8396 | $ret |
@@ -8456,7 +8456,7 @@ discard block |
||
8456 | 8456 | $limit = -1; |
8457 | 8457 | } |
8458 | 8458 | |
8459 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
8459 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
8460 | 8460 | |
8461 | 8461 | if ($array === false) { |
8462 | 8462 | return []; |
@@ -8551,9 +8551,9 @@ discard block |
||
8551 | 8551 | return ''; |
8552 | 8552 | } |
8553 | 8553 | |
8554 | - return (string) \mb_substr( |
|
8554 | + return (string)\mb_substr( |
|
8555 | 8555 | $str, |
8556 | - $offset + (int) \mb_strlen($separator) |
|
8556 | + $offset + (int)\mb_strlen($separator) |
|
8557 | 8557 | ); |
8558 | 8558 | } |
8559 | 8559 | |
@@ -8562,9 +8562,9 @@ discard block |
||
8562 | 8562 | return ''; |
8563 | 8563 | } |
8564 | 8564 | |
8565 | - return (string) \mb_substr( |
|
8565 | + return (string)\mb_substr( |
|
8566 | 8566 | $str, |
8567 | - $offset + (int) self::strlen($separator, $encoding), |
|
8567 | + $offset + (int)self::strlen($separator, $encoding), |
|
8568 | 8568 | null, |
8569 | 8569 | $encoding |
8570 | 8570 | ); |
@@ -8593,9 +8593,9 @@ discard block |
||
8593 | 8593 | return ''; |
8594 | 8594 | } |
8595 | 8595 | |
8596 | - return (string) \mb_substr( |
|
8596 | + return (string)\mb_substr( |
|
8597 | 8597 | $str, |
8598 | - $offset + (int) \mb_strlen($separator) |
|
8598 | + $offset + (int)\mb_strlen($separator) |
|
8599 | 8599 | ); |
8600 | 8600 | } |
8601 | 8601 | |
@@ -8604,9 +8604,9 @@ discard block |
||
8604 | 8604 | return ''; |
8605 | 8605 | } |
8606 | 8606 | |
8607 | - return (string) self::substr( |
|
8607 | + return (string)self::substr( |
|
8608 | 8608 | $str, |
8609 | - $offset + (int) self::strlen($separator, $encoding), |
|
8609 | + $offset + (int)self::strlen($separator, $encoding), |
|
8610 | 8610 | null, |
8611 | 8611 | $encoding |
8612 | 8612 | ); |
@@ -8638,7 +8638,7 @@ discard block |
||
8638 | 8638 | return ''; |
8639 | 8639 | } |
8640 | 8640 | |
8641 | - return (string) \mb_substr( |
|
8641 | + return (string)\mb_substr( |
|
8642 | 8642 | $str, |
8643 | 8643 | 0, |
8644 | 8644 | $offset |
@@ -8650,7 +8650,7 @@ discard block |
||
8650 | 8650 | return ''; |
8651 | 8651 | } |
8652 | 8652 | |
8653 | - return (string) self::substr( |
|
8653 | + return (string)self::substr( |
|
8654 | 8654 | $str, |
8655 | 8655 | 0, |
8656 | 8656 | $offset, |
@@ -8681,7 +8681,7 @@ discard block |
||
8681 | 8681 | return ''; |
8682 | 8682 | } |
8683 | 8683 | |
8684 | - return (string) \mb_substr( |
|
8684 | + return (string)\mb_substr( |
|
8685 | 8685 | $str, |
8686 | 8686 | 0, |
8687 | 8687 | $offset |
@@ -8695,7 +8695,7 @@ discard block |
||
8695 | 8695 | |
8696 | 8696 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8697 | 8697 | |
8698 | - return (string) self::substr( |
|
8698 | + return (string)self::substr( |
|
8699 | 8699 | $str, |
8700 | 8700 | 0, |
8701 | 8701 | $offset, |
@@ -8810,7 +8810,7 @@ discard block |
||
8810 | 8810 | */ |
8811 | 8811 | public static function str_surround(string $str, string $substring): string |
8812 | 8812 | { |
8813 | - return $substring . $str . $substring; |
|
8813 | + return $substring.$str.$substring; |
|
8814 | 8814 | } |
8815 | 8815 | |
8816 | 8816 | /** |
@@ -8874,9 +8874,9 @@ discard block |
||
8874 | 8874 | $word_define_chars = ''; |
8875 | 8875 | } |
8876 | 8876 | |
8877 | - $str = (string) \preg_replace_callback( |
|
8878 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
8879 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
8877 | + $str = (string)\preg_replace_callback( |
|
8878 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
8879 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
8880 | 8880 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
8881 | 8881 | return $match[0]; |
8882 | 8882 | } |
@@ -8976,16 +8976,16 @@ discard block |
||
8976 | 8976 | |
8977 | 8977 | // the main substitutions |
8978 | 8978 | /** @noinspection RegExpDuplicateAlternationBranch - false-positive - https://youtrack.jetbrains.com/issue/WI-51002 */ |
8979 | - $str = (string) \preg_replace_callback( |
|
8979 | + $str = (string)\preg_replace_callback( |
|
8980 | 8980 | '~\\b (_*) (?: # 1. Leading underscore and |
8981 | 8981 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
8982 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
8982 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
8983 | 8983 | | |
8984 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
8984 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
8985 | 8985 | | |
8986 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
8986 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
8987 | 8987 | | |
8988 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
8988 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
8989 | 8989 | ) (_*) \\b # 6. With trailing underscore |
8990 | 8990 | ~ux', |
8991 | 8991 | /** |
@@ -8995,7 +8995,7 @@ discard block |
||
8995 | 8995 | * |
8996 | 8996 | * @return string |
8997 | 8997 | */ |
8998 | - static function (array $matches) use ($encoding): string { |
|
8998 | + static function(array $matches) use ($encoding): string { |
|
8999 | 8999 | // preserve leading underscore |
9000 | 9000 | $str = $matches[1]; |
9001 | 9001 | if ($matches[2]) { |
@@ -9020,11 +9020,11 @@ discard block |
||
9020 | 9020 | ); |
9021 | 9021 | |
9022 | 9022 | // Exceptions for small words: capitalize at start of title... |
9023 | - $str = (string) \preg_replace_callback( |
|
9023 | + $str = (string)\preg_replace_callback( |
|
9024 | 9024 | '~( \\A [[:punct:]]* # start of title... |
9025 | 9025 | | [:.;?!][ ]+ # or of subsentence... |
9026 | 9026 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
9027 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
9027 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
9028 | 9028 | ~uxi', |
9029 | 9029 | /** |
9030 | 9030 | * @param string[] $matches |
@@ -9033,15 +9033,15 @@ discard block |
||
9033 | 9033 | * |
9034 | 9034 | * @return string |
9035 | 9035 | */ |
9036 | - static function (array $matches) use ($encoding): string { |
|
9037 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
9036 | + static function(array $matches) use ($encoding): string { |
|
9037 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
9038 | 9038 | }, |
9039 | 9039 | $str |
9040 | 9040 | ); |
9041 | 9041 | |
9042 | 9042 | // ...and end of title |
9043 | - $str = (string) \preg_replace_callback( |
|
9044 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
9043 | + $str = (string)\preg_replace_callback( |
|
9044 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
9045 | 9045 | (?= [[:punct:]]* \Z # ...at the end of the title... |
9046 | 9046 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
9047 | 9047 | ~uxi', |
@@ -9052,7 +9052,7 @@ discard block |
||
9052 | 9052 | * |
9053 | 9053 | * @return string |
9054 | 9054 | */ |
9055 | - static function (array $matches) use ($encoding): string { |
|
9055 | + static function(array $matches) use ($encoding): string { |
|
9056 | 9056 | return static::ucfirst($matches[1], $encoding); |
9057 | 9057 | }, |
9058 | 9058 | $str |
@@ -9060,10 +9060,10 @@ discard block |
||
9060 | 9060 | |
9061 | 9061 | // Exceptions for small words in hyphenated compound words. |
9062 | 9062 | // e.g. "in-flight" -> In-Flight |
9063 | - $str = (string) \preg_replace_callback( |
|
9063 | + $str = (string)\preg_replace_callback( |
|
9064 | 9064 | '~\\b |
9065 | 9065 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
9066 | - ( ' . $small_words_rx . ' ) |
|
9066 | + ( ' . $small_words_rx.' ) |
|
9067 | 9067 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
9068 | 9068 | ~uxi', |
9069 | 9069 | /** |
@@ -9073,18 +9073,18 @@ discard block |
||
9073 | 9073 | * |
9074 | 9074 | * @return string |
9075 | 9075 | */ |
9076 | - static function (array $matches) use ($encoding): string { |
|
9076 | + static function(array $matches) use ($encoding): string { |
|
9077 | 9077 | return static::ucfirst($matches[1], $encoding); |
9078 | 9078 | }, |
9079 | 9079 | $str |
9080 | 9080 | ); |
9081 | 9081 | |
9082 | 9082 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
9083 | - $str = (string) \preg_replace_callback( |
|
9083 | + $str = (string)\preg_replace_callback( |
|
9084 | 9084 | '~\\b |
9085 | 9085 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
9086 | 9086 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
9087 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
9087 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
9088 | 9088 | (?! - ) # Negative lookahead for another - |
9089 | 9089 | ~uxi', |
9090 | 9090 | /** |
@@ -9094,8 +9094,8 @@ discard block |
||
9094 | 9094 | * |
9095 | 9095 | * @return string |
9096 | 9096 | */ |
9097 | - static function (array $matches) use ($encoding): string { |
|
9098 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
9097 | + static function(array $matches) use ($encoding): string { |
|
9098 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
9099 | 9099 | }, |
9100 | 9100 | $str |
9101 | 9101 | ); |
@@ -9214,7 +9214,7 @@ discard block |
||
9214 | 9214 | ); |
9215 | 9215 | |
9216 | 9216 | foreach ($tmp_return as &$item) { |
9217 | - $item = (string) $item; |
|
9217 | + $item = (string)$item; |
|
9218 | 9218 | } |
9219 | 9219 | |
9220 | 9220 | return $tmp_return; |
@@ -9268,39 +9268,39 @@ discard block |
||
9268 | 9268 | } |
9269 | 9269 | |
9270 | 9270 | if ($encoding === 'UTF-8') { |
9271 | - if ($length >= (int) \mb_strlen($str)) { |
|
9271 | + if ($length >= (int)\mb_strlen($str)) { |
|
9272 | 9272 | return $str; |
9273 | 9273 | } |
9274 | 9274 | |
9275 | 9275 | if ($substring !== '') { |
9276 | - $length -= (int) \mb_strlen($substring); |
|
9276 | + $length -= (int)\mb_strlen($substring); |
|
9277 | 9277 | |
9278 | 9278 | /** @noinspection UnnecessaryCastingInspection */ |
9279 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
9279 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
9280 | 9280 | } |
9281 | 9281 | |
9282 | 9282 | /** @noinspection UnnecessaryCastingInspection */ |
9283 | - return (string) \mb_substr($str, 0, $length); |
|
9283 | + return (string)\mb_substr($str, 0, $length); |
|
9284 | 9284 | } |
9285 | 9285 | |
9286 | 9286 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9287 | 9287 | |
9288 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
9288 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
9289 | 9289 | return $str; |
9290 | 9290 | } |
9291 | 9291 | |
9292 | 9292 | if ($substring !== '') { |
9293 | - $length -= (int) self::strlen($substring, $encoding); |
|
9293 | + $length -= (int)self::strlen($substring, $encoding); |
|
9294 | 9294 | } |
9295 | 9295 | |
9296 | 9296 | return ( |
9297 | - (string) self::substr( |
|
9297 | + (string)self::substr( |
|
9298 | 9298 | $str, |
9299 | 9299 | 0, |
9300 | 9300 | $length, |
9301 | 9301 | $encoding |
9302 | 9302 | ) |
9303 | - ) . $substring; |
|
9303 | + ).$substring; |
|
9304 | 9304 | } |
9305 | 9305 | |
9306 | 9306 | /** |
@@ -9334,12 +9334,12 @@ discard block |
||
9334 | 9334 | } |
9335 | 9335 | |
9336 | 9336 | if ($encoding === 'UTF-8') { |
9337 | - if ($length >= (int) \mb_strlen($str)) { |
|
9337 | + if ($length >= (int)\mb_strlen($str)) { |
|
9338 | 9338 | return $str; |
9339 | 9339 | } |
9340 | 9340 | |
9341 | 9341 | // need to further trim the string so we can append the substring |
9342 | - $length -= (int) \mb_strlen($substring); |
|
9342 | + $length -= (int)\mb_strlen($substring); |
|
9343 | 9343 | if ($length <= 0) { |
9344 | 9344 | return $substring; |
9345 | 9345 | } |
@@ -9365,18 +9365,18 @@ discard block |
||
9365 | 9365 | !$ignore_do_not_split_words_for_one_word |
9366 | 9366 | ) |
9367 | 9367 | ) { |
9368 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
9368 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
9369 | 9369 | } |
9370 | 9370 | } |
9371 | 9371 | } else { |
9372 | 9372 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9373 | 9373 | |
9374 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
9374 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
9375 | 9375 | return $str; |
9376 | 9376 | } |
9377 | 9377 | |
9378 | 9378 | // need to further trim the string so we can append the substring |
9379 | - $length -= (int) self::strlen($substring, $encoding); |
|
9379 | + $length -= (int)self::strlen($substring, $encoding); |
|
9380 | 9380 | if ($length <= 0) { |
9381 | 9381 | return $substring; |
9382 | 9382 | } |
@@ -9402,12 +9402,12 @@ discard block |
||
9402 | 9402 | !$ignore_do_not_split_words_for_one_word |
9403 | 9403 | ) |
9404 | 9404 | ) { |
9405 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
9405 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
9406 | 9406 | } |
9407 | 9407 | } |
9408 | 9408 | } |
9409 | 9409 | |
9410 | - return $truncated . $substring; |
|
9410 | + return $truncated.$substring; |
|
9411 | 9411 | } |
9412 | 9412 | |
9413 | 9413 | /** |
@@ -9534,13 +9534,13 @@ discard block |
||
9534 | 9534 | } |
9535 | 9535 | } elseif ($format === 2) { |
9536 | 9536 | $number_of_words = []; |
9537 | - $offset = (int) self::strlen($str_parts[0]); |
|
9537 | + $offset = (int)self::strlen($str_parts[0]); |
|
9538 | 9538 | for ($i = 1; $i < $len; $i += 2) { |
9539 | 9539 | $number_of_words[$offset] = $str_parts[$i]; |
9540 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
9540 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
9541 | 9541 | } |
9542 | 9542 | } else { |
9543 | - $number_of_words = (int) (($len - 1) / 2); |
|
9543 | + $number_of_words = (int)(($len - 1) / 2); |
|
9544 | 9544 | } |
9545 | 9545 | |
9546 | 9546 | return $number_of_words; |
@@ -9673,21 +9673,21 @@ discard block |
||
9673 | 9673 | } |
9674 | 9674 | |
9675 | 9675 | if ($char_list === '') { |
9676 | - return (int) self::strlen($str, $encoding); |
|
9676 | + return (int)self::strlen($str, $encoding); |
|
9677 | 9677 | } |
9678 | 9678 | |
9679 | 9679 | if ($offset !== null || $length !== null) { |
9680 | 9680 | if ($encoding === 'UTF-8') { |
9681 | 9681 | if ($length === null) { |
9682 | 9682 | /** @noinspection UnnecessaryCastingInspection */ |
9683 | - $str_tmp = \mb_substr($str, (int) $offset); |
|
9683 | + $str_tmp = \mb_substr($str, (int)$offset); |
|
9684 | 9684 | } else { |
9685 | 9685 | /** @noinspection UnnecessaryCastingInspection */ |
9686 | - $str_tmp = \mb_substr($str, (int) $offset, $length); |
|
9686 | + $str_tmp = \mb_substr($str, (int)$offset, $length); |
|
9687 | 9687 | } |
9688 | 9688 | } else { |
9689 | 9689 | /** @noinspection UnnecessaryCastingInspection */ |
9690 | - $str_tmp = self::substr($str, (int) $offset, $length, $encoding); |
|
9690 | + $str_tmp = self::substr($str, (int)$offset, $length, $encoding); |
|
9691 | 9691 | } |
9692 | 9692 | |
9693 | 9693 | if ($str_tmp === false) { |
@@ -9703,7 +9703,7 @@ discard block |
||
9703 | 9703 | } |
9704 | 9704 | |
9705 | 9705 | $matches = []; |
9706 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
9706 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
9707 | 9707 | $return = self::strlen($matches[1], $encoding); |
9708 | 9708 | if ($return === false) { |
9709 | 9709 | return 0; |
@@ -9712,7 +9712,7 @@ discard block |
||
9712 | 9712 | return $return; |
9713 | 9713 | } |
9714 | 9714 | |
9715 | - return (int) self::strlen($str, $encoding); |
|
9715 | + return (int)self::strlen($str, $encoding); |
|
9716 | 9716 | } |
9717 | 9717 | |
9718 | 9718 | /** |
@@ -9775,7 +9775,7 @@ discard block |
||
9775 | 9775 | |
9776 | 9776 | $str = ''; |
9777 | 9777 | foreach ($intOrHex as $strPart) { |
9778 | - $str .= '&#' . (int) $strPart . ';'; |
|
9778 | + $str .= '&#'.(int)$strPart.';'; |
|
9779 | 9779 | } |
9780 | 9780 | |
9781 | 9781 | return self::html_entity_decode($str, \ENT_QUOTES | \ENT_HTML5); |
@@ -9870,7 +9870,7 @@ discard block |
||
9870 | 9870 | return ''; |
9871 | 9871 | } |
9872 | 9872 | |
9873 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
9873 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
9874 | 9874 | } |
9875 | 9875 | |
9876 | 9876 | /** |
@@ -9941,7 +9941,7 @@ discard block |
||
9941 | 9941 | // fallback for ascii only |
9942 | 9942 | // |
9943 | 9943 | |
9944 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9944 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9945 | 9945 | return \stripos($haystack, $needle, $offset); |
9946 | 9946 | } |
9947 | 9947 | |
@@ -10022,7 +10022,7 @@ discard block |
||
10022 | 10022 | /** |
10023 | 10023 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10024 | 10024 | */ |
10025 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10025 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10026 | 10026 | } |
10027 | 10027 | |
10028 | 10028 | if ( |
@@ -10036,11 +10036,11 @@ discard block |
||
10036 | 10036 | } |
10037 | 10037 | } |
10038 | 10038 | |
10039 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
10039 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
10040 | 10040 | return \stristr($haystack, $needle, $before_needle); |
10041 | 10041 | } |
10042 | 10042 | |
10043 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
10043 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
10044 | 10044 | |
10045 | 10045 | if (!isset($match[1])) { |
10046 | 10046 | return false; |
@@ -10050,7 +10050,7 @@ discard block |
||
10050 | 10050 | return $match[1]; |
10051 | 10051 | } |
10052 | 10052 | |
10053 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
10053 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
10054 | 10054 | } |
10055 | 10055 | |
10056 | 10056 | /** |
@@ -10133,7 +10133,7 @@ discard block |
||
10133 | 10133 | /** |
10134 | 10134 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10135 | 10135 | */ |
10136 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10136 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10137 | 10137 | } |
10138 | 10138 | |
10139 | 10139 | // |
@@ -10271,8 +10271,8 @@ discard block |
||
10271 | 10271 | } |
10272 | 10272 | |
10273 | 10273 | return \strnatcmp( |
10274 | - (string) self::strtonatfold($str1), |
|
10275 | - (string) self::strtonatfold($str2) |
|
10274 | + (string)self::strtonatfold($str1), |
|
10275 | + (string)self::strtonatfold($str2) |
|
10276 | 10276 | ); |
10277 | 10277 | } |
10278 | 10278 | |
@@ -10342,11 +10342,11 @@ discard block |
||
10342 | 10342 | } |
10343 | 10343 | |
10344 | 10344 | if ($encoding === 'UTF-8') { |
10345 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
10346 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
10345 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
10346 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
10347 | 10347 | } else { |
10348 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
10349 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
10348 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
10349 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
10350 | 10350 | } |
10351 | 10351 | |
10352 | 10352 | return self::strcmp($str1, $str2); |
@@ -10373,8 +10373,8 @@ discard block |
||
10373 | 10373 | return false; |
10374 | 10374 | } |
10375 | 10375 | |
10376 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
10377 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
10376 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
10377 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
10378 | 10378 | } |
10379 | 10379 | |
10380 | 10380 | return false; |
@@ -10413,10 +10413,10 @@ discard block |
||
10413 | 10413 | } |
10414 | 10414 | |
10415 | 10415 | // iconv and mbstring do not support integer $needle |
10416 | - if ((int) $needle === $needle) { |
|
10417 | - $needle = (string) self::chr($needle); |
|
10416 | + if ((int)$needle === $needle) { |
|
10417 | + $needle = (string)self::chr($needle); |
|
10418 | 10418 | } |
10419 | - $needle = (string) $needle; |
|
10419 | + $needle = (string)$needle; |
|
10420 | 10420 | |
10421 | 10421 | if ($needle === '') { |
10422 | 10422 | return false; |
@@ -10468,7 +10468,7 @@ discard block |
||
10468 | 10468 | /** |
10469 | 10469 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10470 | 10470 | */ |
10471 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10471 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10472 | 10472 | } |
10473 | 10473 | |
10474 | 10474 | // |
@@ -10509,7 +10509,7 @@ discard block |
||
10509 | 10509 | // fallback for ascii only |
10510 | 10510 | // |
10511 | 10511 | |
10512 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10512 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10513 | 10513 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Offset not contained in string */ |
10514 | 10514 | return @\strpos($haystack, $needle, $offset); |
10515 | 10515 | } |
@@ -10522,7 +10522,7 @@ discard block |
||
10522 | 10522 | if ($haystack_tmp === false) { |
10523 | 10523 | $haystack_tmp = ''; |
10524 | 10524 | } |
10525 | - $haystack = (string) $haystack_tmp; |
|
10525 | + $haystack = (string)$haystack_tmp; |
|
10526 | 10526 | |
10527 | 10527 | if ($offset < 0) { |
10528 | 10528 | $offset = 0; |
@@ -10534,7 +10534,7 @@ discard block |
||
10534 | 10534 | } |
10535 | 10535 | |
10536 | 10536 | if ($pos) { |
10537 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
10537 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
10538 | 10538 | } |
10539 | 10539 | |
10540 | 10540 | return $offset + 0; |
@@ -10689,7 +10689,7 @@ discard block |
||
10689 | 10689 | /** |
10690 | 10690 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10691 | 10691 | */ |
10692 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10692 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10693 | 10693 | } |
10694 | 10694 | |
10695 | 10695 | // |
@@ -10701,7 +10701,7 @@ discard block |
||
10701 | 10701 | if ($needle_tmp === false) { |
10702 | 10702 | return false; |
10703 | 10703 | } |
10704 | - $needle = (string) $needle_tmp; |
|
10704 | + $needle = (string)$needle_tmp; |
|
10705 | 10705 | |
10706 | 10706 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
10707 | 10707 | if ($pos === false) { |
@@ -10723,7 +10723,7 @@ discard block |
||
10723 | 10723 | if ($needle_tmp === false) { |
10724 | 10724 | return false; |
10725 | 10725 | } |
10726 | - $needle = (string) $needle_tmp; |
|
10726 | + $needle = (string)$needle_tmp; |
|
10727 | 10727 | |
10728 | 10728 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
10729 | 10729 | if ($pos === false) { |
@@ -10764,7 +10764,7 @@ discard block |
||
10764 | 10764 | if ($encoding === 'UTF-8') { |
10765 | 10765 | if (self::$SUPPORT['intl'] === true) { |
10766 | 10766 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
10767 | - $i = (int) \grapheme_strlen($str); |
|
10767 | + $i = (int)\grapheme_strlen($str); |
|
10768 | 10768 | while ($i--) { |
10769 | 10769 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
10770 | 10770 | if ($reversed_tmp !== false) { |
@@ -10772,7 +10772,7 @@ discard block |
||
10772 | 10772 | } |
10773 | 10773 | } |
10774 | 10774 | } else { |
10775 | - $i = (int) \mb_strlen($str); |
|
10775 | + $i = (int)\mb_strlen($str); |
|
10776 | 10776 | while ($i--) { |
10777 | 10777 | $reversed_tmp = \mb_substr($str, $i, 1); |
10778 | 10778 | if ($reversed_tmp !== false) { |
@@ -10783,7 +10783,7 @@ discard block |
||
10783 | 10783 | } else { |
10784 | 10784 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10785 | 10785 | |
10786 | - $i = (int) self::strlen($str, $encoding); |
|
10786 | + $i = (int)self::strlen($str, $encoding); |
|
10787 | 10787 | while ($i--) { |
10788 | 10788 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
10789 | 10789 | if ($reversed_tmp !== false) { |
@@ -10862,7 +10862,7 @@ discard block |
||
10862 | 10862 | if ($needle_tmp === false) { |
10863 | 10863 | return false; |
10864 | 10864 | } |
10865 | - $needle = (string) $needle_tmp; |
|
10865 | + $needle = (string)$needle_tmp; |
|
10866 | 10866 | |
10867 | 10867 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
10868 | 10868 | if ($pos === false) { |
@@ -10905,10 +10905,10 @@ discard block |
||
10905 | 10905 | } |
10906 | 10906 | |
10907 | 10907 | // iconv and mbstring do not support integer $needle |
10908 | - if ((int) $needle === $needle && $needle >= 0) { |
|
10909 | - $needle = (string) self::chr($needle); |
|
10908 | + if ((int)$needle === $needle && $needle >= 0) { |
|
10909 | + $needle = (string)self::chr($needle); |
|
10910 | 10910 | } |
10911 | - $needle = (string) $needle; |
|
10911 | + $needle = (string)$needle; |
|
10912 | 10912 | |
10913 | 10913 | if ($needle === '') { |
10914 | 10914 | return false; |
@@ -10956,7 +10956,7 @@ discard block |
||
10956 | 10956 | /** |
10957 | 10957 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10958 | 10958 | */ |
10959 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10959 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10960 | 10960 | } |
10961 | 10961 | |
10962 | 10962 | // |
@@ -10980,7 +10980,7 @@ discard block |
||
10980 | 10980 | // fallback for ascii only |
10981 | 10981 | // |
10982 | 10982 | |
10983 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10983 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10984 | 10984 | return \strripos($haystack, $needle, $offset); |
10985 | 10985 | } |
10986 | 10986 | |
@@ -11063,10 +11063,10 @@ discard block |
||
11063 | 11063 | } |
11064 | 11064 | |
11065 | 11065 | // iconv and mbstring do not support integer $needle |
11066 | - if ((int) $needle === $needle && $needle >= 0) { |
|
11067 | - $needle = (string) self::chr($needle); |
|
11066 | + if ((int)$needle === $needle && $needle >= 0) { |
|
11067 | + $needle = (string)self::chr($needle); |
|
11068 | 11068 | } |
11069 | - $needle = (string) $needle; |
|
11069 | + $needle = (string)$needle; |
|
11070 | 11070 | |
11071 | 11071 | if ($needle === '') { |
11072 | 11072 | return false; |
@@ -11114,7 +11114,7 @@ discard block |
||
11114 | 11114 | /** |
11115 | 11115 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11116 | 11116 | */ |
11117 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11117 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11118 | 11118 | } |
11119 | 11119 | |
11120 | 11120 | // |
@@ -11138,7 +11138,7 @@ discard block |
||
11138 | 11138 | // fallback for ascii only |
11139 | 11139 | // |
11140 | 11140 | |
11141 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
11141 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
11142 | 11142 | return \strrpos($haystack, $needle, $offset); |
11143 | 11143 | } |
11144 | 11144 | |
@@ -11158,7 +11158,7 @@ discard block |
||
11158 | 11158 | if ($haystack_tmp === false) { |
11159 | 11159 | $haystack_tmp = ''; |
11160 | 11160 | } |
11161 | - $haystack = (string) $haystack_tmp; |
|
11161 | + $haystack = (string)$haystack_tmp; |
|
11162 | 11162 | } |
11163 | 11163 | |
11164 | 11164 | $pos = \strrpos($haystack, $needle); |
@@ -11172,7 +11172,7 @@ discard block |
||
11172 | 11172 | return false; |
11173 | 11173 | } |
11174 | 11174 | |
11175 | - return $offset + (int) self::strlen($str_tmp); |
|
11175 | + return $offset + (int)self::strlen($str_tmp); |
|
11176 | 11176 | } |
11177 | 11177 | |
11178 | 11178 | /** |
@@ -11240,12 +11240,12 @@ discard block |
||
11240 | 11240 | if ($offset || $length !== null) { |
11241 | 11241 | if ($encoding === 'UTF-8') { |
11242 | 11242 | if ($length === null) { |
11243 | - $str = (string) \mb_substr($str, $offset); |
|
11243 | + $str = (string)\mb_substr($str, $offset); |
|
11244 | 11244 | } else { |
11245 | - $str = (string) \mb_substr($str, $offset, $length); |
|
11245 | + $str = (string)\mb_substr($str, $offset, $length); |
|
11246 | 11246 | } |
11247 | 11247 | } else { |
11248 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
11248 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
11249 | 11249 | } |
11250 | 11250 | } |
11251 | 11251 | |
@@ -11255,7 +11255,7 @@ discard block |
||
11255 | 11255 | |
11256 | 11256 | $matches = []; |
11257 | 11257 | |
11258 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
11258 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
11259 | 11259 | } |
11260 | 11260 | |
11261 | 11261 | /** |
@@ -11337,7 +11337,7 @@ discard block |
||
11337 | 11337 | /** |
11338 | 11338 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11339 | 11339 | */ |
11340 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11340 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11341 | 11341 | } |
11342 | 11342 | |
11343 | 11343 | // |
@@ -11359,7 +11359,7 @@ discard block |
||
11359 | 11359 | // fallback for ascii only |
11360 | 11360 | // |
11361 | 11361 | |
11362 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
11362 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
11363 | 11363 | return \strstr($haystack, $needle, $before_needle); |
11364 | 11364 | } |
11365 | 11365 | |
@@ -11367,7 +11367,7 @@ discard block |
||
11367 | 11367 | // fallback via vanilla php |
11368 | 11368 | // |
11369 | 11369 | |
11370 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
11370 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
11371 | 11371 | |
11372 | 11372 | if (!isset($match[1])) { |
11373 | 11373 | return false; |
@@ -11377,7 +11377,7 @@ discard block |
||
11377 | 11377 | return $match[1]; |
11378 | 11378 | } |
11379 | 11379 | |
11380 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
11380 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
11381 | 11381 | } |
11382 | 11382 | |
11383 | 11383 | /** |
@@ -11507,7 +11507,7 @@ discard block |
||
11507 | 11507 | bool $try_to_keep_the_string_length = false |
11508 | 11508 | ): string { |
11509 | 11509 | // init |
11510 | - $str = (string) $str; |
|
11510 | + $str = (string)$str; |
|
11511 | 11511 | |
11512 | 11512 | if ($str === '') { |
11513 | 11513 | return ''; |
@@ -11536,25 +11536,25 @@ discard block |
||
11536 | 11536 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
11537 | 11537 | } |
11538 | 11538 | |
11539 | - $language_code = $lang . '-Lower'; |
|
11539 | + $language_code = $lang.'-Lower'; |
|
11540 | 11540 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
11541 | 11541 | /** |
11542 | 11542 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11543 | 11543 | */ |
11544 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
11544 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
11545 | 11545 | |
11546 | 11546 | $language_code = 'Any-Lower'; |
11547 | 11547 | } |
11548 | 11548 | |
11549 | 11549 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11550 | 11550 | /** @noinspection UnnecessaryCastingInspection */ |
11551 | - return (string) \transliterator_transliterate($language_code, $str); |
|
11551 | + return (string)\transliterator_transliterate($language_code, $str); |
|
11552 | 11552 | } |
11553 | 11553 | |
11554 | 11554 | /** |
11555 | 11555 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11556 | 11556 | */ |
11557 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
11557 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
11558 | 11558 | } |
11559 | 11559 | |
11560 | 11560 | // always fallback via symfony polyfill |
@@ -11589,7 +11589,7 @@ discard block |
||
11589 | 11589 | bool $try_to_keep_the_string_length = false |
11590 | 11590 | ): string { |
11591 | 11591 | // init |
11592 | - $str = (string) $str; |
|
11592 | + $str = (string)$str; |
|
11593 | 11593 | |
11594 | 11594 | if ($str === '') { |
11595 | 11595 | return ''; |
@@ -11618,25 +11618,25 @@ discard block |
||
11618 | 11618 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
11619 | 11619 | } |
11620 | 11620 | |
11621 | - $language_code = $lang . '-Upper'; |
|
11621 | + $language_code = $lang.'-Upper'; |
|
11622 | 11622 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
11623 | 11623 | /** |
11624 | 11624 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11625 | 11625 | */ |
11626 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
11626 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
11627 | 11627 | |
11628 | 11628 | $language_code = 'Any-Upper'; |
11629 | 11629 | } |
11630 | 11630 | |
11631 | 11631 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11632 | 11632 | /** @noinspection UnnecessaryCastingInspection */ |
11633 | - return (string) \transliterator_transliterate($language_code, $str); |
|
11633 | + return (string)\transliterator_transliterate($language_code, $str); |
|
11634 | 11634 | } |
11635 | 11635 | |
11636 | 11636 | /** |
11637 | 11637 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11638 | 11638 | */ |
11639 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
11639 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
11640 | 11640 | } |
11641 | 11641 | |
11642 | 11642 | // always fallback via symfony polyfill |
@@ -11700,7 +11700,7 @@ discard block |
||
11700 | 11700 | $from = \array_combine($from, $to); |
11701 | 11701 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
11702 | 11702 | if ($from === false) { |
11703 | - 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) . ')'); |
|
11703 | + 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).')'); |
|
11704 | 11704 | } |
11705 | 11705 | } |
11706 | 11706 | |
@@ -11766,9 +11766,9 @@ discard block |
||
11766 | 11766 | } |
11767 | 11767 | |
11768 | 11768 | $wide = 0; |
11769 | - $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); |
|
11769 | + $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); |
|
11770 | 11770 | |
11771 | - return ($wide << 1) + (int) self::strlen($str); |
|
11771 | + return ($wide << 1) + (int)self::strlen($str); |
|
11772 | 11772 | } |
11773 | 11773 | |
11774 | 11774 | /** |
@@ -11868,9 +11868,9 @@ discard block |
||
11868 | 11868 | } |
11869 | 11869 | |
11870 | 11870 | if ($length === null) { |
11871 | - $length = (int) $str_length; |
|
11871 | + $length = (int)$str_length; |
|
11872 | 11872 | } else { |
11873 | - $length = (int) $length; |
|
11873 | + $length = (int)$length; |
|
11874 | 11874 | } |
11875 | 11875 | |
11876 | 11876 | if ( |
@@ -11881,7 +11881,7 @@ discard block |
||
11881 | 11881 | /** |
11882 | 11882 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11883 | 11883 | */ |
11884 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11884 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11885 | 11885 | } |
11886 | 11886 | |
11887 | 11887 | // |
@@ -11977,16 +11977,16 @@ discard block |
||
11977 | 11977 | ) { |
11978 | 11978 | if ($encoding === 'UTF-8') { |
11979 | 11979 | if ($length === null) { |
11980 | - $str1 = (string) \mb_substr($str1, $offset); |
|
11980 | + $str1 = (string)\mb_substr($str1, $offset); |
|
11981 | 11981 | } else { |
11982 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
11982 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
11983 | 11983 | } |
11984 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
11984 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
11985 | 11985 | } else { |
11986 | 11986 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11987 | 11987 | |
11988 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
11989 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
11988 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
11989 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
11990 | 11990 | } |
11991 | 11991 | } |
11992 | 11992 | |
@@ -12053,13 +12053,13 @@ discard block |
||
12053 | 12053 | if ($length_tmp === false) { |
12054 | 12054 | return false; |
12055 | 12055 | } |
12056 | - $length = (int) $length_tmp; |
|
12056 | + $length = (int)$length_tmp; |
|
12057 | 12057 | } |
12058 | 12058 | |
12059 | 12059 | if ($encoding === 'UTF-8') { |
12060 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
12060 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
12061 | 12061 | } else { |
12062 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
12062 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
12063 | 12063 | } |
12064 | 12064 | } |
12065 | 12065 | |
@@ -12071,7 +12071,7 @@ discard block |
||
12071 | 12071 | /** |
12072 | 12072 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
12073 | 12073 | */ |
12074 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
12074 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
12075 | 12075 | } |
12076 | 12076 | |
12077 | 12077 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -12082,7 +12082,7 @@ discard block |
||
12082 | 12082 | return \mb_substr_count($haystack, $needle, $encoding); |
12083 | 12083 | } |
12084 | 12084 | |
12085 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
12085 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
12086 | 12086 | |
12087 | 12087 | return \count($matches); |
12088 | 12088 | } |
@@ -12132,7 +12132,7 @@ discard block |
||
12132 | 12132 | if ($length_tmp === false) { |
12133 | 12133 | return false; |
12134 | 12134 | } |
12135 | - $length = (int) $length_tmp; |
|
12135 | + $length = (int)$length_tmp; |
|
12136 | 12136 | } |
12137 | 12137 | |
12138 | 12138 | if ( |
@@ -12154,7 +12154,7 @@ discard block |
||
12154 | 12154 | if ($haystack_tmp === false) { |
12155 | 12155 | $haystack_tmp = ''; |
12156 | 12156 | } |
12157 | - $haystack = (string) $haystack_tmp; |
|
12157 | + $haystack = (string)$haystack_tmp; |
|
12158 | 12158 | } |
12159 | 12159 | |
12160 | 12160 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -12195,10 +12195,10 @@ discard block |
||
12195 | 12195 | |
12196 | 12196 | if ($encoding === 'UTF-8') { |
12197 | 12197 | if ($case_sensitive) { |
12198 | - return (int) \mb_substr_count($str, $substring); |
|
12198 | + return (int)\mb_substr_count($str, $substring); |
|
12199 | 12199 | } |
12200 | 12200 | |
12201 | - return (int) \mb_substr_count( |
|
12201 | + return (int)\mb_substr_count( |
|
12202 | 12202 | \mb_strtoupper($str), |
12203 | 12203 | \mb_strtoupper($substring) |
12204 | 12204 | ); |
@@ -12207,10 +12207,10 @@ discard block |
||
12207 | 12207 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
12208 | 12208 | |
12209 | 12209 | if ($case_sensitive) { |
12210 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
12210 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
12211 | 12211 | } |
12212 | 12212 | |
12213 | - return (int) \mb_substr_count( |
|
12213 | + return (int)\mb_substr_count( |
|
12214 | 12214 | self::strtocasefold($str, true, false, $encoding, null, false), |
12215 | 12215 | self::strtocasefold($substring, true, false, $encoding, null, false), |
12216 | 12216 | $encoding |
@@ -12244,7 +12244,7 @@ discard block |
||
12244 | 12244 | } |
12245 | 12245 | |
12246 | 12246 | if (self::str_istarts_with($haystack, $needle)) { |
12247 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
12247 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
12248 | 12248 | } |
12249 | 12249 | |
12250 | 12250 | return $haystack; |
@@ -12311,7 +12311,7 @@ discard block |
||
12311 | 12311 | } |
12312 | 12312 | |
12313 | 12313 | if (self::str_iends_with($haystack, $needle)) { |
12314 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
12314 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
12315 | 12315 | } |
12316 | 12316 | |
12317 | 12317 | return $haystack; |
@@ -12344,7 +12344,7 @@ discard block |
||
12344 | 12344 | } |
12345 | 12345 | |
12346 | 12346 | if (self::str_starts_with($haystack, $needle)) { |
12347 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
12347 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
12348 | 12348 | } |
12349 | 12349 | |
12350 | 12350 | return $haystack; |
@@ -12401,7 +12401,7 @@ discard block |
||
12401 | 12401 | if (\is_array($offset)) { |
12402 | 12402 | $offset = \array_slice($offset, 0, $num); |
12403 | 12403 | foreach ($offset as &$value_tmp) { |
12404 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
12404 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
12405 | 12405 | } |
12406 | 12406 | unset($value_tmp); |
12407 | 12407 | } else { |
@@ -12414,7 +12414,7 @@ discard block |
||
12414 | 12414 | } elseif (\is_array($length)) { |
12415 | 12415 | $length = \array_slice($length, 0, $num); |
12416 | 12416 | foreach ($length as &$value_tmp_V2) { |
12417 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
12417 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
12418 | 12418 | } |
12419 | 12419 | unset($value_tmp_V2); |
12420 | 12420 | } else { |
@@ -12434,8 +12434,8 @@ discard block |
||
12434 | 12434 | } |
12435 | 12435 | |
12436 | 12436 | // init |
12437 | - $str = (string) $str; |
|
12438 | - $replacement = (string) $replacement; |
|
12437 | + $str = (string)$str; |
|
12438 | + $replacement = (string)$replacement; |
|
12439 | 12439 | |
12440 | 12440 | if (\is_array($length)) { |
12441 | 12441 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -12450,16 +12450,16 @@ discard block |
||
12450 | 12450 | } |
12451 | 12451 | |
12452 | 12452 | if (self::$SUPPORT['mbstring'] === true) { |
12453 | - $string_length = (int) self::strlen($str, $encoding); |
|
12453 | + $string_length = (int)self::strlen($str, $encoding); |
|
12454 | 12454 | |
12455 | 12455 | if ($offset < 0) { |
12456 | - $offset = (int) \max(0, $string_length + $offset); |
|
12456 | + $offset = (int)\max(0, $string_length + $offset); |
|
12457 | 12457 | } elseif ($offset > $string_length) { |
12458 | 12458 | $offset = $string_length; |
12459 | 12459 | } |
12460 | 12460 | |
12461 | 12461 | if ($length !== null && $length < 0) { |
12462 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
12462 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
12463 | 12463 | } elseif ($length === null || $length > $string_length) { |
12464 | 12464 | $length = $string_length; |
12465 | 12465 | } |
@@ -12470,9 +12470,9 @@ discard block |
||
12470 | 12470 | } |
12471 | 12471 | |
12472 | 12472 | /** @noinspection AdditionOperationOnArraysInspection */ |
12473 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
12474 | - $replacement . |
|
12475 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
12473 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
12474 | + $replacement. |
|
12475 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
12476 | 12476 | } |
12477 | 12477 | |
12478 | 12478 | // |
@@ -12481,8 +12481,7 @@ discard block |
||
12481 | 12481 | |
12482 | 12482 | if (ASCII::is_ascii($str)) { |
12483 | 12483 | return ($length === null) ? |
12484 | - \substr_replace($str, $replacement, $offset) : |
|
12485 | - \substr_replace($str, $replacement, $offset, $length); |
|
12484 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
12486 | 12485 | } |
12487 | 12486 | |
12488 | 12487 | // |
@@ -12498,7 +12497,7 @@ discard block |
||
12498 | 12497 | // e.g.: non mbstring support + invalid chars |
12499 | 12498 | return ''; |
12500 | 12499 | } |
12501 | - $length = (int) $length_tmp; |
|
12500 | + $length = (int)$length_tmp; |
|
12502 | 12501 | } |
12503 | 12502 | |
12504 | 12503 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -12541,14 +12540,14 @@ discard block |
||
12541 | 12540 | && |
12542 | 12541 | \substr($haystack, -\strlen($needle)) === $needle |
12543 | 12542 | ) { |
12544 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
12543 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
12545 | 12544 | } |
12546 | 12545 | |
12547 | 12546 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
12548 | - return (string) self::substr( |
|
12547 | + return (string)self::substr( |
|
12549 | 12548 | $haystack, |
12550 | 12549 | 0, |
12551 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
12550 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
12552 | 12551 | $encoding |
12553 | 12552 | ); |
12554 | 12553 | } |
@@ -12583,10 +12582,10 @@ discard block |
||
12583 | 12582 | } |
12584 | 12583 | |
12585 | 12584 | if ($encoding === 'UTF-8') { |
12586 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
12585 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
12587 | 12586 | } |
12588 | 12587 | |
12589 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
12588 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
12590 | 12589 | } |
12591 | 12590 | |
12592 | 12591 | /** |
@@ -12798,7 +12797,7 @@ discard block |
||
12798 | 12797 | public static function to_boolean($str): bool |
12799 | 12798 | { |
12800 | 12799 | // init |
12801 | - $str = (string) $str; |
|
12800 | + $str = (string)$str; |
|
12802 | 12801 | |
12803 | 12802 | if ($str === '') { |
12804 | 12803 | return false; |
@@ -12826,10 +12825,10 @@ discard block |
||
12826 | 12825 | } |
12827 | 12826 | |
12828 | 12827 | if (\is_numeric($str)) { |
12829 | - return ((float) $str + 0) > 0; |
|
12828 | + return ((float)$str + 0) > 0; |
|
12830 | 12829 | } |
12831 | 12830 | |
12832 | - return (bool) \trim($str); |
|
12831 | + return (bool)\trim($str); |
|
12833 | 12832 | } |
12834 | 12833 | |
12835 | 12834 | /** |
@@ -12877,7 +12876,7 @@ discard block |
||
12877 | 12876 | return $str; |
12878 | 12877 | } |
12879 | 12878 | |
12880 | - $str = (string) $str; |
|
12879 | + $str = (string)$str; |
|
12881 | 12880 | if ($str === '') { |
12882 | 12881 | return ''; |
12883 | 12882 | } |
@@ -12985,7 +12984,7 @@ discard block |
||
12985 | 12984 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
12986 | 12985 | |
12987 | 12986 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
12988 | - $buf .= $c1 . $c2; |
|
12987 | + $buf .= $c1.$c2; |
|
12989 | 12988 | ++$i; |
12990 | 12989 | } else { // not valid UTF8 - convert it |
12991 | 12990 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12996,7 +12995,7 @@ discard block |
||
12996 | 12995 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
12997 | 12996 | |
12998 | 12997 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
12999 | - $buf .= $c1 . $c2 . $c3; |
|
12998 | + $buf .= $c1.$c2.$c3; |
|
13000 | 12999 | $i += 2; |
13001 | 13000 | } else { // not valid UTF8 - convert it |
13002 | 13001 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13008,7 +13007,7 @@ discard block |
||
13008 | 13007 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
13009 | 13008 | |
13010 | 13009 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
13011 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
13010 | + $buf .= $c1.$c2.$c3.$c4; |
|
13012 | 13011 | $i += 3; |
13013 | 13012 | } else { // not valid UTF8 - convert it |
13014 | 13013 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13036,13 +13035,13 @@ discard block |
||
13036 | 13035 | * |
13037 | 13036 | * @return string |
13038 | 13037 | */ |
13039 | - static function (array $matches): string { |
|
13038 | + static function(array $matches): string { |
|
13040 | 13039 | if (isset($matches[3])) { |
13041 | - $cp = (int) \hexdec($matches[3]); |
|
13040 | + $cp = (int)\hexdec($matches[3]); |
|
13042 | 13041 | } else { |
13043 | 13042 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
13044 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
13045 | - + (int) \hexdec($matches[2]) |
|
13043 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
13044 | + + (int)\hexdec($matches[2]) |
|
13046 | 13045 | + 0x10000 |
13047 | 13046 | - (0xD800 << 10) |
13048 | 13047 | - 0xDC00; |
@@ -13053,12 +13052,12 @@ discard block |
||
13053 | 13052 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
13054 | 13053 | |
13055 | 13054 | if ($cp < 0x80) { |
13056 | - return (string) self::chr($cp); |
|
13055 | + return (string)self::chr($cp); |
|
13057 | 13056 | } |
13058 | 13057 | |
13059 | 13058 | if ($cp < 0xA0) { |
13060 | 13059 | /** @noinspection UnnecessaryCastingInspection */ |
13061 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
13060 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
13062 | 13061 | } |
13063 | 13062 | |
13064 | 13063 | return self::decimal_to_chr($cp); |
@@ -13091,7 +13090,7 @@ discard block |
||
13091 | 13090 | public static function to_int(string $str) |
13092 | 13091 | { |
13093 | 13092 | if (\is_numeric($str)) { |
13094 | - return (int) $str; |
|
13093 | + return (int)$str; |
|
13095 | 13094 | } |
13096 | 13095 | |
13097 | 13096 | return null; |
@@ -13126,7 +13125,7 @@ discard block |
||
13126 | 13125 | || |
13127 | 13126 | $input_type === 'double' |
13128 | 13127 | ) { |
13129 | - return (string) $input; |
|
13128 | + return (string)$input; |
|
13130 | 13129 | } |
13131 | 13130 | |
13132 | 13131 | if ($input_type === 'object') { |
@@ -13136,7 +13135,7 @@ discard block |
||
13136 | 13135 | /** @noinspection NestedPositiveIfStatementsInspection */ |
13137 | 13136 | /** @noinspection MissingOrEmptyGroupStatementInspection */ |
13138 | 13137 | if (\method_exists($input, '__toString')) { |
13139 | - return (string) $input; |
|
13138 | + return (string)$input; |
|
13140 | 13139 | } |
13141 | 13140 | } |
13142 | 13141 | |
@@ -13177,7 +13176,7 @@ discard block |
||
13177 | 13176 | } |
13178 | 13177 | |
13179 | 13178 | /** @noinspection PhpComposerExtensionStubsInspection */ |
13180 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
13179 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
13181 | 13180 | } |
13182 | 13181 | |
13183 | 13182 | if ($chars !== null) { |
@@ -13228,15 +13227,15 @@ discard block |
||
13228 | 13227 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
13229 | 13228 | |
13230 | 13229 | if ($encoding === 'UTF-8') { |
13231 | - $str_part_two = (string) \mb_substr($str, 1); |
|
13230 | + $str_part_two = (string)\mb_substr($str, 1); |
|
13232 | 13231 | |
13233 | 13232 | if ($use_mb_functions) { |
13234 | 13233 | $str_part_one = \mb_strtoupper( |
13235 | - (string) \mb_substr($str, 0, 1) |
|
13234 | + (string)\mb_substr($str, 0, 1) |
|
13236 | 13235 | ); |
13237 | 13236 | } else { |
13238 | 13237 | $str_part_one = self::strtoupper( |
13239 | - (string) \mb_substr($str, 0, 1), |
|
13238 | + (string)\mb_substr($str, 0, 1), |
|
13240 | 13239 | $encoding, |
13241 | 13240 | false, |
13242 | 13241 | $lang, |
@@ -13246,16 +13245,16 @@ discard block |
||
13246 | 13245 | } else { |
13247 | 13246 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
13248 | 13247 | |
13249 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
13248 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
13250 | 13249 | |
13251 | 13250 | if ($use_mb_functions) { |
13252 | 13251 | $str_part_one = \mb_strtoupper( |
13253 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
13252 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
13254 | 13253 | $encoding |
13255 | 13254 | ); |
13256 | 13255 | } else { |
13257 | 13256 | $str_part_one = self::strtoupper( |
13258 | - (string) self::substr($str, 0, 1, $encoding), |
|
13257 | + (string)self::substr($str, 0, 1, $encoding), |
|
13259 | 13258 | $encoding, |
13260 | 13259 | false, |
13261 | 13260 | $lang, |
@@ -13264,7 +13263,7 @@ discard block |
||
13264 | 13263 | } |
13265 | 13264 | } |
13266 | 13265 | |
13267 | - return $str_part_one . $str_part_two; |
|
13266 | + return $str_part_one.$str_part_two; |
|
13268 | 13267 | } |
13269 | 13268 | |
13270 | 13269 | /** |
@@ -13325,7 +13324,7 @@ discard block |
||
13325 | 13324 | $str = self::clean($str); |
13326 | 13325 | } |
13327 | 13326 | |
13328 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
13327 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
13329 | 13328 | |
13330 | 13329 | if ( |
13331 | 13330 | $use_php_default_functions |
@@ -13742,7 +13741,7 @@ discard block |
||
13742 | 13741 | if ( |
13743 | 13742 | $keep_utf8_chars |
13744 | 13743 | && |
13745 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
13744 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
13746 | 13745 | ) { |
13747 | 13746 | return $str_backup; |
13748 | 13747 | } |
@@ -13833,17 +13832,17 @@ discard block |
||
13833 | 13832 | return ''; |
13834 | 13833 | } |
13835 | 13834 | |
13836 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
13835 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
13837 | 13836 | |
13838 | 13837 | if ( |
13839 | 13838 | !isset($matches[0]) |
13840 | 13839 | || |
13841 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
13840 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
13842 | 13841 | ) { |
13843 | 13842 | return $str; |
13844 | 13843 | } |
13845 | 13844 | |
13846 | - return \rtrim($matches[0]) . $str_add_on; |
|
13845 | + return \rtrim($matches[0]).$str_add_on; |
|
13847 | 13846 | } |
13848 | 13847 | |
13849 | 13848 | /** |
@@ -13938,7 +13937,7 @@ discard block |
||
13938 | 13937 | } |
13939 | 13938 | } |
13940 | 13939 | |
13941 | - return $str_return . \implode('', $charsArray); |
|
13940 | + return $str_return.\implode('', $charsArray); |
|
13942 | 13941 | } |
13943 | 13942 | |
13944 | 13943 | /** |
@@ -13992,7 +13991,7 @@ discard block |
||
13992 | 13991 | $final_break = ''; |
13993 | 13992 | } |
13994 | 13993 | |
13995 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
13994 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
13996 | 13995 | } |
13997 | 13996 | |
13998 | 13997 | /** |
@@ -14234,7 +14233,7 @@ discard block |
||
14234 | 14233 | /** @noinspection PhpIncludeInspection */ |
14235 | 14234 | /** @noinspection UsingInclusionReturnValueInspection */ |
14236 | 14235 | /** @psalm-suppress UnresolvableInclude */ |
14237 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
14236 | + return include __DIR__.'/data/'.$file.'.php'; |
|
14238 | 14237 | } |
14239 | 14238 | |
14240 | 14239 | /** |
@@ -14254,7 +14253,7 @@ discard block |
||
14254 | 14253 | */ |
14255 | 14254 | \uksort( |
14256 | 14255 | self::$EMOJI, |
14257 | - static function (string $a, string $b): int { |
|
14256 | + static function(string $a, string $b): int { |
|
14258 | 14257 | return \strlen($b) <=> \strlen($a); |
14259 | 14258 | } |
14260 | 14259 | ); |
@@ -14264,7 +14263,7 @@ discard block |
||
14264 | 14263 | |
14265 | 14264 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
14266 | 14265 | $tmp_key = \crc32($key); |
14267 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
14266 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
14268 | 14267 | } |
14269 | 14268 | |
14270 | 14269 | return true; |
@@ -14292,7 +14291,7 @@ discard block |
||
14292 | 14291 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
14293 | 14292 | return \defined('MB_OVERLOAD_STRING') |
14294 | 14293 | && |
14295 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
14294 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
14296 | 14295 | } |
14297 | 14296 | |
14298 | 14297 | /** |
@@ -14358,7 +14357,7 @@ discard block |
||
14358 | 14357 | */ |
14359 | 14358 | static $RX_CLASS_CACHE = []; |
14360 | 14359 | |
14361 | - $cache_key = $s . '_' . $class; |
|
14360 | + $cache_key = $s.'_'.$class; |
|
14362 | 14361 | |
14363 | 14362 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
14364 | 14363 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -14371,7 +14370,7 @@ discard block |
||
14371 | 14370 | /** @noinspection AlterInForeachInspection */ |
14372 | 14371 | foreach (self::str_split($s) as &$s) { |
14373 | 14372 | if ($s === '-') { |
14374 | - $class_array[0] = '-' . $class_array[0]; |
|
14373 | + $class_array[0] = '-'.$class_array[0]; |
|
14375 | 14374 | } elseif (!isset($s[2])) { |
14376 | 14375 | $class_array[0] .= \preg_quote($s, '/'); |
14377 | 14376 | } elseif (self::strlen($s) === 1) { |
@@ -14382,13 +14381,13 @@ discard block |
||
14382 | 14381 | } |
14383 | 14382 | |
14384 | 14383 | if ($class_array[0]) { |
14385 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
14384 | + $class_array[0] = '['.$class_array[0].']'; |
|
14386 | 14385 | } |
14387 | 14386 | |
14388 | 14387 | if (\count($class_array) === 1) { |
14389 | 14388 | $return = $class_array[0]; |
14390 | 14389 | } else { |
14391 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
14390 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
14392 | 14391 | } |
14393 | 14392 | |
14394 | 14393 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -14469,7 +14468,7 @@ discard block |
||
14469 | 14468 | |
14470 | 14469 | if ($delimiter === '-') { |
14471 | 14470 | /** @noinspection AlterInForeachInspection */ |
14472 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
14471 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
14473 | 14472 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
14474 | 14473 | $continue = true; |
14475 | 14474 | |
@@ -14479,7 +14478,7 @@ discard block |
||
14479 | 14478 | } |
14480 | 14479 | |
14481 | 14480 | /** @noinspection AlterInForeachInspection */ |
14482 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
14481 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
14483 | 14482 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
14484 | 14483 | $continue = true; |
14485 | 14484 | |
@@ -14549,8 +14548,8 @@ discard block |
||
14549 | 14548 | } else { |
14550 | 14549 | /** @noinspection OffsetOperationsInspection */ |
14551 | 14550 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
14552 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
14553 | - $buf .= $cc1 . $cc2; |
|
14551 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
14552 | + $buf .= $cc1.$cc2; |
|
14554 | 14553 | } |
14555 | 14554 | |
14556 | 14555 | return $buf; |
@@ -14569,7 +14568,7 @@ discard block |
||
14569 | 14568 | { |
14570 | 14569 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
14571 | 14570 | if (\preg_match($pattern, $str)) { |
14572 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
14571 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
14573 | 14572 | } |
14574 | 14573 | |
14575 | 14574 | 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); |