@@ -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 => "\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 => "\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 | ]; |
@@ -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, '>='); |
@@ -581,22 +581,22 @@ discard block |
||
581 | 581 | * @psalm-suppress PossiblyNullArrayAccess |
582 | 582 | */ |
583 | 583 | $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
584 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
584 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
585 | 585 | } elseif ($code_point <= 0xFFFF) { |
586 | 586 | /** |
587 | 587 | * @psalm-suppress PossiblyNullArrayAccess |
588 | 588 | */ |
589 | 589 | $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
590 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
591 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
590 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
591 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
592 | 592 | } else { |
593 | 593 | /** |
594 | 594 | * @psalm-suppress PossiblyNullArrayAccess |
595 | 595 | */ |
596 | 596 | $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
597 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
598 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
599 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
597 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
598 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
599 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
600 | 600 | } |
601 | 601 | |
602 | 602 | if ($encoding !== 'UTF-8') { |
@@ -5770,8 +5770,8 @@ discard block |
||
5770 | 5770 | |
5771 | 5771 | /** @noinspection UnnecessaryCastingInspection */ |
5772 | 5772 | return (string) \mb_substr($str, 0, $index) . |
5773 | - $substring . |
|
5774 | - (string) \mb_substr($str, $index, $len); |
|
5773 | + $substring . |
|
5774 | + (string) \mb_substr($str, $index, $len); |
|
5775 | 5775 | } |
5776 | 5776 | |
5777 | 5777 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -5782,8 +5782,8 @@ discard block |
||
5782 | 5782 | } |
5783 | 5783 | |
5784 | 5784 | return ((string) self::substr($str, 0, $index, $encoding)) . |
5785 | - $substring . |
|
5786 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5785 | + $substring . |
|
5786 | + ((string) self::substr($str, $index, $len, $encoding)); |
|
5787 | 5787 | } |
5788 | 5788 | |
5789 | 5789 | /** |
@@ -7562,11 +7562,11 @@ discard block |
||
7562 | 7562 | if ($useMbFunction === true) { |
7563 | 7563 | if ($encoding === 'UTF-8') { |
7564 | 7564 | return \mb_strtoupper(\mb_substr($match[0], 0, 1)) |
7565 | - . \mb_strtolower(\mb_substr($match[0], 1)); |
|
7565 | + . \mb_strtolower(\mb_substr($match[0], 1)); |
|
7566 | 7566 | } |
7567 | 7567 | |
7568 | 7568 | return \mb_strtoupper(\mb_substr($match[0], 0, 1, $encoding), $encoding) |
7569 | - . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
7569 | + . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
7570 | 7570 | } |
7571 | 7571 | |
7572 | 7572 | return self::ucfirst( |
@@ -7929,7 +7929,7 @@ discard block |
||
7929 | 7929 | $length, |
7930 | 7930 | $encoding |
7931 | 7931 | ) |
7932 | - ) . $substring; |
|
7932 | + ) . $substring; |
|
7933 | 7933 | } |
7934 | 7934 | |
7935 | 7935 | /** |
@@ -10646,8 +10646,8 @@ discard block |
||
10646 | 10646 | |
10647 | 10647 | /** @noinspection AdditionOperationOnArraysInspection */ |
10648 | 10648 | return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
10649 | - $replacement . |
|
10650 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10649 | + $replacement . |
|
10650 | + ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10651 | 10651 | } |
10652 | 10652 | |
10653 | 10653 | // |
@@ -255,10 +255,10 @@ discard block |
||
255 | 255 | } |
256 | 256 | |
257 | 257 | if ($encoding === 'UTF-8') { |
258 | - return (string) \mb_substr($str, $pos, 1); |
|
258 | + return (string)\mb_substr($str, $pos, 1); |
|
259 | 259 | } |
260 | 260 | |
261 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
261 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | /** |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | public static function add_bom_to_string(string $str): string |
274 | 274 | { |
275 | 275 | if (self::string_has_bom($str) === false) { |
276 | - $str = self::bom() . $str; |
|
276 | + $str = self::bom().$str; |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | return $str; |
@@ -302,8 +302,8 @@ discard block |
||
302 | 302 | $return = []; |
303 | 303 | foreach ($array as $key => &$value) { |
304 | 304 | $key = $case === \CASE_LOWER |
305 | - ? self::strtolower((string) $key, $encoding) |
|
306 | - : self::strtoupper((string) $key, $encoding); |
|
305 | + ? self::strtolower((string)$key, $encoding) |
|
306 | + : self::strtoupper((string)$key, $encoding); |
|
307 | 307 | |
308 | 308 | $return[$key] = $value; |
309 | 309 | } |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | return ''; |
338 | 338 | } |
339 | 339 | |
340 | - $substrIndex = $posStart + (int) \mb_strlen($start); |
|
340 | + $substrIndex = $posStart + (int)\mb_strlen($start); |
|
341 | 341 | $posEnd = \mb_strpos($str, $end, $substrIndex); |
342 | 342 | if ( |
343 | 343 | $posEnd === false |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | return ''; |
348 | 348 | } |
349 | 349 | |
350 | - return (string) \mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
350 | + return (string)\mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | return ''; |
358 | 358 | } |
359 | 359 | |
360 | - $substrIndex = $posStart + (int) self::strlen($start, $encoding); |
|
360 | + $substrIndex = $posStart + (int)self::strlen($start, $encoding); |
|
361 | 361 | $posEnd = self::strpos($str, $end, $substrIndex, $encoding); |
362 | 362 | if ( |
363 | 363 | $posEnd === false |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | return ''; |
368 | 368 | } |
369 | 369 | |
370 | - return (string) self::substr( |
|
370 | + return (string)self::substr( |
|
371 | 371 | $str, |
372 | 372 | $substrIndex, |
373 | 373 | $posEnd - $substrIndex, |
@@ -435,10 +435,10 @@ discard block |
||
435 | 435 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
436 | 436 | { |
437 | 437 | if ($encoding === 'UTF-8') { |
438 | - return (string) \mb_substr($str, $index, 1); |
|
438 | + return (string)\mb_substr($str, $index, 1); |
|
439 | 439 | } |
440 | 440 | |
441 | - return (string) self::substr($str, $index, 1, $encoding); |
|
441 | + return (string)self::substr($str, $index, 1, $encoding); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | /** |
@@ -541,10 +541,10 @@ discard block |
||
541 | 541 | && |
542 | 542 | self::$SUPPORT['mbstring'] === false |
543 | 543 | ) { |
544 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
544 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
545 | 545 | } |
546 | 546 | |
547 | - $cacheKey = $code_point . $encoding; |
|
547 | + $cacheKey = $code_point.$encoding; |
|
548 | 548 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
549 | 549 | return $CHAR_CACHE[$cacheKey]; |
550 | 550 | } |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | if ($code_point <= 127) { // use "simple"-char only until "\x80" |
553 | 553 | |
554 | 554 | if (self::$CHR === null) { |
555 | - self::$CHR = (array) self::getData('chr'); |
|
555 | + self::$CHR = (array)self::getData('chr'); |
|
556 | 556 | } |
557 | 557 | |
558 | 558 | /** |
@@ -587,10 +587,10 @@ discard block |
||
587 | 587 | // |
588 | 588 | |
589 | 589 | if (self::$CHR === null) { |
590 | - self::$CHR = (array) self::getData('chr'); |
|
590 | + self::$CHR = (array)self::getData('chr'); |
|
591 | 591 | } |
592 | 592 | |
593 | - $code_point = (int) $code_point; |
|
593 | + $code_point = (int)$code_point; |
|
594 | 594 | if ($code_point <= 0x7F) { |
595 | 595 | /** |
596 | 596 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -600,22 +600,22 @@ discard block |
||
600 | 600 | /** |
601 | 601 | * @psalm-suppress PossiblyNullArrayAccess |
602 | 602 | */ |
603 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
603 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
604 | 604 | self::$CHR[($code_point & 0x3F) + 0x80]; |
605 | 605 | } elseif ($code_point <= 0xFFFF) { |
606 | 606 | /** |
607 | 607 | * @psalm-suppress PossiblyNullArrayAccess |
608 | 608 | */ |
609 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
610 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
609 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
610 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
611 | 611 | self::$CHR[($code_point & 0x3F) + 0x80]; |
612 | 612 | } else { |
613 | 613 | /** |
614 | 614 | * @psalm-suppress PossiblyNullArrayAccess |
615 | 615 | */ |
616 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
617 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
618 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
616 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
617 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
618 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
619 | 619 | self::$CHR[($code_point & 0x3F) + 0x80]; |
620 | 620 | } |
621 | 621 | |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | |
663 | 663 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
664 | 664 | return \array_map( |
665 | - static function (string $data): int { |
|
665 | + static function(string $data): int { |
|
666 | 666 | // "mb_" is available if overload is used, so use it ... |
667 | 667 | return \mb_strlen($data, 'CP850'); // 8-BIT |
668 | 668 | }, |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | $char = ''; |
731 | 731 | } |
732 | 732 | |
733 | - return self::int_to_hex(self::ord((string) $char), $pfix); |
|
733 | + return self::int_to_hex(self::ord((string)$char), $pfix); |
|
734 | 734 | } |
735 | 735 | |
736 | 736 | /** |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | | ( [\x80-\xBF] ) # invalid byte in range 10000000 - 10111111 |
805 | 805 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
806 | 806 | /x'; |
807 | - $str = (string) \preg_replace($regx, '$1', $str); |
|
807 | + $str = (string)\preg_replace($regx, '$1', $str); |
|
808 | 808 | |
809 | 809 | if ($replace_diamond_question_mark === true) { |
810 | 810 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | public static function cleanup($str): string |
840 | 840 | { |
841 | 841 | // init |
842 | - $str = (string) $str; |
|
842 | + $str = (string)$str; |
|
843 | 843 | |
844 | 844 | if ($str === '') { |
845 | 845 | return ''; |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | { |
923 | 923 | if (self::$SUPPORT['mbstring'] === true) { |
924 | 924 | /** @noinspection PhpComposerExtensionStubsInspection */ |
925 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
925 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
926 | 926 | } |
927 | 927 | |
928 | 928 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | */ |
963 | 963 | public static function css_stripe_media_queries(string $str): string |
964 | 964 | { |
965 | - return (string) \preg_replace( |
|
965 | + return (string)\preg_replace( |
|
966 | 966 | '#@media\\s+(?:only\\s)?(?:[\\s{\\(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#misU', |
967 | 967 | '', |
968 | 968 | $str |
@@ -989,7 +989,7 @@ discard block |
||
989 | 989 | */ |
990 | 990 | public static function decimal_to_chr($int): string |
991 | 991 | { |
992 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
992 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
993 | 993 | } |
994 | 994 | |
995 | 995 | /** |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | if ($toEncoding === 'JSON') { |
1069 | 1069 | $return = self::json_encode($str); |
1070 | 1070 | if ($return === false) { |
1071 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1071 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1072 | 1072 | } |
1073 | 1073 | |
1074 | 1074 | return $return; |
@@ -1154,7 +1154,7 @@ discard block |
||
1154 | 1154 | && |
1155 | 1155 | self::$SUPPORT['mbstring'] === false |
1156 | 1156 | ) { |
1157 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $toEncoding . '" encoding', \E_USER_WARNING); |
|
1157 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$toEncoding.'" encoding', \E_USER_WARNING); |
|
1158 | 1158 | } |
1159 | 1159 | |
1160 | 1160 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1248,31 +1248,31 @@ discard block |
||
1248 | 1248 | $trimChars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1249 | 1249 | |
1250 | 1250 | if ($length === null) { |
1251 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
1251 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
1252 | 1252 | } |
1253 | 1253 | |
1254 | 1254 | if ($search === '') { |
1255 | 1255 | if ($encoding === 'UTF-8') { |
1256 | 1256 | if ($length > 0) { |
1257 | - $stringLength = (int) \mb_strlen($str); |
|
1257 | + $stringLength = (int)\mb_strlen($str); |
|
1258 | 1258 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
1259 | 1259 | } else { |
1260 | 1260 | $end = 0; |
1261 | 1261 | } |
1262 | 1262 | |
1263 | - $pos = (int) \min( |
|
1263 | + $pos = (int)\min( |
|
1264 | 1264 | \mb_strpos($str, ' ', $end), |
1265 | 1265 | \mb_strpos($str, '.', $end) |
1266 | 1266 | ); |
1267 | 1267 | } else { |
1268 | 1268 | if ($length > 0) { |
1269 | - $stringLength = (int) self::strlen($str, $encoding); |
|
1269 | + $stringLength = (int)self::strlen($str, $encoding); |
|
1270 | 1270 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
1271 | 1271 | } else { |
1272 | 1272 | $end = 0; |
1273 | 1273 | } |
1274 | 1274 | |
1275 | - $pos = (int) \min( |
|
1275 | + $pos = (int)\min( |
|
1276 | 1276 | self::strpos($str, ' ', $end, $encoding), |
1277 | 1277 | self::strpos($str, '.', $end, $encoding) |
1278 | 1278 | ); |
@@ -1289,18 +1289,18 @@ discard block |
||
1289 | 1289 | return ''; |
1290 | 1290 | } |
1291 | 1291 | |
1292 | - return \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1292 | + return \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1293 | 1293 | } |
1294 | 1294 | |
1295 | 1295 | return $str; |
1296 | 1296 | } |
1297 | 1297 | |
1298 | 1298 | if ($encoding === 'UTF-8') { |
1299 | - $wordPos = (int) \mb_stripos($str, $search); |
|
1300 | - $halfSide = (int) ($wordPos - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1299 | + $wordPos = (int)\mb_stripos($str, $search); |
|
1300 | + $halfSide = (int)($wordPos - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1301 | 1301 | } else { |
1302 | - $wordPos = (int) self::stripos($str, $search, 0, $encoding); |
|
1303 | - $halfSide = (int) ($wordPos - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1302 | + $wordPos = (int)self::stripos($str, $search, 0, $encoding); |
|
1303 | + $halfSide = (int)($wordPos - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1304 | 1304 | } |
1305 | 1305 | |
1306 | 1306 | $pos_start = 0; |
@@ -1312,12 +1312,12 @@ discard block |
||
1312 | 1312 | } |
1313 | 1313 | if ($halfText !== false) { |
1314 | 1314 | if ($encoding === 'UTF-8') { |
1315 | - $pos_start = (int) \max( |
|
1315 | + $pos_start = (int)\max( |
|
1316 | 1316 | \mb_strrpos($halfText, ' '), |
1317 | 1317 | \mb_strrpos($halfText, '.') |
1318 | 1318 | ); |
1319 | 1319 | } else { |
1320 | - $pos_start = (int) \max( |
|
1320 | + $pos_start = (int)\max( |
|
1321 | 1321 | self::strrpos($halfText, ' ', 0, $encoding), |
1322 | 1322 | self::strrpos($halfText, '.', 0, $encoding) |
1323 | 1323 | ); |
@@ -1327,19 +1327,19 @@ discard block |
||
1327 | 1327 | |
1328 | 1328 | if ($wordPos && $halfSide > 0) { |
1329 | 1329 | $offset = $pos_start + $length - 1; |
1330 | - $realLength = (int) self::strlen($str, $encoding); |
|
1330 | + $realLength = (int)self::strlen($str, $encoding); |
|
1331 | 1331 | |
1332 | 1332 | if ($offset > $realLength) { |
1333 | 1333 | $offset = $realLength; |
1334 | 1334 | } |
1335 | 1335 | |
1336 | 1336 | if ($encoding === 'UTF-8') { |
1337 | - $pos_end = (int) \min( |
|
1337 | + $pos_end = (int)\min( |
|
1338 | 1338 | \mb_strpos($str, ' ', $offset), |
1339 | 1339 | \mb_strpos($str, '.', $offset) |
1340 | 1340 | ) - $pos_start; |
1341 | 1341 | } else { |
1342 | - $pos_end = (int) \min( |
|
1342 | + $pos_end = (int)\min( |
|
1343 | 1343 | self::strpos($str, ' ', $offset, $encoding), |
1344 | 1344 | self::strpos($str, '.', $offset, $encoding) |
1345 | 1345 | ) - $pos_start; |
@@ -1347,12 +1347,12 @@ discard block |
||
1347 | 1347 | |
1348 | 1348 | if (!$pos_end || $pos_end <= 0) { |
1349 | 1349 | if ($encoding === 'UTF-8') { |
1350 | - $strSub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1350 | + $strSub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1351 | 1351 | } else { |
1352 | - $strSub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1352 | + $strSub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1353 | 1353 | } |
1354 | 1354 | if ($strSub !== false) { |
1355 | - $extract = $replacerForSkippedText . \ltrim($strSub, $trimChars); |
|
1355 | + $extract = $replacerForSkippedText.\ltrim($strSub, $trimChars); |
|
1356 | 1356 | } else { |
1357 | 1357 | $extract = ''; |
1358 | 1358 | } |
@@ -1363,26 +1363,26 @@ discard block |
||
1363 | 1363 | $strSub = self::substr($str, $pos_start, $pos_end, $encoding); |
1364 | 1364 | } |
1365 | 1365 | if ($strSub !== false) { |
1366 | - $extract = $replacerForSkippedText . \trim($strSub, $trimChars) . $replacerForSkippedText; |
|
1366 | + $extract = $replacerForSkippedText.\trim($strSub, $trimChars).$replacerForSkippedText; |
|
1367 | 1367 | } else { |
1368 | 1368 | $extract = ''; |
1369 | 1369 | } |
1370 | 1370 | } |
1371 | 1371 | } else { |
1372 | 1372 | $offset = $length - 1; |
1373 | - $trueLength = (int) self::strlen($str, $encoding); |
|
1373 | + $trueLength = (int)self::strlen($str, $encoding); |
|
1374 | 1374 | |
1375 | 1375 | if ($offset > $trueLength) { |
1376 | 1376 | $offset = $trueLength; |
1377 | 1377 | } |
1378 | 1378 | |
1379 | 1379 | if ($encoding === 'UTF-8') { |
1380 | - $pos_end = (int) \min( |
|
1380 | + $pos_end = (int)\min( |
|
1381 | 1381 | \mb_strpos($str, ' ', $offset), |
1382 | 1382 | \mb_strpos($str, '.', $offset) |
1383 | 1383 | ); |
1384 | 1384 | } else { |
1385 | - $pos_end = (int) \min( |
|
1385 | + $pos_end = (int)\min( |
|
1386 | 1386 | self::strpos($str, ' ', $offset, $encoding), |
1387 | 1387 | self::strpos($str, '.', $offset, $encoding) |
1388 | 1388 | ); |
@@ -1395,7 +1395,7 @@ discard block |
||
1395 | 1395 | $strSub = self::substr($str, 0, $pos_end, $encoding); |
1396 | 1396 | } |
1397 | 1397 | if ($strSub !== false) { |
1398 | - $extract = \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1398 | + $extract = \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1399 | 1399 | } else { |
1400 | 1400 | $extract = ''; |
1401 | 1401 | } |
@@ -1515,7 +1515,7 @@ discard block |
||
1515 | 1515 | { |
1516 | 1516 | $file_content = \file_get_contents($file_path); |
1517 | 1517 | if ($file_content === false) { |
1518 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1518 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1519 | 1519 | } |
1520 | 1520 | |
1521 | 1521 | return self::string_has_bom($file_content); |
@@ -1576,7 +1576,7 @@ discard block |
||
1576 | 1576 | ) { |
1577 | 1577 | // Prevent leading combining chars |
1578 | 1578 | // for NFC-safe concatenations. |
1579 | - $var = $leading_combining . $var; |
|
1579 | + $var = $leading_combining.$var; |
|
1580 | 1580 | } |
1581 | 1581 | } |
1582 | 1582 | |
@@ -1815,10 +1815,10 @@ discard block |
||
1815 | 1815 | } |
1816 | 1816 | |
1817 | 1817 | if ($encoding === 'UTF-8') { |
1818 | - return (string) \mb_substr($str, 0, $n); |
|
1818 | + return (string)\mb_substr($str, 0, $n); |
|
1819 | 1819 | } |
1820 | 1820 | |
1821 | - return (string) self::substr($str, 0, $n, $encoding); |
|
1821 | + return (string)self::substr($str, 0, $n, $encoding); |
|
1822 | 1822 | } |
1823 | 1823 | |
1824 | 1824 | /** |
@@ -1893,7 +1893,7 @@ discard block |
||
1893 | 1893 | return $str; |
1894 | 1894 | } |
1895 | 1895 | |
1896 | - $str = (string) $str; |
|
1896 | + $str = (string)$str; |
|
1897 | 1897 | $last = ''; |
1898 | 1898 | while ($last !== $str) { |
1899 | 1899 | $last = $str; |
@@ -2076,7 +2076,7 @@ discard block |
||
2076 | 2076 | } |
2077 | 2077 | |
2078 | 2078 | $str_info = \unpack('C2chars', $str_info); |
2079 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2079 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2080 | 2080 | |
2081 | 2081 | // DEBUG |
2082 | 2082 | //var_dump($type_code); |
@@ -2165,7 +2165,7 @@ discard block |
||
2165 | 2165 | // |
2166 | 2166 | |
2167 | 2167 | if ($encoding === 'UTF-8') { |
2168 | - $maxlength = (int) \mb_strlen($possibleChars); |
|
2168 | + $maxlength = (int)\mb_strlen($possibleChars); |
|
2169 | 2169 | if ($maxlength === 0) { |
2170 | 2170 | return ''; |
2171 | 2171 | } |
@@ -2186,7 +2186,7 @@ discard block |
||
2186 | 2186 | } else { |
2187 | 2187 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2188 | 2188 | |
2189 | - $maxlength = (int) self::strlen($possibleChars, $encoding); |
|
2189 | + $maxlength = (int)self::strlen($possibleChars, $encoding); |
|
2190 | 2190 | if ($maxlength === 0) { |
2191 | 2191 | return ''; |
2192 | 2192 | } |
@@ -2217,16 +2217,16 @@ discard block |
||
2217 | 2217 | */ |
2218 | 2218 | public static function get_unique_string($entropyExtra = '', bool $md5 = true): string |
2219 | 2219 | { |
2220 | - $uniqueHelper = \random_int(0, \mt_getrandmax()) . |
|
2221 | - \session_id() . |
|
2222 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2223 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2220 | + $uniqueHelper = \random_int(0, \mt_getrandmax()). |
|
2221 | + \session_id(). |
|
2222 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2223 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2224 | 2224 | $entropyExtra; |
2225 | 2225 | |
2226 | 2226 | $uniqueString = \uniqid($uniqueHelper, true); |
2227 | 2227 | |
2228 | 2228 | if ($md5) { |
2229 | - $uniqueString = \md5($uniqueString . $uniqueHelper); |
|
2229 | + $uniqueString = \md5($uniqueString.$uniqueHelper); |
|
2230 | 2230 | } |
2231 | 2231 | |
2232 | 2232 | return $uniqueString; |
@@ -2306,7 +2306,7 @@ discard block |
||
2306 | 2306 | public static function hex_to_int($hexDec) |
2307 | 2307 | { |
2308 | 2308 | // init |
2309 | - $hexDec = (string) $hexDec; |
|
2309 | + $hexDec = (string)$hexDec; |
|
2310 | 2310 | |
2311 | 2311 | if ($hexDec === '') { |
2312 | 2312 | return false; |
@@ -2384,7 +2384,7 @@ discard block |
||
2384 | 2384 | return \implode( |
2385 | 2385 | '', |
2386 | 2386 | \array_map( |
2387 | - static function (string $chr) use ($keepAsciiChars, $encoding): string { |
|
2387 | + static function(string $chr) use ($keepAsciiChars, $encoding): string { |
|
2388 | 2388 | return self::single_chr_html_encode($chr, $keepAsciiChars, $encoding); |
2389 | 2389 | }, |
2390 | 2390 | self::str_split($str) |
@@ -2488,7 +2488,7 @@ discard block |
||
2488 | 2488 | && |
2489 | 2489 | self::$SUPPORT['mbstring'] === false |
2490 | 2490 | ) { |
2491 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2491 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2492 | 2492 | } |
2493 | 2493 | |
2494 | 2494 | do { |
@@ -2509,14 +2509,14 @@ discard block |
||
2509 | 2509 | ); |
2510 | 2510 | } |
2511 | 2511 | } else { |
2512 | - $str = (string) \preg_replace_callback( |
|
2512 | + $str = (string)\preg_replace_callback( |
|
2513 | 2513 | "/&#\d{2,6};/", |
2514 | 2514 | /** |
2515 | 2515 | * @param string[] $matches |
2516 | 2516 | * |
2517 | 2517 | * @return string |
2518 | 2518 | */ |
2519 | - static function (array $matches) use ($encoding): string { |
|
2519 | + static function(array $matches) use ($encoding): string { |
|
2520 | 2520 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
2521 | 2521 | if ($returnTmp !== '"' && $returnTmp !== "'") { |
2522 | 2522 | return $returnTmp; |
@@ -2531,7 +2531,7 @@ discard block |
||
2531 | 2531 | if (\strpos($str, '&') !== false) { |
2532 | 2532 | if (\strpos($str, '&#') !== false) { |
2533 | 2533 | // decode also numeric & UTF16 two byte entities |
2534 | - $str = (string) \preg_replace( |
|
2534 | + $str = (string)\preg_replace( |
|
2535 | 2535 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
2536 | 2536 | '$1;', |
2537 | 2537 | $str |
@@ -2577,7 +2577,7 @@ discard block |
||
2577 | 2577 | */ |
2578 | 2578 | public static function html_stripe_empty_tags(string $str): string |
2579 | 2579 | { |
2580 | - return (string) \preg_replace( |
|
2580 | + return (string)\preg_replace( |
|
2581 | 2581 | "/<[^\/>]*>(([\s]?)*|)<\/[^>]*>/iu", |
2582 | 2582 | '', |
2583 | 2583 | $str |
@@ -2876,9 +2876,9 @@ discard block |
||
2876 | 2876 | { |
2877 | 2877 | $hex = \dechex($int); |
2878 | 2878 | |
2879 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
2879 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
2880 | 2880 | |
2881 | - return $pfix . $hex . ''; |
|
2881 | + return $pfix.$hex.''; |
|
2882 | 2882 | } |
2883 | 2883 | |
2884 | 2884 | /** |
@@ -3145,7 +3145,7 @@ discard block |
||
3145 | 3145 | */ |
3146 | 3146 | public static function is_binary($input, bool $strict = false): bool |
3147 | 3147 | { |
3148 | - $input = (string) $input; |
|
3148 | + $input = (string)$input; |
|
3149 | 3149 | if ($input === '') { |
3150 | 3150 | return false; |
3151 | 3151 | } |
@@ -3404,7 +3404,7 @@ discard block |
||
3404 | 3404 | public static function is_utf16($str, $checkIfStringIsBinary = true) |
3405 | 3405 | { |
3406 | 3406 | // init |
3407 | - $str = (string) $str; |
|
3407 | + $str = (string)$str; |
|
3408 | 3408 | $strChars = []; |
3409 | 3409 | |
3410 | 3410 | if ( |
@@ -3482,7 +3482,7 @@ discard block |
||
3482 | 3482 | public static function is_utf32($str, $checkIfStringIsBinary = true) |
3483 | 3483 | { |
3484 | 3484 | // init |
3485 | - $str = (string) $str; |
|
3485 | + $str = (string)$str; |
|
3486 | 3486 | $strChars = []; |
3487 | 3487 | |
3488 | 3488 | if ( |
@@ -3561,16 +3561,16 @@ discard block |
||
3561 | 3561 | self::initEmojiData(); |
3562 | 3562 | |
3563 | 3563 | if ($useReversibleStringMapping === true) { |
3564 | - return (string) \str_replace( |
|
3565 | - (array) self::$EMOJI_VALUES_CACHE, |
|
3566 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
3564 | + return (string)\str_replace( |
|
3565 | + (array)self::$EMOJI_VALUES_CACHE, |
|
3566 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
3567 | 3567 | $str |
3568 | 3568 | ); |
3569 | 3569 | } |
3570 | 3570 | |
3571 | - return (string) \str_replace( |
|
3572 | - (array) self::$EMOJI_VALUES_CACHE, |
|
3573 | - (array) self::$EMOJI_KEYS_CACHE, |
|
3571 | + return (string)\str_replace( |
|
3572 | + (array)self::$EMOJI_VALUES_CACHE, |
|
3573 | + (array)self::$EMOJI_KEYS_CACHE, |
|
3574 | 3574 | $str |
3575 | 3575 | ); |
3576 | 3576 | } |
@@ -3590,16 +3590,16 @@ discard block |
||
3590 | 3590 | self::initEmojiData(); |
3591 | 3591 | |
3592 | 3592 | if ($useReversibleStringMapping === true) { |
3593 | - return (string) \str_replace( |
|
3594 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
3595 | - (array) self::$EMOJI_VALUES_CACHE, |
|
3593 | + return (string)\str_replace( |
|
3594 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
3595 | + (array)self::$EMOJI_VALUES_CACHE, |
|
3596 | 3596 | $str |
3597 | 3597 | ); |
3598 | 3598 | } |
3599 | 3599 | |
3600 | - return (string) \str_replace( |
|
3601 | - (array) self::$EMOJI_KEYS_CACHE, |
|
3602 | - (array) self::$EMOJI_VALUES_CACHE, |
|
3600 | + return (string)\str_replace( |
|
3601 | + (array)self::$EMOJI_KEYS_CACHE, |
|
3602 | + (array)self::$EMOJI_VALUES_CACHE, |
|
3603 | 3603 | $str |
3604 | 3604 | ); |
3605 | 3605 | } |
@@ -3660,7 +3660,7 @@ discard block |
||
3660 | 3660 | self::$ORD = self::getData('ord'); |
3661 | 3661 | } |
3662 | 3662 | |
3663 | - $len = \strlen((string) $str); |
|
3663 | + $len = \strlen((string)$str); |
|
3664 | 3664 | /** @noinspection ForeachInvariantsInspection */ |
3665 | 3665 | for ($i = 0; $i < $len; ++$i) { |
3666 | 3666 | $in = self::$ORD[$str[$i]]; |
@@ -3897,15 +3897,15 @@ discard block |
||
3897 | 3897 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
3898 | 3898 | |
3899 | 3899 | if ($encoding === 'UTF-8') { |
3900 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
3900 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
3901 | 3901 | |
3902 | 3902 | if ($useMbFunction === true) { |
3903 | 3903 | $strPartOne = \mb_strtolower( |
3904 | - (string) \mb_substr($str, 0, 1) |
|
3904 | + (string)\mb_substr($str, 0, 1) |
|
3905 | 3905 | ); |
3906 | 3906 | } else { |
3907 | 3907 | $strPartOne = self::strtolower( |
3908 | - (string) \mb_substr($str, 0, 1), |
|
3908 | + (string)\mb_substr($str, 0, 1), |
|
3909 | 3909 | $encoding, |
3910 | 3910 | false, |
3911 | 3911 | $lang, |
@@ -3915,10 +3915,10 @@ discard block |
||
3915 | 3915 | } else { |
3916 | 3916 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
3917 | 3917 | |
3918 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
3918 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
3919 | 3919 | |
3920 | 3920 | $strPartOne = self::strtolower( |
3921 | - (string) self::substr($str, 0, 1, $encoding), |
|
3921 | + (string)self::substr($str, 0, 1, $encoding), |
|
3922 | 3922 | $encoding, |
3923 | 3923 | false, |
3924 | 3924 | $lang, |
@@ -3926,7 +3926,7 @@ discard block |
||
3926 | 3926 | ); |
3927 | 3927 | } |
3928 | 3928 | |
3929 | - return $strPartOne . $strPartTwo; |
|
3929 | + return $strPartOne.$strPartTwo; |
|
3930 | 3930 | } |
3931 | 3931 | |
3932 | 3932 | /** |
@@ -4045,7 +4045,7 @@ discard block |
||
4045 | 4045 | |
4046 | 4046 | if (self::$SUPPORT['mbstring'] === true) { |
4047 | 4047 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4048 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4048 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4049 | 4049 | } |
4050 | 4050 | |
4051 | 4051 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -4086,7 +4086,7 @@ discard block |
||
4086 | 4086 | { |
4087 | 4087 | $bytes = self::chr_size_list($str); |
4088 | 4088 | if (\count($bytes) > 0) { |
4089 | - return (int) \max($bytes); |
|
4089 | + return (int)\max($bytes); |
|
4090 | 4090 | } |
4091 | 4091 | |
4092 | 4092 | return 0; |
@@ -4156,7 +4156,7 @@ discard block |
||
4156 | 4156 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4157 | 4157 | |
4158 | 4158 | // init |
4159 | - $encoding = (string) $encoding; |
|
4159 | + $encoding = (string)$encoding; |
|
4160 | 4160 | |
4161 | 4161 | if (!$encoding) { |
4162 | 4162 | return $fallback; |
@@ -4210,7 +4210,7 @@ discard block |
||
4210 | 4210 | |
4211 | 4211 | $encodingOrig = $encoding; |
4212 | 4212 | $encoding = \strtoupper($encoding); |
4213 | - $encodingUpperHelper = (string) \preg_replace('/[^a-zA-Z0-9\s]/', '', $encoding); |
|
4213 | + $encodingUpperHelper = (string)\preg_replace('/[^a-zA-Z0-9\s]/', '', $encoding); |
|
4214 | 4214 | |
4215 | 4215 | $equivalences = [ |
4216 | 4216 | 'ISO8859' => 'ISO-8859-1', |
@@ -4368,7 +4368,7 @@ discard block |
||
4368 | 4368 | } |
4369 | 4369 | |
4370 | 4370 | static $WHITESPACE_CACHE = []; |
4371 | - $cacheKey = (int) $keepNonBreakingSpace; |
|
4371 | + $cacheKey = (int)$keepNonBreakingSpace; |
|
4372 | 4372 | |
4373 | 4373 | if (!isset($WHITESPACE_CACHE[$cacheKey])) { |
4374 | 4374 | $WHITESPACE_CACHE[$cacheKey] = self::$WHITESPACE_TABLE; |
@@ -4410,13 +4410,13 @@ discard block |
||
4410 | 4410 | static $CHAR_CACHE = []; |
4411 | 4411 | |
4412 | 4412 | // init |
4413 | - $chr = (string) $chr; |
|
4413 | + $chr = (string)$chr; |
|
4414 | 4414 | |
4415 | 4415 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
4416 | 4416 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4417 | 4417 | } |
4418 | 4418 | |
4419 | - $cacheKey = $chr . $encoding; |
|
4419 | + $cacheKey = $chr.$encoding; |
|
4420 | 4420 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
4421 | 4421 | return $CHAR_CACHE[$cacheKey]; |
4422 | 4422 | } |
@@ -4451,22 +4451,22 @@ discard block |
||
4451 | 4451 | // |
4452 | 4452 | |
4453 | 4453 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
4454 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
4454 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
4455 | 4455 | $code = $chr ? $chr[1] : 0; |
4456 | 4456 | |
4457 | 4457 | if ($code >= 0xF0 && isset($chr[4])) { |
4458 | 4458 | /** @noinspection UnnecessaryCastingInspection */ |
4459 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4459 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4460 | 4460 | } |
4461 | 4461 | |
4462 | 4462 | if ($code >= 0xE0 && isset($chr[3])) { |
4463 | 4463 | /** @noinspection UnnecessaryCastingInspection */ |
4464 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4464 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4465 | 4465 | } |
4466 | 4466 | |
4467 | 4467 | if ($code >= 0xC0 && isset($chr[2])) { |
4468 | 4468 | /** @noinspection UnnecessaryCastingInspection */ |
4469 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4469 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4470 | 4470 | } |
4471 | 4471 | |
4472 | 4472 | return $CHAR_CACHE[$cacheKey] = $code; |
@@ -4515,7 +4515,7 @@ discard block |
||
4515 | 4515 | public static function pcre_utf8_support(): bool |
4516 | 4516 | { |
4517 | 4517 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4518 | - return (bool) @\preg_match('//u', ''); |
|
4518 | + return (bool)@\preg_match('//u', ''); |
|
4519 | 4519 | } |
4520 | 4520 | |
4521 | 4521 | /** |
@@ -4537,10 +4537,10 @@ discard block |
||
4537 | 4537 | } |
4538 | 4538 | |
4539 | 4539 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4540 | - if (\ctype_digit((string) $var1)) { |
|
4541 | - $start = (int) $var1; |
|
4540 | + if (\ctype_digit((string)$var1)) { |
|
4541 | + $start = (int)$var1; |
|
4542 | 4542 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var1)) { |
4543 | - $start = (int) self::hex_to_int($var1); |
|
4543 | + $start = (int)self::hex_to_int($var1); |
|
4544 | 4544 | } else { |
4545 | 4545 | $start = self::ord($var1); |
4546 | 4546 | } |
@@ -4550,10 +4550,10 @@ discard block |
||
4550 | 4550 | } |
4551 | 4551 | |
4552 | 4552 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4553 | - if (\ctype_digit((string) $var2)) { |
|
4554 | - $end = (int) $var2; |
|
4553 | + if (\ctype_digit((string)$var2)) { |
|
4554 | + $end = (int)$var2; |
|
4555 | 4555 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var2)) { |
4556 | - $end = (int) self::hex_to_int($var2); |
|
4556 | + $end = (int)self::hex_to_int($var2); |
|
4557 | 4557 | } else { |
4558 | 4558 | $end = self::ord($var2); |
4559 | 4559 | } |
@@ -4563,8 +4563,8 @@ discard block |
||
4563 | 4563 | } |
4564 | 4564 | |
4565 | 4565 | return \array_map( |
4566 | - static function (int $i): string { |
|
4567 | - return (string) self::chr($i); |
|
4566 | + static function(int $i): string { |
|
4567 | + return (string)self::chr($i); |
|
4568 | 4568 | }, |
4569 | 4569 | \range($start, $end) |
4570 | 4570 | ); |
@@ -4597,7 +4597,7 @@ discard block |
||
4597 | 4597 | |
4598 | 4598 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
4599 | 4599 | if (\preg_match($pattern, $str)) { |
4600 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \rawurldecode($str)); |
|
4600 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \rawurldecode($str)); |
|
4601 | 4601 | } |
4602 | 4602 | |
4603 | 4603 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -4650,8 +4650,8 @@ discard block |
||
4650 | 4650 | $delimiter = '/'; |
4651 | 4651 | } |
4652 | 4652 | |
4653 | - return (string) \preg_replace( |
|
4654 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4653 | + return (string)\preg_replace( |
|
4654 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4655 | 4655 | $replacement, |
4656 | 4656 | $str |
4657 | 4657 | ); |
@@ -4694,9 +4694,9 @@ discard block |
||
4694 | 4694 | return ''; |
4695 | 4695 | } |
4696 | 4696 | |
4697 | - $strLength -= (int) $bomByteLength; |
|
4697 | + $strLength -= (int)$bomByteLength; |
|
4698 | 4698 | |
4699 | - $str = (string) $strTmp; |
|
4699 | + $str = (string)$strTmp; |
|
4700 | 4700 | } |
4701 | 4701 | } |
4702 | 4702 | |
@@ -4720,7 +4720,7 @@ discard block |
||
4720 | 4720 | if (\is_array($what) === true) { |
4721 | 4721 | /** @noinspection ForeachSourceInspection */ |
4722 | 4722 | foreach ($what as $item) { |
4723 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/', $item, $str); |
|
4723 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/', $item, $str); |
|
4724 | 4724 | } |
4725 | 4725 | } |
4726 | 4726 | |
@@ -4752,7 +4752,7 @@ discard block |
||
4752 | 4752 | */ |
4753 | 4753 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
4754 | 4754 | { |
4755 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4755 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4756 | 4756 | } |
4757 | 4757 | |
4758 | 4758 | /** |
@@ -4783,7 +4783,7 @@ discard block |
||
4783 | 4783 | $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
4784 | 4784 | |
4785 | 4785 | do { |
4786 | - $str = (string) \preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4786 | + $str = (string)\preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4787 | 4787 | } while ($count !== 0); |
4788 | 4788 | |
4789 | 4789 | return $str; |
@@ -4802,17 +4802,17 @@ discard block |
||
4802 | 4802 | { |
4803 | 4803 | if ($substring && \strpos($str, $substring) === 0) { |
4804 | 4804 | if ($encoding === 'UTF-8') { |
4805 | - return (string) \mb_substr( |
|
4805 | + return (string)\mb_substr( |
|
4806 | 4806 | $str, |
4807 | - (int) \mb_strlen($substring) |
|
4807 | + (int)\mb_strlen($substring) |
|
4808 | 4808 | ); |
4809 | 4809 | } |
4810 | 4810 | |
4811 | 4811 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4812 | 4812 | |
4813 | - return (string) self::substr( |
|
4813 | + return (string)self::substr( |
|
4814 | 4814 | $str, |
4815 | - (int) self::strlen($substring, $encoding), |
|
4815 | + (int)self::strlen($substring, $encoding), |
|
4816 | 4816 | null, |
4817 | 4817 | $encoding |
4818 | 4818 | ); |
@@ -4834,19 +4834,19 @@ discard block |
||
4834 | 4834 | { |
4835 | 4835 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
4836 | 4836 | if ($encoding === 'UTF-8') { |
4837 | - return (string) \mb_substr( |
|
4837 | + return (string)\mb_substr( |
|
4838 | 4838 | $str, |
4839 | 4839 | 0, |
4840 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
4840 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
4841 | 4841 | ); |
4842 | 4842 | } |
4843 | 4843 | |
4844 | 4844 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4845 | 4845 | |
4846 | - return (string) self::substr( |
|
4846 | + return (string)self::substr( |
|
4847 | 4847 | $str, |
4848 | 4848 | 0, |
4849 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
4849 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
4850 | 4850 | $encoding |
4851 | 4851 | ); |
4852 | 4852 | } |
@@ -4930,7 +4930,7 @@ discard block |
||
4930 | 4930 | $save = \mb_substitute_character(); |
4931 | 4931 | \mb_substitute_character($replacementCharHelper); |
4932 | 4932 | // the polyfill maybe return false, so cast to string |
4933 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4933 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4934 | 4934 | \mb_substitute_character($save); |
4935 | 4935 | } |
4936 | 4936 | |
@@ -4970,7 +4970,7 @@ discard block |
||
4970 | 4970 | |
4971 | 4971 | if (self::$SUPPORT['mbstring'] === true) { |
4972 | 4972 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4973 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4973 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4974 | 4974 | } |
4975 | 4975 | |
4976 | 4976 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -4983,7 +4983,7 @@ discard block |
||
4983 | 4983 | { |
4984 | 4984 | echo '<pre>'; |
4985 | 4985 | foreach (self::$SUPPORT as $key => &$value) { |
4986 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
4986 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
4987 | 4987 | } |
4988 | 4988 | unset($value); |
4989 | 4989 | echo '</pre>'; |
@@ -5012,7 +5012,7 @@ discard block |
||
5012 | 5012 | return $char; |
5013 | 5013 | } |
5014 | 5014 | |
5015 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
5015 | + return '&#'.self::ord($char, $encoding).';'; |
|
5016 | 5016 | } |
5017 | 5017 | |
5018 | 5018 | /** |
@@ -5071,7 +5071,7 @@ discard block |
||
5071 | 5071 | } |
5072 | 5072 | |
5073 | 5073 | // init |
5074 | - $str = (string) $str; |
|
5074 | + $str = (string)$str; |
|
5075 | 5075 | |
5076 | 5076 | if ($str === '') { |
5077 | 5077 | return []; |
@@ -5118,7 +5118,7 @@ discard block |
||
5118 | 5118 | ($str[$i] & "\xE0") === "\xC0" |
5119 | 5119 | ) { |
5120 | 5120 | if (($str[$i + 1] & "\xC0") === "\x80") { |
5121 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
5121 | + $ret[] = $str[$i].$str[$i + 1]; |
|
5122 | 5122 | |
5123 | 5123 | ++$i; |
5124 | 5124 | } |
@@ -5132,7 +5132,7 @@ discard block |
||
5132 | 5132 | && |
5133 | 5133 | ($str[$i + 2] & "\xC0") === "\x80" |
5134 | 5134 | ) { |
5135 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
5135 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
5136 | 5136 | |
5137 | 5137 | $i += 2; |
5138 | 5138 | } |
@@ -5148,7 +5148,7 @@ discard block |
||
5148 | 5148 | && |
5149 | 5149 | ($str[$i + 3] & "\xC0") === "\x80" |
5150 | 5150 | ) { |
5151 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
5151 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
5152 | 5152 | |
5153 | 5153 | $i += 3; |
5154 | 5154 | } |
@@ -5160,7 +5160,7 @@ discard block |
||
5160 | 5160 | $ret = \array_chunk($ret, $length); |
5161 | 5161 | |
5162 | 5162 | return \array_map( |
5163 | - static function (array &$item): string { |
|
5163 | + static function(array &$item): string { |
|
5164 | 5164 | return \implode('', $item); |
5165 | 5165 | }, |
5166 | 5166 | $ret |
@@ -5209,18 +5209,18 @@ discard block |
||
5209 | 5209 | $lang, |
5210 | 5210 | $tryToKeepStringLength |
5211 | 5211 | ); |
5212 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5212 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5213 | 5213 | |
5214 | 5214 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5215 | 5215 | |
5216 | - $str = (string) \preg_replace_callback( |
|
5216 | + $str = (string)\preg_replace_callback( |
|
5217 | 5217 | '/[-_\s]+(.)?/u', |
5218 | 5218 | /** |
5219 | 5219 | * @param array $match |
5220 | 5220 | * |
5221 | 5221 | * @return string |
5222 | 5222 | */ |
5223 | - static function (array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5223 | + static function(array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5224 | 5224 | if (isset($match[1])) { |
5225 | 5225 | if ($useMbFunction === true) { |
5226 | 5226 | if ($encoding === 'UTF-8') { |
@@ -5238,14 +5238,14 @@ discard block |
||
5238 | 5238 | $str |
5239 | 5239 | ); |
5240 | 5240 | |
5241 | - return (string) \preg_replace_callback( |
|
5241 | + return (string)\preg_replace_callback( |
|
5242 | 5242 | '/[\d]+(.)?/u', |
5243 | 5243 | /** |
5244 | 5244 | * @param array $match |
5245 | 5245 | * |
5246 | 5246 | * @return string |
5247 | 5247 | */ |
5248 | - static function (array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5248 | + static function(array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5249 | 5249 | if ($useMbFunction === true) { |
5250 | 5250 | if ($encoding === 'UTF-8') { |
5251 | 5251 | return \mb_strtoupper($match[0]); |
@@ -5417,7 +5417,7 @@ discard block |
||
5417 | 5417 | ): string { |
5418 | 5418 | if (self::$SUPPORT['mbstring'] === true) { |
5419 | 5419 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5420 | - $str = (string) \mb_ereg_replace('\B([A-Z])', '-\1', \trim($str)); |
|
5420 | + $str = (string)\mb_ereg_replace('\B([A-Z])', '-\1', \trim($str)); |
|
5421 | 5421 | |
5422 | 5422 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5423 | 5423 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5427,10 +5427,10 @@ discard block |
||
5427 | 5427 | } |
5428 | 5428 | |
5429 | 5429 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5430 | - return (string) \mb_ereg_replace('[-_\s]+', $delimiter, $str); |
|
5430 | + return (string)\mb_ereg_replace('[-_\s]+', $delimiter, $str); |
|
5431 | 5431 | } |
5432 | 5432 | |
5433 | - $str = (string) \preg_replace('/\B([A-Z])/u', '-\1', \trim($str)); |
|
5433 | + $str = (string)\preg_replace('/\B([A-Z])/u', '-\1', \trim($str)); |
|
5434 | 5434 | |
5435 | 5435 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5436 | 5436 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5439,7 +5439,7 @@ discard block |
||
5439 | 5439 | $str = self::strtolower($str, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
5440 | 5440 | } |
5441 | 5441 | |
5442 | - return (string) \preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
5442 | + return (string)\preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
5443 | 5443 | } |
5444 | 5444 | |
5445 | 5445 | /** |
@@ -5454,7 +5454,7 @@ discard block |
||
5454 | 5454 | public static function str_detect_encoding($str) |
5455 | 5455 | { |
5456 | 5456 | // init |
5457 | - $str = (string) $str; |
|
5457 | + $str = (string)$str; |
|
5458 | 5458 | |
5459 | 5459 | // |
5460 | 5460 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5556,7 +5556,7 @@ discard block |
||
5556 | 5556 | foreach (self::$ENCODINGS as $encodingTmp) { |
5557 | 5557 | // INFO: //IGNORE but still throw notice |
5558 | 5558 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5559 | - if ((string) @\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str) === $str) { |
|
5559 | + if ((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str) === $str) { |
|
5560 | 5560 | return $encodingTmp; |
5561 | 5561 | } |
5562 | 5562 | } |
@@ -5621,7 +5621,7 @@ discard block |
||
5621 | 5621 | return $str; |
5622 | 5622 | } |
5623 | 5623 | |
5624 | - return $substring . $str; |
|
5624 | + return $substring.$str; |
|
5625 | 5625 | } |
5626 | 5626 | |
5627 | 5627 | /** |
@@ -5841,27 +5841,27 @@ discard block |
||
5841 | 5841 | string $encoding = 'UTF-8' |
5842 | 5842 | ): string { |
5843 | 5843 | if ($encoding === 'UTF-8') { |
5844 | - $len = (int) \mb_strlen($str); |
|
5844 | + $len = (int)\mb_strlen($str); |
|
5845 | 5845 | if ($index > $len) { |
5846 | 5846 | return $str; |
5847 | 5847 | } |
5848 | 5848 | |
5849 | 5849 | /** @noinspection UnnecessaryCastingInspection */ |
5850 | - return (string) \mb_substr($str, 0, $index) . |
|
5851 | - $substring . |
|
5852 | - (string) \mb_substr($str, $index, $len); |
|
5850 | + return (string)\mb_substr($str, 0, $index). |
|
5851 | + $substring. |
|
5852 | + (string)\mb_substr($str, $index, $len); |
|
5853 | 5853 | } |
5854 | 5854 | |
5855 | 5855 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5856 | 5856 | |
5857 | - $len = (int) self::strlen($str, $encoding); |
|
5857 | + $len = (int)self::strlen($str, $encoding); |
|
5858 | 5858 | if ($index > $len) { |
5859 | 5859 | return $str; |
5860 | 5860 | } |
5861 | 5861 | |
5862 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
5863 | - $substring . |
|
5864 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5862 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
5863 | + $substring. |
|
5864 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
5865 | 5865 | } |
5866 | 5866 | |
5867 | 5867 | /** |
@@ -5891,15 +5891,15 @@ discard block |
||
5891 | 5891 | */ |
5892 | 5892 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
5893 | 5893 | { |
5894 | - $search = (array) $search; |
|
5894 | + $search = (array)$search; |
|
5895 | 5895 | |
5896 | 5896 | /** @noinspection AlterInForeachInspection */ |
5897 | 5897 | foreach ($search as &$s) { |
5898 | - $s = (string) $s; |
|
5898 | + $s = (string)$s; |
|
5899 | 5899 | if ($s === '') { |
5900 | 5900 | $s = '/^(?<=.)$/'; |
5901 | 5901 | } else { |
5902 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5902 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5903 | 5903 | } |
5904 | 5904 | } |
5905 | 5905 | |
@@ -5931,11 +5931,11 @@ discard block |
||
5931 | 5931 | } |
5932 | 5932 | |
5933 | 5933 | if ($search === '') { |
5934 | - return $str . $replacement; |
|
5934 | + return $str.$replacement; |
|
5935 | 5935 | } |
5936 | 5936 | |
5937 | 5937 | if (\stripos($str, $search) === 0) { |
5938 | - return $replacement . \substr($str, \strlen($search)); |
|
5938 | + return $replacement.\substr($str, \strlen($search)); |
|
5939 | 5939 | } |
5940 | 5940 | |
5941 | 5941 | return $str; |
@@ -5963,11 +5963,11 @@ discard block |
||
5963 | 5963 | } |
5964 | 5964 | |
5965 | 5965 | if ($search === '') { |
5966 | - return $str . $replacement; |
|
5966 | + return $str.$replacement; |
|
5967 | 5967 | } |
5968 | 5968 | |
5969 | 5969 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
5970 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
5970 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
5971 | 5971 | } |
5972 | 5972 | |
5973 | 5973 | return $str; |
@@ -6040,15 +6040,15 @@ discard block |
||
6040 | 6040 | } |
6041 | 6041 | |
6042 | 6042 | if ($encoding === 'UTF-8') { |
6043 | - return (string) \mb_substr( |
|
6043 | + return (string)\mb_substr( |
|
6044 | 6044 | $str, |
6045 | - $offset + (int) \mb_strlen($separator) |
|
6045 | + $offset + (int)\mb_strlen($separator) |
|
6046 | 6046 | ); |
6047 | 6047 | } |
6048 | 6048 | |
6049 | - return (string) self::substr( |
|
6049 | + return (string)self::substr( |
|
6050 | 6050 | $str, |
6051 | - $offset + (int) self::strlen($separator, $encoding), |
|
6051 | + $offset + (int)self::strlen($separator, $encoding), |
|
6052 | 6052 | null, |
6053 | 6053 | $encoding |
6054 | 6054 | ); |
@@ -6075,15 +6075,15 @@ discard block |
||
6075 | 6075 | } |
6076 | 6076 | |
6077 | 6077 | if ($encoding === 'UTF-8') { |
6078 | - return (string) \mb_substr( |
|
6078 | + return (string)\mb_substr( |
|
6079 | 6079 | $str, |
6080 | - $offset + (int) self::strlen($separator) |
|
6080 | + $offset + (int)self::strlen($separator) |
|
6081 | 6081 | ); |
6082 | 6082 | } |
6083 | 6083 | |
6084 | - return (string) self::substr( |
|
6084 | + return (string)self::substr( |
|
6085 | 6085 | $str, |
6086 | - $offset + (int) self::strlen($separator, $encoding), |
|
6086 | + $offset + (int)self::strlen($separator, $encoding), |
|
6087 | 6087 | null, |
6088 | 6088 | $encoding |
6089 | 6089 | ); |
@@ -6110,10 +6110,10 @@ discard block |
||
6110 | 6110 | } |
6111 | 6111 | |
6112 | 6112 | if ($encoding === 'UTF-8') { |
6113 | - return (string) \mb_substr($str, 0, $offset); |
|
6113 | + return (string)\mb_substr($str, 0, $offset); |
|
6114 | 6114 | } |
6115 | 6115 | |
6116 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6116 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6117 | 6117 | } |
6118 | 6118 | |
6119 | 6119 | /** |
@@ -6137,7 +6137,7 @@ discard block |
||
6137 | 6137 | return ''; |
6138 | 6138 | } |
6139 | 6139 | |
6140 | - return (string) \mb_substr($str, 0, $offset); |
|
6140 | + return (string)\mb_substr($str, 0, $offset); |
|
6141 | 6141 | } |
6142 | 6142 | |
6143 | 6143 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6145,7 +6145,7 @@ discard block |
||
6145 | 6145 | return ''; |
6146 | 6146 | } |
6147 | 6147 | |
6148 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6148 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6149 | 6149 | } |
6150 | 6150 | |
6151 | 6151 | /** |
@@ -6233,12 +6233,12 @@ discard block |
||
6233 | 6233 | } |
6234 | 6234 | |
6235 | 6235 | if ($encoding === 'UTF-8') { |
6236 | - return (string) \mb_substr($str, -$n); |
|
6236 | + return (string)\mb_substr($str, -$n); |
|
6237 | 6237 | } |
6238 | 6238 | |
6239 | 6239 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6240 | 6240 | |
6241 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6241 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6242 | 6242 | } |
6243 | 6243 | |
6244 | 6244 | /** |
@@ -6262,21 +6262,21 @@ discard block |
||
6262 | 6262 | } |
6263 | 6263 | |
6264 | 6264 | if ($encoding === 'UTF-8') { |
6265 | - if ((int) \mb_strlen($str) <= $length) { |
|
6265 | + if ((int)\mb_strlen($str) <= $length) { |
|
6266 | 6266 | return $str; |
6267 | 6267 | } |
6268 | 6268 | |
6269 | 6269 | /** @noinspection UnnecessaryCastingInspection */ |
6270 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($strAddOn)) . $strAddOn; |
|
6270 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($strAddOn)).$strAddOn; |
|
6271 | 6271 | } |
6272 | 6272 | |
6273 | 6273 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6274 | 6274 | |
6275 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6275 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6276 | 6276 | return $str; |
6277 | 6277 | } |
6278 | 6278 | |
6279 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($strAddOn), $encoding)) . $strAddOn; |
|
6279 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($strAddOn), $encoding)).$strAddOn; |
|
6280 | 6280 | } |
6281 | 6281 | |
6282 | 6282 | /** |
@@ -6301,12 +6301,12 @@ discard block |
||
6301 | 6301 | |
6302 | 6302 | if ($encoding === 'UTF-8') { |
6303 | 6303 | /** @noinspection UnnecessaryCastingInspection */ |
6304 | - if ((int) \mb_strlen($str) <= $length) { |
|
6304 | + if ((int)\mb_strlen($str) <= $length) { |
|
6305 | 6305 | return $str; |
6306 | 6306 | } |
6307 | 6307 | |
6308 | 6308 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6309 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6309 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6310 | 6310 | } |
6311 | 6311 | |
6312 | 6312 | $str = \mb_substr($str, 0, $length); |
@@ -6316,20 +6316,20 @@ discard block |
||
6316 | 6316 | $new_str = \implode(' ', $array); |
6317 | 6317 | |
6318 | 6318 | if ($new_str === '') { |
6319 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6319 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6320 | 6320 | } |
6321 | 6321 | } else { |
6322 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6322 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6323 | 6323 | return $str; |
6324 | 6324 | } |
6325 | 6325 | |
6326 | 6326 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6327 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6327 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6328 | 6328 | } |
6329 | 6329 | |
6330 | 6330 | $str = self::substr($str, 0, $length, $encoding); |
6331 | 6331 | if ($str === false) { |
6332 | - return '' . $strAddOn; |
|
6332 | + return ''.$strAddOn; |
|
6333 | 6333 | } |
6334 | 6334 | |
6335 | 6335 | $array = \explode(' ', $str); |
@@ -6337,11 +6337,11 @@ discard block |
||
6337 | 6337 | $new_str = \implode(' ', $array); |
6338 | 6338 | |
6339 | 6339 | if ($new_str === '') { |
6340 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6340 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6341 | 6341 | } |
6342 | 6342 | } |
6343 | 6343 | |
6344 | - return $new_str . $strAddOn; |
|
6344 | + return $new_str.$strAddOn; |
|
6345 | 6345 | } |
6346 | 6346 | |
6347 | 6347 | /** |
@@ -6359,7 +6359,7 @@ discard block |
||
6359 | 6359 | $longestCommonPrefix = ''; |
6360 | 6360 | |
6361 | 6361 | if ($encoding === 'UTF-8') { |
6362 | - $maxLength = (int) \min( |
|
6362 | + $maxLength = (int)\min( |
|
6363 | 6363 | \mb_strlen($str), |
6364 | 6364 | \mb_strlen($otherStr) |
6365 | 6365 | ); |
@@ -6380,7 +6380,7 @@ discard block |
||
6380 | 6380 | } else { |
6381 | 6381 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6382 | 6382 | |
6383 | - $maxLength = (int) \min( |
|
6383 | + $maxLength = (int)\min( |
|
6384 | 6384 | self::strlen($str, $encoding), |
6385 | 6385 | self::strlen($otherStr, $encoding) |
6386 | 6386 | ); |
@@ -6423,13 +6423,13 @@ discard block |
||
6423 | 6423 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6424 | 6424 | |
6425 | 6425 | if ($encoding === 'UTF-8') { |
6426 | - $strLength = (int) \mb_strlen($str); |
|
6427 | - $otherLength = (int) \mb_strlen($otherStr); |
|
6426 | + $strLength = (int)\mb_strlen($str); |
|
6427 | + $otherLength = (int)\mb_strlen($otherStr); |
|
6428 | 6428 | } else { |
6429 | 6429 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6430 | 6430 | |
6431 | - $strLength = (int) self::strlen($str, $encoding); |
|
6432 | - $otherLength = (int) self::strlen($otherStr, $encoding); |
|
6431 | + $strLength = (int)self::strlen($str, $encoding); |
|
6432 | + $otherLength = (int)self::strlen($otherStr, $encoding); |
|
6433 | 6433 | } |
6434 | 6434 | |
6435 | 6435 | // Return if either string is empty |
@@ -6482,10 +6482,10 @@ discard block |
||
6482 | 6482 | } |
6483 | 6483 | |
6484 | 6484 | if ($encoding === 'UTF-8') { |
6485 | - return (string) \mb_substr($str, $end - $len, $len); |
|
6485 | + return (string)\mb_substr($str, $end - $len, $len); |
|
6486 | 6486 | } |
6487 | 6487 | |
6488 | - return (string) self::substr($str, $end - $len, $len, $encoding); |
|
6488 | + return (string)self::substr($str, $end - $len, $len, $encoding); |
|
6489 | 6489 | } |
6490 | 6490 | |
6491 | 6491 | /** |
@@ -6504,7 +6504,7 @@ discard block |
||
6504 | 6504 | } |
6505 | 6505 | |
6506 | 6506 | if ($encoding === 'UTF-8') { |
6507 | - $maxLength = (int) \min( |
|
6507 | + $maxLength = (int)\min( |
|
6508 | 6508 | \mb_strlen($str, $encoding), |
6509 | 6509 | \mb_strlen($otherStr, $encoding) |
6510 | 6510 | ); |
@@ -6518,7 +6518,7 @@ discard block |
||
6518 | 6518 | && |
6519 | 6519 | $char === \mb_substr($otherStr, -$i, 1) |
6520 | 6520 | ) { |
6521 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6521 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6522 | 6522 | } else { |
6523 | 6523 | break; |
6524 | 6524 | } |
@@ -6526,7 +6526,7 @@ discard block |
||
6526 | 6526 | } else { |
6527 | 6527 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6528 | 6528 | |
6529 | - $maxLength = (int) \min( |
|
6529 | + $maxLength = (int)\min( |
|
6530 | 6530 | self::strlen($str, $encoding), |
6531 | 6531 | self::strlen($otherStr, $encoding) |
6532 | 6532 | ); |
@@ -6540,7 +6540,7 @@ discard block |
||
6540 | 6540 | && |
6541 | 6541 | $char === self::substr($otherStr, -$i, 1, $encoding) |
6542 | 6542 | ) { |
6543 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6543 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6544 | 6544 | } else { |
6545 | 6545 | break; |
6546 | 6546 | } |
@@ -6560,7 +6560,7 @@ discard block |
||
6560 | 6560 | */ |
6561 | 6561 | public static function str_matches_pattern(string $str, string $pattern): bool |
6562 | 6562 | { |
6563 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
6563 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
6564 | 6564 | } |
6565 | 6565 | |
6566 | 6566 | /** |
@@ -6577,7 +6577,7 @@ discard block |
||
6577 | 6577 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
6578 | 6578 | { |
6579 | 6579 | // init |
6580 | - $length = (int) self::strlen($str, $encoding); |
|
6580 | + $length = (int)self::strlen($str, $encoding); |
|
6581 | 6581 | |
6582 | 6582 | if ($offset >= 0) { |
6583 | 6583 | return $length > $offset; |
@@ -6603,7 +6603,7 @@ discard block |
||
6603 | 6603 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
6604 | 6604 | { |
6605 | 6605 | // init |
6606 | - $length = (int) self::strlen($str); |
|
6606 | + $length = (int)self::strlen($str); |
|
6607 | 6607 | |
6608 | 6608 | if ( |
6609 | 6609 | ($index >= 0 && $length <= $index) |
@@ -6642,7 +6642,7 @@ discard block |
||
6642 | 6642 | return $str; |
6643 | 6643 | } |
6644 | 6644 | |
6645 | - if ($pad_type !== (int) $pad_type) { |
|
6645 | + if ($pad_type !== (int)$pad_type) { |
|
6646 | 6646 | if ($pad_type === 'left') { |
6647 | 6647 | $pad_type = \STR_PAD_LEFT; |
6648 | 6648 | } elseif ($pad_type === 'right') { |
@@ -6651,23 +6651,23 @@ discard block |
||
6651 | 6651 | $pad_type = \STR_PAD_BOTH; |
6652 | 6652 | } else { |
6653 | 6653 | throw new \InvalidArgumentException( |
6654 | - 'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
6654 | + 'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
6655 | 6655 | ); |
6656 | 6656 | } |
6657 | 6657 | } |
6658 | 6658 | |
6659 | 6659 | if ($encoding === 'UTF-8') { |
6660 | - $str_length = (int) \mb_strlen($str); |
|
6660 | + $str_length = (int)\mb_strlen($str); |
|
6661 | 6661 | |
6662 | 6662 | if ($pad_length >= $str_length) { |
6663 | 6663 | switch ($pad_type) { |
6664 | 6664 | case \STR_PAD_LEFT: |
6665 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6665 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6666 | 6666 | |
6667 | 6667 | $diff = ($pad_length - $str_length); |
6668 | 6668 | |
6669 | - $pre = (string) \mb_substr( |
|
6670 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6669 | + $pre = (string)\mb_substr( |
|
6670 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6671 | 6671 | 0, |
6672 | 6672 | $diff |
6673 | 6673 | ); |
@@ -6678,16 +6678,16 @@ discard block |
||
6678 | 6678 | case \STR_PAD_BOTH: |
6679 | 6679 | $diff = ($pad_length - $str_length); |
6680 | 6680 | |
6681 | - $ps_length_left = (int) \floor($diff / 2); |
|
6681 | + $ps_length_left = (int)\floor($diff / 2); |
|
6682 | 6682 | |
6683 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6683 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6684 | 6684 | |
6685 | - $pre = (string) \mb_substr( |
|
6685 | + $pre = (string)\mb_substr( |
|
6686 | 6686 | \str_repeat($pad_string, $ps_length_left), |
6687 | 6687 | 0, |
6688 | 6688 | $ps_length_left |
6689 | 6689 | ); |
6690 | - $post = (string) \mb_substr( |
|
6690 | + $post = (string)\mb_substr( |
|
6691 | 6691 | \str_repeat($pad_string, $ps_length_right), |
6692 | 6692 | 0, |
6693 | 6693 | $ps_length_right |
@@ -6697,19 +6697,19 @@ discard block |
||
6697 | 6697 | |
6698 | 6698 | case \STR_PAD_RIGHT: |
6699 | 6699 | default: |
6700 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6700 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6701 | 6701 | |
6702 | 6702 | $diff = ($pad_length - $str_length); |
6703 | 6703 | |
6704 | - $post = (string) \mb_substr( |
|
6705 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6704 | + $post = (string)\mb_substr( |
|
6705 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6706 | 6706 | 0, |
6707 | 6707 | $diff |
6708 | 6708 | ); |
6709 | 6709 | $pre = ''; |
6710 | 6710 | } |
6711 | 6711 | |
6712 | - return $pre . $str . $post; |
|
6712 | + return $pre.$str.$post; |
|
6713 | 6713 | } |
6714 | 6714 | |
6715 | 6715 | return $str; |
@@ -6717,17 +6717,17 @@ discard block |
||
6717 | 6717 | |
6718 | 6718 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6719 | 6719 | |
6720 | - $str_length = (int) self::strlen($str, $encoding); |
|
6720 | + $str_length = (int)self::strlen($str, $encoding); |
|
6721 | 6721 | |
6722 | 6722 | if ($pad_length >= $str_length) { |
6723 | 6723 | switch ($pad_type) { |
6724 | 6724 | case \STR_PAD_LEFT: |
6725 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6725 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6726 | 6726 | |
6727 | 6727 | $diff = ($pad_length - $str_length); |
6728 | 6728 | |
6729 | - $pre = (string) self::substr( |
|
6730 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6729 | + $pre = (string)self::substr( |
|
6730 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6731 | 6731 | 0, |
6732 | 6732 | $diff, |
6733 | 6733 | $encoding |
@@ -6739,17 +6739,17 @@ discard block |
||
6739 | 6739 | case \STR_PAD_BOTH: |
6740 | 6740 | $diff = ($pad_length - $str_length); |
6741 | 6741 | |
6742 | - $ps_length_left = (int) \floor($diff / 2); |
|
6742 | + $ps_length_left = (int)\floor($diff / 2); |
|
6743 | 6743 | |
6744 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6744 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6745 | 6745 | |
6746 | - $pre = (string) self::substr( |
|
6746 | + $pre = (string)self::substr( |
|
6747 | 6747 | \str_repeat($pad_string, $ps_length_left), |
6748 | 6748 | 0, |
6749 | 6749 | $ps_length_left, |
6750 | 6750 | $encoding |
6751 | 6751 | ); |
6752 | - $post = (string) self::substr( |
|
6752 | + $post = (string)self::substr( |
|
6753 | 6753 | \str_repeat($pad_string, $ps_length_right), |
6754 | 6754 | 0, |
6755 | 6755 | $ps_length_right, |
@@ -6760,12 +6760,12 @@ discard block |
||
6760 | 6760 | |
6761 | 6761 | case \STR_PAD_RIGHT: |
6762 | 6762 | default: |
6763 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6763 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6764 | 6764 | |
6765 | 6765 | $diff = ($pad_length - $str_length); |
6766 | 6766 | |
6767 | - $post = (string) self::substr( |
|
6768 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6767 | + $post = (string)self::substr( |
|
6768 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6769 | 6769 | 0, |
6770 | 6770 | $diff, |
6771 | 6771 | $encoding |
@@ -6773,7 +6773,7 @@ discard block |
||
6773 | 6773 | $pre = ''; |
6774 | 6774 | } |
6775 | 6775 | |
6776 | - return $pre . $str . $post; |
|
6776 | + return $pre.$str.$post; |
|
6777 | 6777 | } |
6778 | 6778 | |
6779 | 6779 | return $str; |
@@ -6925,11 +6925,11 @@ discard block |
||
6925 | 6925 | } |
6926 | 6926 | |
6927 | 6927 | if ($search === '') { |
6928 | - return $str . $replacement; |
|
6928 | + return $str.$replacement; |
|
6929 | 6929 | } |
6930 | 6930 | |
6931 | 6931 | if (\strpos($str, $search) === 0) { |
6932 | - return $replacement . \substr($str, \strlen($search)); |
|
6932 | + return $replacement.\substr($str, \strlen($search)); |
|
6933 | 6933 | } |
6934 | 6934 | |
6935 | 6935 | return $str; |
@@ -6957,11 +6957,11 @@ discard block |
||
6957 | 6957 | } |
6958 | 6958 | |
6959 | 6959 | if ($search === '') { |
6960 | - return $str . $replacement; |
|
6960 | + return $str.$replacement; |
|
6961 | 6961 | } |
6962 | 6962 | |
6963 | 6963 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6964 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6964 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6965 | 6965 | } |
6966 | 6966 | |
6967 | 6967 | return $str; |
@@ -6984,7 +6984,7 @@ discard block |
||
6984 | 6984 | |
6985 | 6985 | if ($pos !== false) { |
6986 | 6986 | /** @psalm-suppress InvalidReturnStatement */ |
6987 | - return self::substr_replace($subject, $replace, $pos, (int) self::strlen($search)); |
|
6987 | + return self::substr_replace($subject, $replace, $pos, (int)self::strlen($search)); |
|
6988 | 6988 | } |
6989 | 6989 | |
6990 | 6990 | return $subject; |
@@ -7009,7 +7009,7 @@ discard block |
||
7009 | 7009 | $pos = self::strrpos($subject, $search); |
7010 | 7010 | if ($pos !== false) { |
7011 | 7011 | /** @psalm-suppress InvalidReturnStatement */ |
7012 | - return self::substr_replace($subject, $replace, $pos, (int) self::strlen($search)); |
|
7012 | + return self::substr_replace($subject, $replace, $pos, (int)self::strlen($search)); |
|
7013 | 7013 | } |
7014 | 7014 | |
7015 | 7015 | return $subject; |
@@ -7028,7 +7028,7 @@ discard block |
||
7028 | 7028 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
7029 | 7029 | { |
7030 | 7030 | if ($encoding === 'UTF-8') { |
7031 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
7031 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
7032 | 7032 | /** @noinspection NonSecureShuffleUsageInspection */ |
7033 | 7033 | \shuffle($indexes); |
7034 | 7034 | |
@@ -7044,7 +7044,7 @@ discard block |
||
7044 | 7044 | } else { |
7045 | 7045 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7046 | 7046 | |
7047 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
7047 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
7048 | 7048 | /** @noinspection NonSecureShuffleUsageInspection */ |
7049 | 7049 | \shuffle($indexes); |
7050 | 7050 | |
@@ -7085,11 +7085,11 @@ discard block |
||
7085 | 7085 | ) { |
7086 | 7086 | if ($encoding === 'UTF-8') { |
7087 | 7087 | if ($end === null) { |
7088 | - $length = (int) \mb_strlen($str); |
|
7088 | + $length = (int)\mb_strlen($str); |
|
7089 | 7089 | } elseif ($end >= 0 && $end <= $start) { |
7090 | 7090 | return ''; |
7091 | 7091 | } elseif ($end < 0) { |
7092 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7092 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7093 | 7093 | } else { |
7094 | 7094 | $length = $end - $start; |
7095 | 7095 | } |
@@ -7100,11 +7100,11 @@ discard block |
||
7100 | 7100 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7101 | 7101 | |
7102 | 7102 | if ($end === null) { |
7103 | - $length = (int) self::strlen($str, $encoding); |
|
7103 | + $length = (int)self::strlen($str, $encoding); |
|
7104 | 7104 | } elseif ($end >= 0 && $end <= $start) { |
7105 | 7105 | return ''; |
7106 | 7106 | } elseif ($end < 0) { |
7107 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7107 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7108 | 7108 | } else { |
7109 | 7109 | $length = $end - $start; |
7110 | 7110 | } |
@@ -7136,35 +7136,35 @@ discard block |
||
7136 | 7136 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7137 | 7137 | } |
7138 | 7138 | |
7139 | - $str = (string) \preg_replace_callback( |
|
7139 | + $str = (string)\preg_replace_callback( |
|
7140 | 7140 | '/([\d|A-Z])/u', |
7141 | 7141 | /** |
7142 | 7142 | * @param string[] $matches |
7143 | 7143 | * |
7144 | 7144 | * @return string |
7145 | 7145 | */ |
7146 | - static function (array $matches) use ($encoding): string { |
|
7146 | + static function(array $matches) use ($encoding): string { |
|
7147 | 7147 | $match = $matches[1]; |
7148 | - $matchInt = (int) $match; |
|
7148 | + $matchInt = (int)$match; |
|
7149 | 7149 | |
7150 | - if ((string) $matchInt === $match) { |
|
7151 | - return '_' . $match . '_'; |
|
7150 | + if ((string)$matchInt === $match) { |
|
7151 | + return '_'.$match.'_'; |
|
7152 | 7152 | } |
7153 | 7153 | |
7154 | 7154 | if ($encoding === 'UTF-8') { |
7155 | - return '_' . \mb_strtolower($match); |
|
7155 | + return '_'.\mb_strtolower($match); |
|
7156 | 7156 | } |
7157 | 7157 | |
7158 | - return '_' . self::strtolower($match, $encoding); |
|
7158 | + return '_'.self::strtolower($match, $encoding); |
|
7159 | 7159 | }, |
7160 | 7160 | $str |
7161 | 7161 | ); |
7162 | 7162 | |
7163 | - $str = (string) \preg_replace( |
|
7163 | + $str = (string)\preg_replace( |
|
7164 | 7164 | [ |
7165 | - '/\s+/', // convert spaces to "_" |
|
7166 | - '/^\s+|\s+$/', // trim leading & trailing spaces |
|
7167 | - '/_+/', // remove double "_" |
|
7165 | + '/\s+/', // convert spaces to "_" |
|
7166 | + '/^\s+|\s+$/', // trim leading & trailing spaces |
|
7167 | + '/_+/', // remove double "_" |
|
7168 | 7168 | ], |
7169 | 7169 | [ |
7170 | 7170 | '_', |
@@ -7248,7 +7248,7 @@ discard block |
||
7248 | 7248 | /** @noinspection PhpComposerExtensionStubsInspection */ |
7249 | 7249 | return \array_filter( |
7250 | 7250 | \mb_split($pattern, $str), |
7251 | - static function () use (&$limit): bool { |
|
7251 | + static function() use (&$limit): bool { |
|
7252 | 7252 | return --$limit >= 0; |
7253 | 7253 | } |
7254 | 7254 | ); |
@@ -7264,7 +7264,7 @@ discard block |
||
7264 | 7264 | $limit = -1; |
7265 | 7265 | } |
7266 | 7266 | |
7267 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7267 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7268 | 7268 | |
7269 | 7269 | if ($array === false) { |
7270 | 7270 | return []; |
@@ -7340,9 +7340,9 @@ discard block |
||
7340 | 7340 | return ''; |
7341 | 7341 | } |
7342 | 7342 | |
7343 | - return (string) \mb_substr( |
|
7343 | + return (string)\mb_substr( |
|
7344 | 7344 | $str, |
7345 | - $offset + (int) \mb_strlen($separator) |
|
7345 | + $offset + (int)\mb_strlen($separator) |
|
7346 | 7346 | ); |
7347 | 7347 | } |
7348 | 7348 | |
@@ -7351,9 +7351,9 @@ discard block |
||
7351 | 7351 | return ''; |
7352 | 7352 | } |
7353 | 7353 | |
7354 | - return (string) \mb_substr( |
|
7354 | + return (string)\mb_substr( |
|
7355 | 7355 | $str, |
7356 | - $offset + (int) self::strlen($separator, $encoding), |
|
7356 | + $offset + (int)self::strlen($separator, $encoding), |
|
7357 | 7357 | null, |
7358 | 7358 | $encoding |
7359 | 7359 | ); |
@@ -7380,9 +7380,9 @@ discard block |
||
7380 | 7380 | return ''; |
7381 | 7381 | } |
7382 | 7382 | |
7383 | - return (string) \mb_substr( |
|
7383 | + return (string)\mb_substr( |
|
7384 | 7384 | $str, |
7385 | - $offset + (int) \mb_strlen($separator) |
|
7385 | + $offset + (int)\mb_strlen($separator) |
|
7386 | 7386 | ); |
7387 | 7387 | } |
7388 | 7388 | |
@@ -7391,9 +7391,9 @@ discard block |
||
7391 | 7391 | return ''; |
7392 | 7392 | } |
7393 | 7393 | |
7394 | - return (string) self::substr( |
|
7394 | + return (string)self::substr( |
|
7395 | 7395 | $str, |
7396 | - $offset + (int) self::strlen($separator, $encoding), |
|
7396 | + $offset + (int)self::strlen($separator, $encoding), |
|
7397 | 7397 | null, |
7398 | 7398 | $encoding |
7399 | 7399 | ); |
@@ -7423,7 +7423,7 @@ discard block |
||
7423 | 7423 | return ''; |
7424 | 7424 | } |
7425 | 7425 | |
7426 | - return (string) \mb_substr( |
|
7426 | + return (string)\mb_substr( |
|
7427 | 7427 | $str, |
7428 | 7428 | 0, |
7429 | 7429 | $offset |
@@ -7435,7 +7435,7 @@ discard block |
||
7435 | 7435 | return ''; |
7436 | 7436 | } |
7437 | 7437 | |
7438 | - return (string) self::substr( |
|
7438 | + return (string)self::substr( |
|
7439 | 7439 | $str, |
7440 | 7440 | 0, |
7441 | 7441 | $offset, |
@@ -7464,7 +7464,7 @@ discard block |
||
7464 | 7464 | return ''; |
7465 | 7465 | } |
7466 | 7466 | |
7467 | - return (string) \mb_substr( |
|
7467 | + return (string)\mb_substr( |
|
7468 | 7468 | $str, |
7469 | 7469 | 0, |
7470 | 7470 | $offset |
@@ -7478,7 +7478,7 @@ discard block |
||
7478 | 7478 | |
7479 | 7479 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7480 | 7480 | |
7481 | - return (string) self::substr( |
|
7481 | + return (string)self::substr( |
|
7482 | 7482 | $str, |
7483 | 7483 | 0, |
7484 | 7484 | $offset, |
@@ -7586,7 +7586,7 @@ discard block |
||
7586 | 7586 | */ |
7587 | 7587 | public static function str_surround(string $str, string $substring): string |
7588 | 7588 | { |
7589 | - return $substring . $str . $substring; |
|
7589 | + return $substring.$str.$substring; |
|
7590 | 7590 | } |
7591 | 7591 | |
7592 | 7592 | /** |
@@ -7630,9 +7630,9 @@ discard block |
||
7630 | 7630 | |
7631 | 7631 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
7632 | 7632 | |
7633 | - return (string) \preg_replace_callback( |
|
7633 | + return (string)\preg_replace_callback( |
|
7634 | 7634 | '/([\S]+)/u', |
7635 | - static function (array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7635 | + static function(array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7636 | 7636 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
7637 | 7637 | return $match[0]; |
7638 | 7638 | } |
@@ -7718,16 +7718,16 @@ discard block |
||
7718 | 7718 | } |
7719 | 7719 | |
7720 | 7720 | // the main substitutions |
7721 | - $str = (string) \preg_replace_callback( |
|
7721 | + $str = (string)\preg_replace_callback( |
|
7722 | 7722 | '~\b (_*) (?: # 1. Leading underscore and |
7723 | 7723 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
7724 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) # URL, domain, or email |
|
7724 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) # URL, domain, or email |
|
7725 | 7725 | | |
7726 | - ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' ) # 3. or small word (case-insensitive) |
|
7726 | + ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' ) # 3. or small word (case-insensitive) |
|
7727 | 7727 | | |
7728 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 4. or word w/o internal caps |
|
7728 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 4. or word w/o internal caps |
|
7729 | 7729 | | |
7730 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 5. or some other word |
|
7730 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 5. or some other word |
|
7731 | 7731 | ) (_*) \b # 6. With trailing underscore |
7732 | 7732 | ~ux', |
7733 | 7733 | /** |
@@ -7735,7 +7735,7 @@ discard block |
||
7735 | 7735 | * |
7736 | 7736 | * @return string |
7737 | 7737 | */ |
7738 | - static function (array $matches) use ($encoding): string { |
|
7738 | + static function(array $matches) use ($encoding): string { |
|
7739 | 7739 | // preserve leading underscore |
7740 | 7740 | $str = $matches[1]; |
7741 | 7741 | if ($matches[2]) { |
@@ -7760,26 +7760,26 @@ discard block |
||
7760 | 7760 | ); |
7761 | 7761 | |
7762 | 7762 | // Exceptions for small words: capitalize at start of title... |
7763 | - $str = (string) \preg_replace_callback( |
|
7763 | + $str = (string)\preg_replace_callback( |
|
7764 | 7764 | '~( \A [[:punct:]]* # start of title... |
7765 | 7765 | | [:.;?!][ ]+ # or of subsentence... |
7766 | 7766 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
7767 | - ( ' . $smallWordsRx . ' ) \b # ...followed by small word |
|
7767 | + ( ' . $smallWordsRx.' ) \b # ...followed by small word |
|
7768 | 7768 | ~uxi', |
7769 | 7769 | /** |
7770 | 7770 | * @param string[] $matches |
7771 | 7771 | * |
7772 | 7772 | * @return string |
7773 | 7773 | */ |
7774 | - static function (array $matches) use ($encoding): string { |
|
7775 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7774 | + static function(array $matches) use ($encoding): string { |
|
7775 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7776 | 7776 | }, |
7777 | 7777 | $str |
7778 | 7778 | ); |
7779 | 7779 | |
7780 | 7780 | // ...and end of title |
7781 | - $str = (string) \preg_replace_callback( |
|
7782 | - '~\b ( ' . $smallWordsRx . ' ) # small word... |
|
7781 | + $str = (string)\preg_replace_callback( |
|
7782 | + '~\b ( '.$smallWordsRx.' ) # small word... |
|
7783 | 7783 | (?= [[:punct:]]* \Z # ...at the end of the title... |
7784 | 7784 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
7785 | 7785 | ~uxi', |
@@ -7788,7 +7788,7 @@ discard block |
||
7788 | 7788 | * |
7789 | 7789 | * @return string |
7790 | 7790 | */ |
7791 | - static function (array $matches) use ($encoding): string { |
|
7791 | + static function(array $matches) use ($encoding): string { |
|
7792 | 7792 | return static::str_upper_first($matches[1], $encoding); |
7793 | 7793 | }, |
7794 | 7794 | $str |
@@ -7796,10 +7796,10 @@ discard block |
||
7796 | 7796 | |
7797 | 7797 | // Exceptions for small words in hyphenated compound words. |
7798 | 7798 | // e.g. "in-flight" -> In-Flight |
7799 | - $str = (string) \preg_replace_callback( |
|
7799 | + $str = (string)\preg_replace_callback( |
|
7800 | 7800 | '~\b |
7801 | 7801 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
7802 | - ( ' . $smallWordsRx . ' ) |
|
7802 | + ( ' . $smallWordsRx.' ) |
|
7803 | 7803 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
7804 | 7804 | ~uxi', |
7805 | 7805 | /** |
@@ -7807,18 +7807,18 @@ discard block |
||
7807 | 7807 | * |
7808 | 7808 | * @return string |
7809 | 7809 | */ |
7810 | - static function (array $matches) use ($encoding): string { |
|
7810 | + static function(array $matches) use ($encoding): string { |
|
7811 | 7811 | return static::str_upper_first($matches[1], $encoding); |
7812 | 7812 | }, |
7813 | 7813 | $str |
7814 | 7814 | ); |
7815 | 7815 | |
7816 | 7816 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
7817 | - $str = (string) \preg_replace_callback( |
|
7817 | + $str = (string)\preg_replace_callback( |
|
7818 | 7818 | '~\b |
7819 | 7819 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
7820 | 7820 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
7821 | - ( ' . $smallWordsRx . ' ) # ...followed by small word |
|
7821 | + ( ' . $smallWordsRx.' ) # ...followed by small word |
|
7822 | 7822 | (?! - ) # Negative lookahead for another - |
7823 | 7823 | ~uxi', |
7824 | 7824 | /** |
@@ -7826,8 +7826,8 @@ discard block |
||
7826 | 7826 | * |
7827 | 7827 | * @return string |
7828 | 7828 | */ |
7829 | - static function (array $matches) use ($encoding): string { |
|
7830 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7829 | + static function(array $matches) use ($encoding): string { |
|
7830 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7831 | 7831 | }, |
7832 | 7832 | $str |
7833 | 7833 | ); |
@@ -7930,7 +7930,7 @@ discard block |
||
7930 | 7930 | ); |
7931 | 7931 | |
7932 | 7932 | foreach ($tmpReturn as &$item) { |
7933 | - $item = (string) $item; |
|
7933 | + $item = (string)$item; |
|
7934 | 7934 | } |
7935 | 7935 | |
7936 | 7936 | return $tmpReturn; |
@@ -7975,39 +7975,39 @@ discard block |
||
7975 | 7975 | } |
7976 | 7976 | |
7977 | 7977 | if ($encoding === 'UTF-8') { |
7978 | - if ($length >= (int) \mb_strlen($str)) { |
|
7978 | + if ($length >= (int)\mb_strlen($str)) { |
|
7979 | 7979 | return $str; |
7980 | 7980 | } |
7981 | 7981 | |
7982 | 7982 | if ($substring !== '') { |
7983 | - $length -= (int) \mb_strlen($substring); |
|
7983 | + $length -= (int)\mb_strlen($substring); |
|
7984 | 7984 | |
7985 | 7985 | /** @noinspection UnnecessaryCastingInspection */ |
7986 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
7986 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
7987 | 7987 | } |
7988 | 7988 | |
7989 | 7989 | /** @noinspection UnnecessaryCastingInspection */ |
7990 | - return (string) \mb_substr($str, 0, $length); |
|
7990 | + return (string)\mb_substr($str, 0, $length); |
|
7991 | 7991 | } |
7992 | 7992 | |
7993 | 7993 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7994 | 7994 | |
7995 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
7995 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
7996 | 7996 | return $str; |
7997 | 7997 | } |
7998 | 7998 | |
7999 | 7999 | if ($substring !== '') { |
8000 | - $length -= (int) self::strlen($substring, $encoding); |
|
8000 | + $length -= (int)self::strlen($substring, $encoding); |
|
8001 | 8001 | } |
8002 | 8002 | |
8003 | 8003 | return ( |
8004 | - (string) self::substr( |
|
8004 | + (string)self::substr( |
|
8005 | 8005 | $str, |
8006 | 8006 | 0, |
8007 | 8007 | $length, |
8008 | 8008 | $encoding |
8009 | 8009 | ) |
8010 | - ) . $substring; |
|
8010 | + ).$substring; |
|
8011 | 8011 | } |
8012 | 8012 | |
8013 | 8013 | /** |
@@ -8037,12 +8037,12 @@ discard block |
||
8037 | 8037 | } |
8038 | 8038 | |
8039 | 8039 | if ($encoding === 'UTF-8') { |
8040 | - if ($length >= (int) \mb_strlen($str)) { |
|
8040 | + if ($length >= (int)\mb_strlen($str)) { |
|
8041 | 8041 | return $str; |
8042 | 8042 | } |
8043 | 8043 | |
8044 | 8044 | // need to further trim the string so we can append the substring |
8045 | - $length -= (int) \mb_strlen($substring); |
|
8045 | + $length -= (int)\mb_strlen($substring); |
|
8046 | 8046 | if ($length <= 0) { |
8047 | 8047 | return $substring; |
8048 | 8048 | } |
@@ -8064,18 +8064,18 @@ discard block |
||
8064 | 8064 | || |
8065 | 8065 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8066 | 8066 | ) { |
8067 | - $truncated = (string) \mb_substr($truncated, 0, (int) $lastPos); |
|
8067 | + $truncated = (string)\mb_substr($truncated, 0, (int)$lastPos); |
|
8068 | 8068 | } |
8069 | 8069 | } |
8070 | 8070 | } else { |
8071 | 8071 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8072 | 8072 | |
8073 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8073 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8074 | 8074 | return $str; |
8075 | 8075 | } |
8076 | 8076 | |
8077 | 8077 | // need to further trim the string so we can append the substring |
8078 | - $length -= (int) self::strlen($substring, $encoding); |
|
8078 | + $length -= (int)self::strlen($substring, $encoding); |
|
8079 | 8079 | if ($length <= 0) { |
8080 | 8080 | return $substring; |
8081 | 8081 | } |
@@ -8097,12 +8097,12 @@ discard block |
||
8097 | 8097 | || |
8098 | 8098 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8099 | 8099 | ) { |
8100 | - $truncated = (string) self::substr($truncated, 0, (int) $lastPos, $encoding); |
|
8100 | + $truncated = (string)self::substr($truncated, 0, (int)$lastPos, $encoding); |
|
8101 | 8101 | } |
8102 | 8102 | } |
8103 | 8103 | } |
8104 | 8104 | |
8105 | - return $truncated . $substring; |
|
8105 | + return $truncated.$substring; |
|
8106 | 8106 | } |
8107 | 8107 | |
8108 | 8108 | /** |
@@ -8192,13 +8192,13 @@ discard block |
||
8192 | 8192 | } |
8193 | 8193 | } elseif ($format === 2) { |
8194 | 8194 | $numberOfWords = []; |
8195 | - $offset = (int) self::strlen($strParts[0]); |
|
8195 | + $offset = (int)self::strlen($strParts[0]); |
|
8196 | 8196 | for ($i = 1; $i < $len; $i += 2) { |
8197 | 8197 | $numberOfWords[$offset] = $strParts[$i]; |
8198 | - $offset += (int) self::strlen($strParts[$i]) + (int) self::strlen($strParts[$i + 1]); |
|
8198 | + $offset += (int)self::strlen($strParts[$i]) + (int)self::strlen($strParts[$i + 1]); |
|
8199 | 8199 | } |
8200 | 8200 | } else { |
8201 | - $numberOfWords = (int) (($len - 1) / 2); |
|
8201 | + $numberOfWords = (int)(($len - 1) / 2); |
|
8202 | 8202 | } |
8203 | 8203 | |
8204 | 8204 | return $numberOfWords; |
@@ -8262,7 +8262,7 @@ discard block |
||
8262 | 8262 | */ |
8263 | 8263 | public static function strcmp(string $str1, string $str2): int |
8264 | 8264 | { |
8265 | - return $str1 . '' === $str2 . '' ? 0 : \strcmp( |
|
8265 | + return $str1.'' === $str2.'' ? 0 : \strcmp( |
|
8266 | 8266 | \Normalizer::normalize($str1, \Normalizer::NFD), |
8267 | 8267 | \Normalizer::normalize($str2, \Normalizer::NFD) |
8268 | 8268 | ); |
@@ -8291,21 +8291,21 @@ discard block |
||
8291 | 8291 | } |
8292 | 8292 | |
8293 | 8293 | if ($charList === '') { |
8294 | - return (int) self::strlen($str, $encoding); |
|
8294 | + return (int)self::strlen($str, $encoding); |
|
8295 | 8295 | } |
8296 | 8296 | |
8297 | 8297 | if ($offset !== null || $length !== null) { |
8298 | 8298 | if ($encoding === 'UTF-8') { |
8299 | 8299 | if ($length === null) { |
8300 | 8300 | /** @noinspection UnnecessaryCastingInspection */ |
8301 | - $strTmp = \mb_substr($str, (int) $offset); |
|
8301 | + $strTmp = \mb_substr($str, (int)$offset); |
|
8302 | 8302 | } else { |
8303 | 8303 | /** @noinspection UnnecessaryCastingInspection */ |
8304 | - $strTmp = \mb_substr($str, (int) $offset, $length); |
|
8304 | + $strTmp = \mb_substr($str, (int)$offset, $length); |
|
8305 | 8305 | } |
8306 | 8306 | } else { |
8307 | 8307 | /** @noinspection UnnecessaryCastingInspection */ |
8308 | - $strTmp = self::substr($str, (int) $offset, $length, $encoding); |
|
8308 | + $strTmp = self::substr($str, (int)$offset, $length, $encoding); |
|
8309 | 8309 | } |
8310 | 8310 | if ($strTmp === false) { |
8311 | 8311 | return 0; |
@@ -8318,7 +8318,7 @@ discard block |
||
8318 | 8318 | } |
8319 | 8319 | |
8320 | 8320 | $matches = []; |
8321 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $matches)) { |
|
8321 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $matches)) { |
|
8322 | 8322 | $return = self::strlen($matches[1], $encoding); |
8323 | 8323 | if ($return === false) { |
8324 | 8324 | return 0; |
@@ -8327,7 +8327,7 @@ discard block |
||
8327 | 8327 | return $return; |
8328 | 8328 | } |
8329 | 8329 | |
8330 | - return (int) self::strlen($str, $encoding); |
|
8330 | + return (int)self::strlen($str, $encoding); |
|
8331 | 8331 | } |
8332 | 8332 | |
8333 | 8333 | /** |
@@ -8449,7 +8449,7 @@ discard block |
||
8449 | 8449 | return ''; |
8450 | 8450 | } |
8451 | 8451 | |
8452 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
8452 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
8453 | 8453 | } |
8454 | 8454 | |
8455 | 8455 | /** |
@@ -8514,7 +8514,7 @@ discard block |
||
8514 | 8514 | // fallback for ascii only |
8515 | 8515 | // |
8516 | 8516 | |
8517 | - if (self::is_ascii($haystack . $needle)) { |
|
8517 | + if (self::is_ascii($haystack.$needle)) { |
|
8518 | 8518 | return \stripos($haystack, $needle, $offset); |
8519 | 8519 | } |
8520 | 8520 | |
@@ -8581,7 +8581,7 @@ discard block |
||
8581 | 8581 | && |
8582 | 8582 | self::$SUPPORT['mbstring'] === false |
8583 | 8583 | ) { |
8584 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8584 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8585 | 8585 | } |
8586 | 8586 | |
8587 | 8587 | if ( |
@@ -8595,11 +8595,11 @@ discard block |
||
8595 | 8595 | } |
8596 | 8596 | } |
8597 | 8597 | |
8598 | - if (self::is_ascii($needle . $haystack)) { |
|
8598 | + if (self::is_ascii($needle.$haystack)) { |
|
8599 | 8599 | return \stristr($haystack, $needle, $before_needle); |
8600 | 8600 | } |
8601 | 8601 | |
8602 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
8602 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
8603 | 8603 | |
8604 | 8604 | if (!isset($match[1])) { |
8605 | 8605 | return false; |
@@ -8609,7 +8609,7 @@ discard block |
||
8609 | 8609 | return $match[1]; |
8610 | 8610 | } |
8611 | 8611 | |
8612 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
8612 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
8613 | 8613 | } |
8614 | 8614 | |
8615 | 8615 | /** |
@@ -8676,7 +8676,7 @@ discard block |
||
8676 | 8676 | && |
8677 | 8677 | self::$SUPPORT['iconv'] === false |
8678 | 8678 | ) { |
8679 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8679 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8680 | 8680 | } |
8681 | 8681 | |
8682 | 8682 | // |
@@ -8787,7 +8787,7 @@ discard block |
||
8787 | 8787 | */ |
8788 | 8788 | public static function strnatcmp(string $str1, string $str2): int |
8789 | 8789 | { |
8790 | - return $str1 . '' === $str2 . '' ? 0 : \strnatcmp((string) self::strtonatfold($str1), (string) self::strtonatfold($str2)); |
|
8790 | + return $str1.'' === $str2.'' ? 0 : \strnatcmp((string)self::strtonatfold($str1), (string)self::strtonatfold($str2)); |
|
8791 | 8791 | } |
8792 | 8792 | |
8793 | 8793 | /** |
@@ -8844,11 +8844,11 @@ discard block |
||
8844 | 8844 | } |
8845 | 8845 | |
8846 | 8846 | if ($encoding === 'UTF-8') { |
8847 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
8848 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
8847 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
8848 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
8849 | 8849 | } else { |
8850 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
8851 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
8850 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
8851 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
8852 | 8852 | } |
8853 | 8853 | |
8854 | 8854 | return self::strcmp($str1, $str2); |
@@ -8870,8 +8870,8 @@ discard block |
||
8870 | 8870 | return false; |
8871 | 8871 | } |
8872 | 8872 | |
8873 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
8874 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
8873 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
8874 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
8875 | 8875 | } |
8876 | 8876 | |
8877 | 8877 | return false; |
@@ -8904,10 +8904,10 @@ discard block |
||
8904 | 8904 | } |
8905 | 8905 | |
8906 | 8906 | // iconv and mbstring do not support integer $needle |
8907 | - if ((int) $needle === $needle) { |
|
8908 | - $needle = (string) self::chr($needle); |
|
8907 | + if ((int)$needle === $needle) { |
|
8908 | + $needle = (string)self::chr($needle); |
|
8909 | 8909 | } |
8910 | - $needle = (string) $needle; |
|
8910 | + $needle = (string)$needle; |
|
8911 | 8911 | |
8912 | 8912 | if ($needle === '') { |
8913 | 8913 | return false; |
@@ -8954,7 +8954,7 @@ discard block |
||
8954 | 8954 | && |
8955 | 8955 | self::$SUPPORT['mbstring'] === false |
8956 | 8956 | ) { |
8957 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8957 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8958 | 8958 | } |
8959 | 8959 | |
8960 | 8960 | // |
@@ -8995,7 +8995,7 @@ discard block |
||
8995 | 8995 | // fallback for ascii only |
8996 | 8996 | // |
8997 | 8997 | |
8998 | - if (self::is_ascii($haystack . $needle)) { |
|
8998 | + if (self::is_ascii($haystack.$needle)) { |
|
8999 | 8999 | return \strpos($haystack, $needle, $offset); |
9000 | 9000 | } |
9001 | 9001 | |
@@ -9007,7 +9007,7 @@ discard block |
||
9007 | 9007 | if ($haystackTmp === false) { |
9008 | 9008 | $haystackTmp = ''; |
9009 | 9009 | } |
9010 | - $haystack = (string) $haystackTmp; |
|
9010 | + $haystack = (string)$haystackTmp; |
|
9011 | 9011 | |
9012 | 9012 | if ($offset < 0) { |
9013 | 9013 | $offset = 0; |
@@ -9019,7 +9019,7 @@ discard block |
||
9019 | 9019 | } |
9020 | 9020 | |
9021 | 9021 | if ($pos) { |
9022 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9022 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9023 | 9023 | } |
9024 | 9024 | |
9025 | 9025 | return $offset + 0; |
@@ -9130,7 +9130,7 @@ discard block |
||
9130 | 9130 | && |
9131 | 9131 | self::$SUPPORT['mbstring'] === false |
9132 | 9132 | ) { |
9133 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9133 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9134 | 9134 | } |
9135 | 9135 | |
9136 | 9136 | // |
@@ -9142,7 +9142,7 @@ discard block |
||
9142 | 9142 | if ($needleTmp === false) { |
9143 | 9143 | return false; |
9144 | 9144 | } |
9145 | - $needle = (string) $needleTmp; |
|
9145 | + $needle = (string)$needleTmp; |
|
9146 | 9146 | |
9147 | 9147 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
9148 | 9148 | if ($pos === false) { |
@@ -9164,7 +9164,7 @@ discard block |
||
9164 | 9164 | if ($needleTmp === false) { |
9165 | 9165 | return false; |
9166 | 9166 | } |
9167 | - $needle = (string) $needleTmp; |
|
9167 | + $needle = (string)$needleTmp; |
|
9168 | 9168 | |
9169 | 9169 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
9170 | 9170 | if ($pos === false) { |
@@ -9200,7 +9200,7 @@ discard block |
||
9200 | 9200 | if ($encoding === 'UTF-8') { |
9201 | 9201 | if (self::$SUPPORT['intl'] === true) { |
9202 | 9202 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
9203 | - $i = (int) \grapheme_strlen($str); |
|
9203 | + $i = (int)\grapheme_strlen($str); |
|
9204 | 9204 | while ($i--) { |
9205 | 9205 | $reversedTmp = \grapheme_substr($str, $i, 1); |
9206 | 9206 | if ($reversedTmp !== false) { |
@@ -9208,7 +9208,7 @@ discard block |
||
9208 | 9208 | } |
9209 | 9209 | } |
9210 | 9210 | } else { |
9211 | - $i = (int) \mb_strlen($str); |
|
9211 | + $i = (int)\mb_strlen($str); |
|
9212 | 9212 | while ($i--) { |
9213 | 9213 | $reversedTmp = \mb_substr($str, $i, 1); |
9214 | 9214 | if ($reversedTmp !== false) { |
@@ -9219,7 +9219,7 @@ discard block |
||
9219 | 9219 | } else { |
9220 | 9220 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9221 | 9221 | |
9222 | - $i = (int) self::strlen($str, $encoding); |
|
9222 | + $i = (int)self::strlen($str, $encoding); |
|
9223 | 9223 | while ($i--) { |
9224 | 9224 | $reversedTmp = self::substr($str, $i, 1, $encoding); |
9225 | 9225 | if ($reversedTmp !== false) { |
@@ -9293,7 +9293,7 @@ discard block |
||
9293 | 9293 | if ($needleTmp === false) { |
9294 | 9294 | return false; |
9295 | 9295 | } |
9296 | - $needle = (string) $needleTmp; |
|
9296 | + $needle = (string)$needleTmp; |
|
9297 | 9297 | |
9298 | 9298 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
9299 | 9299 | if ($pos === false) { |
@@ -9332,10 +9332,10 @@ discard block |
||
9332 | 9332 | } |
9333 | 9333 | |
9334 | 9334 | // iconv and mbstring do not support integer $needle |
9335 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9336 | - $needle = (string) self::chr($needle); |
|
9335 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9336 | + $needle = (string)self::chr($needle); |
|
9337 | 9337 | } |
9338 | - $needle = (string) $needle; |
|
9338 | + $needle = (string)$needle; |
|
9339 | 9339 | |
9340 | 9340 | if ($needle === '') { |
9341 | 9341 | return false; |
@@ -9380,7 +9380,7 @@ discard block |
||
9380 | 9380 | && |
9381 | 9381 | self::$SUPPORT['mbstring'] === false |
9382 | 9382 | ) { |
9383 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9383 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9384 | 9384 | } |
9385 | 9385 | |
9386 | 9386 | // |
@@ -9404,7 +9404,7 @@ discard block |
||
9404 | 9404 | // fallback for ascii only |
9405 | 9405 | // |
9406 | 9406 | |
9407 | - if (self::is_ascii($haystack . $needle)) { |
|
9407 | + if (self::is_ascii($haystack.$needle)) { |
|
9408 | 9408 | return \strripos($haystack, $needle, $offset); |
9409 | 9409 | } |
9410 | 9410 | |
@@ -9480,10 +9480,10 @@ discard block |
||
9480 | 9480 | } |
9481 | 9481 | |
9482 | 9482 | // iconv and mbstring do not support integer $needle |
9483 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9484 | - $needle = (string) self::chr($needle); |
|
9483 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9484 | + $needle = (string)self::chr($needle); |
|
9485 | 9485 | } |
9486 | - $needle = (string) $needle; |
|
9486 | + $needle = (string)$needle; |
|
9487 | 9487 | |
9488 | 9488 | if ($needle === '' || $haystack === '') { |
9489 | 9489 | return false; |
@@ -9528,7 +9528,7 @@ discard block |
||
9528 | 9528 | && |
9529 | 9529 | self::$SUPPORT['mbstring'] === false |
9530 | 9530 | ) { |
9531 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9531 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9532 | 9532 | } |
9533 | 9533 | |
9534 | 9534 | // |
@@ -9552,7 +9552,7 @@ discard block |
||
9552 | 9552 | // fallback for ascii only |
9553 | 9553 | // |
9554 | 9554 | |
9555 | - if (self::is_ascii($haystack . $needle)) { |
|
9555 | + if (self::is_ascii($haystack.$needle)) { |
|
9556 | 9556 | return \strrpos($haystack, $needle, $offset); |
9557 | 9557 | } |
9558 | 9558 | |
@@ -9572,7 +9572,7 @@ discard block |
||
9572 | 9572 | if ($haystackTmp === false) { |
9573 | 9573 | $haystackTmp = ''; |
9574 | 9574 | } |
9575 | - $haystack = (string) $haystackTmp; |
|
9575 | + $haystack = (string)$haystackTmp; |
|
9576 | 9576 | } |
9577 | 9577 | |
9578 | 9578 | $pos = \strrpos($haystack, $needle); |
@@ -9585,7 +9585,7 @@ discard block |
||
9585 | 9585 | return false; |
9586 | 9586 | } |
9587 | 9587 | |
9588 | - return $offset + (int) self::strlen($strTmp); |
|
9588 | + return $offset + (int)self::strlen($strTmp); |
|
9589 | 9589 | } |
9590 | 9590 | |
9591 | 9591 | /** |
@@ -9645,12 +9645,12 @@ discard block |
||
9645 | 9645 | if ($offset || $length !== null) { |
9646 | 9646 | if ($encoding === 'UTF-8') { |
9647 | 9647 | if ($length === null) { |
9648 | - $str = (string) \mb_substr($str, $offset); |
|
9648 | + $str = (string)\mb_substr($str, $offset); |
|
9649 | 9649 | } else { |
9650 | - $str = (string) \mb_substr($str, $offset, $length); |
|
9650 | + $str = (string)\mb_substr($str, $offset, $length); |
|
9651 | 9651 | } |
9652 | 9652 | } else { |
9653 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
9653 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
9654 | 9654 | } |
9655 | 9655 | } |
9656 | 9656 | |
@@ -9660,7 +9660,7 @@ discard block |
||
9660 | 9660 | |
9661 | 9661 | $matches = []; |
9662 | 9662 | |
9663 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
9663 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
9664 | 9664 | } |
9665 | 9665 | |
9666 | 9666 | /** |
@@ -9729,7 +9729,7 @@ discard block |
||
9729 | 9729 | && |
9730 | 9730 | self::$SUPPORT['mbstring'] === false |
9731 | 9731 | ) { |
9732 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9732 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9733 | 9733 | } |
9734 | 9734 | |
9735 | 9735 | // |
@@ -9751,7 +9751,7 @@ discard block |
||
9751 | 9751 | // fallback for ascii only |
9752 | 9752 | // |
9753 | 9753 | |
9754 | - if (self::is_ascii($haystack . $needle)) { |
|
9754 | + if (self::is_ascii($haystack.$needle)) { |
|
9755 | 9755 | return \strstr($haystack, $needle, $before_needle); |
9756 | 9756 | } |
9757 | 9757 | |
@@ -9759,7 +9759,7 @@ discard block |
||
9759 | 9759 | // fallback via vanilla php |
9760 | 9760 | // |
9761 | 9761 | |
9762 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
9762 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
9763 | 9763 | |
9764 | 9764 | if (!isset($match[1])) { |
9765 | 9765 | return false; |
@@ -9769,7 +9769,7 @@ discard block |
||
9769 | 9769 | return $match[1]; |
9770 | 9770 | } |
9771 | 9771 | |
9772 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
9772 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
9773 | 9773 | } |
9774 | 9774 | |
9775 | 9775 | /** |
@@ -9883,7 +9883,7 @@ discard block |
||
9883 | 9883 | bool $tryToKeepStringLength = false |
9884 | 9884 | ): string { |
9885 | 9885 | // init |
9886 | - $str = (string) $str; |
|
9886 | + $str = (string)$str; |
|
9887 | 9887 | |
9888 | 9888 | if ($str === '') { |
9889 | 9889 | return ''; |
@@ -9908,19 +9908,19 @@ discard block |
||
9908 | 9908 | |
9909 | 9909 | if ($lang !== null) { |
9910 | 9910 | if (self::$SUPPORT['intl'] === true) { |
9911 | - $langCode = $lang . '-Lower'; |
|
9911 | + $langCode = $lang.'-Lower'; |
|
9912 | 9912 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
9913 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, \E_USER_WARNING); |
|
9913 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, \E_USER_WARNING); |
|
9914 | 9914 | |
9915 | 9915 | $langCode = 'Any-Lower'; |
9916 | 9916 | } |
9917 | 9917 | |
9918 | 9918 | /** @noinspection PhpComposerExtensionStubsInspection */ |
9919 | 9919 | /** @noinspection UnnecessaryCastingInspection */ |
9920 | - return (string) \transliterator_transliterate($langCode, $str); |
|
9920 | + return (string)\transliterator_transliterate($langCode, $str); |
|
9921 | 9921 | } |
9922 | 9922 | |
9923 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
9923 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
9924 | 9924 | } |
9925 | 9925 | |
9926 | 9926 | // always fallback via symfony polyfill |
@@ -9949,7 +9949,7 @@ discard block |
||
9949 | 9949 | bool $tryToKeepStringLength = false |
9950 | 9950 | ): string { |
9951 | 9951 | // init |
9952 | - $str = (string) $str; |
|
9952 | + $str = (string)$str; |
|
9953 | 9953 | |
9954 | 9954 | if ($str === '') { |
9955 | 9955 | return ''; |
@@ -9974,19 +9974,19 @@ discard block |
||
9974 | 9974 | |
9975 | 9975 | if ($lang !== null) { |
9976 | 9976 | if (self::$SUPPORT['intl'] === true) { |
9977 | - $langCode = $lang . '-Upper'; |
|
9977 | + $langCode = $lang.'-Upper'; |
|
9978 | 9978 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
9979 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
9979 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
9980 | 9980 | |
9981 | 9981 | $langCode = 'Any-Upper'; |
9982 | 9982 | } |
9983 | 9983 | |
9984 | 9984 | /** @noinspection PhpComposerExtensionStubsInspection */ |
9985 | 9985 | /** @noinspection UnnecessaryCastingInspection */ |
9986 | - return (string) \transliterator_transliterate($langCode, $str); |
|
9986 | + return (string)\transliterator_transliterate($langCode, $str); |
|
9987 | 9987 | } |
9988 | 9988 | |
9989 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
9989 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
9990 | 9990 | } |
9991 | 9991 | |
9992 | 9992 | // always fallback via symfony polyfill |
@@ -10030,7 +10030,7 @@ discard block |
||
10030 | 10030 | |
10031 | 10031 | $from = \array_combine($from, $to); |
10032 | 10032 | if ($from === false) { |
10033 | - 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) . ')'); |
|
10033 | + 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).')'); |
|
10034 | 10034 | } |
10035 | 10035 | } |
10036 | 10036 | |
@@ -10087,9 +10087,9 @@ discard block |
||
10087 | 10087 | } |
10088 | 10088 | |
10089 | 10089 | $wide = 0; |
10090 | - $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); |
|
10090 | + $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); |
|
10091 | 10091 | |
10092 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
10092 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
10093 | 10093 | } |
10094 | 10094 | |
10095 | 10095 | /** |
@@ -10189,9 +10189,9 @@ discard block |
||
10189 | 10189 | } |
10190 | 10190 | |
10191 | 10191 | if ($length === null) { |
10192 | - $length = (int) $str_length; |
|
10192 | + $length = (int)$str_length; |
|
10193 | 10193 | } else { |
10194 | - $length = (int) $length; |
|
10194 | + $length = (int)$length; |
|
10195 | 10195 | } |
10196 | 10196 | |
10197 | 10197 | if ( |
@@ -10199,7 +10199,7 @@ discard block |
||
10199 | 10199 | && |
10200 | 10200 | self::$SUPPORT['mbstring'] === false |
10201 | 10201 | ) { |
10202 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10202 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10203 | 10203 | } |
10204 | 10204 | |
10205 | 10205 | // |
@@ -10287,16 +10287,16 @@ discard block |
||
10287 | 10287 | ) { |
10288 | 10288 | if ($encoding === 'UTF-8') { |
10289 | 10289 | if ($length === null) { |
10290 | - $str1 = (string) \mb_substr($str1, $offset); |
|
10290 | + $str1 = (string)\mb_substr($str1, $offset); |
|
10291 | 10291 | } else { |
10292 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
10292 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
10293 | 10293 | } |
10294 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
10294 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
10295 | 10295 | } else { |
10296 | 10296 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10297 | 10297 | |
10298 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
10299 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
10298 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
10299 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
10300 | 10300 | } |
10301 | 10301 | } |
10302 | 10302 | |
@@ -10358,13 +10358,13 @@ discard block |
||
10358 | 10358 | if ($lengthTmp === false) { |
10359 | 10359 | return false; |
10360 | 10360 | } |
10361 | - $length = (int) $lengthTmp; |
|
10361 | + $length = (int)$lengthTmp; |
|
10362 | 10362 | } |
10363 | 10363 | |
10364 | 10364 | if ($encoding === 'UTF-8') { |
10365 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
10365 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
10366 | 10366 | } else { |
10367 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
10367 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
10368 | 10368 | } |
10369 | 10369 | } |
10370 | 10370 | |
@@ -10373,7 +10373,7 @@ discard block |
||
10373 | 10373 | && |
10374 | 10374 | self::$SUPPORT['mbstring'] === false |
10375 | 10375 | ) { |
10376 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10376 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10377 | 10377 | } |
10378 | 10378 | |
10379 | 10379 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10384,7 +10384,7 @@ discard block |
||
10384 | 10384 | return \mb_substr_count($haystack, $needle, $encoding); |
10385 | 10385 | } |
10386 | 10386 | |
10387 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10387 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10388 | 10388 | |
10389 | 10389 | return \count($matches); |
10390 | 10390 | } |
@@ -10431,7 +10431,7 @@ discard block |
||
10431 | 10431 | if ($lengthTmp === false) { |
10432 | 10432 | return false; |
10433 | 10433 | } |
10434 | - $length = (int) $lengthTmp; |
|
10434 | + $length = (int)$lengthTmp; |
|
10435 | 10435 | } |
10436 | 10436 | |
10437 | 10437 | if ( |
@@ -10452,7 +10452,7 @@ discard block |
||
10452 | 10452 | if ($haystackTmp === false) { |
10453 | 10453 | $haystackTmp = ''; |
10454 | 10454 | } |
10455 | - $haystack = (string) $haystackTmp; |
|
10455 | + $haystack = (string)$haystackTmp; |
|
10456 | 10456 | } |
10457 | 10457 | |
10458 | 10458 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10491,10 +10491,10 @@ discard block |
||
10491 | 10491 | |
10492 | 10492 | if ($encoding === 'UTF-8') { |
10493 | 10493 | if ($caseSensitive) { |
10494 | - return (int) \mb_substr_count($str, $substring); |
|
10494 | + return (int)\mb_substr_count($str, $substring); |
|
10495 | 10495 | } |
10496 | 10496 | |
10497 | - return (int) \mb_substr_count( |
|
10497 | + return (int)\mb_substr_count( |
|
10498 | 10498 | \mb_strtoupper($str), |
10499 | 10499 | \mb_strtoupper($substring) |
10500 | 10500 | |
@@ -10504,10 +10504,10 @@ discard block |
||
10504 | 10504 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10505 | 10505 | |
10506 | 10506 | if ($caseSensitive) { |
10507 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
10507 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
10508 | 10508 | } |
10509 | 10509 | |
10510 | - return (int) \mb_substr_count( |
|
10510 | + return (int)\mb_substr_count( |
|
10511 | 10511 | self::strtocasefold($str, true, false, $encoding, null, false), |
10512 | 10512 | self::strtocasefold($substring, true, false, $encoding, null, false), |
10513 | 10513 | $encoding |
@@ -10533,7 +10533,7 @@ discard block |
||
10533 | 10533 | } |
10534 | 10534 | |
10535 | 10535 | if (self::str_istarts_with($haystack, $needle) === true) { |
10536 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10536 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10537 | 10537 | } |
10538 | 10538 | |
10539 | 10539 | return $haystack; |
@@ -10590,7 +10590,7 @@ discard block |
||
10590 | 10590 | } |
10591 | 10591 | |
10592 | 10592 | if (self::str_iends_with($haystack, $needle) === true) { |
10593 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
10593 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
10594 | 10594 | } |
10595 | 10595 | |
10596 | 10596 | return $haystack; |
@@ -10615,7 +10615,7 @@ discard block |
||
10615 | 10615 | } |
10616 | 10616 | |
10617 | 10617 | if (self::str_starts_with($haystack, $needle) === true) { |
10618 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10618 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10619 | 10619 | } |
10620 | 10620 | |
10621 | 10621 | return $haystack; |
@@ -10667,7 +10667,7 @@ discard block |
||
10667 | 10667 | if (\is_array($offset) === true) { |
10668 | 10668 | $offset = \array_slice($offset, 0, $num); |
10669 | 10669 | foreach ($offset as &$valueTmp) { |
10670 | - $valueTmp = (int) $valueTmp === $valueTmp ? $valueTmp : 0; |
|
10670 | + $valueTmp = (int)$valueTmp === $valueTmp ? $valueTmp : 0; |
|
10671 | 10671 | } |
10672 | 10672 | unset($valueTmp); |
10673 | 10673 | } else { |
@@ -10680,7 +10680,7 @@ discard block |
||
10680 | 10680 | } elseif (\is_array($length) === true) { |
10681 | 10681 | $length = \array_slice($length, 0, $num); |
10682 | 10682 | foreach ($length as &$valueTmpV2) { |
10683 | - $valueTmpV2 = (int) $valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10683 | + $valueTmpV2 = (int)$valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10684 | 10684 | } |
10685 | 10685 | unset($valueTmpV2); |
10686 | 10686 | } else { |
@@ -10700,8 +10700,8 @@ discard block |
||
10700 | 10700 | } |
10701 | 10701 | |
10702 | 10702 | // init |
10703 | - $str = (string) $str; |
|
10704 | - $replacement = (string) $replacement; |
|
10703 | + $str = (string)$str; |
|
10704 | + $replacement = (string)$replacement; |
|
10705 | 10705 | |
10706 | 10706 | if (\is_array($length) === true) { |
10707 | 10707 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -10716,16 +10716,16 @@ discard block |
||
10716 | 10716 | } |
10717 | 10717 | |
10718 | 10718 | if (self::$SUPPORT['mbstring'] === true) { |
10719 | - $string_length = (int) self::strlen($str, $encoding); |
|
10719 | + $string_length = (int)self::strlen($str, $encoding); |
|
10720 | 10720 | |
10721 | 10721 | if ($offset < 0) { |
10722 | - $offset = (int) \max(0, $string_length + $offset); |
|
10722 | + $offset = (int)\max(0, $string_length + $offset); |
|
10723 | 10723 | } elseif ($offset > $string_length) { |
10724 | 10724 | $offset = $string_length; |
10725 | 10725 | } |
10726 | 10726 | |
10727 | 10727 | if ($length !== null && $length < 0) { |
10728 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
10728 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
10729 | 10729 | } elseif ($length === null || $length > $string_length) { |
10730 | 10730 | $length = $string_length; |
10731 | 10731 | } |
@@ -10736,9 +10736,9 @@ discard block |
||
10736 | 10736 | } |
10737 | 10737 | |
10738 | 10738 | /** @noinspection AdditionOperationOnArraysInspection */ |
10739 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
10740 | - $replacement . |
|
10741 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10739 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
10740 | + $replacement. |
|
10741 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10742 | 10742 | } |
10743 | 10743 | |
10744 | 10744 | // |
@@ -10747,8 +10747,7 @@ discard block |
||
10747 | 10747 | |
10748 | 10748 | if (self::is_ascii($str)) { |
10749 | 10749 | return ($length === null) ? |
10750 | - \substr_replace($str, $replacement, $offset) : |
|
10751 | - \substr_replace($str, $replacement, $offset, $length); |
|
10750 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
10752 | 10751 | } |
10753 | 10752 | |
10754 | 10753 | // |
@@ -10764,7 +10763,7 @@ discard block |
||
10764 | 10763 | // e.g.: non mbstring support + invalid chars |
10765 | 10764 | return ''; |
10766 | 10765 | } |
10767 | - $length = (int) $lengthTmp; |
|
10766 | + $length = (int)$lengthTmp; |
|
10768 | 10767 | } |
10769 | 10768 | |
10770 | 10769 | \array_splice($smatches[0], $offset, $length, $rmatches[0]); |
@@ -10799,14 +10798,14 @@ discard block |
||
10799 | 10798 | && |
10800 | 10799 | \substr($haystack, -\strlen($needle)) === $needle |
10801 | 10800 | ) { |
10802 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
10801 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
10803 | 10802 | } |
10804 | 10803 | |
10805 | 10804 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
10806 | - return (string) self::substr( |
|
10805 | + return (string)self::substr( |
|
10807 | 10806 | $haystack, |
10808 | 10807 | 0, |
10809 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
10808 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
10810 | 10809 | $encoding |
10811 | 10810 | ); |
10812 | 10811 | } |
@@ -10836,10 +10835,10 @@ discard block |
||
10836 | 10835 | } |
10837 | 10836 | |
10838 | 10837 | if ($encoding === 'UTF-8') { |
10839 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10838 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10840 | 10839 | } |
10841 | 10840 | |
10842 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10841 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10843 | 10842 | } |
10844 | 10843 | |
10845 | 10844 | /** |
@@ -11035,7 +11034,7 @@ discard block |
||
11035 | 11034 | // INFO: https://unicode.org/cldr/utility/character.jsp?a=%E2%84%8C |
11036 | 11035 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11037 | 11036 | /** @noinspection UnnecessaryCastingInspection */ |
11038 | - $str = (string) \transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11037 | + $str = (string)\transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11039 | 11038 | |
11040 | 11039 | // check again, if we only have ASCII, now ... |
11041 | 11040 | if (self::is_ascii($str) === true) { |
@@ -11158,7 +11157,7 @@ discard block |
||
11158 | 11157 | public static function to_boolean($str): bool |
11159 | 11158 | { |
11160 | 11159 | // init |
11161 | - $str = (string) $str; |
|
11160 | + $str = (string)$str; |
|
11162 | 11161 | |
11163 | 11162 | if ($str === '') { |
11164 | 11163 | return false; |
@@ -11186,10 +11185,10 @@ discard block |
||
11186 | 11185 | } |
11187 | 11186 | |
11188 | 11187 | if (\is_numeric($str)) { |
11189 | - return ((float) $str + 0) > 0; |
|
11188 | + return ((float)$str + 0) > 0; |
|
11190 | 11189 | } |
11191 | 11190 | |
11192 | - return (bool) \trim($str); |
|
11191 | + return (bool)\trim($str); |
|
11193 | 11192 | } |
11194 | 11193 | |
11195 | 11194 | /** |
@@ -11210,11 +11209,11 @@ discard block |
||
11210 | 11209 | |
11211 | 11210 | $fallback_char_escaped = \preg_quote($fallback_char, '/'); |
11212 | 11211 | |
11213 | - $string = (string) \preg_replace( |
|
11212 | + $string = (string)\preg_replace( |
|
11214 | 11213 | [ |
11215 | - '/[^' . $fallback_char_escaped . '\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
11216 | - '/[\s]+/', // 2) convert spaces to $fallback_char |
|
11217 | - '/[' . $fallback_char_escaped . ']+/', // 3) remove double $fallback_char's |
|
11214 | + '/[^'.$fallback_char_escaped.'\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
11215 | + '/[\s]+/', // 2) convert spaces to $fallback_char |
|
11216 | + '/['.$fallback_char_escaped.']+/', // 3) remove double $fallback_char's |
|
11218 | 11217 | ], |
11219 | 11218 | [ |
11220 | 11219 | '', |
@@ -11245,7 +11244,7 @@ discard block |
||
11245 | 11244 | return $str; |
11246 | 11245 | } |
11247 | 11246 | |
11248 | - $str = (string) $str; |
|
11247 | + $str = (string)$str; |
|
11249 | 11248 | if ($str === '') { |
11250 | 11249 | return ''; |
11251 | 11250 | } |
@@ -11292,7 +11291,7 @@ discard block |
||
11292 | 11291 | return $str; |
11293 | 11292 | } |
11294 | 11293 | |
11295 | - $str = (string) $str; |
|
11294 | + $str = (string)$str; |
|
11296 | 11295 | if ($str === '') { |
11297 | 11296 | return $str; |
11298 | 11297 | } |
@@ -11310,7 +11309,7 @@ discard block |
||
11310 | 11309 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
11311 | 11310 | |
11312 | 11311 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11313 | - $buf .= $c1 . $c2; |
|
11312 | + $buf .= $c1.$c2; |
|
11314 | 11313 | ++$i; |
11315 | 11314 | } else { // not valid UTF8 - convert it |
11316 | 11315 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11321,7 +11320,7 @@ discard block |
||
11321 | 11320 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
11322 | 11321 | |
11323 | 11322 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11324 | - $buf .= $c1 . $c2 . $c3; |
|
11323 | + $buf .= $c1.$c2.$c3; |
|
11325 | 11324 | $i += 2; |
11326 | 11325 | } else { // not valid UTF8 - convert it |
11327 | 11326 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11333,7 +11332,7 @@ discard block |
||
11333 | 11332 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
11334 | 11333 | |
11335 | 11334 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11336 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
11335 | + $buf .= $c1.$c2.$c3.$c4; |
|
11337 | 11336 | $i += 3; |
11338 | 11337 | } else { // not valid UTF8 - convert it |
11339 | 11338 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11359,13 +11358,13 @@ discard block |
||
11359 | 11358 | * |
11360 | 11359 | * @return string |
11361 | 11360 | */ |
11362 | - static function (array $matches): string { |
|
11361 | + static function(array $matches): string { |
|
11363 | 11362 | if (isset($matches[3])) { |
11364 | - $cp = (int) \hexdec($matches[3]); |
|
11363 | + $cp = (int)\hexdec($matches[3]); |
|
11365 | 11364 | } else { |
11366 | 11365 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
11367 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
11368 | - + (int) \hexdec($matches[2]) |
|
11366 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
11367 | + + (int)\hexdec($matches[2]) |
|
11369 | 11368 | + 0x10000 |
11370 | 11369 | - (0xD800 << 10) |
11371 | 11370 | - 0xDC00; |
@@ -11376,12 +11375,12 @@ discard block |
||
11376 | 11375 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
11377 | 11376 | |
11378 | 11377 | if ($cp < 0x80) { |
11379 | - return (string) self::chr($cp); |
|
11378 | + return (string)self::chr($cp); |
|
11380 | 11379 | } |
11381 | 11380 | |
11382 | 11381 | if ($cp < 0xA0) { |
11383 | 11382 | /** @noinspection UnnecessaryCastingInspection */ |
11384 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
11383 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
11385 | 11384 | } |
11386 | 11385 | |
11387 | 11386 | return self::decimal_to_chr($cp); |
@@ -11429,7 +11428,7 @@ discard block |
||
11429 | 11428 | |
11430 | 11429 | if (self::$SUPPORT['mbstring'] === true) { |
11431 | 11430 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11432 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
11431 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
11433 | 11432 | } |
11434 | 11433 | |
11435 | 11434 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -11466,15 +11465,15 @@ discard block |
||
11466 | 11465 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
11467 | 11466 | |
11468 | 11467 | if ($encoding === 'UTF-8') { |
11469 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
11468 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
11470 | 11469 | |
11471 | 11470 | if ($useMbFunction === true) { |
11472 | 11471 | $strPartOne = \mb_strtoupper( |
11473 | - (string) \mb_substr($str, 0, 1) |
|
11472 | + (string)\mb_substr($str, 0, 1) |
|
11474 | 11473 | ); |
11475 | 11474 | } else { |
11476 | 11475 | $strPartOne = self::strtoupper( |
11477 | - (string) \mb_substr($str, 0, 1), |
|
11476 | + (string)\mb_substr($str, 0, 1), |
|
11478 | 11477 | $encoding, |
11479 | 11478 | false, |
11480 | 11479 | $lang, |
@@ -11484,16 +11483,16 @@ discard block |
||
11484 | 11483 | } else { |
11485 | 11484 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11486 | 11485 | |
11487 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
11486 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
11488 | 11487 | |
11489 | 11488 | if ($useMbFunction === true) { |
11490 | 11489 | $strPartOne = \mb_strtoupper( |
11491 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
11490 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
11492 | 11491 | $encoding |
11493 | 11492 | ); |
11494 | 11493 | } else { |
11495 | 11494 | $strPartOne = self::strtoupper( |
11496 | - (string) self::substr($str, 0, 1, $encoding), |
|
11495 | + (string)self::substr($str, 0, 1, $encoding), |
|
11497 | 11496 | $encoding, |
11498 | 11497 | false, |
11499 | 11498 | $lang, |
@@ -11502,7 +11501,7 @@ discard block |
||
11502 | 11501 | } |
11503 | 11502 | } |
11504 | 11503 | |
11505 | - return $strPartOne . $strPartTwo; |
|
11504 | + return $strPartOne.$strPartTwo; |
|
11506 | 11505 | } |
11507 | 11506 | |
11508 | 11507 | /** |
@@ -11553,7 +11552,7 @@ discard block |
||
11553 | 11552 | $str = self::clean($str); |
11554 | 11553 | } |
11555 | 11554 | |
11556 | - $usePhpDefaultFunctions = !(bool) ($charlist . \implode('', $exceptions)); |
|
11555 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
11557 | 11556 | |
11558 | 11557 | if ( |
11559 | 11558 | $usePhpDefaultFunctions === true |
@@ -11610,7 +11609,7 @@ discard block |
||
11610 | 11609 | |
11611 | 11610 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
11612 | 11611 | if (\preg_match($pattern, $str)) { |
11613 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
11612 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
11614 | 11613 | } |
11615 | 11614 | |
11616 | 11615 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -11949,7 +11948,7 @@ discard block |
||
11949 | 11948 | if ( |
11950 | 11949 | $keepUtf8Chars === true |
11951 | 11950 | && |
11952 | - self::strlen($return) >= (int) self::strlen($str_backup) |
|
11951 | + self::strlen($return) >= (int)self::strlen($str_backup) |
|
11953 | 11952 | ) { |
11954 | 11953 | return $str_backup; |
11955 | 11954 | } |
@@ -12043,17 +12042,17 @@ discard block |
||
12043 | 12042 | return ''; |
12044 | 12043 | } |
12045 | 12044 | |
12046 | - \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches); |
|
12045 | + \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches); |
|
12047 | 12046 | |
12048 | 12047 | if ( |
12049 | 12048 | !isset($matches[0]) |
12050 | 12049 | || |
12051 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
12050 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
12052 | 12051 | ) { |
12053 | 12052 | return $str; |
12054 | 12053 | } |
12055 | 12054 | |
12056 | - return \rtrim($matches[0]) . $strAddOn; |
|
12055 | + return \rtrim($matches[0]).$strAddOn; |
|
12057 | 12056 | } |
12058 | 12057 | |
12059 | 12058 | /** |
@@ -12123,7 +12122,7 @@ discard block |
||
12123 | 12122 | $strReturn .= $break; |
12124 | 12123 | } |
12125 | 12124 | |
12126 | - return $strReturn . \implode('', $chars); |
|
12125 | + return $strReturn.\implode('', $chars); |
|
12127 | 12126 | } |
12128 | 12127 | |
12129 | 12128 | /** |
@@ -12136,7 +12135,7 @@ discard block |
||
12136 | 12135 | */ |
12137 | 12136 | public static function wordwrap_per_line(string $str, int $limit): string |
12138 | 12137 | { |
12139 | - $strings = (array) \preg_split('/\\r\\n|\\r|\\n/', $str); |
|
12138 | + $strings = (array)\preg_split('/\\r\\n|\\r|\\n/', $str); |
|
12140 | 12139 | |
12141 | 12140 | $string = ''; |
12142 | 12141 | foreach ($strings as &$value) { |
@@ -12173,7 +12172,7 @@ discard block |
||
12173 | 12172 | |
12174 | 12173 | \uksort( |
12175 | 12174 | self::$EMOJI, |
12176 | - static function ($a, $b) { |
|
12175 | + static function($a, $b) { |
|
12177 | 12176 | return \strlen($b) <=> \strlen($a); |
12178 | 12177 | } |
12179 | 12178 | ); |
@@ -12183,7 +12182,7 @@ discard block |
||
12183 | 12182 | |
12184 | 12183 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
12185 | 12184 | $tmpKey = \crc32($key); |
12186 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmpKey . '_-_' . \strrev((string) $tmpKey) . '_-_8FTU_ELBATROP_-_'; |
|
12185 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmpKey.'_-_'.\strrev((string)$tmpKey).'_-_8FTU_ELBATROP_-_'; |
|
12187 | 12186 | } |
12188 | 12187 | } |
12189 | 12188 | } |
@@ -12242,7 +12241,7 @@ discard block |
||
12242 | 12241 | /** @noinspection PhpIncludeInspection */ |
12243 | 12242 | /** @noinspection UsingInclusionReturnValueInspection */ |
12244 | 12243 | /** @psalm-suppress UnresolvableInclude */ |
12245 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
12244 | + return include __DIR__.'/data/'.$file.'.php'; |
|
12246 | 12245 | } |
12247 | 12246 | |
12248 | 12247 | /** |
@@ -12254,7 +12253,7 @@ discard block |
||
12254 | 12253 | */ |
12255 | 12254 | private static function getDataIfExists(string $file) |
12256 | 12255 | { |
12257 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
12256 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
12258 | 12257 | if (\file_exists($file)) { |
12259 | 12258 | /** @noinspection PhpIncludeInspection */ |
12260 | 12259 | /** @noinspection UsingInclusionReturnValueInspection */ |
@@ -12279,7 +12278,7 @@ discard block |
||
12279 | 12278 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
12280 | 12279 | return \defined('MB_OVERLOAD_STRING') |
12281 | 12280 | && |
12282 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12281 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12283 | 12282 | } |
12284 | 12283 | |
12285 | 12284 | /** |
@@ -12329,7 +12328,7 @@ discard block |
||
12329 | 12328 | { |
12330 | 12329 | static $RX_CLASSS_CACHE = []; |
12331 | 12330 | |
12332 | - $cacheKey = $s . $class; |
|
12331 | + $cacheKey = $s.$class; |
|
12333 | 12332 | |
12334 | 12333 | if (isset($RX_CLASSS_CACHE[$cacheKey])) { |
12335 | 12334 | return $RX_CLASSS_CACHE[$cacheKey]; |
@@ -12341,7 +12340,7 @@ discard block |
||
12341 | 12340 | /** @noinspection AlterInForeachInspection */ |
12342 | 12341 | foreach (self::str_split($s) as &$s) { |
12343 | 12342 | if ($s === '-') { |
12344 | - $class[0] = '-' . $class[0]; |
|
12343 | + $class[0] = '-'.$class[0]; |
|
12345 | 12344 | } elseif (!isset($s[2])) { |
12346 | 12345 | $class[0] .= \preg_quote($s, '/'); |
12347 | 12346 | } elseif (self::strlen($s) === 1) { |
@@ -12352,13 +12351,13 @@ discard block |
||
12352 | 12351 | } |
12353 | 12352 | |
12354 | 12353 | if ($class[0]) { |
12355 | - $class[0] = '[' . $class[0] . ']'; |
|
12354 | + $class[0] = '['.$class[0].']'; |
|
12356 | 12355 | } |
12357 | 12356 | |
12358 | 12357 | if (\count($class) === 1) { |
12359 | 12358 | $return = $class[0]; |
12360 | 12359 | } else { |
12361 | - $return = '(?:' . \implode('|', $class) . ')'; |
|
12360 | + $return = '(?:'.\implode('|', $class).')'; |
|
12362 | 12361 | } |
12363 | 12362 | |
12364 | 12363 | $RX_CLASSS_CACHE[$cacheKey] = $return; |
@@ -12432,7 +12431,7 @@ discard block |
||
12432 | 12431 | $continue = false; |
12433 | 12432 | |
12434 | 12433 | if ($delimiter === '-') { |
12435 | - foreach ((array) $specialCases['names'] as &$beginning) { |
|
12434 | + foreach ((array)$specialCases['names'] as &$beginning) { |
|
12436 | 12435 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12437 | 12436 | $continue = true; |
12438 | 12437 | } |
@@ -12440,7 +12439,7 @@ discard block |
||
12440 | 12439 | unset($beginning); |
12441 | 12440 | } |
12442 | 12441 | |
12443 | - foreach ((array) $specialCases['prefixes'] as &$beginning) { |
|
12442 | + foreach ((array)$specialCases['prefixes'] as &$beginning) { |
|
12444 | 12443 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12445 | 12444 | $continue = true; |
12446 | 12445 | } |
@@ -12496,8 +12495,8 @@ discard block |
||
12496 | 12495 | $buf .= self::$WIN1252_TO_UTF8[$ordC1]; |
12497 | 12496 | } else { |
12498 | 12497 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
12499 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
12500 | - $buf .= $cc1 . $cc2; |
|
12498 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
12499 | + $buf .= $cc1.$cc2; |
|
12501 | 12500 | } |
12502 | 12501 | |
12503 | 12502 | return $buf; |