@@ -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') { |
@@ -5783,8 +5783,8 @@ discard block |
||
5783 | 5783 | |
5784 | 5784 | /** @noinspection UnnecessaryCastingInspection */ |
5785 | 5785 | return (string) \mb_substr($str, 0, $index) . |
5786 | - $substring . |
|
5787 | - (string) \mb_substr($str, $index, $len); |
|
5786 | + $substring . |
|
5787 | + (string) \mb_substr($str, $index, $len); |
|
5788 | 5788 | } |
5789 | 5789 | |
5790 | 5790 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -5795,8 +5795,8 @@ discard block |
||
5795 | 5795 | } |
5796 | 5796 | |
5797 | 5797 | return ((string) self::substr($str, 0, $index, $encoding)) . |
5798 | - $substring . |
|
5799 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5798 | + $substring . |
|
5799 | + ((string) self::substr($str, $index, $len, $encoding)); |
|
5800 | 5800 | } |
5801 | 5801 | |
5802 | 5802 | /** |
@@ -7575,11 +7575,11 @@ discard block |
||
7575 | 7575 | if ($useMbFunction === true) { |
7576 | 7576 | if ($encoding === 'UTF-8') { |
7577 | 7577 | return \mb_strtoupper(\mb_substr($match[0], 0, 1)) |
7578 | - . \mb_strtolower(\mb_substr($match[0], 1)); |
|
7578 | + . \mb_strtolower(\mb_substr($match[0], 1)); |
|
7579 | 7579 | } |
7580 | 7580 | |
7581 | 7581 | return \mb_strtoupper(\mb_substr($match[0], 0, 1, $encoding), $encoding) |
7582 | - . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
7582 | + . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
7583 | 7583 | } |
7584 | 7584 | |
7585 | 7585 | return self::ucfirst( |
@@ -10649,8 +10649,8 @@ discard block |
||
10649 | 10649 | |
10650 | 10650 | /** @noinspection AdditionOperationOnArraysInspection */ |
10651 | 10651 | return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
10652 | - $replacement . |
|
10653 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10652 | + $replacement . |
|
10653 | + ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10654 | 10654 | } |
10655 | 10655 | |
10656 | 10656 | // |
@@ -235,10 +235,10 @@ discard block |
||
235 | 235 | } |
236 | 236 | |
237 | 237 | if ($encoding === 'UTF-8') { |
238 | - return (string) \mb_substr($str, $pos, 1); |
|
238 | + return (string)\mb_substr($str, $pos, 1); |
|
239 | 239 | } |
240 | 240 | |
241 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
241 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | public static function add_bom_to_string(string $str): string |
254 | 254 | { |
255 | 255 | if (self::string_has_bom($str) === false) { |
256 | - $str = self::bom() . $str; |
|
256 | + $str = self::bom().$str; |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | return $str; |
@@ -282,8 +282,8 @@ discard block |
||
282 | 282 | $return = []; |
283 | 283 | foreach ($array as $key => &$value) { |
284 | 284 | $key = $case === \CASE_LOWER |
285 | - ? self::strtolower((string) $key, $encoding) |
|
286 | - : self::strtoupper((string) $key, $encoding); |
|
285 | + ? self::strtolower((string)$key, $encoding) |
|
286 | + : self::strtoupper((string)$key, $encoding); |
|
287 | 287 | |
288 | 288 | $return[$key] = $value; |
289 | 289 | } |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | return ''; |
318 | 318 | } |
319 | 319 | |
320 | - $substrIndex = $posStart + (int) \mb_strlen($start); |
|
320 | + $substrIndex = $posStart + (int)\mb_strlen($start); |
|
321 | 321 | $posEnd = \mb_strpos($str, $end, $substrIndex); |
322 | 322 | if ( |
323 | 323 | $posEnd === false |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | return ''; |
328 | 328 | } |
329 | 329 | |
330 | - return (string) \mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
330 | + return (string)\mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | return ''; |
338 | 338 | } |
339 | 339 | |
340 | - $substrIndex = $posStart + (int) self::strlen($start, $encoding); |
|
340 | + $substrIndex = $posStart + (int)self::strlen($start, $encoding); |
|
341 | 341 | $posEnd = self::strpos($str, $end, $substrIndex, $encoding); |
342 | 342 | if ( |
343 | 343 | $posEnd === false |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | return ''; |
348 | 348 | } |
349 | 349 | |
350 | - return (string) self::substr( |
|
350 | + return (string)self::substr( |
|
351 | 351 | $str, |
352 | 352 | $substrIndex, |
353 | 353 | $posEnd - $substrIndex, |
@@ -415,10 +415,10 @@ discard block |
||
415 | 415 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
416 | 416 | { |
417 | 417 | if ($encoding === 'UTF-8') { |
418 | - return (string) \mb_substr($str, $index, 1); |
|
418 | + return (string)\mb_substr($str, $index, 1); |
|
419 | 419 | } |
420 | 420 | |
421 | - return (string) self::substr($str, $index, 1, $encoding); |
|
421 | + return (string)self::substr($str, $index, 1, $encoding); |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | /** |
@@ -521,10 +521,10 @@ discard block |
||
521 | 521 | && |
522 | 522 | self::$SUPPORT['mbstring'] === false |
523 | 523 | ) { |
524 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
524 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
525 | 525 | } |
526 | 526 | |
527 | - $cacheKey = $code_point . $encoding; |
|
527 | + $cacheKey = $code_point.$encoding; |
|
528 | 528 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
529 | 529 | return $CHAR_CACHE[$cacheKey]; |
530 | 530 | } |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | if ($code_point <= 127) { // use "simple"-char only until "\x80" |
533 | 533 | |
534 | 534 | if (self::$CHR === null) { |
535 | - self::$CHR = (array) self::getData('chr'); |
|
535 | + self::$CHR = (array)self::getData('chr'); |
|
536 | 536 | } |
537 | 537 | |
538 | 538 | /** |
@@ -567,10 +567,10 @@ discard block |
||
567 | 567 | // |
568 | 568 | |
569 | 569 | if (self::$CHR === null) { |
570 | - self::$CHR = (array) self::getData('chr'); |
|
570 | + self::$CHR = (array)self::getData('chr'); |
|
571 | 571 | } |
572 | 572 | |
573 | - $code_point = (int) $code_point; |
|
573 | + $code_point = (int)$code_point; |
|
574 | 574 | if ($code_point <= 0x7F) { |
575 | 575 | /** |
576 | 576 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -580,22 +580,22 @@ discard block |
||
580 | 580 | /** |
581 | 581 | * @psalm-suppress PossiblyNullArrayAccess |
582 | 582 | */ |
583 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
583 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
584 | 584 | self::$CHR[($code_point & 0x3F) + 0x80]; |
585 | 585 | } elseif ($code_point <= 0xFFFF) { |
586 | 586 | /** |
587 | 587 | * @psalm-suppress PossiblyNullArrayAccess |
588 | 588 | */ |
589 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
590 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
589 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
590 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
591 | 591 | self::$CHR[($code_point & 0x3F) + 0x80]; |
592 | 592 | } else { |
593 | 593 | /** |
594 | 594 | * @psalm-suppress PossiblyNullArrayAccess |
595 | 595 | */ |
596 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
597 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
598 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
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 | 599 | self::$CHR[($code_point & 0x3F) + 0x80]; |
600 | 600 | } |
601 | 601 | |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | |
643 | 643 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
644 | 644 | return \array_map( |
645 | - static function (string $data): int { |
|
645 | + static function(string $data): int { |
|
646 | 646 | // "mb_" is available if overload is used, so use it ... |
647 | 647 | return \mb_strlen($data, 'CP850'); // 8-BIT |
648 | 648 | }, |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | $char = ''; |
711 | 711 | } |
712 | 712 | |
713 | - return self::int_to_hex(self::ord((string) $char), $pfix); |
|
713 | + return self::int_to_hex(self::ord((string)$char), $pfix); |
|
714 | 714 | } |
715 | 715 | |
716 | 716 | /** |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | | ( [\x80-\xBF] ) # invalid byte in range 10000000 - 10111111 |
785 | 785 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
786 | 786 | /x'; |
787 | - $str = (string) \preg_replace($regx, '$1', $str); |
|
787 | + $str = (string)\preg_replace($regx, '$1', $str); |
|
788 | 788 | |
789 | 789 | if ($replace_diamond_question_mark === true) { |
790 | 790 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | public static function cleanup($str): string |
820 | 820 | { |
821 | 821 | // init |
822 | - $str = (string) $str; |
|
822 | + $str = (string)$str; |
|
823 | 823 | |
824 | 824 | if ($str === '') { |
825 | 825 | return ''; |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | { |
903 | 903 | if (self::$SUPPORT['mbstring'] === true) { |
904 | 904 | /** @noinspection PhpComposerExtensionStubsInspection */ |
905 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
905 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
906 | 906 | } |
907 | 907 | |
908 | 908 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -942,7 +942,7 @@ discard block |
||
942 | 942 | */ |
943 | 943 | public static function css_stripe_media_queries(string $str): string |
944 | 944 | { |
945 | - return (string) \preg_replace( |
|
945 | + return (string)\preg_replace( |
|
946 | 946 | '#@media\\s+(?:only\\s)?(?:[\\s{\\(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#misU', |
947 | 947 | '', |
948 | 948 | $str |
@@ -969,7 +969,7 @@ discard block |
||
969 | 969 | */ |
970 | 970 | public static function decimal_to_chr($int): string |
971 | 971 | { |
972 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
972 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
973 | 973 | } |
974 | 974 | |
975 | 975 | /** |
@@ -1048,7 +1048,7 @@ discard block |
||
1048 | 1048 | if ($toEncoding === 'JSON') { |
1049 | 1049 | $return = self::json_encode($str); |
1050 | 1050 | if ($return === false) { |
1051 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1051 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1052 | 1052 | } |
1053 | 1053 | |
1054 | 1054 | return $return; |
@@ -1134,7 +1134,7 @@ discard block |
||
1134 | 1134 | && |
1135 | 1135 | self::$SUPPORT['mbstring'] === false |
1136 | 1136 | ) { |
1137 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $toEncoding . '" encoding', \E_USER_WARNING); |
|
1137 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$toEncoding.'" encoding', \E_USER_WARNING); |
|
1138 | 1138 | } |
1139 | 1139 | |
1140 | 1140 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1228,31 +1228,31 @@ discard block |
||
1228 | 1228 | $trimChars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1229 | 1229 | |
1230 | 1230 | if ($length === null) { |
1231 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
1231 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
1232 | 1232 | } |
1233 | 1233 | |
1234 | 1234 | if ($search === '') { |
1235 | 1235 | if ($encoding === 'UTF-8') { |
1236 | 1236 | if ($length > 0) { |
1237 | - $stringLength = (int) \mb_strlen($str); |
|
1237 | + $stringLength = (int)\mb_strlen($str); |
|
1238 | 1238 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
1239 | 1239 | } else { |
1240 | 1240 | $end = 0; |
1241 | 1241 | } |
1242 | 1242 | |
1243 | - $pos = (int) \min( |
|
1243 | + $pos = (int)\min( |
|
1244 | 1244 | \mb_strpos($str, ' ', $end), |
1245 | 1245 | \mb_strpos($str, '.', $end) |
1246 | 1246 | ); |
1247 | 1247 | } else { |
1248 | 1248 | if ($length > 0) { |
1249 | - $stringLength = (int) self::strlen($str, $encoding); |
|
1249 | + $stringLength = (int)self::strlen($str, $encoding); |
|
1250 | 1250 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
1251 | 1251 | } else { |
1252 | 1252 | $end = 0; |
1253 | 1253 | } |
1254 | 1254 | |
1255 | - $pos = (int) \min( |
|
1255 | + $pos = (int)\min( |
|
1256 | 1256 | self::strpos($str, ' ', $end, $encoding), |
1257 | 1257 | self::strpos($str, '.', $end, $encoding) |
1258 | 1258 | ); |
@@ -1269,18 +1269,18 @@ discard block |
||
1269 | 1269 | return ''; |
1270 | 1270 | } |
1271 | 1271 | |
1272 | - return \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1272 | + return \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1273 | 1273 | } |
1274 | 1274 | |
1275 | 1275 | return $str; |
1276 | 1276 | } |
1277 | 1277 | |
1278 | 1278 | if ($encoding === 'UTF-8') { |
1279 | - $wordPos = (int) \mb_stripos($str, $search); |
|
1280 | - $halfSide = (int) ($wordPos - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1279 | + $wordPos = (int)\mb_stripos($str, $search); |
|
1280 | + $halfSide = (int)($wordPos - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1281 | 1281 | } else { |
1282 | - $wordPos = (int) self::stripos($str, $search, 0, $encoding); |
|
1283 | - $halfSide = (int) ($wordPos - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1282 | + $wordPos = (int)self::stripos($str, $search, 0, $encoding); |
|
1283 | + $halfSide = (int)($wordPos - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1284 | 1284 | } |
1285 | 1285 | |
1286 | 1286 | $pos_start = 0; |
@@ -1292,12 +1292,12 @@ discard block |
||
1292 | 1292 | } |
1293 | 1293 | if ($halfText !== false) { |
1294 | 1294 | if ($encoding === 'UTF-8') { |
1295 | - $pos_start = (int) \max( |
|
1295 | + $pos_start = (int)\max( |
|
1296 | 1296 | \mb_strrpos($halfText, ' '), |
1297 | 1297 | \mb_strrpos($halfText, '.') |
1298 | 1298 | ); |
1299 | 1299 | } else { |
1300 | - $pos_start = (int) \max( |
|
1300 | + $pos_start = (int)\max( |
|
1301 | 1301 | self::strrpos($halfText, ' ', 0, $encoding), |
1302 | 1302 | self::strrpos($halfText, '.', 0, $encoding) |
1303 | 1303 | ); |
@@ -1307,19 +1307,19 @@ discard block |
||
1307 | 1307 | |
1308 | 1308 | if ($wordPos && $halfSide > 0) { |
1309 | 1309 | $offset = $pos_start + $length - 1; |
1310 | - $realLength = (int) self::strlen($str, $encoding); |
|
1310 | + $realLength = (int)self::strlen($str, $encoding); |
|
1311 | 1311 | |
1312 | 1312 | if ($offset > $realLength) { |
1313 | 1313 | $offset = $realLength; |
1314 | 1314 | } |
1315 | 1315 | |
1316 | 1316 | if ($encoding === 'UTF-8') { |
1317 | - $pos_end = (int) \min( |
|
1317 | + $pos_end = (int)\min( |
|
1318 | 1318 | \mb_strpos($str, ' ', $offset), |
1319 | 1319 | \mb_strpos($str, '.', $offset) |
1320 | 1320 | ) - $pos_start; |
1321 | 1321 | } else { |
1322 | - $pos_end = (int) \min( |
|
1322 | + $pos_end = (int)\min( |
|
1323 | 1323 | self::strpos($str, ' ', $offset, $encoding), |
1324 | 1324 | self::strpos($str, '.', $offset, $encoding) |
1325 | 1325 | ) - $pos_start; |
@@ -1327,12 +1327,12 @@ discard block |
||
1327 | 1327 | |
1328 | 1328 | if (!$pos_end || $pos_end <= 0) { |
1329 | 1329 | if ($encoding === 'UTF-8') { |
1330 | - $strSub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1330 | + $strSub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1331 | 1331 | } else { |
1332 | - $strSub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1332 | + $strSub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1333 | 1333 | } |
1334 | 1334 | if ($strSub !== false) { |
1335 | - $extract = $replacerForSkippedText . \ltrim($strSub, $trimChars); |
|
1335 | + $extract = $replacerForSkippedText.\ltrim($strSub, $trimChars); |
|
1336 | 1336 | } else { |
1337 | 1337 | $extract = ''; |
1338 | 1338 | } |
@@ -1343,26 +1343,26 @@ discard block |
||
1343 | 1343 | $strSub = self::substr($str, $pos_start, $pos_end, $encoding); |
1344 | 1344 | } |
1345 | 1345 | if ($strSub !== false) { |
1346 | - $extract = $replacerForSkippedText . \trim($strSub, $trimChars) . $replacerForSkippedText; |
|
1346 | + $extract = $replacerForSkippedText.\trim($strSub, $trimChars).$replacerForSkippedText; |
|
1347 | 1347 | } else { |
1348 | 1348 | $extract = ''; |
1349 | 1349 | } |
1350 | 1350 | } |
1351 | 1351 | } else { |
1352 | 1352 | $offset = $length - 1; |
1353 | - $trueLength = (int) self::strlen($str, $encoding); |
|
1353 | + $trueLength = (int)self::strlen($str, $encoding); |
|
1354 | 1354 | |
1355 | 1355 | if ($offset > $trueLength) { |
1356 | 1356 | $offset = $trueLength; |
1357 | 1357 | } |
1358 | 1358 | |
1359 | 1359 | if ($encoding === 'UTF-8') { |
1360 | - $pos_end = (int) \min( |
|
1360 | + $pos_end = (int)\min( |
|
1361 | 1361 | \mb_strpos($str, ' ', $offset), |
1362 | 1362 | \mb_strpos($str, '.', $offset) |
1363 | 1363 | ); |
1364 | 1364 | } else { |
1365 | - $pos_end = (int) \min( |
|
1365 | + $pos_end = (int)\min( |
|
1366 | 1366 | self::strpos($str, ' ', $offset, $encoding), |
1367 | 1367 | self::strpos($str, '.', $offset, $encoding) |
1368 | 1368 | ); |
@@ -1375,7 +1375,7 @@ discard block |
||
1375 | 1375 | $strSub = self::substr($str, 0, $pos_end, $encoding); |
1376 | 1376 | } |
1377 | 1377 | if ($strSub !== false) { |
1378 | - $extract = \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1378 | + $extract = \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1379 | 1379 | } else { |
1380 | 1380 | $extract = ''; |
1381 | 1381 | } |
@@ -1495,7 +1495,7 @@ discard block |
||
1495 | 1495 | { |
1496 | 1496 | $file_content = \file_get_contents($file_path); |
1497 | 1497 | if ($file_content === false) { |
1498 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1498 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1499 | 1499 | } |
1500 | 1500 | |
1501 | 1501 | return self::string_has_bom($file_content); |
@@ -1556,7 +1556,7 @@ discard block |
||
1556 | 1556 | ) { |
1557 | 1557 | // Prevent leading combining chars |
1558 | 1558 | // for NFC-safe concatenations. |
1559 | - $var = $leading_combining . $var; |
|
1559 | + $var = $leading_combining.$var; |
|
1560 | 1560 | } |
1561 | 1561 | } |
1562 | 1562 | |
@@ -1795,10 +1795,10 @@ discard block |
||
1795 | 1795 | } |
1796 | 1796 | |
1797 | 1797 | if ($encoding === 'UTF-8') { |
1798 | - return (string) \mb_substr($str, 0, $n); |
|
1798 | + return (string)\mb_substr($str, 0, $n); |
|
1799 | 1799 | } |
1800 | 1800 | |
1801 | - return (string) self::substr($str, 0, $n, $encoding); |
|
1801 | + return (string)self::substr($str, 0, $n, $encoding); |
|
1802 | 1802 | } |
1803 | 1803 | |
1804 | 1804 | /** |
@@ -1873,7 +1873,7 @@ discard block |
||
1873 | 1873 | return $str; |
1874 | 1874 | } |
1875 | 1875 | |
1876 | - $str = (string) $str; |
|
1876 | + $str = (string)$str; |
|
1877 | 1877 | $last = ''; |
1878 | 1878 | while ($last !== $str) { |
1879 | 1879 | $last = $str; |
@@ -2056,7 +2056,7 @@ discard block |
||
2056 | 2056 | } |
2057 | 2057 | |
2058 | 2058 | $str_info = \unpack('C2chars', $str_info); |
2059 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2059 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2060 | 2060 | |
2061 | 2061 | // DEBUG |
2062 | 2062 | //var_dump($type_code); |
@@ -2145,7 +2145,7 @@ discard block |
||
2145 | 2145 | // |
2146 | 2146 | |
2147 | 2147 | if ($encoding === 'UTF-8') { |
2148 | - $maxlength = (int) \mb_strlen($possibleChars); |
|
2148 | + $maxlength = (int)\mb_strlen($possibleChars); |
|
2149 | 2149 | if ($maxlength === 0) { |
2150 | 2150 | return ''; |
2151 | 2151 | } |
@@ -2166,7 +2166,7 @@ discard block |
||
2166 | 2166 | } else { |
2167 | 2167 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2168 | 2168 | |
2169 | - $maxlength = (int) self::strlen($possibleChars, $encoding); |
|
2169 | + $maxlength = (int)self::strlen($possibleChars, $encoding); |
|
2170 | 2170 | if ($maxlength === 0) { |
2171 | 2171 | return ''; |
2172 | 2172 | } |
@@ -2197,16 +2197,16 @@ discard block |
||
2197 | 2197 | */ |
2198 | 2198 | public static function get_unique_string($entropyExtra = '', bool $md5 = true): string |
2199 | 2199 | { |
2200 | - $uniqueHelper = \random_int(0, \mt_getrandmax()) . |
|
2201 | - \session_id() . |
|
2202 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2203 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2200 | + $uniqueHelper = \random_int(0, \mt_getrandmax()). |
|
2201 | + \session_id(). |
|
2202 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2203 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2204 | 2204 | $entropyExtra; |
2205 | 2205 | |
2206 | 2206 | $uniqueString = \uniqid($uniqueHelper, true); |
2207 | 2207 | |
2208 | 2208 | if ($md5) { |
2209 | - $uniqueString = \md5($uniqueString . $uniqueHelper); |
|
2209 | + $uniqueString = \md5($uniqueString.$uniqueHelper); |
|
2210 | 2210 | } |
2211 | 2211 | |
2212 | 2212 | return $uniqueString; |
@@ -2286,7 +2286,7 @@ discard block |
||
2286 | 2286 | public static function hex_to_int($hexDec) |
2287 | 2287 | { |
2288 | 2288 | // init |
2289 | - $hexDec = (string) $hexDec; |
|
2289 | + $hexDec = (string)$hexDec; |
|
2290 | 2290 | |
2291 | 2291 | if ($hexDec === '') { |
2292 | 2292 | return false; |
@@ -2364,7 +2364,7 @@ discard block |
||
2364 | 2364 | return \implode( |
2365 | 2365 | '', |
2366 | 2366 | \array_map( |
2367 | - static function (string $chr) use ($keepAsciiChars, $encoding): string { |
|
2367 | + static function(string $chr) use ($keepAsciiChars, $encoding): string { |
|
2368 | 2368 | return self::single_chr_html_encode($chr, $keepAsciiChars, $encoding); |
2369 | 2369 | }, |
2370 | 2370 | self::str_split($str) |
@@ -2468,7 +2468,7 @@ discard block |
||
2468 | 2468 | && |
2469 | 2469 | self::$SUPPORT['mbstring'] === false |
2470 | 2470 | ) { |
2471 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2471 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2472 | 2472 | } |
2473 | 2473 | |
2474 | 2474 | do { |
@@ -2489,14 +2489,14 @@ discard block |
||
2489 | 2489 | ); |
2490 | 2490 | } |
2491 | 2491 | } else { |
2492 | - $str = (string) \preg_replace_callback( |
|
2492 | + $str = (string)\preg_replace_callback( |
|
2493 | 2493 | "/&#\d{2,6};/", |
2494 | 2494 | /** |
2495 | 2495 | * @param string[] $matches |
2496 | 2496 | * |
2497 | 2497 | * @return string |
2498 | 2498 | */ |
2499 | - static function (array $matches) use ($encoding): string { |
|
2499 | + static function(array $matches) use ($encoding): string { |
|
2500 | 2500 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
2501 | 2501 | if ($returnTmp !== '"' && $returnTmp !== "'") { |
2502 | 2502 | return $returnTmp; |
@@ -2511,7 +2511,7 @@ discard block |
||
2511 | 2511 | if (\strpos($str, '&') !== false) { |
2512 | 2512 | if (\strpos($str, '&#') !== false) { |
2513 | 2513 | // decode also numeric & UTF16 two byte entities |
2514 | - $str = (string) \preg_replace( |
|
2514 | + $str = (string)\preg_replace( |
|
2515 | 2515 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
2516 | 2516 | '$1;', |
2517 | 2517 | $str |
@@ -2557,7 +2557,7 @@ discard block |
||
2557 | 2557 | */ |
2558 | 2558 | public static function html_stripe_empty_tags(string $str): string |
2559 | 2559 | { |
2560 | - return (string) \preg_replace( |
|
2560 | + return (string)\preg_replace( |
|
2561 | 2561 | "/<[^\/>]*>(([\s]?)*|)<\/[^>]*>/iu", |
2562 | 2562 | '', |
2563 | 2563 | $str |
@@ -2856,9 +2856,9 @@ discard block |
||
2856 | 2856 | { |
2857 | 2857 | $hex = \dechex($int); |
2858 | 2858 | |
2859 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
2859 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
2860 | 2860 | |
2861 | - return $pfix . $hex . ''; |
|
2861 | + return $pfix.$hex.''; |
|
2862 | 2862 | } |
2863 | 2863 | |
2864 | 2864 | /** |
@@ -3125,7 +3125,7 @@ discard block |
||
3125 | 3125 | */ |
3126 | 3126 | public static function is_binary($input, bool $strict = false): bool |
3127 | 3127 | { |
3128 | - $input = (string) $input; |
|
3128 | + $input = (string)$input; |
|
3129 | 3129 | if ($input === '') { |
3130 | 3130 | return false; |
3131 | 3131 | } |
@@ -3384,7 +3384,7 @@ discard block |
||
3384 | 3384 | public static function is_utf16($str, $checkIfStringIsBinary = true) |
3385 | 3385 | { |
3386 | 3386 | // init |
3387 | - $str = (string) $str; |
|
3387 | + $str = (string)$str; |
|
3388 | 3388 | $strChars = []; |
3389 | 3389 | |
3390 | 3390 | if ( |
@@ -3462,7 +3462,7 @@ discard block |
||
3462 | 3462 | public static function is_utf32($str, $checkIfStringIsBinary = true) |
3463 | 3463 | { |
3464 | 3464 | // init |
3465 | - $str = (string) $str; |
|
3465 | + $str = (string)$str; |
|
3466 | 3466 | $strChars = []; |
3467 | 3467 | |
3468 | 3468 | if ( |
@@ -3582,7 +3582,7 @@ discard block |
||
3582 | 3582 | self::$ORD = self::getData('ord'); |
3583 | 3583 | } |
3584 | 3584 | |
3585 | - $len = \strlen((string) $str); |
|
3585 | + $len = \strlen((string)$str); |
|
3586 | 3586 | /** @noinspection ForeachInvariantsInspection */ |
3587 | 3587 | for ($i = 0; $i < $len; ++$i) { |
3588 | 3588 | $in = self::$ORD[$str[$i]]; |
@@ -3819,15 +3819,15 @@ discard block |
||
3819 | 3819 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
3820 | 3820 | |
3821 | 3821 | if ($encoding === 'UTF-8') { |
3822 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
3822 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
3823 | 3823 | |
3824 | 3824 | if ($useMbFunction === true) { |
3825 | 3825 | $strPartOne = \mb_strtolower( |
3826 | - (string) \mb_substr($str, 0, 1) |
|
3826 | + (string)\mb_substr($str, 0, 1) |
|
3827 | 3827 | ); |
3828 | 3828 | } else { |
3829 | 3829 | $strPartOne = self::strtolower( |
3830 | - (string) \mb_substr($str, 0, 1), |
|
3830 | + (string)\mb_substr($str, 0, 1), |
|
3831 | 3831 | $encoding, |
3832 | 3832 | false, |
3833 | 3833 | $lang, |
@@ -3837,10 +3837,10 @@ discard block |
||
3837 | 3837 | } else { |
3838 | 3838 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
3839 | 3839 | |
3840 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
3840 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
3841 | 3841 | |
3842 | 3842 | $strPartOne = self::strtolower( |
3843 | - (string) self::substr($str, 0, 1, $encoding), |
|
3843 | + (string)self::substr($str, 0, 1, $encoding), |
|
3844 | 3844 | $encoding, |
3845 | 3845 | false, |
3846 | 3846 | $lang, |
@@ -3848,7 +3848,7 @@ discard block |
||
3848 | 3848 | ); |
3849 | 3849 | } |
3850 | 3850 | |
3851 | - return $strPartOne . $strPartTwo; |
|
3851 | + return $strPartOne.$strPartTwo; |
|
3852 | 3852 | } |
3853 | 3853 | |
3854 | 3854 | /** |
@@ -3967,7 +3967,7 @@ discard block |
||
3967 | 3967 | |
3968 | 3968 | if (self::$SUPPORT['mbstring'] === true) { |
3969 | 3969 | /** @noinspection PhpComposerExtensionStubsInspection */ |
3970 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
3970 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
3971 | 3971 | } |
3972 | 3972 | |
3973 | 3973 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -4008,7 +4008,7 @@ discard block |
||
4008 | 4008 | { |
4009 | 4009 | $bytes = self::chr_size_list($str); |
4010 | 4010 | if (\count($bytes) > 0) { |
4011 | - return (int) \max($bytes); |
|
4011 | + return (int)\max($bytes); |
|
4012 | 4012 | } |
4013 | 4013 | |
4014 | 4014 | return 0; |
@@ -4078,7 +4078,7 @@ discard block |
||
4078 | 4078 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4079 | 4079 | |
4080 | 4080 | // init |
4081 | - $encoding = (string) $encoding; |
|
4081 | + $encoding = (string)$encoding; |
|
4082 | 4082 | |
4083 | 4083 | if (!$encoding) { |
4084 | 4084 | return $fallback; |
@@ -4132,7 +4132,7 @@ discard block |
||
4132 | 4132 | |
4133 | 4133 | $encodingOrig = $encoding; |
4134 | 4134 | $encoding = \strtoupper($encoding); |
4135 | - $encodingUpperHelper = (string) \preg_replace('/[^a-zA-Z0-9\s]/', '', $encoding); |
|
4135 | + $encodingUpperHelper = (string)\preg_replace('/[^a-zA-Z0-9\s]/', '', $encoding); |
|
4136 | 4136 | |
4137 | 4137 | $equivalences = [ |
4138 | 4138 | 'ISO8859' => 'ISO-8859-1', |
@@ -4290,7 +4290,7 @@ discard block |
||
4290 | 4290 | } |
4291 | 4291 | |
4292 | 4292 | static $WHITESPACE_CACHE = []; |
4293 | - $cacheKey = (int) $keepNonBreakingSpace; |
|
4293 | + $cacheKey = (int)$keepNonBreakingSpace; |
|
4294 | 4294 | |
4295 | 4295 | if (!isset($WHITESPACE_CACHE[$cacheKey])) { |
4296 | 4296 | $WHITESPACE_CACHE[$cacheKey] = self::$WHITESPACE_TABLE; |
@@ -4332,13 +4332,13 @@ discard block |
||
4332 | 4332 | static $CHAR_CACHE = []; |
4333 | 4333 | |
4334 | 4334 | // init |
4335 | - $chr = (string) $chr; |
|
4335 | + $chr = (string)$chr; |
|
4336 | 4336 | |
4337 | 4337 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
4338 | 4338 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4339 | 4339 | } |
4340 | 4340 | |
4341 | - $cacheKey = $chr . $encoding; |
|
4341 | + $cacheKey = $chr.$encoding; |
|
4342 | 4342 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
4343 | 4343 | return $CHAR_CACHE[$cacheKey]; |
4344 | 4344 | } |
@@ -4373,22 +4373,22 @@ discard block |
||
4373 | 4373 | // |
4374 | 4374 | |
4375 | 4375 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
4376 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
4376 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
4377 | 4377 | $code = $chr ? $chr[1] : 0; |
4378 | 4378 | |
4379 | 4379 | if ($code >= 0xF0 && isset($chr[4])) { |
4380 | 4380 | /** @noinspection UnnecessaryCastingInspection */ |
4381 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4381 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4382 | 4382 | } |
4383 | 4383 | |
4384 | 4384 | if ($code >= 0xE0 && isset($chr[3])) { |
4385 | 4385 | /** @noinspection UnnecessaryCastingInspection */ |
4386 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4386 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4387 | 4387 | } |
4388 | 4388 | |
4389 | 4389 | if ($code >= 0xC0 && isset($chr[2])) { |
4390 | 4390 | /** @noinspection UnnecessaryCastingInspection */ |
4391 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4391 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4392 | 4392 | } |
4393 | 4393 | |
4394 | 4394 | return $CHAR_CACHE[$cacheKey] = $code; |
@@ -4437,7 +4437,7 @@ discard block |
||
4437 | 4437 | public static function pcre_utf8_support(): bool |
4438 | 4438 | { |
4439 | 4439 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4440 | - return (bool) @\preg_match('//u', ''); |
|
4440 | + return (bool)@\preg_match('//u', ''); |
|
4441 | 4441 | } |
4442 | 4442 | |
4443 | 4443 | /** |
@@ -4459,10 +4459,10 @@ discard block |
||
4459 | 4459 | } |
4460 | 4460 | |
4461 | 4461 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4462 | - if (\ctype_digit((string) $var1)) { |
|
4463 | - $start = (int) $var1; |
|
4462 | + if (\ctype_digit((string)$var1)) { |
|
4463 | + $start = (int)$var1; |
|
4464 | 4464 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var1)) { |
4465 | - $start = (int) self::hex_to_int($var1); |
|
4465 | + $start = (int)self::hex_to_int($var1); |
|
4466 | 4466 | } else { |
4467 | 4467 | $start = self::ord($var1); |
4468 | 4468 | } |
@@ -4472,10 +4472,10 @@ discard block |
||
4472 | 4472 | } |
4473 | 4473 | |
4474 | 4474 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4475 | - if (\ctype_digit((string) $var2)) { |
|
4476 | - $end = (int) $var2; |
|
4475 | + if (\ctype_digit((string)$var2)) { |
|
4476 | + $end = (int)$var2; |
|
4477 | 4477 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var2)) { |
4478 | - $end = (int) self::hex_to_int($var2); |
|
4478 | + $end = (int)self::hex_to_int($var2); |
|
4479 | 4479 | } else { |
4480 | 4480 | $end = self::ord($var2); |
4481 | 4481 | } |
@@ -4485,8 +4485,8 @@ discard block |
||
4485 | 4485 | } |
4486 | 4486 | |
4487 | 4487 | return \array_map( |
4488 | - static function (int $i): string { |
|
4489 | - return (string) self::chr($i); |
|
4488 | + static function(int $i): string { |
|
4489 | + return (string)self::chr($i); |
|
4490 | 4490 | }, |
4491 | 4491 | \range($start, $end) |
4492 | 4492 | ); |
@@ -4519,7 +4519,7 @@ discard block |
||
4519 | 4519 | |
4520 | 4520 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
4521 | 4521 | if (\preg_match($pattern, $str)) { |
4522 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \rawurldecode($str)); |
|
4522 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \rawurldecode($str)); |
|
4523 | 4523 | } |
4524 | 4524 | |
4525 | 4525 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -4572,8 +4572,8 @@ discard block |
||
4572 | 4572 | $delimiter = '/'; |
4573 | 4573 | } |
4574 | 4574 | |
4575 | - return (string) \preg_replace( |
|
4576 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4575 | + return (string)\preg_replace( |
|
4576 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4577 | 4577 | $replacement, |
4578 | 4578 | $str |
4579 | 4579 | ); |
@@ -4616,9 +4616,9 @@ discard block |
||
4616 | 4616 | return ''; |
4617 | 4617 | } |
4618 | 4618 | |
4619 | - $strLength -= (int) $bomByteLength; |
|
4619 | + $strLength -= (int)$bomByteLength; |
|
4620 | 4620 | |
4621 | - $str = (string) $strTmp; |
|
4621 | + $str = (string)$strTmp; |
|
4622 | 4622 | } |
4623 | 4623 | } |
4624 | 4624 | |
@@ -4642,7 +4642,7 @@ discard block |
||
4642 | 4642 | if (\is_array($what) === true) { |
4643 | 4643 | /** @noinspection ForeachSourceInspection */ |
4644 | 4644 | foreach ($what as $item) { |
4645 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/', $item, $str); |
|
4645 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/', $item, $str); |
|
4646 | 4646 | } |
4647 | 4647 | } |
4648 | 4648 | |
@@ -4674,7 +4674,7 @@ discard block |
||
4674 | 4674 | */ |
4675 | 4675 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
4676 | 4676 | { |
4677 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4677 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4678 | 4678 | } |
4679 | 4679 | |
4680 | 4680 | /** |
@@ -4705,7 +4705,7 @@ discard block |
||
4705 | 4705 | $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
4706 | 4706 | |
4707 | 4707 | do { |
4708 | - $str = (string) \preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4708 | + $str = (string)\preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4709 | 4709 | } while ($count !== 0); |
4710 | 4710 | |
4711 | 4711 | return $str; |
@@ -4724,17 +4724,17 @@ discard block |
||
4724 | 4724 | { |
4725 | 4725 | if ($substring && \strpos($str, $substring) === 0) { |
4726 | 4726 | if ($encoding === 'UTF-8') { |
4727 | - return (string) \mb_substr( |
|
4727 | + return (string)\mb_substr( |
|
4728 | 4728 | $str, |
4729 | - (int) \mb_strlen($substring) |
|
4729 | + (int)\mb_strlen($substring) |
|
4730 | 4730 | ); |
4731 | 4731 | } |
4732 | 4732 | |
4733 | 4733 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4734 | 4734 | |
4735 | - return (string) self::substr( |
|
4735 | + return (string)self::substr( |
|
4736 | 4736 | $str, |
4737 | - (int) self::strlen($substring, $encoding), |
|
4737 | + (int)self::strlen($substring, $encoding), |
|
4738 | 4738 | null, |
4739 | 4739 | $encoding |
4740 | 4740 | ); |
@@ -4756,19 +4756,19 @@ discard block |
||
4756 | 4756 | { |
4757 | 4757 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
4758 | 4758 | if ($encoding === 'UTF-8') { |
4759 | - return (string) \mb_substr( |
|
4759 | + return (string)\mb_substr( |
|
4760 | 4760 | $str, |
4761 | 4761 | 0, |
4762 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
4762 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
4763 | 4763 | ); |
4764 | 4764 | } |
4765 | 4765 | |
4766 | 4766 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4767 | 4767 | |
4768 | - return (string) self::substr( |
|
4768 | + return (string)self::substr( |
|
4769 | 4769 | $str, |
4770 | 4770 | 0, |
4771 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
4771 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
4772 | 4772 | $encoding |
4773 | 4773 | ); |
4774 | 4774 | } |
@@ -4852,7 +4852,7 @@ discard block |
||
4852 | 4852 | $save = \mb_substitute_character(); |
4853 | 4853 | \mb_substitute_character($replacementCharHelper); |
4854 | 4854 | // the polyfill maybe return false, so cast to string |
4855 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4855 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4856 | 4856 | \mb_substitute_character($save); |
4857 | 4857 | } |
4858 | 4858 | |
@@ -4892,7 +4892,7 @@ discard block |
||
4892 | 4892 | |
4893 | 4893 | if (self::$SUPPORT['mbstring'] === true) { |
4894 | 4894 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4895 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4895 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4896 | 4896 | } |
4897 | 4897 | |
4898 | 4898 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -4905,7 +4905,7 @@ discard block |
||
4905 | 4905 | { |
4906 | 4906 | echo '<pre>'; |
4907 | 4907 | foreach (self::$SUPPORT as $key => &$value) { |
4908 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
4908 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
4909 | 4909 | } |
4910 | 4910 | unset($value); |
4911 | 4911 | echo '</pre>'; |
@@ -4934,7 +4934,7 @@ discard block |
||
4934 | 4934 | return $char; |
4935 | 4935 | } |
4936 | 4936 | |
4937 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
4937 | + return '&#'.self::ord($char, $encoding).';'; |
|
4938 | 4938 | } |
4939 | 4939 | |
4940 | 4940 | /** |
@@ -4993,7 +4993,7 @@ discard block |
||
4993 | 4993 | } |
4994 | 4994 | |
4995 | 4995 | // init |
4996 | - $str = (string) $str; |
|
4996 | + $str = (string)$str; |
|
4997 | 4997 | |
4998 | 4998 | if ($str === '') { |
4999 | 4999 | return []; |
@@ -5040,7 +5040,7 @@ discard block |
||
5040 | 5040 | ($str[$i] & "\xE0") === "\xC0" |
5041 | 5041 | ) { |
5042 | 5042 | if (($str[$i + 1] & "\xC0") === "\x80") { |
5043 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
5043 | + $ret[] = $str[$i].$str[$i + 1]; |
|
5044 | 5044 | |
5045 | 5045 | ++$i; |
5046 | 5046 | } |
@@ -5054,7 +5054,7 @@ discard block |
||
5054 | 5054 | && |
5055 | 5055 | ($str[$i + 2] & "\xC0") === "\x80" |
5056 | 5056 | ) { |
5057 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
5057 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
5058 | 5058 | |
5059 | 5059 | $i += 2; |
5060 | 5060 | } |
@@ -5070,7 +5070,7 @@ discard block |
||
5070 | 5070 | && |
5071 | 5071 | ($str[$i + 3] & "\xC0") === "\x80" |
5072 | 5072 | ) { |
5073 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
5073 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
5074 | 5074 | |
5075 | 5075 | $i += 3; |
5076 | 5076 | } |
@@ -5082,7 +5082,7 @@ discard block |
||
5082 | 5082 | $ret = \array_chunk($ret, $length); |
5083 | 5083 | |
5084 | 5084 | return \array_map( |
5085 | - static function (array &$item): string { |
|
5085 | + static function(array &$item): string { |
|
5086 | 5086 | return \implode('', $item); |
5087 | 5087 | }, |
5088 | 5088 | $ret |
@@ -5131,18 +5131,18 @@ discard block |
||
5131 | 5131 | $lang, |
5132 | 5132 | $tryToKeepStringLength |
5133 | 5133 | ); |
5134 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5134 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5135 | 5135 | |
5136 | 5136 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5137 | 5137 | |
5138 | - $str = (string) \preg_replace_callback( |
|
5138 | + $str = (string)\preg_replace_callback( |
|
5139 | 5139 | '/[-_\s]+(.)?/u', |
5140 | 5140 | /** |
5141 | 5141 | * @param array $match |
5142 | 5142 | * |
5143 | 5143 | * @return string |
5144 | 5144 | */ |
5145 | - static function (array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5145 | + static function(array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5146 | 5146 | if (isset($match[1])) { |
5147 | 5147 | if ($useMbFunction === true) { |
5148 | 5148 | if ($encoding === 'UTF-8') { |
@@ -5160,14 +5160,14 @@ discard block |
||
5160 | 5160 | $str |
5161 | 5161 | ); |
5162 | 5162 | |
5163 | - return (string) \preg_replace_callback( |
|
5163 | + return (string)\preg_replace_callback( |
|
5164 | 5164 | '/[\d]+(.)?/u', |
5165 | 5165 | /** |
5166 | 5166 | * @param array $match |
5167 | 5167 | * |
5168 | 5168 | * @return string |
5169 | 5169 | */ |
5170 | - static function (array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5170 | + static function(array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5171 | 5171 | if ($useMbFunction === true) { |
5172 | 5172 | if ($encoding === 'UTF-8') { |
5173 | 5173 | return \mb_strtoupper($match[0]); |
@@ -5339,7 +5339,7 @@ discard block |
||
5339 | 5339 | ): string { |
5340 | 5340 | if (self::$SUPPORT['mbstring'] === true) { |
5341 | 5341 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5342 | - $str = (string) \mb_ereg_replace('\B([A-Z])', '-\1', \trim($str)); |
|
5342 | + $str = (string)\mb_ereg_replace('\B([A-Z])', '-\1', \trim($str)); |
|
5343 | 5343 | |
5344 | 5344 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5345 | 5345 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5349,10 +5349,10 @@ discard block |
||
5349 | 5349 | } |
5350 | 5350 | |
5351 | 5351 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5352 | - return (string) \mb_ereg_replace('[-_\s]+', $delimiter, $str); |
|
5352 | + return (string)\mb_ereg_replace('[-_\s]+', $delimiter, $str); |
|
5353 | 5353 | } |
5354 | 5354 | |
5355 | - $str = (string) \preg_replace('/\B([A-Z])/u', '-\1', \trim($str)); |
|
5355 | + $str = (string)\preg_replace('/\B([A-Z])/u', '-\1', \trim($str)); |
|
5356 | 5356 | |
5357 | 5357 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5358 | 5358 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5361,7 +5361,7 @@ discard block |
||
5361 | 5361 | $str = self::strtolower($str, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
5362 | 5362 | } |
5363 | 5363 | |
5364 | - return (string) \preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
5364 | + return (string)\preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
5365 | 5365 | } |
5366 | 5366 | |
5367 | 5367 | /** |
@@ -5376,7 +5376,7 @@ discard block |
||
5376 | 5376 | public static function str_detect_encoding($str) |
5377 | 5377 | { |
5378 | 5378 | // init |
5379 | - $str = (string) $str; |
|
5379 | + $str = (string)$str; |
|
5380 | 5380 | |
5381 | 5381 | // |
5382 | 5382 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5478,7 +5478,7 @@ discard block |
||
5478 | 5478 | foreach (self::$ENCODINGS as $encodingTmp) { |
5479 | 5479 | // INFO: //IGNORE but still throw notice |
5480 | 5480 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5481 | - if ((string) @\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str) === $str) { |
|
5481 | + if ((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str) === $str) { |
|
5482 | 5482 | return $encodingTmp; |
5483 | 5483 | } |
5484 | 5484 | } |
@@ -5543,7 +5543,7 @@ discard block |
||
5543 | 5543 | return $str; |
5544 | 5544 | } |
5545 | 5545 | |
5546 | - return $substring . $str; |
|
5546 | + return $substring.$str; |
|
5547 | 5547 | } |
5548 | 5548 | |
5549 | 5549 | /** |
@@ -5763,27 +5763,27 @@ discard block |
||
5763 | 5763 | string $encoding = 'UTF-8' |
5764 | 5764 | ): string { |
5765 | 5765 | if ($encoding === 'UTF-8') { |
5766 | - $len = (int) \mb_strlen($str); |
|
5766 | + $len = (int)\mb_strlen($str); |
|
5767 | 5767 | if ($index > $len) { |
5768 | 5768 | return $str; |
5769 | 5769 | } |
5770 | 5770 | |
5771 | 5771 | /** @noinspection UnnecessaryCastingInspection */ |
5772 | - return (string) \mb_substr($str, 0, $index) . |
|
5773 | - $substring . |
|
5774 | - (string) \mb_substr($str, $index, $len); |
|
5772 | + return (string)\mb_substr($str, 0, $index). |
|
5773 | + $substring. |
|
5774 | + (string)\mb_substr($str, $index, $len); |
|
5775 | 5775 | } |
5776 | 5776 | |
5777 | 5777 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5778 | 5778 | |
5779 | - $len = (int) self::strlen($str, $encoding); |
|
5779 | + $len = (int)self::strlen($str, $encoding); |
|
5780 | 5780 | if ($index > $len) { |
5781 | 5781 | return $str; |
5782 | 5782 | } |
5783 | 5783 | |
5784 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
5785 | - $substring . |
|
5786 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5784 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
5785 | + $substring. |
|
5786 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
5787 | 5787 | } |
5788 | 5788 | |
5789 | 5789 | /** |
@@ -5813,15 +5813,15 @@ discard block |
||
5813 | 5813 | */ |
5814 | 5814 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
5815 | 5815 | { |
5816 | - $search = (array) $search; |
|
5816 | + $search = (array)$search; |
|
5817 | 5817 | |
5818 | 5818 | /** @noinspection AlterInForeachInspection */ |
5819 | 5819 | foreach ($search as &$s) { |
5820 | - $s = (string) $s; |
|
5820 | + $s = (string)$s; |
|
5821 | 5821 | if ($s === '') { |
5822 | 5822 | $s = '/^(?<=.)$/'; |
5823 | 5823 | } else { |
5824 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5824 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5825 | 5825 | } |
5826 | 5826 | } |
5827 | 5827 | |
@@ -5853,11 +5853,11 @@ discard block |
||
5853 | 5853 | } |
5854 | 5854 | |
5855 | 5855 | if ($search === '') { |
5856 | - return $str . $replacement; |
|
5856 | + return $str.$replacement; |
|
5857 | 5857 | } |
5858 | 5858 | |
5859 | 5859 | if (\stripos($str, $search) === 0) { |
5860 | - return $replacement . \substr($str, \strlen($search)); |
|
5860 | + return $replacement.\substr($str, \strlen($search)); |
|
5861 | 5861 | } |
5862 | 5862 | |
5863 | 5863 | return $str; |
@@ -5885,11 +5885,11 @@ discard block |
||
5885 | 5885 | } |
5886 | 5886 | |
5887 | 5887 | if ($search === '') { |
5888 | - return $str . $replacement; |
|
5888 | + return $str.$replacement; |
|
5889 | 5889 | } |
5890 | 5890 | |
5891 | 5891 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
5892 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
5892 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
5893 | 5893 | } |
5894 | 5894 | |
5895 | 5895 | return $str; |
@@ -5962,15 +5962,15 @@ discard block |
||
5962 | 5962 | } |
5963 | 5963 | |
5964 | 5964 | if ($encoding === 'UTF-8') { |
5965 | - return (string) \mb_substr( |
|
5965 | + return (string)\mb_substr( |
|
5966 | 5966 | $str, |
5967 | - $offset + (int) \mb_strlen($separator) |
|
5967 | + $offset + (int)\mb_strlen($separator) |
|
5968 | 5968 | ); |
5969 | 5969 | } |
5970 | 5970 | |
5971 | - return (string) self::substr( |
|
5971 | + return (string)self::substr( |
|
5972 | 5972 | $str, |
5973 | - $offset + (int) self::strlen($separator, $encoding), |
|
5973 | + $offset + (int)self::strlen($separator, $encoding), |
|
5974 | 5974 | null, |
5975 | 5975 | $encoding |
5976 | 5976 | ); |
@@ -5997,15 +5997,15 @@ discard block |
||
5997 | 5997 | } |
5998 | 5998 | |
5999 | 5999 | if ($encoding === 'UTF-8') { |
6000 | - return (string) \mb_substr( |
|
6000 | + return (string)\mb_substr( |
|
6001 | 6001 | $str, |
6002 | - $offset + (int) self::strlen($separator) |
|
6002 | + $offset + (int)self::strlen($separator) |
|
6003 | 6003 | ); |
6004 | 6004 | } |
6005 | 6005 | |
6006 | - return (string) self::substr( |
|
6006 | + return (string)self::substr( |
|
6007 | 6007 | $str, |
6008 | - $offset + (int) self::strlen($separator, $encoding), |
|
6008 | + $offset + (int)self::strlen($separator, $encoding), |
|
6009 | 6009 | null, |
6010 | 6010 | $encoding |
6011 | 6011 | ); |
@@ -6032,10 +6032,10 @@ discard block |
||
6032 | 6032 | } |
6033 | 6033 | |
6034 | 6034 | if ($encoding === 'UTF-8') { |
6035 | - return (string) \mb_substr($str, 0, $offset); |
|
6035 | + return (string)\mb_substr($str, 0, $offset); |
|
6036 | 6036 | } |
6037 | 6037 | |
6038 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6038 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6039 | 6039 | } |
6040 | 6040 | |
6041 | 6041 | /** |
@@ -6059,7 +6059,7 @@ discard block |
||
6059 | 6059 | return ''; |
6060 | 6060 | } |
6061 | 6061 | |
6062 | - return (string) \mb_substr($str, 0, $offset); |
|
6062 | + return (string)\mb_substr($str, 0, $offset); |
|
6063 | 6063 | } |
6064 | 6064 | |
6065 | 6065 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6067,7 +6067,7 @@ discard block |
||
6067 | 6067 | return ''; |
6068 | 6068 | } |
6069 | 6069 | |
6070 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6070 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6071 | 6071 | } |
6072 | 6072 | |
6073 | 6073 | /** |
@@ -6155,12 +6155,12 @@ discard block |
||
6155 | 6155 | } |
6156 | 6156 | |
6157 | 6157 | if ($encoding === 'UTF-8') { |
6158 | - return (string) \mb_substr($str, -$n); |
|
6158 | + return (string)\mb_substr($str, -$n); |
|
6159 | 6159 | } |
6160 | 6160 | |
6161 | 6161 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6162 | 6162 | |
6163 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6163 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6164 | 6164 | } |
6165 | 6165 | |
6166 | 6166 | /** |
@@ -6184,21 +6184,21 @@ discard block |
||
6184 | 6184 | } |
6185 | 6185 | |
6186 | 6186 | if ($encoding === 'UTF-8') { |
6187 | - if ((int) \mb_strlen($str) <= $length) { |
|
6187 | + if ((int)\mb_strlen($str) <= $length) { |
|
6188 | 6188 | return $str; |
6189 | 6189 | } |
6190 | 6190 | |
6191 | 6191 | /** @noinspection UnnecessaryCastingInspection */ |
6192 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($strAddOn)) . $strAddOn; |
|
6192 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($strAddOn)).$strAddOn; |
|
6193 | 6193 | } |
6194 | 6194 | |
6195 | 6195 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6196 | 6196 | |
6197 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6197 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6198 | 6198 | return $str; |
6199 | 6199 | } |
6200 | 6200 | |
6201 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($strAddOn), $encoding)) . $strAddOn; |
|
6201 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($strAddOn), $encoding)).$strAddOn; |
|
6202 | 6202 | } |
6203 | 6203 | |
6204 | 6204 | /** |
@@ -6223,12 +6223,12 @@ discard block |
||
6223 | 6223 | |
6224 | 6224 | if ($encoding === 'UTF-8') { |
6225 | 6225 | /** @noinspection UnnecessaryCastingInspection */ |
6226 | - if ((int) \mb_strlen($str) <= $length) { |
|
6226 | + if ((int)\mb_strlen($str) <= $length) { |
|
6227 | 6227 | return $str; |
6228 | 6228 | } |
6229 | 6229 | |
6230 | 6230 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6231 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6231 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6232 | 6232 | } |
6233 | 6233 | |
6234 | 6234 | $str = \mb_substr($str, 0, $length); |
@@ -6238,20 +6238,20 @@ discard block |
||
6238 | 6238 | $new_str = \implode(' ', $array); |
6239 | 6239 | |
6240 | 6240 | if ($new_str === '') { |
6241 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6241 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6242 | 6242 | } |
6243 | 6243 | } else { |
6244 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6244 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6245 | 6245 | return $str; |
6246 | 6246 | } |
6247 | 6247 | |
6248 | 6248 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6249 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6249 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6250 | 6250 | } |
6251 | 6251 | |
6252 | 6252 | $str = self::substr($str, 0, $length, $encoding); |
6253 | 6253 | if ($str === false) { |
6254 | - return '' . $strAddOn; |
|
6254 | + return ''.$strAddOn; |
|
6255 | 6255 | } |
6256 | 6256 | |
6257 | 6257 | $array = \explode(' ', $str); |
@@ -6259,11 +6259,11 @@ discard block |
||
6259 | 6259 | $new_str = \implode(' ', $array); |
6260 | 6260 | |
6261 | 6261 | if ($new_str === '') { |
6262 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6262 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6263 | 6263 | } |
6264 | 6264 | } |
6265 | 6265 | |
6266 | - return $new_str . $strAddOn; |
|
6266 | + return $new_str.$strAddOn; |
|
6267 | 6267 | } |
6268 | 6268 | |
6269 | 6269 | /** |
@@ -6281,7 +6281,7 @@ discard block |
||
6281 | 6281 | $longestCommonPrefix = ''; |
6282 | 6282 | |
6283 | 6283 | if ($encoding === 'UTF-8') { |
6284 | - $maxLength = (int) \min( |
|
6284 | + $maxLength = (int)\min( |
|
6285 | 6285 | \mb_strlen($str), |
6286 | 6286 | \mb_strlen($otherStr) |
6287 | 6287 | ); |
@@ -6302,7 +6302,7 @@ discard block |
||
6302 | 6302 | } else { |
6303 | 6303 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6304 | 6304 | |
6305 | - $maxLength = (int) \min( |
|
6305 | + $maxLength = (int)\min( |
|
6306 | 6306 | self::strlen($str, $encoding), |
6307 | 6307 | self::strlen($otherStr, $encoding) |
6308 | 6308 | ); |
@@ -6345,13 +6345,13 @@ discard block |
||
6345 | 6345 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6346 | 6346 | |
6347 | 6347 | if ($encoding === 'UTF-8') { |
6348 | - $strLength = (int) \mb_strlen($str); |
|
6349 | - $otherLength = (int) \mb_strlen($otherStr); |
|
6348 | + $strLength = (int)\mb_strlen($str); |
|
6349 | + $otherLength = (int)\mb_strlen($otherStr); |
|
6350 | 6350 | } else { |
6351 | 6351 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6352 | 6352 | |
6353 | - $strLength = (int) self::strlen($str, $encoding); |
|
6354 | - $otherLength = (int) self::strlen($otherStr, $encoding); |
|
6353 | + $strLength = (int)self::strlen($str, $encoding); |
|
6354 | + $otherLength = (int)self::strlen($otherStr, $encoding); |
|
6355 | 6355 | } |
6356 | 6356 | |
6357 | 6357 | // Return if either string is empty |
@@ -6404,10 +6404,10 @@ discard block |
||
6404 | 6404 | } |
6405 | 6405 | |
6406 | 6406 | if ($encoding === 'UTF-8') { |
6407 | - return (string) \mb_substr($str, $end - $len, $len); |
|
6407 | + return (string)\mb_substr($str, $end - $len, $len); |
|
6408 | 6408 | } |
6409 | 6409 | |
6410 | - return (string) self::substr($str, $end - $len, $len, $encoding); |
|
6410 | + return (string)self::substr($str, $end - $len, $len, $encoding); |
|
6411 | 6411 | } |
6412 | 6412 | |
6413 | 6413 | /** |
@@ -6426,7 +6426,7 @@ discard block |
||
6426 | 6426 | } |
6427 | 6427 | |
6428 | 6428 | if ($encoding === 'UTF-8') { |
6429 | - $maxLength = (int) \min( |
|
6429 | + $maxLength = (int)\min( |
|
6430 | 6430 | \mb_strlen($str, $encoding), |
6431 | 6431 | \mb_strlen($otherStr, $encoding) |
6432 | 6432 | ); |
@@ -6440,7 +6440,7 @@ discard block |
||
6440 | 6440 | && |
6441 | 6441 | $char === \mb_substr($otherStr, -$i, 1) |
6442 | 6442 | ) { |
6443 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6443 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6444 | 6444 | } else { |
6445 | 6445 | break; |
6446 | 6446 | } |
@@ -6448,7 +6448,7 @@ discard block |
||
6448 | 6448 | } else { |
6449 | 6449 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6450 | 6450 | |
6451 | - $maxLength = (int) \min( |
|
6451 | + $maxLength = (int)\min( |
|
6452 | 6452 | self::strlen($str, $encoding), |
6453 | 6453 | self::strlen($otherStr, $encoding) |
6454 | 6454 | ); |
@@ -6462,7 +6462,7 @@ discard block |
||
6462 | 6462 | && |
6463 | 6463 | $char === self::substr($otherStr, -$i, 1, $encoding) |
6464 | 6464 | ) { |
6465 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6465 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6466 | 6466 | } else { |
6467 | 6467 | break; |
6468 | 6468 | } |
@@ -6482,7 +6482,7 @@ discard block |
||
6482 | 6482 | */ |
6483 | 6483 | public static function str_matches_pattern(string $str, string $pattern): bool |
6484 | 6484 | { |
6485 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
6485 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
6486 | 6486 | } |
6487 | 6487 | |
6488 | 6488 | /** |
@@ -6499,7 +6499,7 @@ discard block |
||
6499 | 6499 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
6500 | 6500 | { |
6501 | 6501 | // init |
6502 | - $length = (int) self::strlen($str, $encoding); |
|
6502 | + $length = (int)self::strlen($str, $encoding); |
|
6503 | 6503 | |
6504 | 6504 | if ($offset >= 0) { |
6505 | 6505 | return $length > $offset; |
@@ -6525,7 +6525,7 @@ discard block |
||
6525 | 6525 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
6526 | 6526 | { |
6527 | 6527 | // init |
6528 | - $length = (int) self::strlen($str); |
|
6528 | + $length = (int)self::strlen($str); |
|
6529 | 6529 | |
6530 | 6530 | if ( |
6531 | 6531 | ($index >= 0 && $length <= $index) |
@@ -6564,7 +6564,7 @@ discard block |
||
6564 | 6564 | return $str; |
6565 | 6565 | } |
6566 | 6566 | |
6567 | - if ($pad_type !== (int) $pad_type) { |
|
6567 | + if ($pad_type !== (int)$pad_type) { |
|
6568 | 6568 | if ($pad_type === 'left') { |
6569 | 6569 | $pad_type = \STR_PAD_LEFT; |
6570 | 6570 | } elseif ($pad_type === 'right') { |
@@ -6573,23 +6573,23 @@ discard block |
||
6573 | 6573 | $pad_type = \STR_PAD_BOTH; |
6574 | 6574 | } else { |
6575 | 6575 | throw new \InvalidArgumentException( |
6576 | - 'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
6576 | + 'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
6577 | 6577 | ); |
6578 | 6578 | } |
6579 | 6579 | } |
6580 | 6580 | |
6581 | 6581 | if ($encoding === 'UTF-8') { |
6582 | - $str_length = (int) \mb_strlen($str); |
|
6582 | + $str_length = (int)\mb_strlen($str); |
|
6583 | 6583 | |
6584 | 6584 | if ($pad_length >= $str_length) { |
6585 | 6585 | switch ($pad_type) { |
6586 | 6586 | case \STR_PAD_LEFT: |
6587 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6587 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6588 | 6588 | |
6589 | 6589 | $diff = ($pad_length - $str_length); |
6590 | 6590 | |
6591 | - $pre = (string) \mb_substr( |
|
6592 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6591 | + $pre = (string)\mb_substr( |
|
6592 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6593 | 6593 | 0, |
6594 | 6594 | $diff |
6595 | 6595 | ); |
@@ -6600,16 +6600,16 @@ discard block |
||
6600 | 6600 | case \STR_PAD_BOTH: |
6601 | 6601 | $diff = ($pad_length - $str_length); |
6602 | 6602 | |
6603 | - $ps_length_left = (int) \floor($diff / 2); |
|
6603 | + $ps_length_left = (int)\floor($diff / 2); |
|
6604 | 6604 | |
6605 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6605 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6606 | 6606 | |
6607 | - $pre = (string) \mb_substr( |
|
6607 | + $pre = (string)\mb_substr( |
|
6608 | 6608 | \str_repeat($pad_string, $ps_length_left), |
6609 | 6609 | 0, |
6610 | 6610 | $ps_length_left |
6611 | 6611 | ); |
6612 | - $post = (string) \mb_substr( |
|
6612 | + $post = (string)\mb_substr( |
|
6613 | 6613 | \str_repeat($pad_string, $ps_length_right), |
6614 | 6614 | 0, |
6615 | 6615 | $ps_length_right |
@@ -6619,19 +6619,19 @@ discard block |
||
6619 | 6619 | |
6620 | 6620 | case \STR_PAD_RIGHT: |
6621 | 6621 | default: |
6622 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6622 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6623 | 6623 | |
6624 | 6624 | $diff = ($pad_length - $str_length); |
6625 | 6625 | |
6626 | - $post = (string) \mb_substr( |
|
6627 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6626 | + $post = (string)\mb_substr( |
|
6627 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6628 | 6628 | 0, |
6629 | 6629 | $diff |
6630 | 6630 | ); |
6631 | 6631 | $pre = ''; |
6632 | 6632 | } |
6633 | 6633 | |
6634 | - return $pre . $str . $post; |
|
6634 | + return $pre.$str.$post; |
|
6635 | 6635 | } |
6636 | 6636 | |
6637 | 6637 | return $str; |
@@ -6639,17 +6639,17 @@ discard block |
||
6639 | 6639 | |
6640 | 6640 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6641 | 6641 | |
6642 | - $str_length = (int) self::strlen($str, $encoding); |
|
6642 | + $str_length = (int)self::strlen($str, $encoding); |
|
6643 | 6643 | |
6644 | 6644 | if ($pad_length >= $str_length) { |
6645 | 6645 | switch ($pad_type) { |
6646 | 6646 | case \STR_PAD_LEFT: |
6647 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6647 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6648 | 6648 | |
6649 | 6649 | $diff = ($pad_length - $str_length); |
6650 | 6650 | |
6651 | - $pre = (string) self::substr( |
|
6652 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6651 | + $pre = (string)self::substr( |
|
6652 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6653 | 6653 | 0, |
6654 | 6654 | $diff, |
6655 | 6655 | $encoding |
@@ -6661,17 +6661,17 @@ discard block |
||
6661 | 6661 | case \STR_PAD_BOTH: |
6662 | 6662 | $diff = ($pad_length - $str_length); |
6663 | 6663 | |
6664 | - $ps_length_left = (int) \floor($diff / 2); |
|
6664 | + $ps_length_left = (int)\floor($diff / 2); |
|
6665 | 6665 | |
6666 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6666 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6667 | 6667 | |
6668 | - $pre = (string) self::substr( |
|
6668 | + $pre = (string)self::substr( |
|
6669 | 6669 | \str_repeat($pad_string, $ps_length_left), |
6670 | 6670 | 0, |
6671 | 6671 | $ps_length_left, |
6672 | 6672 | $encoding |
6673 | 6673 | ); |
6674 | - $post = (string) self::substr( |
|
6674 | + $post = (string)self::substr( |
|
6675 | 6675 | \str_repeat($pad_string, $ps_length_right), |
6676 | 6676 | 0, |
6677 | 6677 | $ps_length_right, |
@@ -6682,12 +6682,12 @@ discard block |
||
6682 | 6682 | |
6683 | 6683 | case \STR_PAD_RIGHT: |
6684 | 6684 | default: |
6685 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6685 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6686 | 6686 | |
6687 | 6687 | $diff = ($pad_length - $str_length); |
6688 | 6688 | |
6689 | - $post = (string) self::substr( |
|
6690 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6689 | + $post = (string)self::substr( |
|
6690 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6691 | 6691 | 0, |
6692 | 6692 | $diff, |
6693 | 6693 | $encoding |
@@ -6695,7 +6695,7 @@ discard block |
||
6695 | 6695 | $pre = ''; |
6696 | 6696 | } |
6697 | 6697 | |
6698 | - return $pre . $str . $post; |
|
6698 | + return $pre.$str.$post; |
|
6699 | 6699 | } |
6700 | 6700 | |
6701 | 6701 | return $str; |
@@ -6847,11 +6847,11 @@ discard block |
||
6847 | 6847 | } |
6848 | 6848 | |
6849 | 6849 | if ($search === '') { |
6850 | - return $str . $replacement; |
|
6850 | + return $str.$replacement; |
|
6851 | 6851 | } |
6852 | 6852 | |
6853 | 6853 | if (\strpos($str, $search) === 0) { |
6854 | - return $replacement . \substr($str, \strlen($search)); |
|
6854 | + return $replacement.\substr($str, \strlen($search)); |
|
6855 | 6855 | } |
6856 | 6856 | |
6857 | 6857 | return $str; |
@@ -6879,11 +6879,11 @@ discard block |
||
6879 | 6879 | } |
6880 | 6880 | |
6881 | 6881 | if ($search === '') { |
6882 | - return $str . $replacement; |
|
6882 | + return $str.$replacement; |
|
6883 | 6883 | } |
6884 | 6884 | |
6885 | 6885 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6886 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6886 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6887 | 6887 | } |
6888 | 6888 | |
6889 | 6889 | return $str; |
@@ -6906,7 +6906,7 @@ discard block |
||
6906 | 6906 | |
6907 | 6907 | if ($pos !== false) { |
6908 | 6908 | /** @psalm-suppress InvalidReturnStatement */ |
6909 | - return self::substr_replace($subject, $replace, $pos, (int) self::strlen($search)); |
|
6909 | + return self::substr_replace($subject, $replace, $pos, (int)self::strlen($search)); |
|
6910 | 6910 | } |
6911 | 6911 | |
6912 | 6912 | return $subject; |
@@ -6931,7 +6931,7 @@ discard block |
||
6931 | 6931 | $pos = self::strrpos($subject, $search); |
6932 | 6932 | if ($pos !== false) { |
6933 | 6933 | /** @psalm-suppress InvalidReturnStatement */ |
6934 | - return self::substr_replace($subject, $replace, $pos, (int) self::strlen($search)); |
|
6934 | + return self::substr_replace($subject, $replace, $pos, (int)self::strlen($search)); |
|
6935 | 6935 | } |
6936 | 6936 | |
6937 | 6937 | return $subject; |
@@ -6950,7 +6950,7 @@ discard block |
||
6950 | 6950 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
6951 | 6951 | { |
6952 | 6952 | if ($encoding === 'UTF-8') { |
6953 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
6953 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
6954 | 6954 | /** @noinspection NonSecureShuffleUsageInspection */ |
6955 | 6955 | \shuffle($indexes); |
6956 | 6956 | |
@@ -6966,7 +6966,7 @@ discard block |
||
6966 | 6966 | } else { |
6967 | 6967 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6968 | 6968 | |
6969 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
6969 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
6970 | 6970 | /** @noinspection NonSecureShuffleUsageInspection */ |
6971 | 6971 | \shuffle($indexes); |
6972 | 6972 | |
@@ -7007,11 +7007,11 @@ discard block |
||
7007 | 7007 | ) { |
7008 | 7008 | if ($encoding === 'UTF-8') { |
7009 | 7009 | if ($end === null) { |
7010 | - $length = (int) \mb_strlen($str); |
|
7010 | + $length = (int)\mb_strlen($str); |
|
7011 | 7011 | } elseif ($end >= 0 && $end <= $start) { |
7012 | 7012 | return ''; |
7013 | 7013 | } elseif ($end < 0) { |
7014 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7014 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7015 | 7015 | } else { |
7016 | 7016 | $length = $end - $start; |
7017 | 7017 | } |
@@ -7022,11 +7022,11 @@ discard block |
||
7022 | 7022 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7023 | 7023 | |
7024 | 7024 | if ($end === null) { |
7025 | - $length = (int) self::strlen($str, $encoding); |
|
7025 | + $length = (int)self::strlen($str, $encoding); |
|
7026 | 7026 | } elseif ($end >= 0 && $end <= $start) { |
7027 | 7027 | return ''; |
7028 | 7028 | } elseif ($end < 0) { |
7029 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7029 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7030 | 7030 | } else { |
7031 | 7031 | $length = $end - $start; |
7032 | 7032 | } |
@@ -7058,35 +7058,35 @@ discard block |
||
7058 | 7058 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7059 | 7059 | } |
7060 | 7060 | |
7061 | - $str = (string) \preg_replace_callback( |
|
7061 | + $str = (string)\preg_replace_callback( |
|
7062 | 7062 | '/([\d|A-Z])/u', |
7063 | 7063 | /** |
7064 | 7064 | * @param string[] $matches |
7065 | 7065 | * |
7066 | 7066 | * @return string |
7067 | 7067 | */ |
7068 | - static function (array $matches) use ($encoding): string { |
|
7068 | + static function(array $matches) use ($encoding): string { |
|
7069 | 7069 | $match = $matches[1]; |
7070 | - $matchInt = (int) $match; |
|
7070 | + $matchInt = (int)$match; |
|
7071 | 7071 | |
7072 | - if ((string) $matchInt === $match) { |
|
7073 | - return '_' . $match . '_'; |
|
7072 | + if ((string)$matchInt === $match) { |
|
7073 | + return '_'.$match.'_'; |
|
7074 | 7074 | } |
7075 | 7075 | |
7076 | 7076 | if ($encoding === 'UTF-8') { |
7077 | - return '_' . \mb_strtolower($match); |
|
7077 | + return '_'.\mb_strtolower($match); |
|
7078 | 7078 | } |
7079 | 7079 | |
7080 | - return '_' . self::strtolower($match, $encoding); |
|
7080 | + return '_'.self::strtolower($match, $encoding); |
|
7081 | 7081 | }, |
7082 | 7082 | $str |
7083 | 7083 | ); |
7084 | 7084 | |
7085 | - $str = (string) \preg_replace( |
|
7085 | + $str = (string)\preg_replace( |
|
7086 | 7086 | [ |
7087 | - '/\s+/', // convert spaces to "_" |
|
7088 | - '/^\s+|\s+$/', // trim leading & trailing spaces |
|
7089 | - '/_+/', // remove double "_" |
|
7087 | + '/\s+/', // convert spaces to "_" |
|
7088 | + '/^\s+|\s+$/', // trim leading & trailing spaces |
|
7089 | + '/_+/', // remove double "_" |
|
7090 | 7090 | ], |
7091 | 7091 | [ |
7092 | 7092 | '_', |
@@ -7170,7 +7170,7 @@ discard block |
||
7170 | 7170 | /** @noinspection PhpComposerExtensionStubsInspection */ |
7171 | 7171 | return \array_filter( |
7172 | 7172 | \mb_split($pattern, $str), |
7173 | - static function () use (&$limit): bool { |
|
7173 | + static function() use (&$limit): bool { |
|
7174 | 7174 | return --$limit >= 0; |
7175 | 7175 | } |
7176 | 7176 | ); |
@@ -7186,7 +7186,7 @@ discard block |
||
7186 | 7186 | $limit = -1; |
7187 | 7187 | } |
7188 | 7188 | |
7189 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7189 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7190 | 7190 | |
7191 | 7191 | if ($array === false) { |
7192 | 7192 | return []; |
@@ -7262,9 +7262,9 @@ discard block |
||
7262 | 7262 | return ''; |
7263 | 7263 | } |
7264 | 7264 | |
7265 | - return (string) \mb_substr( |
|
7265 | + return (string)\mb_substr( |
|
7266 | 7266 | $str, |
7267 | - $offset + (int) \mb_strlen($separator) |
|
7267 | + $offset + (int)\mb_strlen($separator) |
|
7268 | 7268 | ); |
7269 | 7269 | } |
7270 | 7270 | |
@@ -7273,9 +7273,9 @@ discard block |
||
7273 | 7273 | return ''; |
7274 | 7274 | } |
7275 | 7275 | |
7276 | - return (string) \mb_substr( |
|
7276 | + return (string)\mb_substr( |
|
7277 | 7277 | $str, |
7278 | - $offset + (int) self::strlen($separator, $encoding), |
|
7278 | + $offset + (int)self::strlen($separator, $encoding), |
|
7279 | 7279 | null, |
7280 | 7280 | $encoding |
7281 | 7281 | ); |
@@ -7302,9 +7302,9 @@ discard block |
||
7302 | 7302 | return ''; |
7303 | 7303 | } |
7304 | 7304 | |
7305 | - return (string) \mb_substr( |
|
7305 | + return (string)\mb_substr( |
|
7306 | 7306 | $str, |
7307 | - $offset + (int) \mb_strlen($separator) |
|
7307 | + $offset + (int)\mb_strlen($separator) |
|
7308 | 7308 | ); |
7309 | 7309 | } |
7310 | 7310 | |
@@ -7313,9 +7313,9 @@ discard block |
||
7313 | 7313 | return ''; |
7314 | 7314 | } |
7315 | 7315 | |
7316 | - return (string) self::substr( |
|
7316 | + return (string)self::substr( |
|
7317 | 7317 | $str, |
7318 | - $offset + (int) self::strlen($separator, $encoding), |
|
7318 | + $offset + (int)self::strlen($separator, $encoding), |
|
7319 | 7319 | null, |
7320 | 7320 | $encoding |
7321 | 7321 | ); |
@@ -7345,7 +7345,7 @@ discard block |
||
7345 | 7345 | return ''; |
7346 | 7346 | } |
7347 | 7347 | |
7348 | - return (string) \mb_substr( |
|
7348 | + return (string)\mb_substr( |
|
7349 | 7349 | $str, |
7350 | 7350 | 0, |
7351 | 7351 | $offset |
@@ -7357,7 +7357,7 @@ discard block |
||
7357 | 7357 | return ''; |
7358 | 7358 | } |
7359 | 7359 | |
7360 | - return (string) self::substr( |
|
7360 | + return (string)self::substr( |
|
7361 | 7361 | $str, |
7362 | 7362 | 0, |
7363 | 7363 | $offset, |
@@ -7386,7 +7386,7 @@ discard block |
||
7386 | 7386 | return ''; |
7387 | 7387 | } |
7388 | 7388 | |
7389 | - return (string) \mb_substr( |
|
7389 | + return (string)\mb_substr( |
|
7390 | 7390 | $str, |
7391 | 7391 | 0, |
7392 | 7392 | $offset |
@@ -7400,7 +7400,7 @@ discard block |
||
7400 | 7400 | |
7401 | 7401 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7402 | 7402 | |
7403 | - return (string) self::substr( |
|
7403 | + return (string)self::substr( |
|
7404 | 7404 | $str, |
7405 | 7405 | 0, |
7406 | 7406 | $offset, |
@@ -7508,7 +7508,7 @@ discard block |
||
7508 | 7508 | */ |
7509 | 7509 | public static function str_surround(string $str, string $substring): string |
7510 | 7510 | { |
7511 | - return $substring . $str . $substring; |
|
7511 | + return $substring.$str.$substring; |
|
7512 | 7512 | } |
7513 | 7513 | |
7514 | 7514 | /** |
@@ -7552,9 +7552,9 @@ discard block |
||
7552 | 7552 | |
7553 | 7553 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
7554 | 7554 | |
7555 | - return (string) \preg_replace_callback( |
|
7555 | + return (string)\preg_replace_callback( |
|
7556 | 7556 | '/([\S]+)/u', |
7557 | - static function (array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7557 | + static function(array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7558 | 7558 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
7559 | 7559 | return $match[0]; |
7560 | 7560 | } |
@@ -7640,16 +7640,16 @@ discard block |
||
7640 | 7640 | } |
7641 | 7641 | |
7642 | 7642 | // the main substitutions |
7643 | - $str = (string) \preg_replace_callback( |
|
7643 | + $str = (string)\preg_replace_callback( |
|
7644 | 7644 | '~\b (_*) (?: # 1. Leading underscore and |
7645 | 7645 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
7646 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) # URL, domain, or email |
|
7646 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) # URL, domain, or email |
|
7647 | 7647 | | |
7648 | - ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' ) # 3. or small word (case-insensitive) |
|
7648 | + ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' ) # 3. or small word (case-insensitive) |
|
7649 | 7649 | | |
7650 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 4. or word w/o internal caps |
|
7650 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 4. or word w/o internal caps |
|
7651 | 7651 | | |
7652 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 5. or some other word |
|
7652 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 5. or some other word |
|
7653 | 7653 | ) (_*) \b # 6. With trailing underscore |
7654 | 7654 | ~ux', |
7655 | 7655 | /** |
@@ -7657,7 +7657,7 @@ discard block |
||
7657 | 7657 | * |
7658 | 7658 | * @return string |
7659 | 7659 | */ |
7660 | - static function (array $matches) use ($encoding): string { |
|
7660 | + static function(array $matches) use ($encoding): string { |
|
7661 | 7661 | // preserve leading underscore |
7662 | 7662 | $str = $matches[1]; |
7663 | 7663 | if ($matches[2]) { |
@@ -7682,26 +7682,26 @@ discard block |
||
7682 | 7682 | ); |
7683 | 7683 | |
7684 | 7684 | // Exceptions for small words: capitalize at start of title... |
7685 | - $str = (string) \preg_replace_callback( |
|
7685 | + $str = (string)\preg_replace_callback( |
|
7686 | 7686 | '~( \A [[:punct:]]* # start of title... |
7687 | 7687 | | [:.;?!][ ]+ # or of subsentence... |
7688 | 7688 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
7689 | - ( ' . $smallWordsRx . ' ) \b # ...followed by small word |
|
7689 | + ( ' . $smallWordsRx.' ) \b # ...followed by small word |
|
7690 | 7690 | ~uxi', |
7691 | 7691 | /** |
7692 | 7692 | * @param string[] $matches |
7693 | 7693 | * |
7694 | 7694 | * @return string |
7695 | 7695 | */ |
7696 | - static function (array $matches) use ($encoding): string { |
|
7697 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7696 | + static function(array $matches) use ($encoding): string { |
|
7697 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7698 | 7698 | }, |
7699 | 7699 | $str |
7700 | 7700 | ); |
7701 | 7701 | |
7702 | 7702 | // ...and end of title |
7703 | - $str = (string) \preg_replace_callback( |
|
7704 | - '~\b ( ' . $smallWordsRx . ' ) # small word... |
|
7703 | + $str = (string)\preg_replace_callback( |
|
7704 | + '~\b ( '.$smallWordsRx.' ) # small word... |
|
7705 | 7705 | (?= [[:punct:]]* \Z # ...at the end of the title... |
7706 | 7706 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
7707 | 7707 | ~uxi', |
@@ -7710,7 +7710,7 @@ discard block |
||
7710 | 7710 | * |
7711 | 7711 | * @return string |
7712 | 7712 | */ |
7713 | - static function (array $matches) use ($encoding): string { |
|
7713 | + static function(array $matches) use ($encoding): string { |
|
7714 | 7714 | return static::str_upper_first($matches[1], $encoding); |
7715 | 7715 | }, |
7716 | 7716 | $str |
@@ -7718,10 +7718,10 @@ discard block |
||
7718 | 7718 | |
7719 | 7719 | // Exceptions for small words in hyphenated compound words. |
7720 | 7720 | // e.g. "in-flight" -> In-Flight |
7721 | - $str = (string) \preg_replace_callback( |
|
7721 | + $str = (string)\preg_replace_callback( |
|
7722 | 7722 | '~\b |
7723 | 7723 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
7724 | - ( ' . $smallWordsRx . ' ) |
|
7724 | + ( ' . $smallWordsRx.' ) |
|
7725 | 7725 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
7726 | 7726 | ~uxi', |
7727 | 7727 | /** |
@@ -7729,18 +7729,18 @@ discard block |
||
7729 | 7729 | * |
7730 | 7730 | * @return string |
7731 | 7731 | */ |
7732 | - static function (array $matches) use ($encoding): string { |
|
7732 | + static function(array $matches) use ($encoding): string { |
|
7733 | 7733 | return static::str_upper_first($matches[1], $encoding); |
7734 | 7734 | }, |
7735 | 7735 | $str |
7736 | 7736 | ); |
7737 | 7737 | |
7738 | 7738 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
7739 | - $str = (string) \preg_replace_callback( |
|
7739 | + $str = (string)\preg_replace_callback( |
|
7740 | 7740 | '~\b |
7741 | 7741 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
7742 | 7742 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
7743 | - ( ' . $smallWordsRx . ' ) # ...followed by small word |
|
7743 | + ( ' . $smallWordsRx.' ) # ...followed by small word |
|
7744 | 7744 | (?! - ) # Negative lookahead for another - |
7745 | 7745 | ~uxi', |
7746 | 7746 | /** |
@@ -7748,8 +7748,8 @@ discard block |
||
7748 | 7748 | * |
7749 | 7749 | * @return string |
7750 | 7750 | */ |
7751 | - static function (array $matches) use ($encoding): string { |
|
7752 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7751 | + static function(array $matches) use ($encoding): string { |
|
7752 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7753 | 7753 | }, |
7754 | 7754 | $str |
7755 | 7755 | ); |
@@ -7852,7 +7852,7 @@ discard block |
||
7852 | 7852 | ); |
7853 | 7853 | |
7854 | 7854 | foreach ($tmpReturn as &$item) { |
7855 | - $item = (string) $item; |
|
7855 | + $item = (string)$item; |
|
7856 | 7856 | } |
7857 | 7857 | |
7858 | 7858 | return $tmpReturn; |
@@ -7897,37 +7897,37 @@ discard block |
||
7897 | 7897 | } |
7898 | 7898 | |
7899 | 7899 | if ($encoding === 'UTF-8') { |
7900 | - if ($length >= (int) \mb_strlen($str)) { |
|
7900 | + if ($length >= (int)\mb_strlen($str)) { |
|
7901 | 7901 | return $str; |
7902 | 7902 | } |
7903 | 7903 | |
7904 | 7904 | if ($substring !== '') { |
7905 | - $length -= (int) \mb_strlen($substring); |
|
7905 | + $length -= (int)\mb_strlen($substring); |
|
7906 | 7906 | |
7907 | 7907 | /** @noinspection UnnecessaryCastingInspection */ |
7908 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
7908 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
7909 | 7909 | } |
7910 | 7910 | |
7911 | 7911 | /** @noinspection UnnecessaryCastingInspection */ |
7912 | - return (string) \mb_substr($str, 0, $length); |
|
7912 | + return (string)\mb_substr($str, 0, $length); |
|
7913 | 7913 | } |
7914 | 7914 | |
7915 | 7915 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7916 | 7916 | |
7917 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
7917 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
7918 | 7918 | return $str; |
7919 | 7919 | } |
7920 | 7920 | |
7921 | 7921 | if ($substring !== '') { |
7922 | - $length -= (int) self::strlen($substring, $encoding); |
|
7922 | + $length -= (int)self::strlen($substring, $encoding); |
|
7923 | 7923 | } |
7924 | 7924 | |
7925 | - return ((string) self::substr( |
|
7925 | + return ((string)self::substr( |
|
7926 | 7926 | $str, |
7927 | 7927 | 0, |
7928 | 7928 | $length, |
7929 | 7929 | $encoding |
7930 | - )) . $substring; |
|
7930 | + )).$substring; |
|
7931 | 7931 | } |
7932 | 7932 | |
7933 | 7933 | /** |
@@ -7957,12 +7957,12 @@ discard block |
||
7957 | 7957 | } |
7958 | 7958 | |
7959 | 7959 | if ($encoding === 'UTF-8') { |
7960 | - if ($length >= (int) \mb_strlen($str)) { |
|
7960 | + if ($length >= (int)\mb_strlen($str)) { |
|
7961 | 7961 | return $str; |
7962 | 7962 | } |
7963 | 7963 | |
7964 | 7964 | // need to further trim the string so we can append the substring |
7965 | - $length -= (int) \mb_strlen($substring); |
|
7965 | + $length -= (int)\mb_strlen($substring); |
|
7966 | 7966 | if ($length <= 0) { |
7967 | 7967 | return $substring; |
7968 | 7968 | } |
@@ -7984,18 +7984,18 @@ discard block |
||
7984 | 7984 | || |
7985 | 7985 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
7986 | 7986 | ) { |
7987 | - $truncated = (string) \mb_substr($truncated, 0, (int) $lastPos); |
|
7987 | + $truncated = (string)\mb_substr($truncated, 0, (int)$lastPos); |
|
7988 | 7988 | } |
7989 | 7989 | } |
7990 | 7990 | } else { |
7991 | 7991 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7992 | 7992 | |
7993 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
7993 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
7994 | 7994 | return $str; |
7995 | 7995 | } |
7996 | 7996 | |
7997 | 7997 | // need to further trim the string so we can append the substring |
7998 | - $length -= (int) self::strlen($substring, $encoding); |
|
7998 | + $length -= (int)self::strlen($substring, $encoding); |
|
7999 | 7999 | if ($length <= 0) { |
8000 | 8000 | return $substring; |
8001 | 8001 | } |
@@ -8017,12 +8017,12 @@ discard block |
||
8017 | 8017 | || |
8018 | 8018 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8019 | 8019 | ) { |
8020 | - $truncated = (string) self::substr($truncated, 0, (int) $lastPos, $encoding); |
|
8020 | + $truncated = (string)self::substr($truncated, 0, (int)$lastPos, $encoding); |
|
8021 | 8021 | } |
8022 | 8022 | } |
8023 | 8023 | } |
8024 | 8024 | |
8025 | - return $truncated . $substring; |
|
8025 | + return $truncated.$substring; |
|
8026 | 8026 | } |
8027 | 8027 | |
8028 | 8028 | /** |
@@ -8112,13 +8112,13 @@ discard block |
||
8112 | 8112 | } |
8113 | 8113 | } elseif ($format === 2) { |
8114 | 8114 | $numberOfWords = []; |
8115 | - $offset = (int) self::strlen($strParts[0]); |
|
8115 | + $offset = (int)self::strlen($strParts[0]); |
|
8116 | 8116 | for ($i = 1; $i < $len; $i += 2) { |
8117 | 8117 | $numberOfWords[$offset] = $strParts[$i]; |
8118 | - $offset += (int) self::strlen($strParts[$i]) + (int) self::strlen($strParts[$i + 1]); |
|
8118 | + $offset += (int)self::strlen($strParts[$i]) + (int)self::strlen($strParts[$i + 1]); |
|
8119 | 8119 | } |
8120 | 8120 | } else { |
8121 | - $numberOfWords = (int) (($len - 1) / 2); |
|
8121 | + $numberOfWords = (int)(($len - 1) / 2); |
|
8122 | 8122 | } |
8123 | 8123 | |
8124 | 8124 | return $numberOfWords; |
@@ -8182,7 +8182,7 @@ discard block |
||
8182 | 8182 | */ |
8183 | 8183 | public static function strcmp(string $str1, string $str2): int |
8184 | 8184 | { |
8185 | - return $str1 . '' === $str2 . '' ? 0 : \strcmp( |
|
8185 | + return $str1.'' === $str2.'' ? 0 : \strcmp( |
|
8186 | 8186 | \Normalizer::normalize($str1, \Normalizer::NFD), |
8187 | 8187 | \Normalizer::normalize($str2, \Normalizer::NFD) |
8188 | 8188 | ); |
@@ -8211,21 +8211,21 @@ discard block |
||
8211 | 8211 | } |
8212 | 8212 | |
8213 | 8213 | if ($charList === '') { |
8214 | - return (int) self::strlen($str, $encoding); |
|
8214 | + return (int)self::strlen($str, $encoding); |
|
8215 | 8215 | } |
8216 | 8216 | |
8217 | 8217 | if ($offset !== null || $length !== null) { |
8218 | 8218 | if ($encoding === 'UTF-8') { |
8219 | 8219 | if ($length === null) { |
8220 | 8220 | /** @noinspection UnnecessaryCastingInspection */ |
8221 | - $strTmp = \mb_substr($str, (int) $offset); |
|
8221 | + $strTmp = \mb_substr($str, (int)$offset); |
|
8222 | 8222 | } else { |
8223 | 8223 | /** @noinspection UnnecessaryCastingInspection */ |
8224 | - $strTmp = \mb_substr($str, (int) $offset, $length); |
|
8224 | + $strTmp = \mb_substr($str, (int)$offset, $length); |
|
8225 | 8225 | } |
8226 | 8226 | } else { |
8227 | 8227 | /** @noinspection UnnecessaryCastingInspection */ |
8228 | - $strTmp = self::substr($str, (int) $offset, $length, $encoding); |
|
8228 | + $strTmp = self::substr($str, (int)$offset, $length, $encoding); |
|
8229 | 8229 | } |
8230 | 8230 | if ($strTmp === false) { |
8231 | 8231 | return 0; |
@@ -8238,7 +8238,7 @@ discard block |
||
8238 | 8238 | } |
8239 | 8239 | |
8240 | 8240 | $matches = []; |
8241 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $matches)) { |
|
8241 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $matches)) { |
|
8242 | 8242 | $return = self::strlen($matches[1], $encoding); |
8243 | 8243 | if ($return === false) { |
8244 | 8244 | return 0; |
@@ -8247,7 +8247,7 @@ discard block |
||
8247 | 8247 | return $return; |
8248 | 8248 | } |
8249 | 8249 | |
8250 | - return (int) self::strlen($str, $encoding); |
|
8250 | + return (int)self::strlen($str, $encoding); |
|
8251 | 8251 | } |
8252 | 8252 | |
8253 | 8253 | /** |
@@ -8369,7 +8369,7 @@ discard block |
||
8369 | 8369 | return ''; |
8370 | 8370 | } |
8371 | 8371 | |
8372 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
8372 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
8373 | 8373 | } |
8374 | 8374 | |
8375 | 8375 | /** |
@@ -8434,7 +8434,7 @@ discard block |
||
8434 | 8434 | // fallback for ascii only |
8435 | 8435 | // |
8436 | 8436 | |
8437 | - if (self::is_ascii($haystack . $needle)) { |
|
8437 | + if (self::is_ascii($haystack.$needle)) { |
|
8438 | 8438 | return \stripos($haystack, $needle, $offset); |
8439 | 8439 | } |
8440 | 8440 | |
@@ -8501,7 +8501,7 @@ discard block |
||
8501 | 8501 | && |
8502 | 8502 | self::$SUPPORT['mbstring'] === false |
8503 | 8503 | ) { |
8504 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8504 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8505 | 8505 | } |
8506 | 8506 | |
8507 | 8507 | if ( |
@@ -8515,11 +8515,11 @@ discard block |
||
8515 | 8515 | } |
8516 | 8516 | } |
8517 | 8517 | |
8518 | - if (self::is_ascii($needle . $haystack)) { |
|
8518 | + if (self::is_ascii($needle.$haystack)) { |
|
8519 | 8519 | return \stristr($haystack, $needle, $before_needle); |
8520 | 8520 | } |
8521 | 8521 | |
8522 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
8522 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
8523 | 8523 | |
8524 | 8524 | if (!isset($match[1])) { |
8525 | 8525 | return false; |
@@ -8529,7 +8529,7 @@ discard block |
||
8529 | 8529 | return $match[1]; |
8530 | 8530 | } |
8531 | 8531 | |
8532 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
8532 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
8533 | 8533 | } |
8534 | 8534 | |
8535 | 8535 | /** |
@@ -8596,7 +8596,7 @@ discard block |
||
8596 | 8596 | && |
8597 | 8597 | self::$SUPPORT['iconv'] === false |
8598 | 8598 | ) { |
8599 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8599 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8600 | 8600 | } |
8601 | 8601 | |
8602 | 8602 | // |
@@ -8707,7 +8707,7 @@ discard block |
||
8707 | 8707 | */ |
8708 | 8708 | public static function strnatcmp(string $str1, string $str2): int |
8709 | 8709 | { |
8710 | - return $str1 . '' === $str2 . '' ? 0 : \strnatcmp((string) self::strtonatfold($str1), (string) self::strtonatfold($str2)); |
|
8710 | + return $str1.'' === $str2.'' ? 0 : \strnatcmp((string)self::strtonatfold($str1), (string)self::strtonatfold($str2)); |
|
8711 | 8711 | } |
8712 | 8712 | |
8713 | 8713 | /** |
@@ -8764,11 +8764,11 @@ discard block |
||
8764 | 8764 | } |
8765 | 8765 | |
8766 | 8766 | if ($encoding === 'UTF-8') { |
8767 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
8768 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
8767 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
8768 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
8769 | 8769 | } else { |
8770 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
8771 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
8770 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
8771 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
8772 | 8772 | } |
8773 | 8773 | |
8774 | 8774 | return self::strcmp($str1, $str2); |
@@ -8790,8 +8790,8 @@ discard block |
||
8790 | 8790 | return false; |
8791 | 8791 | } |
8792 | 8792 | |
8793 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
8794 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
8793 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
8794 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
8795 | 8795 | } |
8796 | 8796 | |
8797 | 8797 | return false; |
@@ -8824,10 +8824,10 @@ discard block |
||
8824 | 8824 | } |
8825 | 8825 | |
8826 | 8826 | // iconv and mbstring do not support integer $needle |
8827 | - if ((int) $needle === $needle) { |
|
8828 | - $needle = (string) self::chr($needle); |
|
8827 | + if ((int)$needle === $needle) { |
|
8828 | + $needle = (string)self::chr($needle); |
|
8829 | 8829 | } |
8830 | - $needle = (string) $needle; |
|
8830 | + $needle = (string)$needle; |
|
8831 | 8831 | |
8832 | 8832 | if ($needle === '') { |
8833 | 8833 | return false; |
@@ -8874,7 +8874,7 @@ discard block |
||
8874 | 8874 | && |
8875 | 8875 | self::$SUPPORT['mbstring'] === false |
8876 | 8876 | ) { |
8877 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8877 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8878 | 8878 | } |
8879 | 8879 | |
8880 | 8880 | // |
@@ -8915,7 +8915,7 @@ discard block |
||
8915 | 8915 | // fallback for ascii only |
8916 | 8916 | // |
8917 | 8917 | |
8918 | - if (self::is_ascii($haystack . $needle)) { |
|
8918 | + if (self::is_ascii($haystack.$needle)) { |
|
8919 | 8919 | return \strpos($haystack, $needle, $offset); |
8920 | 8920 | } |
8921 | 8921 | |
@@ -8927,7 +8927,7 @@ discard block |
||
8927 | 8927 | if ($haystackTmp === false) { |
8928 | 8928 | $haystackTmp = ''; |
8929 | 8929 | } |
8930 | - $haystack = (string) $haystackTmp; |
|
8930 | + $haystack = (string)$haystackTmp; |
|
8931 | 8931 | |
8932 | 8932 | if ($offset < 0) { |
8933 | 8933 | $offset = 0; |
@@ -8939,7 +8939,7 @@ discard block |
||
8939 | 8939 | } |
8940 | 8940 | |
8941 | 8941 | if ($pos) { |
8942 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
8942 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
8943 | 8943 | } |
8944 | 8944 | |
8945 | 8945 | return $offset + 0; |
@@ -9050,7 +9050,7 @@ discard block |
||
9050 | 9050 | && |
9051 | 9051 | self::$SUPPORT['mbstring'] === false |
9052 | 9052 | ) { |
9053 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9053 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9054 | 9054 | } |
9055 | 9055 | |
9056 | 9056 | // |
@@ -9062,7 +9062,7 @@ discard block |
||
9062 | 9062 | if ($needleTmp === false) { |
9063 | 9063 | return false; |
9064 | 9064 | } |
9065 | - $needle = (string) $needleTmp; |
|
9065 | + $needle = (string)$needleTmp; |
|
9066 | 9066 | |
9067 | 9067 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
9068 | 9068 | if ($pos === false) { |
@@ -9084,7 +9084,7 @@ discard block |
||
9084 | 9084 | if ($needleTmp === false) { |
9085 | 9085 | return false; |
9086 | 9086 | } |
9087 | - $needle = (string) $needleTmp; |
|
9087 | + $needle = (string)$needleTmp; |
|
9088 | 9088 | |
9089 | 9089 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
9090 | 9090 | if ($pos === false) { |
@@ -9116,7 +9116,7 @@ discard block |
||
9116 | 9116 | $reversed = ''; |
9117 | 9117 | |
9118 | 9118 | if ($encoding === 'UTF-8') { |
9119 | - $i = (int) \mb_strlen($str); |
|
9119 | + $i = (int)\mb_strlen($str); |
|
9120 | 9120 | while ($i--) { |
9121 | 9121 | $reversedTmp = \mb_substr($str, $i, 1); |
9122 | 9122 | if ($reversedTmp !== false) { |
@@ -9126,7 +9126,7 @@ discard block |
||
9126 | 9126 | } else { |
9127 | 9127 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9128 | 9128 | |
9129 | - $i = (int) self::strlen($str, $encoding); |
|
9129 | + $i = (int)self::strlen($str, $encoding); |
|
9130 | 9130 | while ($i--) { |
9131 | 9131 | $reversedTmp = self::substr($str, $i, 1, $encoding); |
9132 | 9132 | if ($reversedTmp !== false) { |
@@ -9200,7 +9200,7 @@ discard block |
||
9200 | 9200 | if ($needleTmp === false) { |
9201 | 9201 | return false; |
9202 | 9202 | } |
9203 | - $needle = (string) $needleTmp; |
|
9203 | + $needle = (string)$needleTmp; |
|
9204 | 9204 | |
9205 | 9205 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
9206 | 9206 | if ($pos === false) { |
@@ -9239,10 +9239,10 @@ discard block |
||
9239 | 9239 | } |
9240 | 9240 | |
9241 | 9241 | // iconv and mbstring do not support integer $needle |
9242 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9243 | - $needle = (string) self::chr($needle); |
|
9242 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9243 | + $needle = (string)self::chr($needle); |
|
9244 | 9244 | } |
9245 | - $needle = (string) $needle; |
|
9245 | + $needle = (string)$needle; |
|
9246 | 9246 | |
9247 | 9247 | if ($needle === '') { |
9248 | 9248 | return false; |
@@ -9287,7 +9287,7 @@ discard block |
||
9287 | 9287 | && |
9288 | 9288 | self::$SUPPORT['mbstring'] === false |
9289 | 9289 | ) { |
9290 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9290 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9291 | 9291 | } |
9292 | 9292 | |
9293 | 9293 | // |
@@ -9311,7 +9311,7 @@ discard block |
||
9311 | 9311 | // fallback for ascii only |
9312 | 9312 | // |
9313 | 9313 | |
9314 | - if (self::is_ascii($haystack . $needle)) { |
|
9314 | + if (self::is_ascii($haystack.$needle)) { |
|
9315 | 9315 | return \strripos($haystack, $needle, $offset); |
9316 | 9316 | } |
9317 | 9317 | |
@@ -9387,10 +9387,10 @@ discard block |
||
9387 | 9387 | } |
9388 | 9388 | |
9389 | 9389 | // iconv and mbstring do not support integer $needle |
9390 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9391 | - $needle = (string) self::chr($needle); |
|
9390 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9391 | + $needle = (string)self::chr($needle); |
|
9392 | 9392 | } |
9393 | - $needle = (string) $needle; |
|
9393 | + $needle = (string)$needle; |
|
9394 | 9394 | |
9395 | 9395 | if ($needle === '' || $haystack === '') { |
9396 | 9396 | return false; |
@@ -9435,7 +9435,7 @@ discard block |
||
9435 | 9435 | && |
9436 | 9436 | self::$SUPPORT['mbstring'] === false |
9437 | 9437 | ) { |
9438 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9438 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9439 | 9439 | } |
9440 | 9440 | |
9441 | 9441 | // |
@@ -9459,7 +9459,7 @@ discard block |
||
9459 | 9459 | // fallback for ascii only |
9460 | 9460 | // |
9461 | 9461 | |
9462 | - if (self::is_ascii($haystack . $needle)) { |
|
9462 | + if (self::is_ascii($haystack.$needle)) { |
|
9463 | 9463 | return \strrpos($haystack, $needle, $offset); |
9464 | 9464 | } |
9465 | 9465 | |
@@ -9479,7 +9479,7 @@ discard block |
||
9479 | 9479 | if ($haystackTmp === false) { |
9480 | 9480 | $haystackTmp = ''; |
9481 | 9481 | } |
9482 | - $haystack = (string) $haystackTmp; |
|
9482 | + $haystack = (string)$haystackTmp; |
|
9483 | 9483 | } |
9484 | 9484 | |
9485 | 9485 | $pos = \strrpos($haystack, $needle); |
@@ -9492,7 +9492,7 @@ discard block |
||
9492 | 9492 | return false; |
9493 | 9493 | } |
9494 | 9494 | |
9495 | - return $offset + (int) self::strlen($strTmp); |
|
9495 | + return $offset + (int)self::strlen($strTmp); |
|
9496 | 9496 | } |
9497 | 9497 | |
9498 | 9498 | /** |
@@ -9552,12 +9552,12 @@ discard block |
||
9552 | 9552 | if ($offset || $length !== null) { |
9553 | 9553 | if ($encoding === 'UTF-8') { |
9554 | 9554 | if ($length === null) { |
9555 | - $str = (string) \mb_substr($str, $offset); |
|
9555 | + $str = (string)\mb_substr($str, $offset); |
|
9556 | 9556 | } else { |
9557 | - $str = (string) \mb_substr($str, $offset, $length); |
|
9557 | + $str = (string)\mb_substr($str, $offset, $length); |
|
9558 | 9558 | } |
9559 | 9559 | } else { |
9560 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
9560 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
9561 | 9561 | } |
9562 | 9562 | } |
9563 | 9563 | |
@@ -9567,7 +9567,7 @@ discard block |
||
9567 | 9567 | |
9568 | 9568 | $matches = []; |
9569 | 9569 | |
9570 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
9570 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
9571 | 9571 | } |
9572 | 9572 | |
9573 | 9573 | /** |
@@ -9636,7 +9636,7 @@ discard block |
||
9636 | 9636 | && |
9637 | 9637 | self::$SUPPORT['mbstring'] === false |
9638 | 9638 | ) { |
9639 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9639 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9640 | 9640 | } |
9641 | 9641 | |
9642 | 9642 | // |
@@ -9658,7 +9658,7 @@ discard block |
||
9658 | 9658 | // fallback for ascii only |
9659 | 9659 | // |
9660 | 9660 | |
9661 | - if (self::is_ascii($haystack . $needle)) { |
|
9661 | + if (self::is_ascii($haystack.$needle)) { |
|
9662 | 9662 | return \strstr($haystack, $needle, $before_needle); |
9663 | 9663 | } |
9664 | 9664 | |
@@ -9666,7 +9666,7 @@ discard block |
||
9666 | 9666 | // fallback via vanilla php |
9667 | 9667 | // |
9668 | 9668 | |
9669 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
9669 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
9670 | 9670 | |
9671 | 9671 | if (!isset($match[1])) { |
9672 | 9672 | return false; |
@@ -9676,7 +9676,7 @@ discard block |
||
9676 | 9676 | return $match[1]; |
9677 | 9677 | } |
9678 | 9678 | |
9679 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
9679 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
9680 | 9680 | } |
9681 | 9681 | |
9682 | 9682 | /** |
@@ -9790,7 +9790,7 @@ discard block |
||
9790 | 9790 | bool $tryToKeepStringLength = false |
9791 | 9791 | ): string { |
9792 | 9792 | // init |
9793 | - $str = (string) $str; |
|
9793 | + $str = (string)$str; |
|
9794 | 9794 | |
9795 | 9795 | if ($str === '') { |
9796 | 9796 | return ''; |
@@ -9815,19 +9815,19 @@ discard block |
||
9815 | 9815 | |
9816 | 9816 | if ($lang !== null) { |
9817 | 9817 | if (self::$SUPPORT['intl'] === true) { |
9818 | - $langCode = $lang . '-Lower'; |
|
9818 | + $langCode = $lang.'-Lower'; |
|
9819 | 9819 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
9820 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, \E_USER_WARNING); |
|
9820 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, \E_USER_WARNING); |
|
9821 | 9821 | |
9822 | 9822 | $langCode = 'Any-Lower'; |
9823 | 9823 | } |
9824 | 9824 | |
9825 | 9825 | /** @noinspection PhpComposerExtensionStubsInspection */ |
9826 | 9826 | /** @noinspection UnnecessaryCastingInspection */ |
9827 | - return (string) \transliterator_transliterate($langCode, $str); |
|
9827 | + return (string)\transliterator_transliterate($langCode, $str); |
|
9828 | 9828 | } |
9829 | 9829 | |
9830 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
9830 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
9831 | 9831 | } |
9832 | 9832 | |
9833 | 9833 | // always fallback via symfony polyfill |
@@ -9856,7 +9856,7 @@ discard block |
||
9856 | 9856 | bool $tryToKeepStringLength = false |
9857 | 9857 | ): string { |
9858 | 9858 | // init |
9859 | - $str = (string) $str; |
|
9859 | + $str = (string)$str; |
|
9860 | 9860 | |
9861 | 9861 | if ($str === '') { |
9862 | 9862 | return ''; |
@@ -9881,19 +9881,19 @@ discard block |
||
9881 | 9881 | |
9882 | 9882 | if ($lang !== null) { |
9883 | 9883 | if (self::$SUPPORT['intl'] === true) { |
9884 | - $langCode = $lang . '-Upper'; |
|
9884 | + $langCode = $lang.'-Upper'; |
|
9885 | 9885 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
9886 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
9886 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
9887 | 9887 | |
9888 | 9888 | $langCode = 'Any-Upper'; |
9889 | 9889 | } |
9890 | 9890 | |
9891 | 9891 | /** @noinspection PhpComposerExtensionStubsInspection */ |
9892 | 9892 | /** @noinspection UnnecessaryCastingInspection */ |
9893 | - return (string) \transliterator_transliterate($langCode, $str); |
|
9893 | + return (string)\transliterator_transliterate($langCode, $str); |
|
9894 | 9894 | } |
9895 | 9895 | |
9896 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
9896 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
9897 | 9897 | } |
9898 | 9898 | |
9899 | 9899 | // always fallback via symfony polyfill |
@@ -9937,7 +9937,7 @@ discard block |
||
9937 | 9937 | |
9938 | 9938 | $from = \array_combine($from, $to); |
9939 | 9939 | if ($from === false) { |
9940 | - 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) . ')'); |
|
9940 | + 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).')'); |
|
9941 | 9941 | } |
9942 | 9942 | } |
9943 | 9943 | |
@@ -9994,9 +9994,9 @@ discard block |
||
9994 | 9994 | } |
9995 | 9995 | |
9996 | 9996 | $wide = 0; |
9997 | - $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); |
|
9997 | + $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); |
|
9998 | 9998 | |
9999 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
9999 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
10000 | 10000 | } |
10001 | 10001 | |
10002 | 10002 | /** |
@@ -10096,9 +10096,9 @@ discard block |
||
10096 | 10096 | } |
10097 | 10097 | |
10098 | 10098 | if ($length === null) { |
10099 | - $length = (int) $str_length; |
|
10099 | + $length = (int)$str_length; |
|
10100 | 10100 | } else { |
10101 | - $length = (int) $length; |
|
10101 | + $length = (int)$length; |
|
10102 | 10102 | } |
10103 | 10103 | |
10104 | 10104 | if ( |
@@ -10106,7 +10106,7 @@ discard block |
||
10106 | 10106 | && |
10107 | 10107 | self::$SUPPORT['mbstring'] === false |
10108 | 10108 | ) { |
10109 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10109 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10110 | 10110 | } |
10111 | 10111 | |
10112 | 10112 | // |
@@ -10194,16 +10194,16 @@ discard block |
||
10194 | 10194 | ) { |
10195 | 10195 | if ($encoding === 'UTF-8') { |
10196 | 10196 | if ($length === null) { |
10197 | - $str1 = (string) \mb_substr($str1, $offset); |
|
10197 | + $str1 = (string)\mb_substr($str1, $offset); |
|
10198 | 10198 | } else { |
10199 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
10199 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
10200 | 10200 | } |
10201 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
10201 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
10202 | 10202 | } else { |
10203 | 10203 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10204 | 10204 | |
10205 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
10206 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
10205 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
10206 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
10207 | 10207 | } |
10208 | 10208 | } |
10209 | 10209 | |
@@ -10265,13 +10265,13 @@ discard block |
||
10265 | 10265 | if ($lengthTmp === false) { |
10266 | 10266 | return false; |
10267 | 10267 | } |
10268 | - $length = (int) $lengthTmp; |
|
10268 | + $length = (int)$lengthTmp; |
|
10269 | 10269 | } |
10270 | 10270 | |
10271 | 10271 | if ($encoding === 'UTF-8') { |
10272 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
10272 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
10273 | 10273 | } else { |
10274 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
10274 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
10275 | 10275 | } |
10276 | 10276 | } |
10277 | 10277 | |
@@ -10280,7 +10280,7 @@ discard block |
||
10280 | 10280 | && |
10281 | 10281 | self::$SUPPORT['mbstring'] === false |
10282 | 10282 | ) { |
10283 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10283 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10284 | 10284 | } |
10285 | 10285 | |
10286 | 10286 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10291,7 +10291,7 @@ discard block |
||
10291 | 10291 | return \mb_substr_count($haystack, $needle, $encoding); |
10292 | 10292 | } |
10293 | 10293 | |
10294 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10294 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10295 | 10295 | |
10296 | 10296 | return \count($matches); |
10297 | 10297 | } |
@@ -10338,7 +10338,7 @@ discard block |
||
10338 | 10338 | if ($lengthTmp === false) { |
10339 | 10339 | return false; |
10340 | 10340 | } |
10341 | - $length = (int) $lengthTmp; |
|
10341 | + $length = (int)$lengthTmp; |
|
10342 | 10342 | } |
10343 | 10343 | |
10344 | 10344 | if ( |
@@ -10359,7 +10359,7 @@ discard block |
||
10359 | 10359 | if ($haystackTmp === false) { |
10360 | 10360 | $haystackTmp = ''; |
10361 | 10361 | } |
10362 | - $haystack = (string) $haystackTmp; |
|
10362 | + $haystack = (string)$haystackTmp; |
|
10363 | 10363 | } |
10364 | 10364 | |
10365 | 10365 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10398,10 +10398,10 @@ discard block |
||
10398 | 10398 | |
10399 | 10399 | if ($encoding === 'UTF-8') { |
10400 | 10400 | if ($caseSensitive) { |
10401 | - return (int) \mb_substr_count($str, $substring); |
|
10401 | + return (int)\mb_substr_count($str, $substring); |
|
10402 | 10402 | } |
10403 | 10403 | |
10404 | - return (int) \mb_substr_count( |
|
10404 | + return (int)\mb_substr_count( |
|
10405 | 10405 | \mb_strtoupper($str), |
10406 | 10406 | \mb_strtoupper($substring) |
10407 | 10407 | |
@@ -10411,10 +10411,10 @@ discard block |
||
10411 | 10411 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10412 | 10412 | |
10413 | 10413 | if ($caseSensitive) { |
10414 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
10414 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
10415 | 10415 | } |
10416 | 10416 | |
10417 | - return (int) \mb_substr_count( |
|
10417 | + return (int)\mb_substr_count( |
|
10418 | 10418 | self::strtocasefold($str, true, false, $encoding, null, false), |
10419 | 10419 | self::strtocasefold($substring, true, false, $encoding, null, false), |
10420 | 10420 | $encoding |
@@ -10440,7 +10440,7 @@ discard block |
||
10440 | 10440 | } |
10441 | 10441 | |
10442 | 10442 | if (self::str_istarts_with($haystack, $needle) === true) { |
10443 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10443 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10444 | 10444 | } |
10445 | 10445 | |
10446 | 10446 | return $haystack; |
@@ -10497,7 +10497,7 @@ discard block |
||
10497 | 10497 | } |
10498 | 10498 | |
10499 | 10499 | if (self::str_iends_with($haystack, $needle) === true) { |
10500 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
10500 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
10501 | 10501 | } |
10502 | 10502 | |
10503 | 10503 | return $haystack; |
@@ -10522,7 +10522,7 @@ discard block |
||
10522 | 10522 | } |
10523 | 10523 | |
10524 | 10524 | if (self::str_starts_with($haystack, $needle) === true) { |
10525 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10525 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10526 | 10526 | } |
10527 | 10527 | |
10528 | 10528 | return $haystack; |
@@ -10574,7 +10574,7 @@ discard block |
||
10574 | 10574 | if (\is_array($offset) === true) { |
10575 | 10575 | $offset = \array_slice($offset, 0, $num); |
10576 | 10576 | foreach ($offset as &$valueTmp) { |
10577 | - $valueTmp = (int) $valueTmp === $valueTmp ? $valueTmp : 0; |
|
10577 | + $valueTmp = (int)$valueTmp === $valueTmp ? $valueTmp : 0; |
|
10578 | 10578 | } |
10579 | 10579 | unset($valueTmp); |
10580 | 10580 | } else { |
@@ -10587,7 +10587,7 @@ discard block |
||
10587 | 10587 | } elseif (\is_array($length) === true) { |
10588 | 10588 | $length = \array_slice($length, 0, $num); |
10589 | 10589 | foreach ($length as &$valueTmpV2) { |
10590 | - $valueTmpV2 = (int) $valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10590 | + $valueTmpV2 = (int)$valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10591 | 10591 | } |
10592 | 10592 | unset($valueTmpV2); |
10593 | 10593 | } else { |
@@ -10607,8 +10607,8 @@ discard block |
||
10607 | 10607 | } |
10608 | 10608 | |
10609 | 10609 | // init |
10610 | - $str = (string) $str; |
|
10611 | - $replacement = (string) $replacement; |
|
10610 | + $str = (string)$str; |
|
10611 | + $replacement = (string)$replacement; |
|
10612 | 10612 | |
10613 | 10613 | if (\is_array($length) === true) { |
10614 | 10614 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -10623,16 +10623,16 @@ discard block |
||
10623 | 10623 | } |
10624 | 10624 | |
10625 | 10625 | if (self::$SUPPORT['mbstring'] === true) { |
10626 | - $string_length = (int) self::strlen($str, $encoding); |
|
10626 | + $string_length = (int)self::strlen($str, $encoding); |
|
10627 | 10627 | |
10628 | 10628 | if ($offset < 0) { |
10629 | - $offset = (int) \max(0, $string_length + $offset); |
|
10629 | + $offset = (int)\max(0, $string_length + $offset); |
|
10630 | 10630 | } elseif ($offset > $string_length) { |
10631 | 10631 | $offset = $string_length; |
10632 | 10632 | } |
10633 | 10633 | |
10634 | 10634 | if ($length !== null && $length < 0) { |
10635 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
10635 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
10636 | 10636 | } elseif ($length === null || $length > $string_length) { |
10637 | 10637 | $length = $string_length; |
10638 | 10638 | } |
@@ -10643,9 +10643,9 @@ discard block |
||
10643 | 10643 | } |
10644 | 10644 | |
10645 | 10645 | /** @noinspection AdditionOperationOnArraysInspection */ |
10646 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
10647 | - $replacement . |
|
10648 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10646 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
10647 | + $replacement. |
|
10648 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10649 | 10649 | } |
10650 | 10650 | |
10651 | 10651 | // |
@@ -10654,8 +10654,7 @@ discard block |
||
10654 | 10654 | |
10655 | 10655 | if (self::is_ascii($str)) { |
10656 | 10656 | return ($length === null) ? |
10657 | - \substr_replace($str, $replacement, $offset) : |
|
10658 | - \substr_replace($str, $replacement, $offset, $length); |
|
10657 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
10659 | 10658 | } |
10660 | 10659 | |
10661 | 10660 | // |
@@ -10671,7 +10670,7 @@ discard block |
||
10671 | 10670 | // e.g.: non mbstring support + invalid chars |
10672 | 10671 | return ''; |
10673 | 10672 | } |
10674 | - $length = (int) $lengthTmp; |
|
10673 | + $length = (int)$lengthTmp; |
|
10675 | 10674 | } |
10676 | 10675 | |
10677 | 10676 | \array_splice($smatches[0], $offset, $length, $rmatches[0]); |
@@ -10706,14 +10705,14 @@ discard block |
||
10706 | 10705 | && |
10707 | 10706 | \substr($haystack, -\strlen($needle)) === $needle |
10708 | 10707 | ) { |
10709 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
10708 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
10710 | 10709 | } |
10711 | 10710 | |
10712 | 10711 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
10713 | - return (string) self::substr( |
|
10712 | + return (string)self::substr( |
|
10714 | 10713 | $haystack, |
10715 | 10714 | 0, |
10716 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
10715 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
10717 | 10716 | $encoding |
10718 | 10717 | ); |
10719 | 10718 | } |
@@ -10743,10 +10742,10 @@ discard block |
||
10743 | 10742 | } |
10744 | 10743 | |
10745 | 10744 | if ($encoding === 'UTF-8') { |
10746 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10745 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10747 | 10746 | } |
10748 | 10747 | |
10749 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10748 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10750 | 10749 | } |
10751 | 10750 | |
10752 | 10751 | /** |
@@ -10942,7 +10941,7 @@ discard block |
||
10942 | 10941 | // INFO: https://unicode.org/cldr/utility/character.jsp?a=%E2%84%8C |
10943 | 10942 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10944 | 10943 | /** @noinspection UnnecessaryCastingInspection */ |
10945 | - $str = (string) \transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
10944 | + $str = (string)\transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
10946 | 10945 | |
10947 | 10946 | // check again, if we only have ASCII, now ... |
10948 | 10947 | if (self::is_ascii($str) === true) { |
@@ -11065,7 +11064,7 @@ discard block |
||
11065 | 11064 | public static function to_boolean($str): bool |
11066 | 11065 | { |
11067 | 11066 | // init |
11068 | - $str = (string) $str; |
|
11067 | + $str = (string)$str; |
|
11069 | 11068 | |
11070 | 11069 | if ($str === '') { |
11071 | 11070 | return false; |
@@ -11093,10 +11092,10 @@ discard block |
||
11093 | 11092 | } |
11094 | 11093 | |
11095 | 11094 | if (\is_numeric($str)) { |
11096 | - return ((float) $str + 0) > 0; |
|
11095 | + return ((float)$str + 0) > 0; |
|
11097 | 11096 | } |
11098 | 11097 | |
11099 | - return (bool) \trim($str); |
|
11098 | + return (bool)\trim($str); |
|
11100 | 11099 | } |
11101 | 11100 | |
11102 | 11101 | /** |
@@ -11117,11 +11116,11 @@ discard block |
||
11117 | 11116 | |
11118 | 11117 | $fallback_char_escaped = \preg_quote($fallback_char, '/'); |
11119 | 11118 | |
11120 | - $string = (string) \preg_replace( |
|
11119 | + $string = (string)\preg_replace( |
|
11121 | 11120 | [ |
11122 | - '/[^' . $fallback_char_escaped . '\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
11123 | - '/[\s]+/', // 2) convert spaces to $fallback_char |
|
11124 | - '/[' . $fallback_char_escaped . ']+/', // 3) remove double $fallback_char's |
|
11121 | + '/[^'.$fallback_char_escaped.'\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
11122 | + '/[\s]+/', // 2) convert spaces to $fallback_char |
|
11123 | + '/['.$fallback_char_escaped.']+/', // 3) remove double $fallback_char's |
|
11125 | 11124 | ], |
11126 | 11125 | [ |
11127 | 11126 | '', |
@@ -11152,7 +11151,7 @@ discard block |
||
11152 | 11151 | return $str; |
11153 | 11152 | } |
11154 | 11153 | |
11155 | - $str = (string) $str; |
|
11154 | + $str = (string)$str; |
|
11156 | 11155 | if ($str === '') { |
11157 | 11156 | return ''; |
11158 | 11157 | } |
@@ -11199,7 +11198,7 @@ discard block |
||
11199 | 11198 | return $str; |
11200 | 11199 | } |
11201 | 11200 | |
11202 | - $str = (string) $str; |
|
11201 | + $str = (string)$str; |
|
11203 | 11202 | if ($str === '') { |
11204 | 11203 | return $str; |
11205 | 11204 | } |
@@ -11217,7 +11216,7 @@ discard block |
||
11217 | 11216 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
11218 | 11217 | |
11219 | 11218 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11220 | - $buf .= $c1 . $c2; |
|
11219 | + $buf .= $c1.$c2; |
|
11221 | 11220 | ++$i; |
11222 | 11221 | } else { // not valid UTF8 - convert it |
11223 | 11222 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11228,7 +11227,7 @@ discard block |
||
11228 | 11227 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
11229 | 11228 | |
11230 | 11229 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11231 | - $buf .= $c1 . $c2 . $c3; |
|
11230 | + $buf .= $c1.$c2.$c3; |
|
11232 | 11231 | $i += 2; |
11233 | 11232 | } else { // not valid UTF8 - convert it |
11234 | 11233 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11240,7 +11239,7 @@ discard block |
||
11240 | 11239 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
11241 | 11240 | |
11242 | 11241 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11243 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
11242 | + $buf .= $c1.$c2.$c3.$c4; |
|
11244 | 11243 | $i += 3; |
11245 | 11244 | } else { // not valid UTF8 - convert it |
11246 | 11245 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11266,13 +11265,13 @@ discard block |
||
11266 | 11265 | * |
11267 | 11266 | * @return string |
11268 | 11267 | */ |
11269 | - static function (array $matches): string { |
|
11268 | + static function(array $matches): string { |
|
11270 | 11269 | if (isset($matches[3])) { |
11271 | - $cp = (int) \hexdec($matches[3]); |
|
11270 | + $cp = (int)\hexdec($matches[3]); |
|
11272 | 11271 | } else { |
11273 | 11272 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
11274 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
11275 | - + (int) \hexdec($matches[2]) |
|
11273 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
11274 | + + (int)\hexdec($matches[2]) |
|
11276 | 11275 | + 0x10000 |
11277 | 11276 | - (0xD800 << 10) |
11278 | 11277 | - 0xDC00; |
@@ -11283,12 +11282,12 @@ discard block |
||
11283 | 11282 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
11284 | 11283 | |
11285 | 11284 | if ($cp < 0x80) { |
11286 | - return (string) self::chr($cp); |
|
11285 | + return (string)self::chr($cp); |
|
11287 | 11286 | } |
11288 | 11287 | |
11289 | 11288 | if ($cp < 0xA0) { |
11290 | 11289 | /** @noinspection UnnecessaryCastingInspection */ |
11291 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
11290 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
11292 | 11291 | } |
11293 | 11292 | |
11294 | 11293 | return self::decimal_to_chr($cp); |
@@ -11336,7 +11335,7 @@ discard block |
||
11336 | 11335 | |
11337 | 11336 | if (self::$SUPPORT['mbstring'] === true) { |
11338 | 11337 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11339 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
11338 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
11340 | 11339 | } |
11341 | 11340 | |
11342 | 11341 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -11373,15 +11372,15 @@ discard block |
||
11373 | 11372 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
11374 | 11373 | |
11375 | 11374 | if ($encoding === 'UTF-8') { |
11376 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
11375 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
11377 | 11376 | |
11378 | 11377 | if ($useMbFunction === true) { |
11379 | 11378 | $strPartOne = \mb_strtoupper( |
11380 | - (string) \mb_substr($str, 0, 1) |
|
11379 | + (string)\mb_substr($str, 0, 1) |
|
11381 | 11380 | ); |
11382 | 11381 | } else { |
11383 | 11382 | $strPartOne = self::strtoupper( |
11384 | - (string) \mb_substr($str, 0, 1), |
|
11383 | + (string)\mb_substr($str, 0, 1), |
|
11385 | 11384 | $encoding, |
11386 | 11385 | false, |
11387 | 11386 | $lang, |
@@ -11391,16 +11390,16 @@ discard block |
||
11391 | 11390 | } else { |
11392 | 11391 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11393 | 11392 | |
11394 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
11393 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
11395 | 11394 | |
11396 | 11395 | if ($useMbFunction === true) { |
11397 | 11396 | $strPartOne = \mb_strtoupper( |
11398 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
11397 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
11399 | 11398 | $encoding |
11400 | 11399 | ); |
11401 | 11400 | } else { |
11402 | 11401 | $strPartOne = self::strtoupper( |
11403 | - (string) self::substr($str, 0, 1, $encoding), |
|
11402 | + (string)self::substr($str, 0, 1, $encoding), |
|
11404 | 11403 | $encoding, |
11405 | 11404 | false, |
11406 | 11405 | $lang, |
@@ -11409,7 +11408,7 @@ discard block |
||
11409 | 11408 | } |
11410 | 11409 | } |
11411 | 11410 | |
11412 | - return $strPartOne . $strPartTwo; |
|
11411 | + return $strPartOne.$strPartTwo; |
|
11413 | 11412 | } |
11414 | 11413 | |
11415 | 11414 | /** |
@@ -11460,7 +11459,7 @@ discard block |
||
11460 | 11459 | $str = self::clean($str); |
11461 | 11460 | } |
11462 | 11461 | |
11463 | - $usePhpDefaultFunctions = !(bool) ($charlist . \implode('', $exceptions)); |
|
11462 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
11464 | 11463 | |
11465 | 11464 | if ( |
11466 | 11465 | $usePhpDefaultFunctions === true |
@@ -11517,7 +11516,7 @@ discard block |
||
11517 | 11516 | |
11518 | 11517 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
11519 | 11518 | if (\preg_match($pattern, $str)) { |
11520 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
11519 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
11521 | 11520 | } |
11522 | 11521 | |
11523 | 11522 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -11856,7 +11855,7 @@ discard block |
||
11856 | 11855 | if ( |
11857 | 11856 | $keepUtf8Chars === true |
11858 | 11857 | && |
11859 | - self::strlen($return) >= (int) self::strlen($str_backup) |
|
11858 | + self::strlen($return) >= (int)self::strlen($str_backup) |
|
11860 | 11859 | ) { |
11861 | 11860 | return $str_backup; |
11862 | 11861 | } |
@@ -11950,17 +11949,17 @@ discard block |
||
11950 | 11949 | return ''; |
11951 | 11950 | } |
11952 | 11951 | |
11953 | - \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches); |
|
11952 | + \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches); |
|
11954 | 11953 | |
11955 | 11954 | if ( |
11956 | 11955 | !isset($matches[0]) |
11957 | 11956 | || |
11958 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
11957 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
11959 | 11958 | ) { |
11960 | 11959 | return $str; |
11961 | 11960 | } |
11962 | 11961 | |
11963 | - return \rtrim($matches[0]) . $strAddOn; |
|
11962 | + return \rtrim($matches[0]).$strAddOn; |
|
11964 | 11963 | } |
11965 | 11964 | |
11966 | 11965 | /** |
@@ -12030,7 +12029,7 @@ discard block |
||
12030 | 12029 | $strReturn .= $break; |
12031 | 12030 | } |
12032 | 12031 | |
12033 | - return $strReturn . \implode('', $chars); |
|
12032 | + return $strReturn.\implode('', $chars); |
|
12034 | 12033 | } |
12035 | 12034 | |
12036 | 12035 | /** |
@@ -12043,7 +12042,7 @@ discard block |
||
12043 | 12042 | */ |
12044 | 12043 | public static function wordwrap_per_line(string $str, int $limit): string |
12045 | 12044 | { |
12046 | - $strings = (array) \preg_split('/\\r\\n|\\r|\\n/', $str); |
|
12045 | + $strings = (array)\preg_split('/\\r\\n|\\r|\\n/', $str); |
|
12047 | 12046 | |
12048 | 12047 | $string = ''; |
12049 | 12048 | foreach ($strings as &$value) { |
@@ -12122,7 +12121,7 @@ discard block |
||
12122 | 12121 | /** @noinspection PhpIncludeInspection */ |
12123 | 12122 | /** @noinspection UsingInclusionReturnValueInspection */ |
12124 | 12123 | /** @psalm-suppress UnresolvableInclude */ |
12125 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
12124 | + return include __DIR__.'/data/'.$file.'.php'; |
|
12126 | 12125 | } |
12127 | 12126 | |
12128 | 12127 | /** |
@@ -12134,7 +12133,7 @@ discard block |
||
12134 | 12133 | */ |
12135 | 12134 | private static function getDataIfExists(string $file) |
12136 | 12135 | { |
12137 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
12136 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
12138 | 12137 | if (\file_exists($file)) { |
12139 | 12138 | /** @noinspection PhpIncludeInspection */ |
12140 | 12139 | /** @noinspection UsingInclusionReturnValueInspection */ |
@@ -12159,7 +12158,7 @@ discard block |
||
12159 | 12158 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
12160 | 12159 | return \defined('MB_OVERLOAD_STRING') |
12161 | 12160 | && |
12162 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12161 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12163 | 12162 | } |
12164 | 12163 | |
12165 | 12164 | /** |
@@ -12209,7 +12208,7 @@ discard block |
||
12209 | 12208 | { |
12210 | 12209 | static $RX_CLASSS_CACHE = []; |
12211 | 12210 | |
12212 | - $cacheKey = $s . $class; |
|
12211 | + $cacheKey = $s.$class; |
|
12213 | 12212 | |
12214 | 12213 | if (isset($RX_CLASSS_CACHE[$cacheKey])) { |
12215 | 12214 | return $RX_CLASSS_CACHE[$cacheKey]; |
@@ -12221,7 +12220,7 @@ discard block |
||
12221 | 12220 | /** @noinspection AlterInForeachInspection */ |
12222 | 12221 | foreach (self::str_split($s) as &$s) { |
12223 | 12222 | if ($s === '-') { |
12224 | - $class[0] = '-' . $class[0]; |
|
12223 | + $class[0] = '-'.$class[0]; |
|
12225 | 12224 | } elseif (!isset($s[2])) { |
12226 | 12225 | $class[0] .= \preg_quote($s, '/'); |
12227 | 12226 | } elseif (self::strlen($s) === 1) { |
@@ -12232,13 +12231,13 @@ discard block |
||
12232 | 12231 | } |
12233 | 12232 | |
12234 | 12233 | if ($class[0]) { |
12235 | - $class[0] = '[' . $class[0] . ']'; |
|
12234 | + $class[0] = '['.$class[0].']'; |
|
12236 | 12235 | } |
12237 | 12236 | |
12238 | 12237 | if (\count($class) === 1) { |
12239 | 12238 | $return = $class[0]; |
12240 | 12239 | } else { |
12241 | - $return = '(?:' . \implode('|', $class) . ')'; |
|
12240 | + $return = '(?:'.\implode('|', $class).')'; |
|
12242 | 12241 | } |
12243 | 12242 | |
12244 | 12243 | $RX_CLASSS_CACHE[$cacheKey] = $return; |
@@ -12312,7 +12311,7 @@ discard block |
||
12312 | 12311 | $continue = false; |
12313 | 12312 | |
12314 | 12313 | if ($delimiter === '-') { |
12315 | - foreach ((array) $specialCases['names'] as &$beginning) { |
|
12314 | + foreach ((array)$specialCases['names'] as &$beginning) { |
|
12316 | 12315 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12317 | 12316 | $continue = true; |
12318 | 12317 | } |
@@ -12320,7 +12319,7 @@ discard block |
||
12320 | 12319 | unset($beginning); |
12321 | 12320 | } |
12322 | 12321 | |
12323 | - foreach ((array) $specialCases['prefixes'] as &$beginning) { |
|
12322 | + foreach ((array)$specialCases['prefixes'] as &$beginning) { |
|
12324 | 12323 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12325 | 12324 | $continue = true; |
12326 | 12325 | } |
@@ -12376,8 +12375,8 @@ discard block |
||
12376 | 12375 | $buf .= self::$WIN1252_TO_UTF8[$ordC1]; |
12377 | 12376 | } else { |
12378 | 12377 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
12379 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
12380 | - $buf .= $cc1 . $cc2; |
|
12378 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
12379 | + $buf .= $cc1.$cc2; |
|
12381 | 12380 | } |
12382 | 12381 | |
12383 | 12382 | return $buf; |