@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | return false; |
71 | 71 | } |
72 | 72 | |
73 | - $uri = (string) $_SERVER['REQUEST_URI']; |
|
73 | + $uri = (string)$_SERVER['REQUEST_URI']; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | $uriOrig = $uri; |
@@ -87,27 +87,27 @@ discard block |
||
87 | 87 | // When not, assumes Windows-1252 and redirects to the corresponding UTF-8 encoded URL |
88 | 88 | // |
89 | 89 | |
90 | - $uri = (string) \preg_replace_callback( |
|
90 | + $uri = (string)\preg_replace_callback( |
|
91 | 91 | '/[\x80-\xFF]+/', |
92 | 92 | /** |
93 | 93 | * @param array $m |
94 | 94 | * |
95 | 95 | * @return string |
96 | 96 | */ |
97 | - static function (array $m): string { |
|
97 | + static function(array $m): string { |
|
98 | 98 | return \rawurlencode($m[0]); |
99 | 99 | }, |
100 | 100 | $uri |
101 | 101 | ); |
102 | 102 | |
103 | - $uri = (string) \preg_replace_callback( |
|
103 | + $uri = (string)\preg_replace_callback( |
|
104 | 104 | '/(?:%[89A-F][0-9A-F])+/i', |
105 | 105 | /** |
106 | 106 | * @param array $m |
107 | 107 | * |
108 | 108 | * @return string |
109 | 109 | */ |
110 | - static function (array $m): string { |
|
110 | + static function(array $m): string { |
|
111 | 111 | return \rawurlencode(UTF8::rawurldecode($m[0])); |
112 | 112 | }, |
113 | 113 | $uri |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | ) { |
123 | 123 | // Use ob_start() to buffer content and avoid problem of headers already sent... |
124 | 124 | $severProtocol = ($_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'); |
125 | - \header($severProtocol . ' 301 Moved Permanently'); |
|
126 | - \header('Location: ' . $uri); |
|
125 | + \header($severProtocol.' 301 Moved Permanently'); |
|
126 | + \header('Location: '.$uri); |
|
127 | 127 | exit(); |
128 | 128 | } |
129 | 129 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | return false; |
161 | 161 | } |
162 | 162 | |
163 | - $length = (int) $length; |
|
163 | + $length = (int)$length; |
|
164 | 164 | |
165 | 165 | if ($length <= 0) { |
166 | 166 | return false; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | { |
192 | 192 | static $_IS_PHP; |
193 | 193 | |
194 | - $version = (string) $version; |
|
194 | + $version = (string)$version; |
|
195 | 195 | |
196 | 196 | if (!isset($_IS_PHP[$version])) { |
197 | 197 | $_IS_PHP[$version] = \version_compare(\PHP_VERSION, $version, '>='); |
@@ -3,17 +3,17 @@ discard block |
||
3 | 3 | return [ |
4 | 4 | 0x80 => "\xe2\x82\xac", // € |
5 | 5 | 0x82 => "\xe2\x80\x9a", // ‚ |
6 | - 0x83 => "\xc6\x92", // ƒ |
|
6 | + 0x83 => "\xc6\x92", // ƒ |
|
7 | 7 | 0x84 => "\xe2\x80\x9e", // „ |
8 | 8 | 0x85 => "\xe2\x80\xa6", // … |
9 | 9 | 0x86 => "\xe2\x80\xa0", // † |
10 | 10 | 0x87 => "\xe2\x80\xa1", // ‡ |
11 | - 0x88 => "\xcb\x86", // ˆ |
|
11 | + 0x88 => "\xcb\x86", // ˆ |
|
12 | 12 | 0x89 => "\xe2\x80\xb0", // ‰ |
13 | - 0x8a => "\xc5\xa0", // Š |
|
13 | + 0x8a => "\xc5\xa0", // Š |
|
14 | 14 | 0x8b => "\xe2\x80\xb9", // ‹ |
15 | - 0x8c => "\xc5\x92", // Œ |
|
16 | - 0x8e => "\xc5\xbd", // Ž |
|
15 | + 0x8c => "\xc5\x92", // Œ |
|
16 | + 0x8e => "\xc5\xbd", // Ž |
|
17 | 17 | 0x91 => "\xe2\x80\x98", // ‘ |
18 | 18 | 0x92 => "\xe2\x80\x99", // ’ |
19 | 19 | 0x93 => "\xe2\x80\x9c", // “ |
@@ -21,106 +21,106 @@ discard block |
||
21 | 21 | 0x95 => "\xe2\x80\xa2", // • |
22 | 22 | 0x96 => "\xe2\x80\x93", // – |
23 | 23 | 0x97 => "\xe2\x80\x94", // — |
24 | - 0x98 => "\xcb\x9c", // ˜ |
|
24 | + 0x98 => "\xcb\x9c", // ˜ |
|
25 | 25 | 0x99 => "\xe2\x84\xa2", // ™ |
26 | - 0x9a => "\xc5\xa1", // š |
|
26 | + 0x9a => "\xc5\xa1", // š |
|
27 | 27 | 0x9b => "\xe2\x80\xba", // › |
28 | - 0x9c => "\xc5\x93", // œ |
|
29 | - 0x9e => "\xc5\xbe", // ž |
|
30 | - 0x9f => "\xc5\xb8", // Ÿ |
|
28 | + 0x9c => "\xc5\x93", // œ |
|
29 | + 0x9e => "\xc5\xbe", // ž |
|
30 | + 0x9f => "\xc5\xb8", // Ÿ |
|
31 | 31 | 0xa0 => "\xc2\xa0", |
32 | - 0xa1 => "\xc2\xa1", // ¡ |
|
33 | - 0xa2 => "\xc2\xa2", // ¢ |
|
34 | - 0xa3 => "\xc2\xa3", // £ |
|
35 | - 0xa4 => "\xc2\xa4", // ¤ |
|
36 | - 0xa5 => "\xc2\xa5", // ¥ |
|
37 | - 0xa6 => "\xc2\xa6", // ¦ |
|
38 | - 0xa7 => "\xc2\xa7", // § |
|
39 | - 0xa8 => "\xc2\xa8", // ¨ |
|
40 | - 0xa9 => "\xc2\xa9", // © |
|
41 | - 0xaa => "\xc2\xaa", // ª |
|
42 | - 0xab => "\xc2\xab", // « |
|
43 | - 0xac => "\xc2\xac", // ¬ |
|
44 | - 0xad => "\xc2\xad", // |
|
45 | - 0xae => "\xc2\xae", // ® |
|
46 | - 0xaf => "\xc2\xaf", // ¯ |
|
47 | - 0xb0 => "\xc2\xb0", // ° |
|
48 | - 0xb1 => "\xc2\xb1", // ± |
|
49 | - 0xb2 => "\xc2\xb2", // ² |
|
50 | - 0xb3 => "\xc2\xb3", // ³ |
|
51 | - 0xb4 => "\xc2\xb4", // ´ |
|
52 | - 0xb5 => "\xc2\xb5", // µ |
|
53 | - 0xb6 => "\xc2\xb6", // ¶ |
|
54 | - 0xb7 => "\xc2\xb7", // · |
|
55 | - 0xb8 => "\xc2\xb8", // ¸ |
|
56 | - 0xb9 => "\xc2\xb9", // ¹ |
|
57 | - 0xba => "\xc2\xba", // º |
|
58 | - 0xbb => "\xc2\xbb", // » |
|
59 | - 0xbc => "\xc2\xbc", // ¼ |
|
60 | - 0xbd => "\xc2\xbd", // ½ |
|
61 | - 0xbe => "\xc2\xbe", // ¾ |
|
62 | - 0xbf => "\xc2\xbf", // ¿ |
|
63 | - 0xc0 => "\xc3\x80", // À |
|
64 | - 0xc1 => "\xc3\x81", // Á |
|
65 | - 0xc2 => "\xc3\x82", // Â |
|
66 | - 0xc3 => "\xc3\x83", // Ã |
|
67 | - 0xc4 => "\xc3\x84", // Ä |
|
68 | - 0xc5 => "\xc3\x85", // Å |
|
69 | - 0xc6 => "\xc3\x86", // Æ |
|
70 | - 0xc7 => "\xc3\x87", // Ç |
|
71 | - 0xc8 => "\xc3\x88", // È |
|
72 | - 0xc9 => "\xc3\x89", // É |
|
73 | - 0xca => "\xc3\x8a", // Ê |
|
74 | - 0xcb => "\xc3\x8b", // Ë |
|
75 | - 0xcc => "\xc3\x8c", // Ì |
|
76 | - 0xcd => "\xc3\x8d", // Í |
|
77 | - 0xce => "\xc3\x8e", // Î |
|
78 | - 0xcf => "\xc3\x8f", // Ï |
|
79 | - 0xd0 => "\xc3\x90", // Ð |
|
80 | - 0xd1 => "\xc3\x91", // Ñ |
|
81 | - 0xd2 => "\xc3\x92", // Ò |
|
82 | - 0xd3 => "\xc3\x93", // Ó |
|
83 | - 0xd4 => "\xc3\x94", // Ô |
|
84 | - 0xd5 => "\xc3\x95", // Õ |
|
85 | - 0xd6 => "\xc3\x96", // Ö |
|
86 | - 0xd7 => "\xc3\x97", // × |
|
87 | - 0xd8 => "\xc3\x98", // Ø |
|
88 | - 0xd9 => "\xc3\x99", // Ù |
|
89 | - 0xda => "\xc3\x9a", // Ú |
|
90 | - 0xdb => "\xc3\x9b", // Û |
|
91 | - 0xdc => "\xc3\x9c", // Ü |
|
92 | - 0xdd => "\xc3\x9d", // Ý |
|
93 | - 0xde => "\xc3\x9e", // Þ |
|
94 | - 0xdf => "\xc3\x9f", // ß |
|
95 | - 0xe0 => "\xc3\xa0", // à |
|
96 | - 0xe1 => "\xc3\xa1", // á |
|
97 | - 0xe2 => "\xc3\xa2", // â |
|
98 | - 0xe3 => "\xc3\xa3", // ã |
|
99 | - 0xe4 => "\xc3\xa4", // ä |
|
100 | - 0xe5 => "\xc3\xa5", // å |
|
101 | - 0xe6 => "\xc3\xa6", // æ |
|
102 | - 0xe7 => "\xc3\xa7", // ç |
|
103 | - 0xe8 => "\xc3\xa8", // è |
|
104 | - 0xe9 => "\xc3\xa9", // é |
|
105 | - 0xea => "\xc3\xaa", // ê |
|
106 | - 0xeb => "\xc3\xab", // ë |
|
107 | - 0xec => "\xc3\xac", // ì |
|
108 | - 0xed => "\xc3\xad", // í |
|
109 | - 0xee => "\xc3\xae", // î |
|
110 | - 0xef => "\xc3\xaf", // ï |
|
111 | - 0xf0 => "\xc3\xb0", // ð |
|
112 | - 0xf1 => "\xc3\xb1", // ñ |
|
113 | - 0xf2 => "\xc3\xb2", // ò |
|
114 | - 0xf3 => "\xc3\xb3", // ó |
|
115 | - 0xf4 => "\xc3\xb4", // ô |
|
116 | - 0xf5 => "\xc3\xb5", // õ |
|
117 | - 0xf6 => "\xc3\xb6", // ö |
|
118 | - 0xf7 => "\xc3\xb7", // ÷ |
|
119 | - 0xf8 => "\xc3\xb8", // ø |
|
120 | - 0xf9 => "\xc3\xb9", // ù |
|
121 | - 0xfa => "\xc3\xba", // ú |
|
122 | - 0xfb => "\xc3\xbb", // û |
|
123 | - 0xfc => "\xc3\xbc", // ü |
|
124 | - 0xfd => "\xc3\xbd", // ý |
|
125 | - 0xfe => "\xc3\xbe", // þ |
|
32 | + 0xa1 => "\xc2\xa1", // ¡ |
|
33 | + 0xa2 => "\xc2\xa2", // ¢ |
|
34 | + 0xa3 => "\xc2\xa3", // £ |
|
35 | + 0xa4 => "\xc2\xa4", // ¤ |
|
36 | + 0xa5 => "\xc2\xa5", // ¥ |
|
37 | + 0xa6 => "\xc2\xa6", // ¦ |
|
38 | + 0xa7 => "\xc2\xa7", // § |
|
39 | + 0xa8 => "\xc2\xa8", // ¨ |
|
40 | + 0xa9 => "\xc2\xa9", // © |
|
41 | + 0xaa => "\xc2\xaa", // ª |
|
42 | + 0xab => "\xc2\xab", // « |
|
43 | + 0xac => "\xc2\xac", // ¬ |
|
44 | + 0xad => "\xc2\xad", // |
|
45 | + 0xae => "\xc2\xae", // ® |
|
46 | + 0xaf => "\xc2\xaf", // ¯ |
|
47 | + 0xb0 => "\xc2\xb0", // ° |
|
48 | + 0xb1 => "\xc2\xb1", // ± |
|
49 | + 0xb2 => "\xc2\xb2", // ² |
|
50 | + 0xb3 => "\xc2\xb3", // ³ |
|
51 | + 0xb4 => "\xc2\xb4", // ´ |
|
52 | + 0xb5 => "\xc2\xb5", // µ |
|
53 | + 0xb6 => "\xc2\xb6", // ¶ |
|
54 | + 0xb7 => "\xc2\xb7", // · |
|
55 | + 0xb8 => "\xc2\xb8", // ¸ |
|
56 | + 0xb9 => "\xc2\xb9", // ¹ |
|
57 | + 0xba => "\xc2\xba", // º |
|
58 | + 0xbb => "\xc2\xbb", // » |
|
59 | + 0xbc => "\xc2\xbc", // ¼ |
|
60 | + 0xbd => "\xc2\xbd", // ½ |
|
61 | + 0xbe => "\xc2\xbe", // ¾ |
|
62 | + 0xbf => "\xc2\xbf", // ¿ |
|
63 | + 0xc0 => "\xc3\x80", // À |
|
64 | + 0xc1 => "\xc3\x81", // Á |
|
65 | + 0xc2 => "\xc3\x82", // Â |
|
66 | + 0xc3 => "\xc3\x83", // Ã |
|
67 | + 0xc4 => "\xc3\x84", // Ä |
|
68 | + 0xc5 => "\xc3\x85", // Å |
|
69 | + 0xc6 => "\xc3\x86", // Æ |
|
70 | + 0xc7 => "\xc3\x87", // Ç |
|
71 | + 0xc8 => "\xc3\x88", // È |
|
72 | + 0xc9 => "\xc3\x89", // É |
|
73 | + 0xca => "\xc3\x8a", // Ê |
|
74 | + 0xcb => "\xc3\x8b", // Ë |
|
75 | + 0xcc => "\xc3\x8c", // Ì |
|
76 | + 0xcd => "\xc3\x8d", // Í |
|
77 | + 0xce => "\xc3\x8e", // Î |
|
78 | + 0xcf => "\xc3\x8f", // Ï |
|
79 | + 0xd0 => "\xc3\x90", // Ð |
|
80 | + 0xd1 => "\xc3\x91", // Ñ |
|
81 | + 0xd2 => "\xc3\x92", // Ò |
|
82 | + 0xd3 => "\xc3\x93", // Ó |
|
83 | + 0xd4 => "\xc3\x94", // Ô |
|
84 | + 0xd5 => "\xc3\x95", // Õ |
|
85 | + 0xd6 => "\xc3\x96", // Ö |
|
86 | + 0xd7 => "\xc3\x97", // × |
|
87 | + 0xd8 => "\xc3\x98", // Ø |
|
88 | + 0xd9 => "\xc3\x99", // Ù |
|
89 | + 0xda => "\xc3\x9a", // Ú |
|
90 | + 0xdb => "\xc3\x9b", // Û |
|
91 | + 0xdc => "\xc3\x9c", // Ü |
|
92 | + 0xdd => "\xc3\x9d", // Ý |
|
93 | + 0xde => "\xc3\x9e", // Þ |
|
94 | + 0xdf => "\xc3\x9f", // ß |
|
95 | + 0xe0 => "\xc3\xa0", // à |
|
96 | + 0xe1 => "\xc3\xa1", // á |
|
97 | + 0xe2 => "\xc3\xa2", // â |
|
98 | + 0xe3 => "\xc3\xa3", // ã |
|
99 | + 0xe4 => "\xc3\xa4", // ä |
|
100 | + 0xe5 => "\xc3\xa5", // å |
|
101 | + 0xe6 => "\xc3\xa6", // æ |
|
102 | + 0xe7 => "\xc3\xa7", // ç |
|
103 | + 0xe8 => "\xc3\xa8", // è |
|
104 | + 0xe9 => "\xc3\xa9", // é |
|
105 | + 0xea => "\xc3\xaa", // ê |
|
106 | + 0xeb => "\xc3\xab", // ë |
|
107 | + 0xec => "\xc3\xac", // ì |
|
108 | + 0xed => "\xc3\xad", // í |
|
109 | + 0xee => "\xc3\xae", // î |
|
110 | + 0xef => "\xc3\xaf", // ï |
|
111 | + 0xf0 => "\xc3\xb0", // ð |
|
112 | + 0xf1 => "\xc3\xb1", // ñ |
|
113 | + 0xf2 => "\xc3\xb2", // ò |
|
114 | + 0xf3 => "\xc3\xb3", // ó |
|
115 | + 0xf4 => "\xc3\xb4", // ô |
|
116 | + 0xf5 => "\xc3\xb5", // õ |
|
117 | + 0xf6 => "\xc3\xb6", // ö |
|
118 | + 0xf7 => "\xc3\xb7", // ÷ |
|
119 | + 0xf8 => "\xc3\xb8", // ø |
|
120 | + 0xf9 => "\xc3\xb9", // ù |
|
121 | + 0xfa => "\xc3\xba", // ú |
|
122 | + 0xfb => "\xc3\xbb", // û |
|
123 | + 0xfc => "\xc3\xbc", // ü |
|
124 | + 0xfd => "\xc3\xbd", // ý |
|
125 | + 0xfe => "\xc3\xbe", // þ |
|
126 | 126 | ]; |
@@ -602,22 +602,22 @@ discard block |
||
602 | 602 | * @psalm-suppress PossiblyNullArrayAccess |
603 | 603 | */ |
604 | 604 | $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
605 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
605 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
606 | 606 | } elseif ($code_point <= 0xFFFF) { |
607 | 607 | /** |
608 | 608 | * @psalm-suppress PossiblyNullArrayAccess |
609 | 609 | */ |
610 | 610 | $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
611 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
612 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
611 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
612 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
613 | 613 | } else { |
614 | 614 | /** |
615 | 615 | * @psalm-suppress PossiblyNullArrayAccess |
616 | 616 | */ |
617 | 617 | $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
618 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
619 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
620 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
618 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
619 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
620 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
621 | 621 | } |
622 | 622 | |
623 | 623 | if ($encoding !== 'UTF-8') { |
@@ -5804,8 +5804,8 @@ discard block |
||
5804 | 5804 | |
5805 | 5805 | /** @noinspection UnnecessaryCastingInspection */ |
5806 | 5806 | return (string) \mb_substr($str, 0, $index) . |
5807 | - $substring . |
|
5808 | - (string) \mb_substr($str, $index, $len); |
|
5807 | + $substring . |
|
5808 | + (string) \mb_substr($str, $index, $len); |
|
5809 | 5809 | } |
5810 | 5810 | |
5811 | 5811 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -5816,8 +5816,8 @@ discard block |
||
5816 | 5816 | } |
5817 | 5817 | |
5818 | 5818 | return ((string) self::substr($str, 0, $index, $encoding)) . |
5819 | - $substring . |
|
5820 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5819 | + $substring . |
|
5820 | + ((string) self::substr($str, $index, $len, $encoding)); |
|
5821 | 5821 | } |
5822 | 5822 | |
5823 | 5823 | /** |
@@ -7757,11 +7757,11 @@ discard block |
||
7757 | 7757 | if ($useMbFunction === true) { |
7758 | 7758 | if ($encoding === 'UTF-8') { |
7759 | 7759 | return \mb_strtoupper(\mb_substr($match[0], 0, 1)) |
7760 | - . \mb_strtolower(\mb_substr($match[0], 1)); |
|
7760 | + . \mb_strtolower(\mb_substr($match[0], 1)); |
|
7761 | 7761 | } |
7762 | 7762 | |
7763 | 7763 | return \mb_strtoupper(\mb_substr($match[0], 0, 1, $encoding), $encoding) |
7764 | - . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
7764 | + . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
7765 | 7765 | } |
7766 | 7766 | |
7767 | 7767 | return self::ucfirst( |
@@ -8118,13 +8118,13 @@ discard block |
||
8118 | 8118 | } |
8119 | 8119 | |
8120 | 8120 | return ( |
8121 | - (string) self::substr( |
|
8122 | - $str, |
|
8123 | - 0, |
|
8124 | - $length, |
|
8125 | - $encoding |
|
8126 | - ) |
|
8127 | - ) . $substring; |
|
8121 | + (string) self::substr( |
|
8122 | + $str, |
|
8123 | + 0, |
|
8124 | + $length, |
|
8125 | + $encoding |
|
8126 | + ) |
|
8127 | + ) . $substring; |
|
8128 | 8128 | } |
8129 | 8129 | |
8130 | 8130 | /** |
@@ -10864,8 +10864,8 @@ discard block |
||
10864 | 10864 | |
10865 | 10865 | /** @noinspection AdditionOperationOnArraysInspection */ |
10866 | 10866 | return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
10867 | - $replacement . |
|
10868 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10867 | + $replacement . |
|
10868 | + ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10869 | 10869 | } |
10870 | 10870 | |
10871 | 10871 | // |
@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | } |
261 | 261 | |
262 | 262 | if ($encoding === 'UTF-8') { |
263 | - return (string) \mb_substr($str, $pos, 1); |
|
263 | + return (string)\mb_substr($str, $pos, 1); |
|
264 | 264 | } |
265 | 265 | |
266 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
266 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | public static function add_bom_to_string(string $str): string |
279 | 279 | { |
280 | 280 | if (self::string_has_bom($str) === false) { |
281 | - $str = self::bom() . $str; |
|
281 | + $str = self::bom().$str; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | return $str; |
@@ -307,8 +307,8 @@ discard block |
||
307 | 307 | $return = []; |
308 | 308 | foreach ($array as $key => &$value) { |
309 | 309 | $key = $case === \CASE_LOWER |
310 | - ? self::strtolower((string) $key, $encoding) |
|
311 | - : self::strtoupper((string) $key, $encoding); |
|
310 | + ? self::strtolower((string)$key, $encoding) |
|
311 | + : self::strtoupper((string)$key, $encoding); |
|
312 | 312 | |
313 | 313 | $return[$key] = $value; |
314 | 314 | } |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | return ''; |
343 | 343 | } |
344 | 344 | |
345 | - $substrIndex = $posStart + (int) \mb_strlen($start); |
|
345 | + $substrIndex = $posStart + (int)\mb_strlen($start); |
|
346 | 346 | $posEnd = \mb_strpos($str, $end, $substrIndex); |
347 | 347 | if ( |
348 | 348 | $posEnd === false |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | return ''; |
353 | 353 | } |
354 | 354 | |
355 | - return (string) \mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
355 | + return (string)\mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | return ''; |
363 | 363 | } |
364 | 364 | |
365 | - $substrIndex = $posStart + (int) self::strlen($start, $encoding); |
|
365 | + $substrIndex = $posStart + (int)self::strlen($start, $encoding); |
|
366 | 366 | $posEnd = self::strpos($str, $end, $substrIndex, $encoding); |
367 | 367 | if ( |
368 | 368 | $posEnd === false |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | return ''; |
373 | 373 | } |
374 | 374 | |
375 | - return (string) self::substr( |
|
375 | + return (string)self::substr( |
|
376 | 376 | $str, |
377 | 377 | $substrIndex, |
378 | 378 | $posEnd - $substrIndex, |
@@ -440,10 +440,10 @@ discard block |
||
440 | 440 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
441 | 441 | { |
442 | 442 | if ($encoding === 'UTF-8') { |
443 | - return (string) \mb_substr($str, $index, 1); |
|
443 | + return (string)\mb_substr($str, $index, 1); |
|
444 | 444 | } |
445 | 445 | |
446 | - return (string) self::substr($str, $index, 1, $encoding); |
|
446 | + return (string)self::substr($str, $index, 1, $encoding); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
@@ -542,10 +542,10 @@ discard block |
||
542 | 542 | && |
543 | 543 | self::$SUPPORT['mbstring'] === false |
544 | 544 | ) { |
545 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
545 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
546 | 546 | } |
547 | 547 | |
548 | - $cacheKey = $code_point . $encoding; |
|
548 | + $cacheKey = $code_point.$encoding; |
|
549 | 549 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
550 | 550 | return $CHAR_CACHE[$cacheKey]; |
551 | 551 | } |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | self::$CHR = self::getData('chr'); |
592 | 592 | } |
593 | 593 | |
594 | - $code_point = (int) $code_point; |
|
594 | + $code_point = (int)$code_point; |
|
595 | 595 | if ($code_point <= 0x7F) { |
596 | 596 | /** |
597 | 597 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -601,22 +601,22 @@ discard block |
||
601 | 601 | /** |
602 | 602 | * @psalm-suppress PossiblyNullArrayAccess |
603 | 603 | */ |
604 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
604 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
605 | 605 | self::$CHR[($code_point & 0x3F) + 0x80]; |
606 | 606 | } elseif ($code_point <= 0xFFFF) { |
607 | 607 | /** |
608 | 608 | * @psalm-suppress PossiblyNullArrayAccess |
609 | 609 | */ |
610 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
611 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
610 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
611 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
612 | 612 | self::$CHR[($code_point & 0x3F) + 0x80]; |
613 | 613 | } else { |
614 | 614 | /** |
615 | 615 | * @psalm-suppress PossiblyNullArrayAccess |
616 | 616 | */ |
617 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
618 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
619 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
617 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
618 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
619 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
620 | 620 | self::$CHR[($code_point & 0x3F) + 0x80]; |
621 | 621 | } |
622 | 622 | |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | |
664 | 664 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
665 | 665 | return \array_map( |
666 | - static function (string $data): int { |
|
666 | + static function(string $data): int { |
|
667 | 667 | // "mb_" is available if overload is used, so use it ... |
668 | 668 | return \mb_strlen($data, 'CP850'); // 8-BIT |
669 | 669 | }, |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | $char = ''; |
732 | 732 | } |
733 | 733 | |
734 | - return self::int_to_hex(self::ord((string) $char), $pfix); |
|
734 | + return self::int_to_hex(self::ord((string)$char), $pfix); |
|
735 | 735 | } |
736 | 736 | |
737 | 737 | /** |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
807 | 807 | /x'; |
808 | 808 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
809 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
809 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
810 | 810 | |
811 | 811 | if ($replace_diamond_question_mark === true) { |
812 | 812 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | public static function cleanup($str): string |
842 | 842 | { |
843 | 843 | // init |
844 | - $str = (string) $str; |
|
844 | + $str = (string)$str; |
|
845 | 845 | |
846 | 846 | if ($str === '') { |
847 | 847 | return ''; |
@@ -924,7 +924,7 @@ discard block |
||
924 | 924 | { |
925 | 925 | if (self::$SUPPORT['mbstring'] === true) { |
926 | 926 | /** @noinspection PhpComposerExtensionStubsInspection */ |
927 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
927 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
928 | 928 | } |
929 | 929 | |
930 | 930 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -964,7 +964,7 @@ discard block |
||
964 | 964 | */ |
965 | 965 | public static function css_stripe_media_queries(string $str): string |
966 | 966 | { |
967 | - return (string) \preg_replace( |
|
967 | + return (string)\preg_replace( |
|
968 | 968 | '#@media\\s+(?:only\\s)?(?:[\\s{\\(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
969 | 969 | '', |
970 | 970 | $str |
@@ -991,7 +991,7 @@ discard block |
||
991 | 991 | */ |
992 | 992 | public static function decimal_to_chr($int): string |
993 | 993 | { |
994 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
994 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
995 | 995 | } |
996 | 996 | |
997 | 997 | /** |
@@ -1036,16 +1036,16 @@ discard block |
||
1036 | 1036 | self::initEmojiData(); |
1037 | 1037 | |
1038 | 1038 | if ($useReversibleStringMapping === true) { |
1039 | - return (string) \str_replace( |
|
1040 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1041 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1039 | + return (string)\str_replace( |
|
1040 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1041 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1042 | 1042 | $str |
1043 | 1043 | ); |
1044 | 1044 | } |
1045 | 1045 | |
1046 | - return (string) \str_replace( |
|
1047 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1048 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1046 | + return (string)\str_replace( |
|
1047 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1048 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1049 | 1049 | $str |
1050 | 1050 | ); |
1051 | 1051 | } |
@@ -1065,16 +1065,16 @@ discard block |
||
1065 | 1065 | self::initEmojiData(); |
1066 | 1066 | |
1067 | 1067 | if ($useReversibleStringMapping === true) { |
1068 | - return (string) \str_replace( |
|
1069 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1070 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1068 | + return (string)\str_replace( |
|
1069 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1070 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1071 | 1071 | $str |
1072 | 1072 | ); |
1073 | 1073 | } |
1074 | 1074 | |
1075 | - return (string) \str_replace( |
|
1076 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1077 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1075 | + return (string)\str_replace( |
|
1076 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1077 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1078 | 1078 | $str |
1079 | 1079 | ); |
1080 | 1080 | } |
@@ -1128,7 +1128,7 @@ discard block |
||
1128 | 1128 | if ($toEncoding === 'JSON') { |
1129 | 1129 | $return = self::json_encode($str); |
1130 | 1130 | if ($return === false) { |
1131 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1131 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1132 | 1132 | } |
1133 | 1133 | |
1134 | 1134 | return $return; |
@@ -1214,7 +1214,7 @@ discard block |
||
1214 | 1214 | && |
1215 | 1215 | self::$SUPPORT['mbstring'] === false |
1216 | 1216 | ) { |
1217 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $toEncoding . '" encoding', \E_USER_WARNING); |
|
1217 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$toEncoding.'" encoding', \E_USER_WARNING); |
|
1218 | 1218 | } |
1219 | 1219 | |
1220 | 1220 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1308,31 +1308,31 @@ discard block |
||
1308 | 1308 | $trimChars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1309 | 1309 | |
1310 | 1310 | if ($length === null) { |
1311 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
1311 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
1312 | 1312 | } |
1313 | 1313 | |
1314 | 1314 | if ($search === '') { |
1315 | 1315 | if ($encoding === 'UTF-8') { |
1316 | 1316 | if ($length > 0) { |
1317 | - $stringLength = (int) \mb_strlen($str); |
|
1317 | + $stringLength = (int)\mb_strlen($str); |
|
1318 | 1318 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
1319 | 1319 | } else { |
1320 | 1320 | $end = 0; |
1321 | 1321 | } |
1322 | 1322 | |
1323 | - $pos = (int) \min( |
|
1323 | + $pos = (int)\min( |
|
1324 | 1324 | \mb_strpos($str, ' ', $end), |
1325 | 1325 | \mb_strpos($str, '.', $end) |
1326 | 1326 | ); |
1327 | 1327 | } else { |
1328 | 1328 | if ($length > 0) { |
1329 | - $stringLength = (int) self::strlen($str, $encoding); |
|
1329 | + $stringLength = (int)self::strlen($str, $encoding); |
|
1330 | 1330 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
1331 | 1331 | } else { |
1332 | 1332 | $end = 0; |
1333 | 1333 | } |
1334 | 1334 | |
1335 | - $pos = (int) \min( |
|
1335 | + $pos = (int)\min( |
|
1336 | 1336 | self::strpos($str, ' ', $end, $encoding), |
1337 | 1337 | self::strpos($str, '.', $end, $encoding) |
1338 | 1338 | ); |
@@ -1349,18 +1349,18 @@ discard block |
||
1349 | 1349 | return ''; |
1350 | 1350 | } |
1351 | 1351 | |
1352 | - return \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1352 | + return \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1353 | 1353 | } |
1354 | 1354 | |
1355 | 1355 | return $str; |
1356 | 1356 | } |
1357 | 1357 | |
1358 | 1358 | if ($encoding === 'UTF-8') { |
1359 | - $wordPos = (int) \mb_stripos($str, $search); |
|
1360 | - $halfSide = (int) ($wordPos - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1359 | + $wordPos = (int)\mb_stripos($str, $search); |
|
1360 | + $halfSide = (int)($wordPos - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1361 | 1361 | } else { |
1362 | - $wordPos = (int) self::stripos($str, $search, 0, $encoding); |
|
1363 | - $halfSide = (int) ($wordPos - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1362 | + $wordPos = (int)self::stripos($str, $search, 0, $encoding); |
|
1363 | + $halfSide = (int)($wordPos - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1364 | 1364 | } |
1365 | 1365 | |
1366 | 1366 | $pos_start = 0; |
@@ -1372,12 +1372,12 @@ discard block |
||
1372 | 1372 | } |
1373 | 1373 | if ($halfText !== false) { |
1374 | 1374 | if ($encoding === 'UTF-8') { |
1375 | - $pos_start = (int) \max( |
|
1375 | + $pos_start = (int)\max( |
|
1376 | 1376 | \mb_strrpos($halfText, ' '), |
1377 | 1377 | \mb_strrpos($halfText, '.') |
1378 | 1378 | ); |
1379 | 1379 | } else { |
1380 | - $pos_start = (int) \max( |
|
1380 | + $pos_start = (int)\max( |
|
1381 | 1381 | self::strrpos($halfText, ' ', 0, $encoding), |
1382 | 1382 | self::strrpos($halfText, '.', 0, $encoding) |
1383 | 1383 | ); |
@@ -1387,19 +1387,19 @@ discard block |
||
1387 | 1387 | |
1388 | 1388 | if ($wordPos && $halfSide > 0) { |
1389 | 1389 | $offset = $pos_start + $length - 1; |
1390 | - $realLength = (int) self::strlen($str, $encoding); |
|
1390 | + $realLength = (int)self::strlen($str, $encoding); |
|
1391 | 1391 | |
1392 | 1392 | if ($offset > $realLength) { |
1393 | 1393 | $offset = $realLength; |
1394 | 1394 | } |
1395 | 1395 | |
1396 | 1396 | if ($encoding === 'UTF-8') { |
1397 | - $pos_end = (int) \min( |
|
1397 | + $pos_end = (int)\min( |
|
1398 | 1398 | \mb_strpos($str, ' ', $offset), |
1399 | 1399 | \mb_strpos($str, '.', $offset) |
1400 | 1400 | ) - $pos_start; |
1401 | 1401 | } else { |
1402 | - $pos_end = (int) \min( |
|
1402 | + $pos_end = (int)\min( |
|
1403 | 1403 | self::strpos($str, ' ', $offset, $encoding), |
1404 | 1404 | self::strpos($str, '.', $offset, $encoding) |
1405 | 1405 | ) - $pos_start; |
@@ -1407,12 +1407,12 @@ discard block |
||
1407 | 1407 | |
1408 | 1408 | if (!$pos_end || $pos_end <= 0) { |
1409 | 1409 | if ($encoding === 'UTF-8') { |
1410 | - $strSub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1410 | + $strSub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1411 | 1411 | } else { |
1412 | - $strSub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1412 | + $strSub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1413 | 1413 | } |
1414 | 1414 | if ($strSub !== false) { |
1415 | - $extract = $replacerForSkippedText . \ltrim($strSub, $trimChars); |
|
1415 | + $extract = $replacerForSkippedText.\ltrim($strSub, $trimChars); |
|
1416 | 1416 | } else { |
1417 | 1417 | $extract = ''; |
1418 | 1418 | } |
@@ -1423,26 +1423,26 @@ discard block |
||
1423 | 1423 | $strSub = self::substr($str, $pos_start, $pos_end, $encoding); |
1424 | 1424 | } |
1425 | 1425 | if ($strSub !== false) { |
1426 | - $extract = $replacerForSkippedText . \trim($strSub, $trimChars) . $replacerForSkippedText; |
|
1426 | + $extract = $replacerForSkippedText.\trim($strSub, $trimChars).$replacerForSkippedText; |
|
1427 | 1427 | } else { |
1428 | 1428 | $extract = ''; |
1429 | 1429 | } |
1430 | 1430 | } |
1431 | 1431 | } else { |
1432 | 1432 | $offset = $length - 1; |
1433 | - $trueLength = (int) self::strlen($str, $encoding); |
|
1433 | + $trueLength = (int)self::strlen($str, $encoding); |
|
1434 | 1434 | |
1435 | 1435 | if ($offset > $trueLength) { |
1436 | 1436 | $offset = $trueLength; |
1437 | 1437 | } |
1438 | 1438 | |
1439 | 1439 | if ($encoding === 'UTF-8') { |
1440 | - $pos_end = (int) \min( |
|
1440 | + $pos_end = (int)\min( |
|
1441 | 1441 | \mb_strpos($str, ' ', $offset), |
1442 | 1442 | \mb_strpos($str, '.', $offset) |
1443 | 1443 | ); |
1444 | 1444 | } else { |
1445 | - $pos_end = (int) \min( |
|
1445 | + $pos_end = (int)\min( |
|
1446 | 1446 | self::strpos($str, ' ', $offset, $encoding), |
1447 | 1447 | self::strpos($str, '.', $offset, $encoding) |
1448 | 1448 | ); |
@@ -1455,7 +1455,7 @@ discard block |
||
1455 | 1455 | $strSub = self::substr($str, 0, $pos_end, $encoding); |
1456 | 1456 | } |
1457 | 1457 | if ($strSub !== false) { |
1458 | - $extract = \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1458 | + $extract = \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1459 | 1459 | } else { |
1460 | 1460 | $extract = ''; |
1461 | 1461 | } |
@@ -1576,7 +1576,7 @@ discard block |
||
1576 | 1576 | { |
1577 | 1577 | $file_content = \file_get_contents($file_path); |
1578 | 1578 | if ($file_content === false) { |
1579 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1579 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1580 | 1580 | } |
1581 | 1581 | |
1582 | 1582 | return self::string_has_bom($file_content); |
@@ -1639,7 +1639,7 @@ discard block |
||
1639 | 1639 | ) { |
1640 | 1640 | // Prevent leading combining chars |
1641 | 1641 | // for NFC-safe concatenations. |
1642 | - $var = $leading_combining . $var; |
|
1642 | + $var = $leading_combining.$var; |
|
1643 | 1643 | } |
1644 | 1644 | } |
1645 | 1645 | |
@@ -1878,10 +1878,10 @@ discard block |
||
1878 | 1878 | } |
1879 | 1879 | |
1880 | 1880 | if ($encoding === 'UTF-8') { |
1881 | - return (string) \mb_substr($str, 0, $n); |
|
1881 | + return (string)\mb_substr($str, 0, $n); |
|
1882 | 1882 | } |
1883 | 1883 | |
1884 | - return (string) self::substr($str, 0, $n, $encoding); |
|
1884 | + return (string)self::substr($str, 0, $n, $encoding); |
|
1885 | 1885 | } |
1886 | 1886 | |
1887 | 1887 | /** |
@@ -1956,7 +1956,7 @@ discard block |
||
1956 | 1956 | return $str; |
1957 | 1957 | } |
1958 | 1958 | |
1959 | - $str = (string) $str; |
|
1959 | + $str = (string)$str; |
|
1960 | 1960 | $last = ''; |
1961 | 1961 | while ($last !== $str) { |
1962 | 1962 | $last = $str; |
@@ -2145,7 +2145,7 @@ discard block |
||
2145 | 2145 | return $fallback; |
2146 | 2146 | } |
2147 | 2147 | /** @noinspection OffsetOperationsInspection */ |
2148 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2148 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2149 | 2149 | |
2150 | 2150 | // DEBUG |
2151 | 2151 | //var_dump($type_code); |
@@ -2240,7 +2240,7 @@ discard block |
||
2240 | 2240 | // |
2241 | 2241 | |
2242 | 2242 | if ($encoding === 'UTF-8') { |
2243 | - $maxlength = (int) \mb_strlen($possibleChars); |
|
2243 | + $maxlength = (int)\mb_strlen($possibleChars); |
|
2244 | 2244 | if ($maxlength === 0) { |
2245 | 2245 | return ''; |
2246 | 2246 | } |
@@ -2261,7 +2261,7 @@ discard block |
||
2261 | 2261 | } else { |
2262 | 2262 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2263 | 2263 | |
2264 | - $maxlength = (int) self::strlen($possibleChars, $encoding); |
|
2264 | + $maxlength = (int)self::strlen($possibleChars, $encoding); |
|
2265 | 2265 | if ($maxlength === 0) { |
2266 | 2266 | return ''; |
2267 | 2267 | } |
@@ -2292,16 +2292,16 @@ discard block |
||
2292 | 2292 | */ |
2293 | 2293 | public static function get_unique_string($entropyExtra = '', bool $md5 = true): string |
2294 | 2294 | { |
2295 | - $uniqueHelper = \random_int(0, \mt_getrandmax()) . |
|
2296 | - \session_id() . |
|
2297 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2298 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2295 | + $uniqueHelper = \random_int(0, \mt_getrandmax()). |
|
2296 | + \session_id(). |
|
2297 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2298 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2299 | 2299 | $entropyExtra; |
2300 | 2300 | |
2301 | 2301 | $uniqueString = \uniqid($uniqueHelper, true); |
2302 | 2302 | |
2303 | 2303 | if ($md5) { |
2304 | - $uniqueString = \md5($uniqueString . $uniqueHelper); |
|
2304 | + $uniqueString = \md5($uniqueString.$uniqueHelper); |
|
2305 | 2305 | } |
2306 | 2306 | |
2307 | 2307 | return $uniqueString; |
@@ -2380,7 +2380,7 @@ discard block |
||
2380 | 2380 | public static function hex_to_int($hexDec) |
2381 | 2381 | { |
2382 | 2382 | // init |
2383 | - $hexDec = (string) $hexDec; |
|
2383 | + $hexDec = (string)$hexDec; |
|
2384 | 2384 | |
2385 | 2385 | if ($hexDec === '') { |
2386 | 2386 | return false; |
@@ -2458,7 +2458,7 @@ discard block |
||
2458 | 2458 | return \implode( |
2459 | 2459 | '', |
2460 | 2460 | \array_map( |
2461 | - static function (string $chr) use ($keepAsciiChars, $encoding): string { |
|
2461 | + static function(string $chr) use ($keepAsciiChars, $encoding): string { |
|
2462 | 2462 | return self::single_chr_html_encode($chr, $keepAsciiChars, $encoding); |
2463 | 2463 | }, |
2464 | 2464 | self::str_split($str) |
@@ -2562,7 +2562,7 @@ discard block |
||
2562 | 2562 | && |
2563 | 2563 | self::$SUPPORT['mbstring'] === false |
2564 | 2564 | ) { |
2565 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2565 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2566 | 2566 | } |
2567 | 2567 | |
2568 | 2568 | do { |
@@ -2583,14 +2583,14 @@ discard block |
||
2583 | 2583 | ); |
2584 | 2584 | } |
2585 | 2585 | } else { |
2586 | - $str = (string) \preg_replace_callback( |
|
2586 | + $str = (string)\preg_replace_callback( |
|
2587 | 2587 | "/&#\d{2,6};/", |
2588 | 2588 | /** |
2589 | 2589 | * @param string[] $matches |
2590 | 2590 | * |
2591 | 2591 | * @return string |
2592 | 2592 | */ |
2593 | - static function (array $matches) use ($encoding): string { |
|
2593 | + static function(array $matches) use ($encoding): string { |
|
2594 | 2594 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
2595 | 2595 | if ($returnTmp !== '"' && $returnTmp !== "'") { |
2596 | 2596 | return $returnTmp; |
@@ -2605,7 +2605,7 @@ discard block |
||
2605 | 2605 | if (\strpos($str, '&') !== false) { |
2606 | 2606 | if (\strpos($str, '&#') !== false) { |
2607 | 2607 | // decode also numeric & UTF16 two byte entities |
2608 | - $str = (string) \preg_replace( |
|
2608 | + $str = (string)\preg_replace( |
|
2609 | 2609 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
2610 | 2610 | '$1;', |
2611 | 2611 | $str |
@@ -2651,7 +2651,7 @@ discard block |
||
2651 | 2651 | */ |
2652 | 2652 | public static function html_stripe_empty_tags(string $str): string |
2653 | 2653 | { |
2654 | - return (string) \preg_replace( |
|
2654 | + return (string)\preg_replace( |
|
2655 | 2655 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
2656 | 2656 | '', |
2657 | 2657 | $str |
@@ -2950,9 +2950,9 @@ discard block |
||
2950 | 2950 | { |
2951 | 2951 | $hex = \dechex($int); |
2952 | 2952 | |
2953 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
2953 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
2954 | 2954 | |
2955 | - return $pfix . $hex . ''; |
|
2955 | + return $pfix.$hex.''; |
|
2956 | 2956 | } |
2957 | 2957 | |
2958 | 2958 | /** |
@@ -3210,7 +3210,7 @@ discard block |
||
3210 | 3210 | */ |
3211 | 3211 | public static function is_binary($input, bool $strict = false): bool |
3212 | 3212 | { |
3213 | - $input = (string) $input; |
|
3213 | + $input = (string)$input; |
|
3214 | 3214 | if ($input === '') { |
3215 | 3215 | return false; |
3216 | 3216 | } |
@@ -3471,7 +3471,7 @@ discard block |
||
3471 | 3471 | public static function is_utf16($str, $checkIfStringIsBinary = true) |
3472 | 3472 | { |
3473 | 3473 | // init |
3474 | - $str = (string) $str; |
|
3474 | + $str = (string)$str; |
|
3475 | 3475 | $strChars = []; |
3476 | 3476 | |
3477 | 3477 | if ( |
@@ -3549,7 +3549,7 @@ discard block |
||
3549 | 3549 | public static function is_utf32($str, $checkIfStringIsBinary = true) |
3550 | 3550 | { |
3551 | 3551 | // init |
3552 | - $str = (string) $str; |
|
3552 | + $str = (string)$str; |
|
3553 | 3553 | $strChars = []; |
3554 | 3554 | |
3555 | 3555 | if ( |
@@ -3669,7 +3669,7 @@ discard block |
||
3669 | 3669 | self::$ORD = self::getData('ord'); |
3670 | 3670 | } |
3671 | 3671 | |
3672 | - $len = \strlen((string) $str); |
|
3672 | + $len = \strlen((string)$str); |
|
3673 | 3673 | /** @noinspection ForeachInvariantsInspection */ |
3674 | 3674 | for ($i = 0; $i < $len; ++$i) { |
3675 | 3675 | $in = self::$ORD[$str[$i]]; |
@@ -3906,15 +3906,15 @@ discard block |
||
3906 | 3906 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
3907 | 3907 | |
3908 | 3908 | if ($encoding === 'UTF-8') { |
3909 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
3909 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
3910 | 3910 | |
3911 | 3911 | if ($useMbFunction === true) { |
3912 | 3912 | $strPartOne = \mb_strtolower( |
3913 | - (string) \mb_substr($str, 0, 1) |
|
3913 | + (string)\mb_substr($str, 0, 1) |
|
3914 | 3914 | ); |
3915 | 3915 | } else { |
3916 | 3916 | $strPartOne = self::strtolower( |
3917 | - (string) \mb_substr($str, 0, 1), |
|
3917 | + (string)\mb_substr($str, 0, 1), |
|
3918 | 3918 | $encoding, |
3919 | 3919 | false, |
3920 | 3920 | $lang, |
@@ -3924,10 +3924,10 @@ discard block |
||
3924 | 3924 | } else { |
3925 | 3925 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
3926 | 3926 | |
3927 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
3927 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
3928 | 3928 | |
3929 | 3929 | $strPartOne = self::strtolower( |
3930 | - (string) self::substr($str, 0, 1, $encoding), |
|
3930 | + (string)self::substr($str, 0, 1, $encoding), |
|
3931 | 3931 | $encoding, |
3932 | 3932 | false, |
3933 | 3933 | $lang, |
@@ -3935,7 +3935,7 @@ discard block |
||
3935 | 3935 | ); |
3936 | 3936 | } |
3937 | 3937 | |
3938 | - return $strPartOne . $strPartTwo; |
|
3938 | + return $strPartOne.$strPartTwo; |
|
3939 | 3939 | } |
3940 | 3940 | |
3941 | 3941 | /** |
@@ -4054,7 +4054,7 @@ discard block |
||
4054 | 4054 | |
4055 | 4055 | if (self::$SUPPORT['mbstring'] === true) { |
4056 | 4056 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4057 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4057 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4058 | 4058 | } |
4059 | 4059 | |
4060 | 4060 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -4095,7 +4095,7 @@ discard block |
||
4095 | 4095 | { |
4096 | 4096 | $bytes = self::chr_size_list($str); |
4097 | 4097 | if (\count($bytes) > 0) { |
4098 | - return (int) \max($bytes); |
|
4098 | + return (int)\max($bytes); |
|
4099 | 4099 | } |
4100 | 4100 | |
4101 | 4101 | return 0; |
@@ -4164,7 +4164,7 @@ discard block |
||
4164 | 4164 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4165 | 4165 | |
4166 | 4166 | // init |
4167 | - $encoding = (string) $encoding; |
|
4167 | + $encoding = (string)$encoding; |
|
4168 | 4168 | |
4169 | 4169 | if (!$encoding) { |
4170 | 4170 | return $fallback; |
@@ -4218,7 +4218,7 @@ discard block |
||
4218 | 4218 | |
4219 | 4219 | $encodingOrig = $encoding; |
4220 | 4220 | $encoding = \strtoupper($encoding); |
4221 | - $encodingUpperHelper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4221 | + $encodingUpperHelper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4222 | 4222 | |
4223 | 4223 | $equivalences = [ |
4224 | 4224 | 'ISO8859' => 'ISO-8859-1', |
@@ -4376,7 +4376,7 @@ discard block |
||
4376 | 4376 | } |
4377 | 4377 | |
4378 | 4378 | static $WHITESPACE_CACHE = []; |
4379 | - $cacheKey = (int) $keepNonBreakingSpace; |
|
4379 | + $cacheKey = (int)$keepNonBreakingSpace; |
|
4380 | 4380 | |
4381 | 4381 | if (!isset($WHITESPACE_CACHE[$cacheKey])) { |
4382 | 4382 | $WHITESPACE_CACHE[$cacheKey] = self::$WHITESPACE_TABLE; |
@@ -4418,13 +4418,13 @@ discard block |
||
4418 | 4418 | static $CHAR_CACHE = []; |
4419 | 4419 | |
4420 | 4420 | // init |
4421 | - $chr = (string) $chr; |
|
4421 | + $chr = (string)$chr; |
|
4422 | 4422 | |
4423 | 4423 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
4424 | 4424 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4425 | 4425 | } |
4426 | 4426 | |
4427 | - $cacheKey = $chr . $encoding; |
|
4427 | + $cacheKey = $chr.$encoding; |
|
4428 | 4428 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
4429 | 4429 | return $CHAR_CACHE[$cacheKey]; |
4430 | 4430 | } |
@@ -4459,7 +4459,7 @@ discard block |
||
4459 | 4459 | // |
4460 | 4460 | |
4461 | 4461 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
4462 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
4462 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
4463 | 4463 | /** @noinspection OffsetOperationsInspection */ |
4464 | 4464 | $code = $chr ? $chr[1] : 0; |
4465 | 4465 | |
@@ -4467,21 +4467,21 @@ discard block |
||
4467 | 4467 | if ($code >= 0xF0 && isset($chr[4])) { |
4468 | 4468 | /** @noinspection UnnecessaryCastingInspection */ |
4469 | 4469 | /** @noinspection OffsetOperationsInspection */ |
4470 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4470 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4471 | 4471 | } |
4472 | 4472 | |
4473 | 4473 | /** @noinspection OffsetOperationsInspection */ |
4474 | 4474 | if ($code >= 0xE0 && isset($chr[3])) { |
4475 | 4475 | /** @noinspection UnnecessaryCastingInspection */ |
4476 | 4476 | /** @noinspection OffsetOperationsInspection */ |
4477 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4477 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4478 | 4478 | } |
4479 | 4479 | |
4480 | 4480 | /** @noinspection OffsetOperationsInspection */ |
4481 | 4481 | if ($code >= 0xC0 && isset($chr[2])) { |
4482 | 4482 | /** @noinspection UnnecessaryCastingInspection */ |
4483 | 4483 | /** @noinspection OffsetOperationsInspection */ |
4484 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4484 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4485 | 4485 | } |
4486 | 4486 | |
4487 | 4487 | return $CHAR_CACHE[$cacheKey] = $code; |
@@ -4530,7 +4530,7 @@ discard block |
||
4530 | 4530 | public static function pcre_utf8_support(): bool |
4531 | 4531 | { |
4532 | 4532 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4533 | - return (bool) @\preg_match('//u', ''); |
|
4533 | + return (bool)@\preg_match('//u', ''); |
|
4534 | 4534 | } |
4535 | 4535 | |
4536 | 4536 | /** |
@@ -4562,11 +4562,11 @@ discard block |
||
4562 | 4562 | |
4563 | 4563 | if ($step !== 1) { |
4564 | 4564 | if (!\is_numeric($step)) { |
4565 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
4565 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
4566 | 4566 | } |
4567 | 4567 | |
4568 | 4568 | if ($step <= 0) { |
4569 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
4569 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
4570 | 4570 | } |
4571 | 4571 | } |
4572 | 4572 | |
@@ -4578,14 +4578,14 @@ discard block |
||
4578 | 4578 | $is_xdigit = false; |
4579 | 4579 | |
4580 | 4580 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4581 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
4581 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
4582 | 4582 | $is_digit = true; |
4583 | - $start = (int) $var1; |
|
4583 | + $start = (int)$var1; |
|
4584 | 4584 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
4585 | 4585 | $is_xdigit = true; |
4586 | - $start = (int) self::hex_to_int($var1); |
|
4586 | + $start = (int)self::hex_to_int($var1); |
|
4587 | 4587 | } elseif (!$use_ctype && \is_numeric($var1)) { |
4588 | - $start = (int) $var1; |
|
4588 | + $start = (int)$var1; |
|
4589 | 4589 | } else { |
4590 | 4590 | $start = self::ord($var1); |
4591 | 4591 | } |
@@ -4595,11 +4595,11 @@ discard block |
||
4595 | 4595 | } |
4596 | 4596 | |
4597 | 4597 | if ($is_digit) { |
4598 | - $end = (int) $var2; |
|
4598 | + $end = (int)$var2; |
|
4599 | 4599 | } elseif ($is_xdigit) { |
4600 | - $end = (int) self::hex_to_int($var2); |
|
4600 | + $end = (int)self::hex_to_int($var2); |
|
4601 | 4601 | } elseif (!$use_ctype && \is_numeric($var2)) { |
4602 | - $end = (int) $var2; |
|
4602 | + $end = (int)$var2; |
|
4603 | 4603 | } else { |
4604 | 4604 | $end = self::ord($var2); |
4605 | 4605 | } |
@@ -4610,7 +4610,7 @@ discard block |
||
4610 | 4610 | |
4611 | 4611 | $array = []; |
4612 | 4612 | foreach (\range($start, $end, $step) as $i) { |
4613 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
4613 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
4614 | 4614 | } |
4615 | 4615 | |
4616 | 4616 | return $array; |
@@ -4701,8 +4701,8 @@ discard block |
||
4701 | 4701 | $delimiter = '/'; |
4702 | 4702 | } |
4703 | 4703 | |
4704 | - return (string) \preg_replace( |
|
4705 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4704 | + return (string)\preg_replace( |
|
4705 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4706 | 4706 | $replacement, |
4707 | 4707 | $str |
4708 | 4708 | ); |
@@ -4744,9 +4744,9 @@ discard block |
||
4744 | 4744 | return ''; |
4745 | 4745 | } |
4746 | 4746 | |
4747 | - $strLength -= (int) $bomByteLength; |
|
4747 | + $strLength -= (int)$bomByteLength; |
|
4748 | 4748 | |
4749 | - $str = (string) $strTmp; |
|
4749 | + $str = (string)$strTmp; |
|
4750 | 4750 | } |
4751 | 4751 | } |
4752 | 4752 | |
@@ -4770,7 +4770,7 @@ discard block |
||
4770 | 4770 | if (\is_array($what) === true) { |
4771 | 4771 | /** @noinspection ForeachSourceInspection */ |
4772 | 4772 | foreach ($what as $item) { |
4773 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/u') . ')+/u', $item, $str); |
|
4773 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/u').')+/u', $item, $str); |
|
4774 | 4774 | } |
4775 | 4775 | } |
4776 | 4776 | |
@@ -4802,7 +4802,7 @@ discard block |
||
4802 | 4802 | */ |
4803 | 4803 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
4804 | 4804 | { |
4805 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4805 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4806 | 4806 | } |
4807 | 4807 | |
4808 | 4808 | /** |
@@ -4833,7 +4833,7 @@ discard block |
||
4833 | 4833 | $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
4834 | 4834 | |
4835 | 4835 | do { |
4836 | - $str = (string) \preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4836 | + $str = (string)\preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4837 | 4837 | } while ($count !== 0); |
4838 | 4838 | |
4839 | 4839 | return $str; |
@@ -4852,17 +4852,17 @@ discard block |
||
4852 | 4852 | { |
4853 | 4853 | if ($substring && \strpos($str, $substring) === 0) { |
4854 | 4854 | if ($encoding === 'UTF-8') { |
4855 | - return (string) \mb_substr( |
|
4855 | + return (string)\mb_substr( |
|
4856 | 4856 | $str, |
4857 | - (int) \mb_strlen($substring) |
|
4857 | + (int)\mb_strlen($substring) |
|
4858 | 4858 | ); |
4859 | 4859 | } |
4860 | 4860 | |
4861 | 4861 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4862 | 4862 | |
4863 | - return (string) self::substr( |
|
4863 | + return (string)self::substr( |
|
4864 | 4864 | $str, |
4865 | - (int) self::strlen($substring, $encoding), |
|
4865 | + (int)self::strlen($substring, $encoding), |
|
4866 | 4866 | null, |
4867 | 4867 | $encoding |
4868 | 4868 | ); |
@@ -4884,19 +4884,19 @@ discard block |
||
4884 | 4884 | { |
4885 | 4885 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
4886 | 4886 | if ($encoding === 'UTF-8') { |
4887 | - return (string) \mb_substr( |
|
4887 | + return (string)\mb_substr( |
|
4888 | 4888 | $str, |
4889 | 4889 | 0, |
4890 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
4890 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
4891 | 4891 | ); |
4892 | 4892 | } |
4893 | 4893 | |
4894 | 4894 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4895 | 4895 | |
4896 | - return (string) self::substr( |
|
4896 | + return (string)self::substr( |
|
4897 | 4897 | $str, |
4898 | 4898 | 0, |
4899 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
4899 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
4900 | 4900 | $encoding |
4901 | 4901 | ); |
4902 | 4902 | } |
@@ -4980,7 +4980,7 @@ discard block |
||
4980 | 4980 | $save = \mb_substitute_character(); |
4981 | 4981 | \mb_substitute_character($replacementCharHelper); |
4982 | 4982 | // the polyfill maybe return false, so cast to string |
4983 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4983 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4984 | 4984 | \mb_substitute_character($save); |
4985 | 4985 | } |
4986 | 4986 | |
@@ -5020,7 +5020,7 @@ discard block |
||
5020 | 5020 | |
5021 | 5021 | if (self::$SUPPORT['mbstring'] === true) { |
5022 | 5022 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5023 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
5023 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
5024 | 5024 | } |
5025 | 5025 | |
5026 | 5026 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -5035,7 +5035,7 @@ discard block |
||
5035 | 5035 | { |
5036 | 5036 | echo '<pre>'; |
5037 | 5037 | foreach (self::$SUPPORT as $key => &$value) { |
5038 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
5038 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
5039 | 5039 | } |
5040 | 5040 | unset($value); |
5041 | 5041 | echo '</pre>'; |
@@ -5064,7 +5064,7 @@ discard block |
||
5064 | 5064 | return $char; |
5065 | 5065 | } |
5066 | 5066 | |
5067 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
5067 | + return '&#'.self::ord($char, $encoding).';'; |
|
5068 | 5068 | } |
5069 | 5069 | |
5070 | 5070 | /** |
@@ -5155,18 +5155,18 @@ discard block |
||
5155 | 5155 | $lang, |
5156 | 5156 | $tryToKeepStringLength |
5157 | 5157 | ); |
5158 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5158 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5159 | 5159 | |
5160 | 5160 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5161 | 5161 | |
5162 | - $str = (string) \preg_replace_callback( |
|
5162 | + $str = (string)\preg_replace_callback( |
|
5163 | 5163 | '/[-_\\s]+(.)?/u', |
5164 | 5164 | /** |
5165 | 5165 | * @param array $match |
5166 | 5166 | * |
5167 | 5167 | * @return string |
5168 | 5168 | */ |
5169 | - static function (array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5169 | + static function(array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5170 | 5170 | if (isset($match[1])) { |
5171 | 5171 | if ($useMbFunction === true) { |
5172 | 5172 | if ($encoding === 'UTF-8') { |
@@ -5184,14 +5184,14 @@ discard block |
||
5184 | 5184 | $str |
5185 | 5185 | ); |
5186 | 5186 | |
5187 | - return (string) \preg_replace_callback( |
|
5187 | + return (string)\preg_replace_callback( |
|
5188 | 5188 | '/[\\p{N}]+(.)?/u', |
5189 | 5189 | /** |
5190 | 5190 | * @param array $match |
5191 | 5191 | * |
5192 | 5192 | * @return string |
5193 | 5193 | */ |
5194 | - static function (array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5194 | + static function(array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5195 | 5195 | if ($useMbFunction === true) { |
5196 | 5196 | if ($encoding === 'UTF-8') { |
5197 | 5197 | return \mb_strtoupper($match[0]); |
@@ -5369,7 +5369,7 @@ discard block |
||
5369 | 5369 | ): string { |
5370 | 5370 | if (self::$SUPPORT['mbstring'] === true) { |
5371 | 5371 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5372 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5372 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5373 | 5373 | |
5374 | 5374 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5375 | 5375 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5379,10 +5379,10 @@ discard block |
||
5379 | 5379 | } |
5380 | 5380 | |
5381 | 5381 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5382 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5382 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5383 | 5383 | } |
5384 | 5384 | |
5385 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5385 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5386 | 5386 | |
5387 | 5387 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5388 | 5388 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5391,7 +5391,7 @@ discard block |
||
5391 | 5391 | $str = self::strtolower($str, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
5392 | 5392 | } |
5393 | 5393 | |
5394 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5394 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5395 | 5395 | } |
5396 | 5396 | |
5397 | 5397 | /** |
@@ -5406,7 +5406,7 @@ discard block |
||
5406 | 5406 | public static function str_detect_encoding($str) |
5407 | 5407 | { |
5408 | 5408 | // init |
5409 | - $str = (string) $str; |
|
5409 | + $str = (string)$str; |
|
5410 | 5410 | |
5411 | 5411 | // |
5412 | 5412 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5473,7 +5473,7 @@ discard block |
||
5473 | 5473 | foreach (self::$ENCODINGS as $encodingTmp) { |
5474 | 5474 | // INFO: //IGNORE but still throw notice |
5475 | 5475 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5476 | - if ((string) @\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str) === $str) { |
|
5476 | + if ((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str) === $str) { |
|
5477 | 5477 | return $encodingTmp; |
5478 | 5478 | } |
5479 | 5479 | } |
@@ -5561,7 +5561,7 @@ discard block |
||
5561 | 5561 | return $str; |
5562 | 5562 | } |
5563 | 5563 | |
5564 | - return $substring . $str; |
|
5564 | + return $substring.$str; |
|
5565 | 5565 | } |
5566 | 5566 | |
5567 | 5567 | /** |
@@ -5815,27 +5815,27 @@ discard block |
||
5815 | 5815 | string $encoding = 'UTF-8' |
5816 | 5816 | ): string { |
5817 | 5817 | if ($encoding === 'UTF-8') { |
5818 | - $len = (int) \mb_strlen($str); |
|
5818 | + $len = (int)\mb_strlen($str); |
|
5819 | 5819 | if ($index > $len) { |
5820 | 5820 | return $str; |
5821 | 5821 | } |
5822 | 5822 | |
5823 | 5823 | /** @noinspection UnnecessaryCastingInspection */ |
5824 | - return (string) \mb_substr($str, 0, $index) . |
|
5825 | - $substring . |
|
5826 | - (string) \mb_substr($str, $index, $len); |
|
5824 | + return (string)\mb_substr($str, 0, $index). |
|
5825 | + $substring. |
|
5826 | + (string)\mb_substr($str, $index, $len); |
|
5827 | 5827 | } |
5828 | 5828 | |
5829 | 5829 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5830 | 5830 | |
5831 | - $len = (int) self::strlen($str, $encoding); |
|
5831 | + $len = (int)self::strlen($str, $encoding); |
|
5832 | 5832 | if ($index > $len) { |
5833 | 5833 | return $str; |
5834 | 5834 | } |
5835 | 5835 | |
5836 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
5837 | - $substring . |
|
5838 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5836 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
5837 | + $substring. |
|
5838 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
5839 | 5839 | } |
5840 | 5840 | |
5841 | 5841 | /** |
@@ -5865,15 +5865,15 @@ discard block |
||
5865 | 5865 | */ |
5866 | 5866 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
5867 | 5867 | { |
5868 | - $search = (array) $search; |
|
5868 | + $search = (array)$search; |
|
5869 | 5869 | |
5870 | 5870 | /** @noinspection AlterInForeachInspection */ |
5871 | 5871 | foreach ($search as &$s) { |
5872 | - $s = (string) $s; |
|
5872 | + $s = (string)$s; |
|
5873 | 5873 | if ($s === '') { |
5874 | 5874 | $s = '/^(?<=.)$/'; |
5875 | 5875 | } else { |
5876 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5876 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5877 | 5877 | } |
5878 | 5878 | } |
5879 | 5879 | |
@@ -5905,11 +5905,11 @@ discard block |
||
5905 | 5905 | } |
5906 | 5906 | |
5907 | 5907 | if ($search === '') { |
5908 | - return $str . $replacement; |
|
5908 | + return $str.$replacement; |
|
5909 | 5909 | } |
5910 | 5910 | |
5911 | 5911 | if (\stripos($str, $search) === 0) { |
5912 | - return $replacement . \substr($str, \strlen($search)); |
|
5912 | + return $replacement.\substr($str, \strlen($search)); |
|
5913 | 5913 | } |
5914 | 5914 | |
5915 | 5915 | return $str; |
@@ -5937,11 +5937,11 @@ discard block |
||
5937 | 5937 | } |
5938 | 5938 | |
5939 | 5939 | if ($search === '') { |
5940 | - return $str . $replacement; |
|
5940 | + return $str.$replacement; |
|
5941 | 5941 | } |
5942 | 5942 | |
5943 | 5943 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
5944 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
5944 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
5945 | 5945 | } |
5946 | 5946 | |
5947 | 5947 | return $str; |
@@ -6018,15 +6018,15 @@ discard block |
||
6018 | 6018 | } |
6019 | 6019 | |
6020 | 6020 | if ($encoding === 'UTF-8') { |
6021 | - return (string) \mb_substr( |
|
6021 | + return (string)\mb_substr( |
|
6022 | 6022 | $str, |
6023 | - $offset + (int) \mb_strlen($separator) |
|
6023 | + $offset + (int)\mb_strlen($separator) |
|
6024 | 6024 | ); |
6025 | 6025 | } |
6026 | 6026 | |
6027 | - return (string) self::substr( |
|
6027 | + return (string)self::substr( |
|
6028 | 6028 | $str, |
6029 | - $offset + (int) self::strlen($separator, $encoding), |
|
6029 | + $offset + (int)self::strlen($separator, $encoding), |
|
6030 | 6030 | null, |
6031 | 6031 | $encoding |
6032 | 6032 | ); |
@@ -6053,15 +6053,15 @@ discard block |
||
6053 | 6053 | } |
6054 | 6054 | |
6055 | 6055 | if ($encoding === 'UTF-8') { |
6056 | - return (string) \mb_substr( |
|
6056 | + return (string)\mb_substr( |
|
6057 | 6057 | $str, |
6058 | - $offset + (int) self::strlen($separator) |
|
6058 | + $offset + (int)self::strlen($separator) |
|
6059 | 6059 | ); |
6060 | 6060 | } |
6061 | 6061 | |
6062 | - return (string) self::substr( |
|
6062 | + return (string)self::substr( |
|
6063 | 6063 | $str, |
6064 | - $offset + (int) self::strlen($separator, $encoding), |
|
6064 | + $offset + (int)self::strlen($separator, $encoding), |
|
6065 | 6065 | null, |
6066 | 6066 | $encoding |
6067 | 6067 | ); |
@@ -6088,10 +6088,10 @@ discard block |
||
6088 | 6088 | } |
6089 | 6089 | |
6090 | 6090 | if ($encoding === 'UTF-8') { |
6091 | - return (string) \mb_substr($str, 0, $offset); |
|
6091 | + return (string)\mb_substr($str, 0, $offset); |
|
6092 | 6092 | } |
6093 | 6093 | |
6094 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6094 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6095 | 6095 | } |
6096 | 6096 | |
6097 | 6097 | /** |
@@ -6115,7 +6115,7 @@ discard block |
||
6115 | 6115 | return ''; |
6116 | 6116 | } |
6117 | 6117 | |
6118 | - return (string) \mb_substr($str, 0, $offset); |
|
6118 | + return (string)\mb_substr($str, 0, $offset); |
|
6119 | 6119 | } |
6120 | 6120 | |
6121 | 6121 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6123,7 +6123,7 @@ discard block |
||
6123 | 6123 | return ''; |
6124 | 6124 | } |
6125 | 6125 | |
6126 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6126 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6127 | 6127 | } |
6128 | 6128 | |
6129 | 6129 | /** |
@@ -6211,12 +6211,12 @@ discard block |
||
6211 | 6211 | } |
6212 | 6212 | |
6213 | 6213 | if ($encoding === 'UTF-8') { |
6214 | - return (string) \mb_substr($str, -$n); |
|
6214 | + return (string)\mb_substr($str, -$n); |
|
6215 | 6215 | } |
6216 | 6216 | |
6217 | 6217 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6218 | 6218 | |
6219 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6219 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6220 | 6220 | } |
6221 | 6221 | |
6222 | 6222 | /** |
@@ -6240,21 +6240,21 @@ discard block |
||
6240 | 6240 | } |
6241 | 6241 | |
6242 | 6242 | if ($encoding === 'UTF-8') { |
6243 | - if ((int) \mb_strlen($str) <= $length) { |
|
6243 | + if ((int)\mb_strlen($str) <= $length) { |
|
6244 | 6244 | return $str; |
6245 | 6245 | } |
6246 | 6246 | |
6247 | 6247 | /** @noinspection UnnecessaryCastingInspection */ |
6248 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($strAddOn)) . $strAddOn; |
|
6248 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($strAddOn)).$strAddOn; |
|
6249 | 6249 | } |
6250 | 6250 | |
6251 | 6251 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6252 | 6252 | |
6253 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6253 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6254 | 6254 | return $str; |
6255 | 6255 | } |
6256 | 6256 | |
6257 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($strAddOn), $encoding)) . $strAddOn; |
|
6257 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($strAddOn), $encoding)).$strAddOn; |
|
6258 | 6258 | } |
6259 | 6259 | |
6260 | 6260 | /** |
@@ -6279,12 +6279,12 @@ discard block |
||
6279 | 6279 | |
6280 | 6280 | if ($encoding === 'UTF-8') { |
6281 | 6281 | /** @noinspection UnnecessaryCastingInspection */ |
6282 | - if ((int) \mb_strlen($str) <= $length) { |
|
6282 | + if ((int)\mb_strlen($str) <= $length) { |
|
6283 | 6283 | return $str; |
6284 | 6284 | } |
6285 | 6285 | |
6286 | 6286 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6287 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6287 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6288 | 6288 | } |
6289 | 6289 | |
6290 | 6290 | $str = \mb_substr($str, 0, $length); |
@@ -6294,20 +6294,20 @@ discard block |
||
6294 | 6294 | $new_str = \implode(' ', $array); |
6295 | 6295 | |
6296 | 6296 | if ($new_str === '') { |
6297 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6297 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6298 | 6298 | } |
6299 | 6299 | } else { |
6300 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6300 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6301 | 6301 | return $str; |
6302 | 6302 | } |
6303 | 6303 | |
6304 | 6304 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6305 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6305 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6306 | 6306 | } |
6307 | 6307 | |
6308 | 6308 | $str = self::substr($str, 0, $length, $encoding); |
6309 | 6309 | if ($str === false) { |
6310 | - return '' . $strAddOn; |
|
6310 | + return ''.$strAddOn; |
|
6311 | 6311 | } |
6312 | 6312 | |
6313 | 6313 | $array = \explode(' ', $str); |
@@ -6315,11 +6315,11 @@ discard block |
||
6315 | 6315 | $new_str = \implode(' ', $array); |
6316 | 6316 | |
6317 | 6317 | if ($new_str === '') { |
6318 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6318 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6319 | 6319 | } |
6320 | 6320 | } |
6321 | 6321 | |
6322 | - return $new_str . $strAddOn; |
|
6322 | + return $new_str.$strAddOn; |
|
6323 | 6323 | } |
6324 | 6324 | |
6325 | 6325 | /** |
@@ -6337,7 +6337,7 @@ discard block |
||
6337 | 6337 | $longestCommonPrefix = ''; |
6338 | 6338 | |
6339 | 6339 | if ($encoding === 'UTF-8') { |
6340 | - $maxLength = (int) \min( |
|
6340 | + $maxLength = (int)\min( |
|
6341 | 6341 | \mb_strlen($str), |
6342 | 6342 | \mb_strlen($otherStr) |
6343 | 6343 | ); |
@@ -6358,7 +6358,7 @@ discard block |
||
6358 | 6358 | } else { |
6359 | 6359 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6360 | 6360 | |
6361 | - $maxLength = (int) \min( |
|
6361 | + $maxLength = (int)\min( |
|
6362 | 6362 | self::strlen($str, $encoding), |
6363 | 6363 | self::strlen($otherStr, $encoding) |
6364 | 6364 | ); |
@@ -6401,13 +6401,13 @@ discard block |
||
6401 | 6401 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6402 | 6402 | |
6403 | 6403 | if ($encoding === 'UTF-8') { |
6404 | - $strLength = (int) \mb_strlen($str); |
|
6405 | - $otherLength = (int) \mb_strlen($otherStr); |
|
6404 | + $strLength = (int)\mb_strlen($str); |
|
6405 | + $otherLength = (int)\mb_strlen($otherStr); |
|
6406 | 6406 | } else { |
6407 | 6407 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6408 | 6408 | |
6409 | - $strLength = (int) self::strlen($str, $encoding); |
|
6410 | - $otherLength = (int) self::strlen($otherStr, $encoding); |
|
6409 | + $strLength = (int)self::strlen($str, $encoding); |
|
6410 | + $otherLength = (int)self::strlen($otherStr, $encoding); |
|
6411 | 6411 | } |
6412 | 6412 | |
6413 | 6413 | // Return if either string is empty |
@@ -6460,10 +6460,10 @@ discard block |
||
6460 | 6460 | } |
6461 | 6461 | |
6462 | 6462 | if ($encoding === 'UTF-8') { |
6463 | - return (string) \mb_substr($str, $end - $len, $len); |
|
6463 | + return (string)\mb_substr($str, $end - $len, $len); |
|
6464 | 6464 | } |
6465 | 6465 | |
6466 | - return (string) self::substr($str, $end - $len, $len, $encoding); |
|
6466 | + return (string)self::substr($str, $end - $len, $len, $encoding); |
|
6467 | 6467 | } |
6468 | 6468 | |
6469 | 6469 | /** |
@@ -6482,7 +6482,7 @@ discard block |
||
6482 | 6482 | } |
6483 | 6483 | |
6484 | 6484 | if ($encoding === 'UTF-8') { |
6485 | - $maxLength = (int) \min( |
|
6485 | + $maxLength = (int)\min( |
|
6486 | 6486 | \mb_strlen($str, $encoding), |
6487 | 6487 | \mb_strlen($otherStr, $encoding) |
6488 | 6488 | ); |
@@ -6496,7 +6496,7 @@ discard block |
||
6496 | 6496 | && |
6497 | 6497 | $char === \mb_substr($otherStr, -$i, 1) |
6498 | 6498 | ) { |
6499 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6499 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6500 | 6500 | } else { |
6501 | 6501 | break; |
6502 | 6502 | } |
@@ -6504,7 +6504,7 @@ discard block |
||
6504 | 6504 | } else { |
6505 | 6505 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6506 | 6506 | |
6507 | - $maxLength = (int) \min( |
|
6507 | + $maxLength = (int)\min( |
|
6508 | 6508 | self::strlen($str, $encoding), |
6509 | 6509 | self::strlen($otherStr, $encoding) |
6510 | 6510 | ); |
@@ -6518,7 +6518,7 @@ discard block |
||
6518 | 6518 | && |
6519 | 6519 | $char === self::substr($otherStr, -$i, 1, $encoding) |
6520 | 6520 | ) { |
6521 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6521 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6522 | 6522 | } else { |
6523 | 6523 | break; |
6524 | 6524 | } |
@@ -6538,7 +6538,7 @@ discard block |
||
6538 | 6538 | */ |
6539 | 6539 | public static function str_matches_pattern(string $str, string $pattern): bool |
6540 | 6540 | { |
6541 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
6541 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
6542 | 6542 | } |
6543 | 6543 | |
6544 | 6544 | /** |
@@ -6555,7 +6555,7 @@ discard block |
||
6555 | 6555 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
6556 | 6556 | { |
6557 | 6557 | // init |
6558 | - $length = (int) self::strlen($str, $encoding); |
|
6558 | + $length = (int)self::strlen($str, $encoding); |
|
6559 | 6559 | |
6560 | 6560 | if ($offset >= 0) { |
6561 | 6561 | return $length > $offset; |
@@ -6581,7 +6581,7 @@ discard block |
||
6581 | 6581 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
6582 | 6582 | { |
6583 | 6583 | // init |
6584 | - $length = (int) self::strlen($str); |
|
6584 | + $length = (int)self::strlen($str); |
|
6585 | 6585 | |
6586 | 6586 | if ( |
6587 | 6587 | ($index >= 0 && $length <= $index) |
@@ -6620,7 +6620,7 @@ discard block |
||
6620 | 6620 | return $str; |
6621 | 6621 | } |
6622 | 6622 | |
6623 | - if ($pad_type !== (int) $pad_type) { |
|
6623 | + if ($pad_type !== (int)$pad_type) { |
|
6624 | 6624 | if ($pad_type === 'left') { |
6625 | 6625 | $pad_type = \STR_PAD_LEFT; |
6626 | 6626 | } elseif ($pad_type === 'right') { |
@@ -6629,23 +6629,23 @@ discard block |
||
6629 | 6629 | $pad_type = \STR_PAD_BOTH; |
6630 | 6630 | } else { |
6631 | 6631 | throw new \InvalidArgumentException( |
6632 | - 'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
6632 | + 'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
6633 | 6633 | ); |
6634 | 6634 | } |
6635 | 6635 | } |
6636 | 6636 | |
6637 | 6637 | if ($encoding === 'UTF-8') { |
6638 | - $str_length = (int) \mb_strlen($str); |
|
6638 | + $str_length = (int)\mb_strlen($str); |
|
6639 | 6639 | |
6640 | 6640 | if ($pad_length >= $str_length) { |
6641 | 6641 | switch ($pad_type) { |
6642 | 6642 | case \STR_PAD_LEFT: |
6643 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6643 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6644 | 6644 | |
6645 | 6645 | $diff = ($pad_length - $str_length); |
6646 | 6646 | |
6647 | - $pre = (string) \mb_substr( |
|
6648 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6647 | + $pre = (string)\mb_substr( |
|
6648 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6649 | 6649 | 0, |
6650 | 6650 | $diff |
6651 | 6651 | ); |
@@ -6656,16 +6656,16 @@ discard block |
||
6656 | 6656 | case \STR_PAD_BOTH: |
6657 | 6657 | $diff = ($pad_length - $str_length); |
6658 | 6658 | |
6659 | - $ps_length_left = (int) \floor($diff / 2); |
|
6659 | + $ps_length_left = (int)\floor($diff / 2); |
|
6660 | 6660 | |
6661 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6661 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6662 | 6662 | |
6663 | - $pre = (string) \mb_substr( |
|
6663 | + $pre = (string)\mb_substr( |
|
6664 | 6664 | \str_repeat($pad_string, $ps_length_left), |
6665 | 6665 | 0, |
6666 | 6666 | $ps_length_left |
6667 | 6667 | ); |
6668 | - $post = (string) \mb_substr( |
|
6668 | + $post = (string)\mb_substr( |
|
6669 | 6669 | \str_repeat($pad_string, $ps_length_right), |
6670 | 6670 | 0, |
6671 | 6671 | $ps_length_right |
@@ -6675,19 +6675,19 @@ discard block |
||
6675 | 6675 | |
6676 | 6676 | case \STR_PAD_RIGHT: |
6677 | 6677 | default: |
6678 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6678 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6679 | 6679 | |
6680 | 6680 | $diff = ($pad_length - $str_length); |
6681 | 6681 | |
6682 | - $post = (string) \mb_substr( |
|
6683 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6682 | + $post = (string)\mb_substr( |
|
6683 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6684 | 6684 | 0, |
6685 | 6685 | $diff |
6686 | 6686 | ); |
6687 | 6687 | $pre = ''; |
6688 | 6688 | } |
6689 | 6689 | |
6690 | - return $pre . $str . $post; |
|
6690 | + return $pre.$str.$post; |
|
6691 | 6691 | } |
6692 | 6692 | |
6693 | 6693 | return $str; |
@@ -6695,17 +6695,17 @@ discard block |
||
6695 | 6695 | |
6696 | 6696 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6697 | 6697 | |
6698 | - $str_length = (int) self::strlen($str, $encoding); |
|
6698 | + $str_length = (int)self::strlen($str, $encoding); |
|
6699 | 6699 | |
6700 | 6700 | if ($pad_length >= $str_length) { |
6701 | 6701 | switch ($pad_type) { |
6702 | 6702 | case \STR_PAD_LEFT: |
6703 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6703 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6704 | 6704 | |
6705 | 6705 | $diff = ($pad_length - $str_length); |
6706 | 6706 | |
6707 | - $pre = (string) self::substr( |
|
6708 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6707 | + $pre = (string)self::substr( |
|
6708 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6709 | 6709 | 0, |
6710 | 6710 | $diff, |
6711 | 6711 | $encoding |
@@ -6717,17 +6717,17 @@ discard block |
||
6717 | 6717 | case \STR_PAD_BOTH: |
6718 | 6718 | $diff = ($pad_length - $str_length); |
6719 | 6719 | |
6720 | - $ps_length_left = (int) \floor($diff / 2); |
|
6720 | + $ps_length_left = (int)\floor($diff / 2); |
|
6721 | 6721 | |
6722 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6722 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6723 | 6723 | |
6724 | - $pre = (string) self::substr( |
|
6724 | + $pre = (string)self::substr( |
|
6725 | 6725 | \str_repeat($pad_string, $ps_length_left), |
6726 | 6726 | 0, |
6727 | 6727 | $ps_length_left, |
6728 | 6728 | $encoding |
6729 | 6729 | ); |
6730 | - $post = (string) self::substr( |
|
6730 | + $post = (string)self::substr( |
|
6731 | 6731 | \str_repeat($pad_string, $ps_length_right), |
6732 | 6732 | 0, |
6733 | 6733 | $ps_length_right, |
@@ -6738,12 +6738,12 @@ discard block |
||
6738 | 6738 | |
6739 | 6739 | case \STR_PAD_RIGHT: |
6740 | 6740 | default: |
6741 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6741 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6742 | 6742 | |
6743 | 6743 | $diff = ($pad_length - $str_length); |
6744 | 6744 | |
6745 | - $post = (string) self::substr( |
|
6746 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6745 | + $post = (string)self::substr( |
|
6746 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6747 | 6747 | 0, |
6748 | 6748 | $diff, |
6749 | 6749 | $encoding |
@@ -6751,7 +6751,7 @@ discard block |
||
6751 | 6751 | $pre = ''; |
6752 | 6752 | } |
6753 | 6753 | |
6754 | - return $pre . $str . $post; |
|
6754 | + return $pre.$str.$post; |
|
6755 | 6755 | } |
6756 | 6756 | |
6757 | 6757 | return $str; |
@@ -6910,11 +6910,11 @@ discard block |
||
6910 | 6910 | } |
6911 | 6911 | |
6912 | 6912 | if ($search === '') { |
6913 | - return $str . $replacement; |
|
6913 | + return $str.$replacement; |
|
6914 | 6914 | } |
6915 | 6915 | |
6916 | 6916 | if (\strpos($str, $search) === 0) { |
6917 | - return $replacement . \substr($str, \strlen($search)); |
|
6917 | + return $replacement.\substr($str, \strlen($search)); |
|
6918 | 6918 | } |
6919 | 6919 | |
6920 | 6920 | return $str; |
@@ -6942,11 +6942,11 @@ discard block |
||
6942 | 6942 | } |
6943 | 6943 | |
6944 | 6944 | if ($search === '') { |
6945 | - return $str . $replacement; |
|
6945 | + return $str.$replacement; |
|
6946 | 6946 | } |
6947 | 6947 | |
6948 | 6948 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6949 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6949 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6950 | 6950 | } |
6951 | 6951 | |
6952 | 6952 | return $str; |
@@ -6975,7 +6975,7 @@ discard block |
||
6975 | 6975 | $subject, |
6976 | 6976 | $replace, |
6977 | 6977 | $pos, |
6978 | - (int) self::strlen($search) |
|
6978 | + (int)self::strlen($search) |
|
6979 | 6979 | ); |
6980 | 6980 | } |
6981 | 6981 | |
@@ -7007,7 +7007,7 @@ discard block |
||
7007 | 7007 | $subject, |
7008 | 7008 | $replace, |
7009 | 7009 | $pos, |
7010 | - (int) self::strlen($search) |
|
7010 | + (int)self::strlen($search) |
|
7011 | 7011 | ); |
7012 | 7012 | } |
7013 | 7013 | |
@@ -7027,7 +7027,7 @@ discard block |
||
7027 | 7027 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
7028 | 7028 | { |
7029 | 7029 | if ($encoding === 'UTF-8') { |
7030 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
7030 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
7031 | 7031 | /** @noinspection NonSecureShuffleUsageInspection */ |
7032 | 7032 | \shuffle($indexes); |
7033 | 7033 | |
@@ -7043,7 +7043,7 @@ discard block |
||
7043 | 7043 | } else { |
7044 | 7044 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7045 | 7045 | |
7046 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
7046 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
7047 | 7047 | /** @noinspection NonSecureShuffleUsageInspection */ |
7048 | 7048 | \shuffle($indexes); |
7049 | 7049 | |
@@ -7084,11 +7084,11 @@ discard block |
||
7084 | 7084 | ) { |
7085 | 7085 | if ($encoding === 'UTF-8') { |
7086 | 7086 | if ($end === null) { |
7087 | - $length = (int) \mb_strlen($str); |
|
7087 | + $length = (int)\mb_strlen($str); |
|
7088 | 7088 | } elseif ($end >= 0 && $end <= $start) { |
7089 | 7089 | return ''; |
7090 | 7090 | } elseif ($end < 0) { |
7091 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7091 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7092 | 7092 | } else { |
7093 | 7093 | $length = $end - $start; |
7094 | 7094 | } |
@@ -7099,11 +7099,11 @@ discard block |
||
7099 | 7099 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7100 | 7100 | |
7101 | 7101 | if ($end === null) { |
7102 | - $length = (int) self::strlen($str, $encoding); |
|
7102 | + $length = (int)self::strlen($str, $encoding); |
|
7103 | 7103 | } elseif ($end >= 0 && $end <= $start) { |
7104 | 7104 | return ''; |
7105 | 7105 | } elseif ($end < 0) { |
7106 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7106 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7107 | 7107 | } else { |
7108 | 7108 | $length = $end - $start; |
7109 | 7109 | } |
@@ -7135,35 +7135,35 @@ discard block |
||
7135 | 7135 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7136 | 7136 | } |
7137 | 7137 | |
7138 | - $str = (string) \preg_replace_callback( |
|
7138 | + $str = (string)\preg_replace_callback( |
|
7139 | 7139 | '/([\\p{N}|\\p{Lu}])/u', |
7140 | 7140 | /** |
7141 | 7141 | * @param string[] $matches |
7142 | 7142 | * |
7143 | 7143 | * @return string |
7144 | 7144 | */ |
7145 | - static function (array $matches) use ($encoding): string { |
|
7145 | + static function(array $matches) use ($encoding): string { |
|
7146 | 7146 | $match = $matches[1]; |
7147 | - $matchInt = (int) $match; |
|
7147 | + $matchInt = (int)$match; |
|
7148 | 7148 | |
7149 | - if ((string) $matchInt === $match) { |
|
7150 | - return '_' . $match . '_'; |
|
7149 | + if ((string)$matchInt === $match) { |
|
7150 | + return '_'.$match.'_'; |
|
7151 | 7151 | } |
7152 | 7152 | |
7153 | 7153 | if ($encoding === 'UTF-8') { |
7154 | - return '_' . \mb_strtolower($match); |
|
7154 | + return '_'.\mb_strtolower($match); |
|
7155 | 7155 | } |
7156 | 7156 | |
7157 | - return '_' . self::strtolower($match, $encoding); |
|
7157 | + return '_'.self::strtolower($match, $encoding); |
|
7158 | 7158 | }, |
7159 | 7159 | $str |
7160 | 7160 | ); |
7161 | 7161 | |
7162 | - $str = (string) \preg_replace( |
|
7162 | + $str = (string)\preg_replace( |
|
7163 | 7163 | [ |
7164 | - '/\\s+/u', // convert spaces to "_" |
|
7164 | + '/\\s+/u', // convert spaces to "_" |
|
7165 | 7165 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
7166 | - '/_+/', // remove double "_" |
|
7166 | + '/_+/', // remove double "_" |
|
7167 | 7167 | ], |
7168 | 7168 | [ |
7169 | 7169 | '_', |
@@ -7239,7 +7239,7 @@ discard block |
||
7239 | 7239 | } |
7240 | 7240 | |
7241 | 7241 | // init |
7242 | - $str = (string) $str; |
|
7242 | + $str = (string)$str; |
|
7243 | 7243 | |
7244 | 7244 | if ($str === '') { |
7245 | 7245 | return []; |
@@ -7286,7 +7286,7 @@ discard block |
||
7286 | 7286 | ($str[$i] & "\xE0") === "\xC0" |
7287 | 7287 | ) { |
7288 | 7288 | if (($str[$i + 1] & "\xC0") === "\x80") { |
7289 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
7289 | + $ret[] = $str[$i].$str[$i + 1]; |
|
7290 | 7290 | |
7291 | 7291 | ++$i; |
7292 | 7292 | } |
@@ -7300,7 +7300,7 @@ discard block |
||
7300 | 7300 | && |
7301 | 7301 | ($str[$i + 2] & "\xC0") === "\x80" |
7302 | 7302 | ) { |
7303 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
7303 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
7304 | 7304 | |
7305 | 7305 | $i += 2; |
7306 | 7306 | } |
@@ -7316,7 +7316,7 @@ discard block |
||
7316 | 7316 | && |
7317 | 7317 | ($str[$i + 3] & "\xC0") === "\x80" |
7318 | 7318 | ) { |
7319 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
7319 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
7320 | 7320 | |
7321 | 7321 | $i += 3; |
7322 | 7322 | } |
@@ -7328,7 +7328,7 @@ discard block |
||
7328 | 7328 | $ret = \array_chunk($ret, $length); |
7329 | 7329 | |
7330 | 7330 | return \array_map( |
7331 | - static function (array &$item): string { |
|
7331 | + static function(array &$item): string { |
|
7332 | 7332 | return \implode('', $item); |
7333 | 7333 | }, |
7334 | 7334 | $ret |
@@ -7391,7 +7391,7 @@ discard block |
||
7391 | 7391 | $limit = -1; |
7392 | 7392 | } |
7393 | 7393 | |
7394 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7394 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7395 | 7395 | |
7396 | 7396 | if ($array === false) { |
7397 | 7397 | return []; |
@@ -7475,9 +7475,9 @@ discard block |
||
7475 | 7475 | return ''; |
7476 | 7476 | } |
7477 | 7477 | |
7478 | - return (string) \mb_substr( |
|
7478 | + return (string)\mb_substr( |
|
7479 | 7479 | $str, |
7480 | - $offset + (int) \mb_strlen($separator) |
|
7480 | + $offset + (int)\mb_strlen($separator) |
|
7481 | 7481 | ); |
7482 | 7482 | } |
7483 | 7483 | |
@@ -7486,9 +7486,9 @@ discard block |
||
7486 | 7486 | return ''; |
7487 | 7487 | } |
7488 | 7488 | |
7489 | - return (string) \mb_substr( |
|
7489 | + return (string)\mb_substr( |
|
7490 | 7490 | $str, |
7491 | - $offset + (int) self::strlen($separator, $encoding), |
|
7491 | + $offset + (int)self::strlen($separator, $encoding), |
|
7492 | 7492 | null, |
7493 | 7493 | $encoding |
7494 | 7494 | ); |
@@ -7515,9 +7515,9 @@ discard block |
||
7515 | 7515 | return ''; |
7516 | 7516 | } |
7517 | 7517 | |
7518 | - return (string) \mb_substr( |
|
7518 | + return (string)\mb_substr( |
|
7519 | 7519 | $str, |
7520 | - $offset + (int) \mb_strlen($separator) |
|
7520 | + $offset + (int)\mb_strlen($separator) |
|
7521 | 7521 | ); |
7522 | 7522 | } |
7523 | 7523 | |
@@ -7526,9 +7526,9 @@ discard block |
||
7526 | 7526 | return ''; |
7527 | 7527 | } |
7528 | 7528 | |
7529 | - return (string) self::substr( |
|
7529 | + return (string)self::substr( |
|
7530 | 7530 | $str, |
7531 | - $offset + (int) self::strlen($separator, $encoding), |
|
7531 | + $offset + (int)self::strlen($separator, $encoding), |
|
7532 | 7532 | null, |
7533 | 7533 | $encoding |
7534 | 7534 | ); |
@@ -7558,7 +7558,7 @@ discard block |
||
7558 | 7558 | return ''; |
7559 | 7559 | } |
7560 | 7560 | |
7561 | - return (string) \mb_substr( |
|
7561 | + return (string)\mb_substr( |
|
7562 | 7562 | $str, |
7563 | 7563 | 0, |
7564 | 7564 | $offset |
@@ -7570,7 +7570,7 @@ discard block |
||
7570 | 7570 | return ''; |
7571 | 7571 | } |
7572 | 7572 | |
7573 | - return (string) self::substr( |
|
7573 | + return (string)self::substr( |
|
7574 | 7574 | $str, |
7575 | 7575 | 0, |
7576 | 7576 | $offset, |
@@ -7599,7 +7599,7 @@ discard block |
||
7599 | 7599 | return ''; |
7600 | 7600 | } |
7601 | 7601 | |
7602 | - return (string) \mb_substr( |
|
7602 | + return (string)\mb_substr( |
|
7603 | 7603 | $str, |
7604 | 7604 | 0, |
7605 | 7605 | $offset |
@@ -7613,7 +7613,7 @@ discard block |
||
7613 | 7613 | |
7614 | 7614 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7615 | 7615 | |
7616 | - return (string) self::substr( |
|
7616 | + return (string)self::substr( |
|
7617 | 7617 | $str, |
7618 | 7618 | 0, |
7619 | 7619 | $offset, |
@@ -7721,7 +7721,7 @@ discard block |
||
7721 | 7721 | */ |
7722 | 7722 | public static function str_surround(string $str, string $substring): string |
7723 | 7723 | { |
7724 | - return $substring . $str . $substring; |
|
7724 | + return $substring.$str.$substring; |
|
7725 | 7725 | } |
7726 | 7726 | |
7727 | 7727 | /** |
@@ -7765,9 +7765,9 @@ discard block |
||
7765 | 7765 | |
7766 | 7766 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
7767 | 7767 | |
7768 | - return (string) \preg_replace_callback( |
|
7768 | + return (string)\preg_replace_callback( |
|
7769 | 7769 | '/([^\\s]+)/u', |
7770 | - static function (array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7770 | + static function(array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7771 | 7771 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
7772 | 7772 | return $match[0]; |
7773 | 7773 | } |
@@ -7853,16 +7853,16 @@ discard block |
||
7853 | 7853 | } |
7854 | 7854 | |
7855 | 7855 | // the main substitutions |
7856 | - $str = (string) \preg_replace_callback( |
|
7856 | + $str = (string)\preg_replace_callback( |
|
7857 | 7857 | '~\\b (_*) (?: # 1. Leading underscore and |
7858 | 7858 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
7859 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) # URL, domain, or email |
|
7859 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) # URL, domain, or email |
|
7860 | 7860 | | |
7861 | - ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' ) # 3. or small word (case-insensitive) |
|
7861 | + ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' ) # 3. or small word (case-insensitive) |
|
7862 | 7862 | | |
7863 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 4. or word w/o internal caps |
|
7863 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 4. or word w/o internal caps |
|
7864 | 7864 | | |
7865 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 5. or some other word |
|
7865 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 5. or some other word |
|
7866 | 7866 | ) (_*) \\b # 6. With trailing underscore |
7867 | 7867 | ~ux', |
7868 | 7868 | /** |
@@ -7870,7 +7870,7 @@ discard block |
||
7870 | 7870 | * |
7871 | 7871 | * @return string |
7872 | 7872 | */ |
7873 | - static function (array $matches) use ($encoding): string { |
|
7873 | + static function(array $matches) use ($encoding): string { |
|
7874 | 7874 | // preserve leading underscore |
7875 | 7875 | $str = $matches[1]; |
7876 | 7876 | if ($matches[2]) { |
@@ -7895,26 +7895,26 @@ discard block |
||
7895 | 7895 | ); |
7896 | 7896 | |
7897 | 7897 | // Exceptions for small words: capitalize at start of title... |
7898 | - $str = (string) \preg_replace_callback( |
|
7898 | + $str = (string)\preg_replace_callback( |
|
7899 | 7899 | '~( \\A [[:punct:]]* # start of title... |
7900 | 7900 | | [:.;?!][ ]+ # or of subsentence... |
7901 | 7901 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
7902 | - ( ' . $smallWordsRx . ' ) \\b # ...followed by small word |
|
7902 | + ( ' . $smallWordsRx.' ) \\b # ...followed by small word |
|
7903 | 7903 | ~uxi', |
7904 | 7904 | /** |
7905 | 7905 | * @param string[] $matches |
7906 | 7906 | * |
7907 | 7907 | * @return string |
7908 | 7908 | */ |
7909 | - static function (array $matches) use ($encoding): string { |
|
7910 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7909 | + static function(array $matches) use ($encoding): string { |
|
7910 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7911 | 7911 | }, |
7912 | 7912 | $str |
7913 | 7913 | ); |
7914 | 7914 | |
7915 | 7915 | // ...and end of title |
7916 | - $str = (string) \preg_replace_callback( |
|
7917 | - '~\\b ( ' . $smallWordsRx . ' ) # small word... |
|
7916 | + $str = (string)\preg_replace_callback( |
|
7917 | + '~\\b ( '.$smallWordsRx.' ) # small word... |
|
7918 | 7918 | (?= [[:punct:]]* \Z # ...at the end of the title... |
7919 | 7919 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
7920 | 7920 | ~uxi', |
@@ -7923,7 +7923,7 @@ discard block |
||
7923 | 7923 | * |
7924 | 7924 | * @return string |
7925 | 7925 | */ |
7926 | - static function (array $matches) use ($encoding): string { |
|
7926 | + static function(array $matches) use ($encoding): string { |
|
7927 | 7927 | return static::str_upper_first($matches[1], $encoding); |
7928 | 7928 | }, |
7929 | 7929 | $str |
@@ -7931,10 +7931,10 @@ discard block |
||
7931 | 7931 | |
7932 | 7932 | // Exceptions for small words in hyphenated compound words. |
7933 | 7933 | // e.g. "in-flight" -> In-Flight |
7934 | - $str = (string) \preg_replace_callback( |
|
7934 | + $str = (string)\preg_replace_callback( |
|
7935 | 7935 | '~\\b |
7936 | 7936 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
7937 | - ( ' . $smallWordsRx . ' ) |
|
7937 | + ( ' . $smallWordsRx.' ) |
|
7938 | 7938 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
7939 | 7939 | ~uxi', |
7940 | 7940 | /** |
@@ -7942,18 +7942,18 @@ discard block |
||
7942 | 7942 | * |
7943 | 7943 | * @return string |
7944 | 7944 | */ |
7945 | - static function (array $matches) use ($encoding): string { |
|
7945 | + static function(array $matches) use ($encoding): string { |
|
7946 | 7946 | return static::str_upper_first($matches[1], $encoding); |
7947 | 7947 | }, |
7948 | 7948 | $str |
7949 | 7949 | ); |
7950 | 7950 | |
7951 | 7951 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
7952 | - $str = (string) \preg_replace_callback( |
|
7952 | + $str = (string)\preg_replace_callback( |
|
7953 | 7953 | '~\\b |
7954 | 7954 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
7955 | 7955 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
7956 | - ( ' . $smallWordsRx . ' ) # ...followed by small word |
|
7956 | + ( ' . $smallWordsRx.' ) # ...followed by small word |
|
7957 | 7957 | (?! - ) # Negative lookahead for another - |
7958 | 7958 | ~uxi', |
7959 | 7959 | /** |
@@ -7961,8 +7961,8 @@ discard block |
||
7961 | 7961 | * |
7962 | 7962 | * @return string |
7963 | 7963 | */ |
7964 | - static function (array $matches) use ($encoding): string { |
|
7965 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7964 | + static function(array $matches) use ($encoding): string { |
|
7965 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7966 | 7966 | }, |
7967 | 7967 | $str |
7968 | 7968 | ); |
@@ -8070,7 +8070,7 @@ discard block |
||
8070 | 8070 | ); |
8071 | 8071 | |
8072 | 8072 | foreach ($tmpReturn as &$item) { |
8073 | - $item = (string) $item; |
|
8073 | + $item = (string)$item; |
|
8074 | 8074 | } |
8075 | 8075 | |
8076 | 8076 | return $tmpReturn; |
@@ -8115,39 +8115,39 @@ discard block |
||
8115 | 8115 | } |
8116 | 8116 | |
8117 | 8117 | if ($encoding === 'UTF-8') { |
8118 | - if ($length >= (int) \mb_strlen($str)) { |
|
8118 | + if ($length >= (int)\mb_strlen($str)) { |
|
8119 | 8119 | return $str; |
8120 | 8120 | } |
8121 | 8121 | |
8122 | 8122 | if ($substring !== '') { |
8123 | - $length -= (int) \mb_strlen($substring); |
|
8123 | + $length -= (int)\mb_strlen($substring); |
|
8124 | 8124 | |
8125 | 8125 | /** @noinspection UnnecessaryCastingInspection */ |
8126 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
8126 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
8127 | 8127 | } |
8128 | 8128 | |
8129 | 8129 | /** @noinspection UnnecessaryCastingInspection */ |
8130 | - return (string) \mb_substr($str, 0, $length); |
|
8130 | + return (string)\mb_substr($str, 0, $length); |
|
8131 | 8131 | } |
8132 | 8132 | |
8133 | 8133 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8134 | 8134 | |
8135 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8135 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8136 | 8136 | return $str; |
8137 | 8137 | } |
8138 | 8138 | |
8139 | 8139 | if ($substring !== '') { |
8140 | - $length -= (int) self::strlen($substring, $encoding); |
|
8140 | + $length -= (int)self::strlen($substring, $encoding); |
|
8141 | 8141 | } |
8142 | 8142 | |
8143 | 8143 | return ( |
8144 | - (string) self::substr( |
|
8144 | + (string)self::substr( |
|
8145 | 8145 | $str, |
8146 | 8146 | 0, |
8147 | 8147 | $length, |
8148 | 8148 | $encoding |
8149 | 8149 | ) |
8150 | - ) . $substring; |
|
8150 | + ).$substring; |
|
8151 | 8151 | } |
8152 | 8152 | |
8153 | 8153 | /** |
@@ -8177,12 +8177,12 @@ discard block |
||
8177 | 8177 | } |
8178 | 8178 | |
8179 | 8179 | if ($encoding === 'UTF-8') { |
8180 | - if ($length >= (int) \mb_strlen($str)) { |
|
8180 | + if ($length >= (int)\mb_strlen($str)) { |
|
8181 | 8181 | return $str; |
8182 | 8182 | } |
8183 | 8183 | |
8184 | 8184 | // need to further trim the string so we can append the substring |
8185 | - $length -= (int) \mb_strlen($substring); |
|
8185 | + $length -= (int)\mb_strlen($substring); |
|
8186 | 8186 | if ($length <= 0) { |
8187 | 8187 | return $substring; |
8188 | 8188 | } |
@@ -8204,18 +8204,18 @@ discard block |
||
8204 | 8204 | || |
8205 | 8205 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8206 | 8206 | ) { |
8207 | - $truncated = (string) \mb_substr($truncated, 0, (int) $lastPos); |
|
8207 | + $truncated = (string)\mb_substr($truncated, 0, (int)$lastPos); |
|
8208 | 8208 | } |
8209 | 8209 | } |
8210 | 8210 | } else { |
8211 | 8211 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8212 | 8212 | |
8213 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8213 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8214 | 8214 | return $str; |
8215 | 8215 | } |
8216 | 8216 | |
8217 | 8217 | // need to further trim the string so we can append the substring |
8218 | - $length -= (int) self::strlen($substring, $encoding); |
|
8218 | + $length -= (int)self::strlen($substring, $encoding); |
|
8219 | 8219 | if ($length <= 0) { |
8220 | 8220 | return $substring; |
8221 | 8221 | } |
@@ -8237,12 +8237,12 @@ discard block |
||
8237 | 8237 | || |
8238 | 8238 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8239 | 8239 | ) { |
8240 | - $truncated = (string) self::substr($truncated, 0, (int) $lastPos, $encoding); |
|
8240 | + $truncated = (string)self::substr($truncated, 0, (int)$lastPos, $encoding); |
|
8241 | 8241 | } |
8242 | 8242 | } |
8243 | 8243 | } |
8244 | 8244 | |
8245 | - return $truncated . $substring; |
|
8245 | + return $truncated.$substring; |
|
8246 | 8246 | } |
8247 | 8247 | |
8248 | 8248 | /** |
@@ -8332,13 +8332,13 @@ discard block |
||
8332 | 8332 | } |
8333 | 8333 | } elseif ($format === 2) { |
8334 | 8334 | $numberOfWords = []; |
8335 | - $offset = (int) self::strlen($strParts[0]); |
|
8335 | + $offset = (int)self::strlen($strParts[0]); |
|
8336 | 8336 | for ($i = 1; $i < $len; $i += 2) { |
8337 | 8337 | $numberOfWords[$offset] = $strParts[$i]; |
8338 | - $offset += (int) self::strlen($strParts[$i]) + (int) self::strlen($strParts[$i + 1]); |
|
8338 | + $offset += (int)self::strlen($strParts[$i]) + (int)self::strlen($strParts[$i + 1]); |
|
8339 | 8339 | } |
8340 | 8340 | } else { |
8341 | - $numberOfWords = (int) (($len - 1) / 2); |
|
8341 | + $numberOfWords = (int)(($len - 1) / 2); |
|
8342 | 8342 | } |
8343 | 8343 | |
8344 | 8344 | return $numberOfWords; |
@@ -8435,21 +8435,21 @@ discard block |
||
8435 | 8435 | } |
8436 | 8436 | |
8437 | 8437 | if ($charList === '') { |
8438 | - return (int) self::strlen($str, $encoding); |
|
8438 | + return (int)self::strlen($str, $encoding); |
|
8439 | 8439 | } |
8440 | 8440 | |
8441 | 8441 | if ($offset !== null || $length !== null) { |
8442 | 8442 | if ($encoding === 'UTF-8') { |
8443 | 8443 | if ($length === null) { |
8444 | 8444 | /** @noinspection UnnecessaryCastingInspection */ |
8445 | - $strTmp = \mb_substr($str, (int) $offset); |
|
8445 | + $strTmp = \mb_substr($str, (int)$offset); |
|
8446 | 8446 | } else { |
8447 | 8447 | /** @noinspection UnnecessaryCastingInspection */ |
8448 | - $strTmp = \mb_substr($str, (int) $offset, $length); |
|
8448 | + $strTmp = \mb_substr($str, (int)$offset, $length); |
|
8449 | 8449 | } |
8450 | 8450 | } else { |
8451 | 8451 | /** @noinspection UnnecessaryCastingInspection */ |
8452 | - $strTmp = self::substr($str, (int) $offset, $length, $encoding); |
|
8452 | + $strTmp = self::substr($str, (int)$offset, $length, $encoding); |
|
8453 | 8453 | } |
8454 | 8454 | |
8455 | 8455 | if ($strTmp === false) { |
@@ -8464,7 +8464,7 @@ discard block |
||
8464 | 8464 | } |
8465 | 8465 | |
8466 | 8466 | $matches = []; |
8467 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $matches)) { |
|
8467 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $matches)) { |
|
8468 | 8468 | $return = self::strlen($matches[1], $encoding); |
8469 | 8469 | if ($return === false) { |
8470 | 8470 | return 0; |
@@ -8473,7 +8473,7 @@ discard block |
||
8473 | 8473 | return $return; |
8474 | 8474 | } |
8475 | 8475 | |
8476 | - return (int) self::strlen($str, $encoding); |
|
8476 | + return (int)self::strlen($str, $encoding); |
|
8477 | 8477 | } |
8478 | 8478 | |
8479 | 8479 | /** |
@@ -8595,7 +8595,7 @@ discard block |
||
8595 | 8595 | return ''; |
8596 | 8596 | } |
8597 | 8597 | |
8598 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
8598 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
8599 | 8599 | } |
8600 | 8600 | |
8601 | 8601 | /** |
@@ -8660,7 +8660,7 @@ discard block |
||
8660 | 8660 | // fallback for ascii only |
8661 | 8661 | // |
8662 | 8662 | |
8663 | - if (self::is_ascii($haystack . $needle)) { |
|
8663 | + if (self::is_ascii($haystack.$needle)) { |
|
8664 | 8664 | return \stripos($haystack, $needle, $offset); |
8665 | 8665 | } |
8666 | 8666 | |
@@ -8727,7 +8727,7 @@ discard block |
||
8727 | 8727 | && |
8728 | 8728 | self::$SUPPORT['mbstring'] === false |
8729 | 8729 | ) { |
8730 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8730 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8731 | 8731 | } |
8732 | 8732 | |
8733 | 8733 | if ( |
@@ -8741,11 +8741,11 @@ discard block |
||
8741 | 8741 | } |
8742 | 8742 | } |
8743 | 8743 | |
8744 | - if (self::is_ascii($needle . $haystack)) { |
|
8744 | + if (self::is_ascii($needle.$haystack)) { |
|
8745 | 8745 | return \stristr($haystack, $needle, $before_needle); |
8746 | 8746 | } |
8747 | 8747 | |
8748 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
8748 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
8749 | 8749 | |
8750 | 8750 | if (!isset($match[1])) { |
8751 | 8751 | return false; |
@@ -8755,7 +8755,7 @@ discard block |
||
8755 | 8755 | return $match[1]; |
8756 | 8756 | } |
8757 | 8757 | |
8758 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
8758 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
8759 | 8759 | } |
8760 | 8760 | |
8761 | 8761 | /** |
@@ -8822,7 +8822,7 @@ discard block |
||
8822 | 8822 | && |
8823 | 8823 | self::$SUPPORT['iconv'] === false |
8824 | 8824 | ) { |
8825 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8825 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8826 | 8826 | } |
8827 | 8827 | |
8828 | 8828 | // |
@@ -8938,8 +8938,8 @@ discard block |
||
8938 | 8938 | } |
8939 | 8939 | |
8940 | 8940 | return \strnatcmp( |
8941 | - (string) self::strtonatfold($str1), |
|
8942 | - (string) self::strtonatfold($str2) |
|
8941 | + (string)self::strtonatfold($str1), |
|
8942 | + (string)self::strtonatfold($str2) |
|
8943 | 8943 | ); |
8944 | 8944 | } |
8945 | 8945 | |
@@ -8997,11 +8997,11 @@ discard block |
||
8997 | 8997 | } |
8998 | 8998 | |
8999 | 8999 | if ($encoding === 'UTF-8') { |
9000 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
9001 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
9000 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
9001 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
9002 | 9002 | } else { |
9003 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
9004 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
9003 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
9004 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
9005 | 9005 | } |
9006 | 9006 | |
9007 | 9007 | return self::strcmp($str1, $str2); |
@@ -9023,8 +9023,8 @@ discard block |
||
9023 | 9023 | return false; |
9024 | 9024 | } |
9025 | 9025 | |
9026 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
9027 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
9026 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
9027 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
9028 | 9028 | } |
9029 | 9029 | |
9030 | 9030 | return false; |
@@ -9057,10 +9057,10 @@ discard block |
||
9057 | 9057 | } |
9058 | 9058 | |
9059 | 9059 | // iconv and mbstring do not support integer $needle |
9060 | - if ((int) $needle === $needle) { |
|
9061 | - $needle = (string) self::chr($needle); |
|
9060 | + if ((int)$needle === $needle) { |
|
9061 | + $needle = (string)self::chr($needle); |
|
9062 | 9062 | } |
9063 | - $needle = (string) $needle; |
|
9063 | + $needle = (string)$needle; |
|
9064 | 9064 | |
9065 | 9065 | if ($needle === '') { |
9066 | 9066 | return false; |
@@ -9107,7 +9107,7 @@ discard block |
||
9107 | 9107 | && |
9108 | 9108 | self::$SUPPORT['mbstring'] === false |
9109 | 9109 | ) { |
9110 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9110 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9111 | 9111 | } |
9112 | 9112 | |
9113 | 9113 | // |
@@ -9148,7 +9148,7 @@ discard block |
||
9148 | 9148 | // fallback for ascii only |
9149 | 9149 | // |
9150 | 9150 | |
9151 | - if (self::is_ascii($haystack . $needle)) { |
|
9151 | + if (self::is_ascii($haystack.$needle)) { |
|
9152 | 9152 | return \strpos($haystack, $needle, $offset); |
9153 | 9153 | } |
9154 | 9154 | |
@@ -9160,7 +9160,7 @@ discard block |
||
9160 | 9160 | if ($haystackTmp === false) { |
9161 | 9161 | $haystackTmp = ''; |
9162 | 9162 | } |
9163 | - $haystack = (string) $haystackTmp; |
|
9163 | + $haystack = (string)$haystackTmp; |
|
9164 | 9164 | |
9165 | 9165 | if ($offset < 0) { |
9166 | 9166 | $offset = 0; |
@@ -9172,7 +9172,7 @@ discard block |
||
9172 | 9172 | } |
9173 | 9173 | |
9174 | 9174 | if ($pos) { |
9175 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9175 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9176 | 9176 | } |
9177 | 9177 | |
9178 | 9178 | return $offset + 0; |
@@ -9283,7 +9283,7 @@ discard block |
||
9283 | 9283 | && |
9284 | 9284 | self::$SUPPORT['mbstring'] === false |
9285 | 9285 | ) { |
9286 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9286 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9287 | 9287 | } |
9288 | 9288 | |
9289 | 9289 | // |
@@ -9295,7 +9295,7 @@ discard block |
||
9295 | 9295 | if ($needleTmp === false) { |
9296 | 9296 | return false; |
9297 | 9297 | } |
9298 | - $needle = (string) $needleTmp; |
|
9298 | + $needle = (string)$needleTmp; |
|
9299 | 9299 | |
9300 | 9300 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
9301 | 9301 | if ($pos === false) { |
@@ -9317,7 +9317,7 @@ discard block |
||
9317 | 9317 | if ($needleTmp === false) { |
9318 | 9318 | return false; |
9319 | 9319 | } |
9320 | - $needle = (string) $needleTmp; |
|
9320 | + $needle = (string)$needleTmp; |
|
9321 | 9321 | |
9322 | 9322 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
9323 | 9323 | if ($pos === false) { |
@@ -9353,7 +9353,7 @@ discard block |
||
9353 | 9353 | if ($encoding === 'UTF-8') { |
9354 | 9354 | if (self::$SUPPORT['intl'] === true) { |
9355 | 9355 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
9356 | - $i = (int) \grapheme_strlen($str); |
|
9356 | + $i = (int)\grapheme_strlen($str); |
|
9357 | 9357 | while ($i--) { |
9358 | 9358 | $reversedTmp = \grapheme_substr($str, $i, 1); |
9359 | 9359 | if ($reversedTmp !== false) { |
@@ -9361,7 +9361,7 @@ discard block |
||
9361 | 9361 | } |
9362 | 9362 | } |
9363 | 9363 | } else { |
9364 | - $i = (int) \mb_strlen($str); |
|
9364 | + $i = (int)\mb_strlen($str); |
|
9365 | 9365 | while ($i--) { |
9366 | 9366 | $reversedTmp = \mb_substr($str, $i, 1); |
9367 | 9367 | if ($reversedTmp !== false) { |
@@ -9372,7 +9372,7 @@ discard block |
||
9372 | 9372 | } else { |
9373 | 9373 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9374 | 9374 | |
9375 | - $i = (int) self::strlen($str, $encoding); |
|
9375 | + $i = (int)self::strlen($str, $encoding); |
|
9376 | 9376 | while ($i--) { |
9377 | 9377 | $reversedTmp = self::substr($str, $i, 1, $encoding); |
9378 | 9378 | if ($reversedTmp !== false) { |
@@ -9446,7 +9446,7 @@ discard block |
||
9446 | 9446 | if ($needleTmp === false) { |
9447 | 9447 | return false; |
9448 | 9448 | } |
9449 | - $needle = (string) $needleTmp; |
|
9449 | + $needle = (string)$needleTmp; |
|
9450 | 9450 | |
9451 | 9451 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
9452 | 9452 | if ($pos === false) { |
@@ -9485,10 +9485,10 @@ discard block |
||
9485 | 9485 | } |
9486 | 9486 | |
9487 | 9487 | // iconv and mbstring do not support integer $needle |
9488 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9489 | - $needle = (string) self::chr($needle); |
|
9488 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9489 | + $needle = (string)self::chr($needle); |
|
9490 | 9490 | } |
9491 | - $needle = (string) $needle; |
|
9491 | + $needle = (string)$needle; |
|
9492 | 9492 | |
9493 | 9493 | if ($needle === '') { |
9494 | 9494 | return false; |
@@ -9533,7 +9533,7 @@ discard block |
||
9533 | 9533 | && |
9534 | 9534 | self::$SUPPORT['mbstring'] === false |
9535 | 9535 | ) { |
9536 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9536 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9537 | 9537 | } |
9538 | 9538 | |
9539 | 9539 | // |
@@ -9557,7 +9557,7 @@ discard block |
||
9557 | 9557 | // fallback for ascii only |
9558 | 9558 | // |
9559 | 9559 | |
9560 | - if (self::is_ascii($haystack . $needle)) { |
|
9560 | + if (self::is_ascii($haystack.$needle)) { |
|
9561 | 9561 | return \strripos($haystack, $needle, $offset); |
9562 | 9562 | } |
9563 | 9563 | |
@@ -9633,10 +9633,10 @@ discard block |
||
9633 | 9633 | } |
9634 | 9634 | |
9635 | 9635 | // iconv and mbstring do not support integer $needle |
9636 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9637 | - $needle = (string) self::chr($needle); |
|
9636 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9637 | + $needle = (string)self::chr($needle); |
|
9638 | 9638 | } |
9639 | - $needle = (string) $needle; |
|
9639 | + $needle = (string)$needle; |
|
9640 | 9640 | |
9641 | 9641 | if ($needle === '') { |
9642 | 9642 | return false; |
@@ -9681,7 +9681,7 @@ discard block |
||
9681 | 9681 | && |
9682 | 9682 | self::$SUPPORT['mbstring'] === false |
9683 | 9683 | ) { |
9684 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9684 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9685 | 9685 | } |
9686 | 9686 | |
9687 | 9687 | // |
@@ -9705,7 +9705,7 @@ discard block |
||
9705 | 9705 | // fallback for ascii only |
9706 | 9706 | // |
9707 | 9707 | |
9708 | - if (self::is_ascii($haystack . $needle)) { |
|
9708 | + if (self::is_ascii($haystack.$needle)) { |
|
9709 | 9709 | return \strrpos($haystack, $needle, $offset); |
9710 | 9710 | } |
9711 | 9711 | |
@@ -9725,7 +9725,7 @@ discard block |
||
9725 | 9725 | if ($haystackTmp === false) { |
9726 | 9726 | $haystackTmp = ''; |
9727 | 9727 | } |
9728 | - $haystack = (string) $haystackTmp; |
|
9728 | + $haystack = (string)$haystackTmp; |
|
9729 | 9729 | } |
9730 | 9730 | |
9731 | 9731 | $pos = \strrpos($haystack, $needle); |
@@ -9738,7 +9738,7 @@ discard block |
||
9738 | 9738 | return false; |
9739 | 9739 | } |
9740 | 9740 | |
9741 | - return $offset + (int) self::strlen($strTmp); |
|
9741 | + return $offset + (int)self::strlen($strTmp); |
|
9742 | 9742 | } |
9743 | 9743 | |
9744 | 9744 | /** |
@@ -9798,12 +9798,12 @@ discard block |
||
9798 | 9798 | if ($offset || $length !== null) { |
9799 | 9799 | if ($encoding === 'UTF-8') { |
9800 | 9800 | if ($length === null) { |
9801 | - $str = (string) \mb_substr($str, $offset); |
|
9801 | + $str = (string)\mb_substr($str, $offset); |
|
9802 | 9802 | } else { |
9803 | - $str = (string) \mb_substr($str, $offset, $length); |
|
9803 | + $str = (string)\mb_substr($str, $offset, $length); |
|
9804 | 9804 | } |
9805 | 9805 | } else { |
9806 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
9806 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
9807 | 9807 | } |
9808 | 9808 | } |
9809 | 9809 | |
@@ -9813,7 +9813,7 @@ discard block |
||
9813 | 9813 | |
9814 | 9814 | $matches = []; |
9815 | 9815 | |
9816 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
9816 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
9817 | 9817 | } |
9818 | 9818 | |
9819 | 9819 | /** |
@@ -9882,7 +9882,7 @@ discard block |
||
9882 | 9882 | && |
9883 | 9883 | self::$SUPPORT['mbstring'] === false |
9884 | 9884 | ) { |
9885 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9885 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9886 | 9886 | } |
9887 | 9887 | |
9888 | 9888 | // |
@@ -9904,7 +9904,7 @@ discard block |
||
9904 | 9904 | // fallback for ascii only |
9905 | 9905 | // |
9906 | 9906 | |
9907 | - if (self::is_ascii($haystack . $needle)) { |
|
9907 | + if (self::is_ascii($haystack.$needle)) { |
|
9908 | 9908 | return \strstr($haystack, $needle, $before_needle); |
9909 | 9909 | } |
9910 | 9910 | |
@@ -9912,7 +9912,7 @@ discard block |
||
9912 | 9912 | // fallback via vanilla php |
9913 | 9913 | // |
9914 | 9914 | |
9915 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
9915 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
9916 | 9916 | |
9917 | 9917 | if (!isset($match[1])) { |
9918 | 9918 | return false; |
@@ -9922,7 +9922,7 @@ discard block |
||
9922 | 9922 | return $match[1]; |
9923 | 9923 | } |
9924 | 9924 | |
9925 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
9925 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
9926 | 9926 | } |
9927 | 9927 | |
9928 | 9928 | /** |
@@ -10036,7 +10036,7 @@ discard block |
||
10036 | 10036 | bool $tryToKeepStringLength = false |
10037 | 10037 | ): string { |
10038 | 10038 | // init |
10039 | - $str = (string) $str; |
|
10039 | + $str = (string)$str; |
|
10040 | 10040 | |
10041 | 10041 | if ($str === '') { |
10042 | 10042 | return ''; |
@@ -10065,19 +10065,19 @@ discard block |
||
10065 | 10065 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10066 | 10066 | } |
10067 | 10067 | |
10068 | - $langCode = $lang . '-Lower'; |
|
10068 | + $langCode = $lang.'-Lower'; |
|
10069 | 10069 | if (!\in_array($langCode, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10070 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, \E_USER_WARNING); |
|
10070 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, \E_USER_WARNING); |
|
10071 | 10071 | |
10072 | 10072 | $langCode = 'Any-Lower'; |
10073 | 10073 | } |
10074 | 10074 | |
10075 | 10075 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10076 | 10076 | /** @noinspection UnnecessaryCastingInspection */ |
10077 | - return (string) \transliterator_transliterate($langCode, $str); |
|
10077 | + return (string)\transliterator_transliterate($langCode, $str); |
|
10078 | 10078 | } |
10079 | 10079 | |
10080 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
10080 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
10081 | 10081 | } |
10082 | 10082 | |
10083 | 10083 | // always fallback via symfony polyfill |
@@ -10106,7 +10106,7 @@ discard block |
||
10106 | 10106 | bool $tryToKeepStringLength = false |
10107 | 10107 | ): string { |
10108 | 10108 | // init |
10109 | - $str = (string) $str; |
|
10109 | + $str = (string)$str; |
|
10110 | 10110 | |
10111 | 10111 | if ($str === '') { |
10112 | 10112 | return ''; |
@@ -10135,19 +10135,19 @@ discard block |
||
10135 | 10135 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10136 | 10136 | } |
10137 | 10137 | |
10138 | - $langCode = $lang . '-Upper'; |
|
10138 | + $langCode = $lang.'-Upper'; |
|
10139 | 10139 | if (!\in_array($langCode, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10140 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
10140 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
10141 | 10141 | |
10142 | 10142 | $langCode = 'Any-Upper'; |
10143 | 10143 | } |
10144 | 10144 | |
10145 | 10145 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10146 | 10146 | /** @noinspection UnnecessaryCastingInspection */ |
10147 | - return (string) \transliterator_transliterate($langCode, $str); |
|
10147 | + return (string)\transliterator_transliterate($langCode, $str); |
|
10148 | 10148 | } |
10149 | 10149 | |
10150 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
10150 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
10151 | 10151 | } |
10152 | 10152 | |
10153 | 10153 | // always fallback via symfony polyfill |
@@ -10191,7 +10191,7 @@ discard block |
||
10191 | 10191 | |
10192 | 10192 | $from = \array_combine($from, $to); |
10193 | 10193 | if ($from === false) { |
10194 | - 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) . ')'); |
|
10194 | + 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).')'); |
|
10195 | 10195 | } |
10196 | 10196 | } |
10197 | 10197 | |
@@ -10248,9 +10248,9 @@ discard block |
||
10248 | 10248 | } |
10249 | 10249 | |
10250 | 10250 | $wide = 0; |
10251 | - $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); |
|
10251 | + $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); |
|
10252 | 10252 | |
10253 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
10253 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
10254 | 10254 | } |
10255 | 10255 | |
10256 | 10256 | /** |
@@ -10350,9 +10350,9 @@ discard block |
||
10350 | 10350 | } |
10351 | 10351 | |
10352 | 10352 | if ($length === null) { |
10353 | - $length = (int) $str_length; |
|
10353 | + $length = (int)$str_length; |
|
10354 | 10354 | } else { |
10355 | - $length = (int) $length; |
|
10355 | + $length = (int)$length; |
|
10356 | 10356 | } |
10357 | 10357 | |
10358 | 10358 | if ( |
@@ -10360,7 +10360,7 @@ discard block |
||
10360 | 10360 | && |
10361 | 10361 | self::$SUPPORT['mbstring'] === false |
10362 | 10362 | ) { |
10363 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10363 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10364 | 10364 | } |
10365 | 10365 | |
10366 | 10366 | // |
@@ -10448,16 +10448,16 @@ discard block |
||
10448 | 10448 | ) { |
10449 | 10449 | if ($encoding === 'UTF-8') { |
10450 | 10450 | if ($length === null) { |
10451 | - $str1 = (string) \mb_substr($str1, $offset); |
|
10451 | + $str1 = (string)\mb_substr($str1, $offset); |
|
10452 | 10452 | } else { |
10453 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
10453 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
10454 | 10454 | } |
10455 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
10455 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
10456 | 10456 | } else { |
10457 | 10457 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10458 | 10458 | |
10459 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
10460 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
10459 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
10460 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
10461 | 10461 | } |
10462 | 10462 | } |
10463 | 10463 | |
@@ -10519,13 +10519,13 @@ discard block |
||
10519 | 10519 | if ($lengthTmp === false) { |
10520 | 10520 | return false; |
10521 | 10521 | } |
10522 | - $length = (int) $lengthTmp; |
|
10522 | + $length = (int)$lengthTmp; |
|
10523 | 10523 | } |
10524 | 10524 | |
10525 | 10525 | if ($encoding === 'UTF-8') { |
10526 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
10526 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
10527 | 10527 | } else { |
10528 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
10528 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
10529 | 10529 | } |
10530 | 10530 | } |
10531 | 10531 | |
@@ -10534,7 +10534,7 @@ discard block |
||
10534 | 10534 | && |
10535 | 10535 | self::$SUPPORT['mbstring'] === false |
10536 | 10536 | ) { |
10537 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10537 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10538 | 10538 | } |
10539 | 10539 | |
10540 | 10540 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10545,7 +10545,7 @@ discard block |
||
10545 | 10545 | return \mb_substr_count($haystack, $needle, $encoding); |
10546 | 10546 | } |
10547 | 10547 | |
10548 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10548 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10549 | 10549 | |
10550 | 10550 | return \count($matches); |
10551 | 10551 | } |
@@ -10592,7 +10592,7 @@ discard block |
||
10592 | 10592 | if ($lengthTmp === false) { |
10593 | 10593 | return false; |
10594 | 10594 | } |
10595 | - $length = (int) $lengthTmp; |
|
10595 | + $length = (int)$lengthTmp; |
|
10596 | 10596 | } |
10597 | 10597 | |
10598 | 10598 | if ( |
@@ -10613,7 +10613,7 @@ discard block |
||
10613 | 10613 | if ($haystackTmp === false) { |
10614 | 10614 | $haystackTmp = ''; |
10615 | 10615 | } |
10616 | - $haystack = (string) $haystackTmp; |
|
10616 | + $haystack = (string)$haystackTmp; |
|
10617 | 10617 | } |
10618 | 10618 | |
10619 | 10619 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10652,10 +10652,10 @@ discard block |
||
10652 | 10652 | |
10653 | 10653 | if ($encoding === 'UTF-8') { |
10654 | 10654 | if ($caseSensitive) { |
10655 | - return (int) \mb_substr_count($str, $substring); |
|
10655 | + return (int)\mb_substr_count($str, $substring); |
|
10656 | 10656 | } |
10657 | 10657 | |
10658 | - return (int) \mb_substr_count( |
|
10658 | + return (int)\mb_substr_count( |
|
10659 | 10659 | \mb_strtoupper($str), |
10660 | 10660 | \mb_strtoupper($substring) |
10661 | 10661 | |
@@ -10665,10 +10665,10 @@ discard block |
||
10665 | 10665 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10666 | 10666 | |
10667 | 10667 | if ($caseSensitive) { |
10668 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
10668 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
10669 | 10669 | } |
10670 | 10670 | |
10671 | - return (int) \mb_substr_count( |
|
10671 | + return (int)\mb_substr_count( |
|
10672 | 10672 | self::strtocasefold($str, true, false, $encoding, null, false), |
10673 | 10673 | self::strtocasefold($substring, true, false, $encoding, null, false), |
10674 | 10674 | $encoding |
@@ -10694,7 +10694,7 @@ discard block |
||
10694 | 10694 | } |
10695 | 10695 | |
10696 | 10696 | if (self::str_istarts_with($haystack, $needle) === true) { |
10697 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10697 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10698 | 10698 | } |
10699 | 10699 | |
10700 | 10700 | return $haystack; |
@@ -10751,7 +10751,7 @@ discard block |
||
10751 | 10751 | } |
10752 | 10752 | |
10753 | 10753 | if (self::str_iends_with($haystack, $needle) === true) { |
10754 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
10754 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
10755 | 10755 | } |
10756 | 10756 | |
10757 | 10757 | return $haystack; |
@@ -10776,7 +10776,7 @@ discard block |
||
10776 | 10776 | } |
10777 | 10777 | |
10778 | 10778 | if (self::str_starts_with($haystack, $needle) === true) { |
10779 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10779 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10780 | 10780 | } |
10781 | 10781 | |
10782 | 10782 | return $haystack; |
@@ -10828,7 +10828,7 @@ discard block |
||
10828 | 10828 | if (\is_array($offset) === true) { |
10829 | 10829 | $offset = \array_slice($offset, 0, $num); |
10830 | 10830 | foreach ($offset as &$valueTmp) { |
10831 | - $valueTmp = (int) $valueTmp === $valueTmp ? $valueTmp : 0; |
|
10831 | + $valueTmp = (int)$valueTmp === $valueTmp ? $valueTmp : 0; |
|
10832 | 10832 | } |
10833 | 10833 | unset($valueTmp); |
10834 | 10834 | } else { |
@@ -10841,7 +10841,7 @@ discard block |
||
10841 | 10841 | } elseif (\is_array($length) === true) { |
10842 | 10842 | $length = \array_slice($length, 0, $num); |
10843 | 10843 | foreach ($length as &$valueTmpV2) { |
10844 | - $valueTmpV2 = (int) $valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10844 | + $valueTmpV2 = (int)$valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10845 | 10845 | } |
10846 | 10846 | unset($valueTmpV2); |
10847 | 10847 | } else { |
@@ -10861,8 +10861,8 @@ discard block |
||
10861 | 10861 | } |
10862 | 10862 | |
10863 | 10863 | // init |
10864 | - $str = (string) $str; |
|
10865 | - $replacement = (string) $replacement; |
|
10864 | + $str = (string)$str; |
|
10865 | + $replacement = (string)$replacement; |
|
10866 | 10866 | |
10867 | 10867 | if (\is_array($length) === true) { |
10868 | 10868 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -10877,16 +10877,16 @@ discard block |
||
10877 | 10877 | } |
10878 | 10878 | |
10879 | 10879 | if (self::$SUPPORT['mbstring'] === true) { |
10880 | - $string_length = (int) self::strlen($str, $encoding); |
|
10880 | + $string_length = (int)self::strlen($str, $encoding); |
|
10881 | 10881 | |
10882 | 10882 | if ($offset < 0) { |
10883 | - $offset = (int) \max(0, $string_length + $offset); |
|
10883 | + $offset = (int)\max(0, $string_length + $offset); |
|
10884 | 10884 | } elseif ($offset > $string_length) { |
10885 | 10885 | $offset = $string_length; |
10886 | 10886 | } |
10887 | 10887 | |
10888 | 10888 | if ($length !== null && $length < 0) { |
10889 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
10889 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
10890 | 10890 | } elseif ($length === null || $length > $string_length) { |
10891 | 10891 | $length = $string_length; |
10892 | 10892 | } |
@@ -10897,9 +10897,9 @@ discard block |
||
10897 | 10897 | } |
10898 | 10898 | |
10899 | 10899 | /** @noinspection AdditionOperationOnArraysInspection */ |
10900 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
10901 | - $replacement . |
|
10902 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10900 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
10901 | + $replacement. |
|
10902 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10903 | 10903 | } |
10904 | 10904 | |
10905 | 10905 | // |
@@ -10908,8 +10908,7 @@ discard block |
||
10908 | 10908 | |
10909 | 10909 | if (self::is_ascii($str)) { |
10910 | 10910 | return ($length === null) ? |
10911 | - \substr_replace($str, $replacement, $offset) : |
|
10912 | - \substr_replace($str, $replacement, $offset, $length); |
|
10911 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
10913 | 10912 | } |
10914 | 10913 | |
10915 | 10914 | // |
@@ -10925,7 +10924,7 @@ discard block |
||
10925 | 10924 | // e.g.: non mbstring support + invalid chars |
10926 | 10925 | return ''; |
10927 | 10926 | } |
10928 | - $length = (int) $lengthTmp; |
|
10927 | + $length = (int)$lengthTmp; |
|
10929 | 10928 | } |
10930 | 10929 | |
10931 | 10930 | \array_splice($smatches[0], $offset, $length, $rmatches[0]); |
@@ -10960,14 +10959,14 @@ discard block |
||
10960 | 10959 | && |
10961 | 10960 | \substr($haystack, -\strlen($needle)) === $needle |
10962 | 10961 | ) { |
10963 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
10962 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
10964 | 10963 | } |
10965 | 10964 | |
10966 | 10965 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
10967 | - return (string) self::substr( |
|
10966 | + return (string)self::substr( |
|
10968 | 10967 | $haystack, |
10969 | 10968 | 0, |
10970 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
10969 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
10971 | 10970 | $encoding |
10972 | 10971 | ); |
10973 | 10972 | } |
@@ -10997,10 +10996,10 @@ discard block |
||
10997 | 10996 | } |
10998 | 10997 | |
10999 | 10998 | if ($encoding === 'UTF-8') { |
11000 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10999 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
11001 | 11000 | } |
11002 | 11001 | |
11003 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
11002 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
11004 | 11003 | } |
11005 | 11004 | |
11006 | 11005 | /** |
@@ -11192,7 +11191,7 @@ discard block |
||
11192 | 11191 | // INFO: https://unicode.org/cldr/utility/character.jsp?a=%E2%84%8C |
11193 | 11192 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11194 | 11193 | /** @noinspection UnnecessaryCastingInspection */ |
11195 | - $str = (string) \transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11194 | + $str = (string)\transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11196 | 11195 | |
11197 | 11196 | // check again, if we only have ASCII, now ... |
11198 | 11197 | if (self::is_ascii($str) === true) { |
@@ -11316,7 +11315,7 @@ discard block |
||
11316 | 11315 | public static function to_boolean($str): bool |
11317 | 11316 | { |
11318 | 11317 | // init |
11319 | - $str = (string) $str; |
|
11318 | + $str = (string)$str; |
|
11320 | 11319 | |
11321 | 11320 | if ($str === '') { |
11322 | 11321 | return false; |
@@ -11344,10 +11343,10 @@ discard block |
||
11344 | 11343 | } |
11345 | 11344 | |
11346 | 11345 | if (\is_numeric($str)) { |
11347 | - return ((float) $str + 0) > 0; |
|
11346 | + return ((float)$str + 0) > 0; |
|
11348 | 11347 | } |
11349 | 11348 | |
11350 | - return (bool) \trim($str); |
|
11349 | + return (bool)\trim($str); |
|
11351 | 11350 | } |
11352 | 11351 | |
11353 | 11352 | /** |
@@ -11368,11 +11367,11 @@ discard block |
||
11368 | 11367 | |
11369 | 11368 | $fallback_char_escaped = \preg_quote($fallback_char, '/'); |
11370 | 11369 | |
11371 | - $string = (string) \preg_replace( |
|
11370 | + $string = (string)\preg_replace( |
|
11372 | 11371 | [ |
11373 | - '/[^' . $fallback_char_escaped . '\\.\\-a-zA-Z0-9\\s]/', // 1) remove un-needed chars |
|
11374 | - '/[\\s]+/u', // 2) convert spaces to $fallback_char |
|
11375 | - '/[' . $fallback_char_escaped . ']+/u', // 3) remove double $fallback_char's |
|
11372 | + '/[^'.$fallback_char_escaped.'\\.\\-a-zA-Z0-9\\s]/', // 1) remove un-needed chars |
|
11373 | + '/[\\s]+/u', // 2) convert spaces to $fallback_char |
|
11374 | + '/['.$fallback_char_escaped.']+/u', // 3) remove double $fallback_char's |
|
11376 | 11375 | ], |
11377 | 11376 | [ |
11378 | 11377 | '', |
@@ -11403,7 +11402,7 @@ discard block |
||
11403 | 11402 | return $str; |
11404 | 11403 | } |
11405 | 11404 | |
11406 | - $str = (string) $str; |
|
11405 | + $str = (string)$str; |
|
11407 | 11406 | if ($str === '') { |
11408 | 11407 | return ''; |
11409 | 11408 | } |
@@ -11450,7 +11449,7 @@ discard block |
||
11450 | 11449 | return $str; |
11451 | 11450 | } |
11452 | 11451 | |
11453 | - $str = (string) $str; |
|
11452 | + $str = (string)$str; |
|
11454 | 11453 | if ($str === '') { |
11455 | 11454 | return $str; |
11456 | 11455 | } |
@@ -11468,7 +11467,7 @@ discard block |
||
11468 | 11467 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
11469 | 11468 | |
11470 | 11469 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11471 | - $buf .= $c1 . $c2; |
|
11470 | + $buf .= $c1.$c2; |
|
11472 | 11471 | ++$i; |
11473 | 11472 | } else { // not valid UTF8 - convert it |
11474 | 11473 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11479,7 +11478,7 @@ discard block |
||
11479 | 11478 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
11480 | 11479 | |
11481 | 11480 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11482 | - $buf .= $c1 . $c2 . $c3; |
|
11481 | + $buf .= $c1.$c2.$c3; |
|
11483 | 11482 | $i += 2; |
11484 | 11483 | } else { // not valid UTF8 - convert it |
11485 | 11484 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11491,7 +11490,7 @@ discard block |
||
11491 | 11490 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
11492 | 11491 | |
11493 | 11492 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11494 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
11493 | + $buf .= $c1.$c2.$c3.$c4; |
|
11495 | 11494 | $i += 3; |
11496 | 11495 | } else { // not valid UTF8 - convert it |
11497 | 11496 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11517,13 +11516,13 @@ discard block |
||
11517 | 11516 | * |
11518 | 11517 | * @return string |
11519 | 11518 | */ |
11520 | - static function (array $matches): string { |
|
11519 | + static function(array $matches): string { |
|
11521 | 11520 | if (isset($matches[3])) { |
11522 | - $cp = (int) \hexdec($matches[3]); |
|
11521 | + $cp = (int)\hexdec($matches[3]); |
|
11523 | 11522 | } else { |
11524 | 11523 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
11525 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
11526 | - + (int) \hexdec($matches[2]) |
|
11524 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
11525 | + + (int)\hexdec($matches[2]) |
|
11527 | 11526 | + 0x10000 |
11528 | 11527 | - (0xD800 << 10) |
11529 | 11528 | - 0xDC00; |
@@ -11534,12 +11533,12 @@ discard block |
||
11534 | 11533 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
11535 | 11534 | |
11536 | 11535 | if ($cp < 0x80) { |
11537 | - return (string) self::chr($cp); |
|
11536 | + return (string)self::chr($cp); |
|
11538 | 11537 | } |
11539 | 11538 | |
11540 | 11539 | if ($cp < 0xA0) { |
11541 | 11540 | /** @noinspection UnnecessaryCastingInspection */ |
11542 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
11541 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
11543 | 11542 | } |
11544 | 11543 | |
11545 | 11544 | return self::decimal_to_chr($cp); |
@@ -11587,7 +11586,7 @@ discard block |
||
11587 | 11586 | |
11588 | 11587 | if (self::$SUPPORT['mbstring'] === true) { |
11589 | 11588 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11590 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
11589 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
11591 | 11590 | } |
11592 | 11591 | |
11593 | 11592 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -11624,15 +11623,15 @@ discard block |
||
11624 | 11623 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
11625 | 11624 | |
11626 | 11625 | if ($encoding === 'UTF-8') { |
11627 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
11626 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
11628 | 11627 | |
11629 | 11628 | if ($useMbFunction === true) { |
11630 | 11629 | $strPartOne = \mb_strtoupper( |
11631 | - (string) \mb_substr($str, 0, 1) |
|
11630 | + (string)\mb_substr($str, 0, 1) |
|
11632 | 11631 | ); |
11633 | 11632 | } else { |
11634 | 11633 | $strPartOne = self::strtoupper( |
11635 | - (string) \mb_substr($str, 0, 1), |
|
11634 | + (string)\mb_substr($str, 0, 1), |
|
11636 | 11635 | $encoding, |
11637 | 11636 | false, |
11638 | 11637 | $lang, |
@@ -11642,16 +11641,16 @@ discard block |
||
11642 | 11641 | } else { |
11643 | 11642 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11644 | 11643 | |
11645 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
11644 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
11646 | 11645 | |
11647 | 11646 | if ($useMbFunction === true) { |
11648 | 11647 | $strPartOne = \mb_strtoupper( |
11649 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
11648 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
11650 | 11649 | $encoding |
11651 | 11650 | ); |
11652 | 11651 | } else { |
11653 | 11652 | $strPartOne = self::strtoupper( |
11654 | - (string) self::substr($str, 0, 1, $encoding), |
|
11653 | + (string)self::substr($str, 0, 1, $encoding), |
|
11655 | 11654 | $encoding, |
11656 | 11655 | false, |
11657 | 11656 | $lang, |
@@ -11660,7 +11659,7 @@ discard block |
||
11660 | 11659 | } |
11661 | 11660 | } |
11662 | 11661 | |
11663 | - return $strPartOne . $strPartTwo; |
|
11662 | + return $strPartOne.$strPartTwo; |
|
11664 | 11663 | } |
11665 | 11664 | |
11666 | 11665 | /** |
@@ -11711,7 +11710,7 @@ discard block |
||
11711 | 11710 | $str = self::clean($str); |
11712 | 11711 | } |
11713 | 11712 | |
11714 | - $usePhpDefaultFunctions = !(bool) ($charlist . \implode('', $exceptions)); |
|
11713 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
11715 | 11714 | |
11716 | 11715 | if ( |
11717 | 11716 | $usePhpDefaultFunctions === true |
@@ -12098,7 +12097,7 @@ discard block |
||
12098 | 12097 | if ( |
12099 | 12098 | $keepUtf8Chars === true |
12100 | 12099 | && |
12101 | - self::strlen($return) >= (int) self::strlen($str_backup) |
|
12100 | + self::strlen($return) >= (int)self::strlen($str_backup) |
|
12102 | 12101 | ) { |
12103 | 12102 | return $str_backup; |
12104 | 12103 | } |
@@ -12174,17 +12173,17 @@ discard block |
||
12174 | 12173 | return ''; |
12175 | 12174 | } |
12176 | 12175 | |
12177 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
12176 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
12178 | 12177 | |
12179 | 12178 | if ( |
12180 | 12179 | !isset($matches[0]) |
12181 | 12180 | || |
12182 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
12181 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
12183 | 12182 | ) { |
12184 | 12183 | return $str; |
12185 | 12184 | } |
12186 | 12185 | |
12187 | - return \rtrim($matches[0]) . $strAddOn; |
|
12186 | + return \rtrim($matches[0]).$strAddOn; |
|
12188 | 12187 | } |
12189 | 12188 | |
12190 | 12189 | /** |
@@ -12271,7 +12270,7 @@ discard block |
||
12271 | 12270 | } |
12272 | 12271 | } |
12273 | 12272 | |
12274 | - return $strReturn . \implode('', $chars); |
|
12273 | + return $strReturn.\implode('', $chars); |
|
12275 | 12274 | } |
12276 | 12275 | |
12277 | 12276 | /** |
@@ -12323,7 +12322,7 @@ discard block |
||
12323 | 12322 | $finalBreak = ''; |
12324 | 12323 | } |
12325 | 12324 | |
12326 | - return \implode($delimiter ?? "\n", $stringArray) . $finalBreak; |
|
12325 | + return \implode($delimiter ?? "\n", $stringArray).$finalBreak; |
|
12327 | 12326 | } |
12328 | 12327 | |
12329 | 12328 | /** |
@@ -12390,7 +12389,7 @@ discard block |
||
12390 | 12389 | /** @noinspection PhpIncludeInspection */ |
12391 | 12390 | /** @noinspection UsingInclusionReturnValueInspection */ |
12392 | 12391 | /** @psalm-suppress UnresolvableInclude */ |
12393 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
12392 | + return include __DIR__.'/data/'.$file.'.php'; |
|
12394 | 12393 | } |
12395 | 12394 | |
12396 | 12395 | /** |
@@ -12402,7 +12401,7 @@ discard block |
||
12402 | 12401 | */ |
12403 | 12402 | private static function getDataIfExists(string $file) |
12404 | 12403 | { |
12405 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
12404 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
12406 | 12405 | if (\file_exists($file)) { |
12407 | 12406 | /** @noinspection PhpIncludeInspection */ |
12408 | 12407 | /** @noinspection UsingInclusionReturnValueInspection */ |
@@ -12424,7 +12423,7 @@ discard block |
||
12424 | 12423 | |
12425 | 12424 | \uksort( |
12426 | 12425 | self::$EMOJI, |
12427 | - static function (string $a, string $b): int { |
|
12426 | + static function(string $a, string $b): int { |
|
12428 | 12427 | return \strlen($b) <=> \strlen($a); |
12429 | 12428 | } |
12430 | 12429 | ); |
@@ -12434,7 +12433,7 @@ discard block |
||
12434 | 12433 | |
12435 | 12434 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
12436 | 12435 | $tmpKey = \crc32($key); |
12437 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmpKey . '_-_' . \strrev((string) $tmpKey) . '_-_8FTU_ELBATROP_-_'; |
|
12436 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmpKey.'_-_'.\strrev((string)$tmpKey).'_-_8FTU_ELBATROP_-_'; |
|
12438 | 12437 | } |
12439 | 12438 | |
12440 | 12439 | return true; |
@@ -12458,7 +12457,7 @@ discard block |
||
12458 | 12457 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
12459 | 12458 | return \defined('MB_OVERLOAD_STRING') |
12460 | 12459 | && |
12461 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12460 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12462 | 12461 | } |
12463 | 12462 | |
12464 | 12463 | /** |
@@ -12508,7 +12507,7 @@ discard block |
||
12508 | 12507 | { |
12509 | 12508 | static $RX_CLASS_CACHE = []; |
12510 | 12509 | |
12511 | - $cacheKey = $s . $class; |
|
12510 | + $cacheKey = $s.$class; |
|
12512 | 12511 | |
12513 | 12512 | if (isset($RX_CLASS_CACHE[$cacheKey])) { |
12514 | 12513 | return $RX_CLASS_CACHE[$cacheKey]; |
@@ -12520,7 +12519,7 @@ discard block |
||
12520 | 12519 | /** @noinspection AlterInForeachInspection */ |
12521 | 12520 | foreach (self::str_split($s) as &$s) { |
12522 | 12521 | if ($s === '-') { |
12523 | - $classArray[0] = '-' . $classArray[0]; |
|
12522 | + $classArray[0] = '-'.$classArray[0]; |
|
12524 | 12523 | } elseif (!isset($s[2])) { |
12525 | 12524 | $classArray[0] .= \preg_quote($s, '/'); |
12526 | 12525 | } elseif (self::strlen($s) === 1) { |
@@ -12531,13 +12530,13 @@ discard block |
||
12531 | 12530 | } |
12532 | 12531 | |
12533 | 12532 | if ($classArray[0]) { |
12534 | - $classArray[0] = '[' . $classArray[0] . ']'; |
|
12533 | + $classArray[0] = '['.$classArray[0].']'; |
|
12535 | 12534 | } |
12536 | 12535 | |
12537 | 12536 | if (\count($classArray) === 1) { |
12538 | 12537 | $return = $classArray[0]; |
12539 | 12538 | } else { |
12540 | - $return = '(?:' . \implode('|', $classArray) . ')'; |
|
12539 | + $return = '(?:'.\implode('|', $classArray).')'; |
|
12541 | 12540 | } |
12542 | 12541 | |
12543 | 12542 | $RX_CLASS_CACHE[$cacheKey] = $return; |
@@ -12612,7 +12611,7 @@ discard block |
||
12612 | 12611 | |
12613 | 12612 | if ($delimiter === '-') { |
12614 | 12613 | /** @noinspection AlterInForeachInspection */ |
12615 | - foreach ((array) $specialCases['names'] as &$beginning) { |
|
12614 | + foreach ((array)$specialCases['names'] as &$beginning) { |
|
12616 | 12615 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12617 | 12616 | $continue = true; |
12618 | 12617 | } |
@@ -12620,7 +12619,7 @@ discard block |
||
12620 | 12619 | } |
12621 | 12620 | |
12622 | 12621 | /** @noinspection AlterInForeachInspection */ |
12623 | - foreach ((array) $specialCases['prefixes'] as &$beginning) { |
|
12622 | + foreach ((array)$specialCases['prefixes'] as &$beginning) { |
|
12624 | 12623 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12625 | 12624 | $continue = true; |
12626 | 12625 | } |
@@ -12680,8 +12679,8 @@ discard block |
||
12680 | 12679 | } else { |
12681 | 12680 | /** @noinspection OffsetOperationsInspection */ |
12682 | 12681 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
12683 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
12684 | - $buf .= $cc1 . $cc2; |
|
12682 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
12683 | + $buf .= $cc1.$cc2; |
|
12685 | 12684 | } |
12686 | 12685 | |
12687 | 12686 | return $buf; |
@@ -12696,7 +12695,7 @@ discard block |
||
12696 | 12695 | { |
12697 | 12696 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
12698 | 12697 | if (\preg_match($pattern, $str)) { |
12699 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
12698 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
12700 | 12699 | } |
12701 | 12700 | |
12702 | 12701 | return $str; |