@@ -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-f]{2,6}(?![0-9a-f;])|(?:0*\d{2,6}(?![0-9;]))))/iS', |
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-f]{3,4})/i'; |
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 []; |
@@ -5053,7 +5053,7 @@ discard block |
||
5053 | 5053 | ($str[$i] & "\xE0") === "\xC0" |
5054 | 5054 | ) { |
5055 | 5055 | if (($str[$i + 1] & "\xC0") === "\x80") { |
5056 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
5056 | + $ret[] = $str[$i].$str[$i + 1]; |
|
5057 | 5057 | |
5058 | 5058 | ++$i; |
5059 | 5059 | } |
@@ -5067,7 +5067,7 @@ discard block |
||
5067 | 5067 | && |
5068 | 5068 | ($str[$i + 2] & "\xC0") === "\x80" |
5069 | 5069 | ) { |
5070 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
5070 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
5071 | 5071 | |
5072 | 5072 | $i += 2; |
5073 | 5073 | } |
@@ -5083,7 +5083,7 @@ discard block |
||
5083 | 5083 | && |
5084 | 5084 | ($str[$i + 3] & "\xC0") === "\x80" |
5085 | 5085 | ) { |
5086 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
5086 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
5087 | 5087 | |
5088 | 5088 | $i += 3; |
5089 | 5089 | } |
@@ -5095,7 +5095,7 @@ discard block |
||
5095 | 5095 | $ret = \array_chunk($ret, $length); |
5096 | 5096 | |
5097 | 5097 | return \array_map( |
5098 | - static function (array &$item): string { |
|
5098 | + static function(array &$item): string { |
|
5099 | 5099 | return \implode('', $item); |
5100 | 5100 | }, |
5101 | 5101 | $ret |
@@ -5144,18 +5144,18 @@ discard block |
||
5144 | 5144 | $lang, |
5145 | 5145 | $tryToKeepStringLength |
5146 | 5146 | ); |
5147 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5147 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5148 | 5148 | |
5149 | 5149 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5150 | 5150 | |
5151 | - $str = (string) \preg_replace_callback( |
|
5151 | + $str = (string)\preg_replace_callback( |
|
5152 | 5152 | '/[-_\s]+(.)?/u', |
5153 | 5153 | /** |
5154 | 5154 | * @param array $match |
5155 | 5155 | * |
5156 | 5156 | * @return string |
5157 | 5157 | */ |
5158 | - static function (array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5158 | + static function(array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5159 | 5159 | if (isset($match[1])) { |
5160 | 5160 | if ($useMbFunction === true) { |
5161 | 5161 | if ($encoding === 'UTF-8') { |
@@ -5173,14 +5173,14 @@ discard block |
||
5173 | 5173 | $str |
5174 | 5174 | ); |
5175 | 5175 | |
5176 | - return (string) \preg_replace_callback( |
|
5176 | + return (string)\preg_replace_callback( |
|
5177 | 5177 | '/[\d]+(.)?/u', |
5178 | 5178 | /** |
5179 | 5179 | * @param array $match |
5180 | 5180 | * |
5181 | 5181 | * @return string |
5182 | 5182 | */ |
5183 | - static function (array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5183 | + static function(array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5184 | 5184 | if ($useMbFunction === true) { |
5185 | 5185 | if ($encoding === 'UTF-8') { |
5186 | 5186 | return \mb_strtoupper($match[0]); |
@@ -5352,7 +5352,7 @@ discard block |
||
5352 | 5352 | ): string { |
5353 | 5353 | if (self::$SUPPORT['mbstring'] === true) { |
5354 | 5354 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5355 | - $str = (string) \mb_ereg_replace('\B([A-Z])', '-\1', \trim($str)); |
|
5355 | + $str = (string)\mb_ereg_replace('\B([A-Z])', '-\1', \trim($str)); |
|
5356 | 5356 | |
5357 | 5357 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5358 | 5358 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5362,10 +5362,10 @@ discard block |
||
5362 | 5362 | } |
5363 | 5363 | |
5364 | 5364 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5365 | - return (string) \mb_ereg_replace('[-_\s]+', $delimiter, $str); |
|
5365 | + return (string)\mb_ereg_replace('[-_\s]+', $delimiter, $str); |
|
5366 | 5366 | } |
5367 | 5367 | |
5368 | - $str = (string) \preg_replace('/\B([A-Z])/u', '-\1', \trim($str)); |
|
5368 | + $str = (string)\preg_replace('/\B([A-Z])/u', '-\1', \trim($str)); |
|
5369 | 5369 | |
5370 | 5370 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5371 | 5371 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5374,7 +5374,7 @@ discard block |
||
5374 | 5374 | $str = self::strtolower($str, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
5375 | 5375 | } |
5376 | 5376 | |
5377 | - return (string) \preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
5377 | + return (string)\preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
5378 | 5378 | } |
5379 | 5379 | |
5380 | 5380 | /** |
@@ -5389,7 +5389,7 @@ discard block |
||
5389 | 5389 | public static function str_detect_encoding($str) |
5390 | 5390 | { |
5391 | 5391 | // init |
5392 | - $str = (string) $str; |
|
5392 | + $str = (string)$str; |
|
5393 | 5393 | |
5394 | 5394 | // |
5395 | 5395 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5491,7 +5491,7 @@ discard block |
||
5491 | 5491 | foreach (self::$ENCODINGS as $encodingTmp) { |
5492 | 5492 | // INFO: //IGNORE but still throw notice |
5493 | 5493 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5494 | - if ((string) @\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str) === $str) { |
|
5494 | + if ((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str) === $str) { |
|
5495 | 5495 | return $encodingTmp; |
5496 | 5496 | } |
5497 | 5497 | } |
@@ -5556,7 +5556,7 @@ discard block |
||
5556 | 5556 | return $str; |
5557 | 5557 | } |
5558 | 5558 | |
5559 | - return $substring . $str; |
|
5559 | + return $substring.$str; |
|
5560 | 5560 | } |
5561 | 5561 | |
5562 | 5562 | /** |
@@ -5776,27 +5776,27 @@ discard block |
||
5776 | 5776 | string $encoding = 'UTF-8' |
5777 | 5777 | ): string { |
5778 | 5778 | if ($encoding === 'UTF-8') { |
5779 | - $len = (int) \mb_strlen($str); |
|
5779 | + $len = (int)\mb_strlen($str); |
|
5780 | 5780 | if ($index > $len) { |
5781 | 5781 | return $str; |
5782 | 5782 | } |
5783 | 5783 | |
5784 | 5784 | /** @noinspection UnnecessaryCastingInspection */ |
5785 | - return (string) \mb_substr($str, 0, $index) . |
|
5786 | - $substring . |
|
5787 | - (string) \mb_substr($str, $index, $len); |
|
5785 | + return (string)\mb_substr($str, 0, $index). |
|
5786 | + $substring. |
|
5787 | + (string)\mb_substr($str, $index, $len); |
|
5788 | 5788 | } |
5789 | 5789 | |
5790 | 5790 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5791 | 5791 | |
5792 | - $len = (int) self::strlen($str, $encoding); |
|
5792 | + $len = (int)self::strlen($str, $encoding); |
|
5793 | 5793 | if ($index > $len) { |
5794 | 5794 | return $str; |
5795 | 5795 | } |
5796 | 5796 | |
5797 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
5798 | - $substring . |
|
5799 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5797 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
5798 | + $substring. |
|
5799 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
5800 | 5800 | } |
5801 | 5801 | |
5802 | 5802 | /** |
@@ -5826,15 +5826,15 @@ discard block |
||
5826 | 5826 | */ |
5827 | 5827 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
5828 | 5828 | { |
5829 | - $search = (array) $search; |
|
5829 | + $search = (array)$search; |
|
5830 | 5830 | |
5831 | 5831 | /** @noinspection AlterInForeachInspection */ |
5832 | 5832 | foreach ($search as &$s) { |
5833 | - $s = (string) $s; |
|
5833 | + $s = (string)$s; |
|
5834 | 5834 | if ($s === '') { |
5835 | 5835 | $s = '/^(?<=.)$/'; |
5836 | 5836 | } else { |
5837 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5837 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5838 | 5838 | } |
5839 | 5839 | } |
5840 | 5840 | |
@@ -5866,11 +5866,11 @@ discard block |
||
5866 | 5866 | } |
5867 | 5867 | |
5868 | 5868 | if ($search === '') { |
5869 | - return $str . $replacement; |
|
5869 | + return $str.$replacement; |
|
5870 | 5870 | } |
5871 | 5871 | |
5872 | 5872 | if (\stripos($str, $search) === 0) { |
5873 | - return $replacement . \substr($str, \strlen($search)); |
|
5873 | + return $replacement.\substr($str, \strlen($search)); |
|
5874 | 5874 | } |
5875 | 5875 | |
5876 | 5876 | return $str; |
@@ -5898,11 +5898,11 @@ discard block |
||
5898 | 5898 | } |
5899 | 5899 | |
5900 | 5900 | if ($search === '') { |
5901 | - return $str . $replacement; |
|
5901 | + return $str.$replacement; |
|
5902 | 5902 | } |
5903 | 5903 | |
5904 | 5904 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
5905 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
5905 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
5906 | 5906 | } |
5907 | 5907 | |
5908 | 5908 | return $str; |
@@ -5975,15 +5975,15 @@ discard block |
||
5975 | 5975 | } |
5976 | 5976 | |
5977 | 5977 | if ($encoding === 'UTF-8') { |
5978 | - return (string) \mb_substr( |
|
5978 | + return (string)\mb_substr( |
|
5979 | 5979 | $str, |
5980 | - $offset + (int) \mb_strlen($separator) |
|
5980 | + $offset + (int)\mb_strlen($separator) |
|
5981 | 5981 | ); |
5982 | 5982 | } |
5983 | 5983 | |
5984 | - return (string) self::substr( |
|
5984 | + return (string)self::substr( |
|
5985 | 5985 | $str, |
5986 | - $offset + (int) self::strlen($separator, $encoding), |
|
5986 | + $offset + (int)self::strlen($separator, $encoding), |
|
5987 | 5987 | null, |
5988 | 5988 | $encoding |
5989 | 5989 | ); |
@@ -6010,15 +6010,15 @@ discard block |
||
6010 | 6010 | } |
6011 | 6011 | |
6012 | 6012 | if ($encoding === 'UTF-8') { |
6013 | - return (string) \mb_substr( |
|
6013 | + return (string)\mb_substr( |
|
6014 | 6014 | $str, |
6015 | - $offset + (int) self::strlen($separator) |
|
6015 | + $offset + (int)self::strlen($separator) |
|
6016 | 6016 | ); |
6017 | 6017 | } |
6018 | 6018 | |
6019 | - return (string) self::substr( |
|
6019 | + return (string)self::substr( |
|
6020 | 6020 | $str, |
6021 | - $offset + (int) self::strlen($separator, $encoding), |
|
6021 | + $offset + (int)self::strlen($separator, $encoding), |
|
6022 | 6022 | null, |
6023 | 6023 | $encoding |
6024 | 6024 | ); |
@@ -6045,10 +6045,10 @@ discard block |
||
6045 | 6045 | } |
6046 | 6046 | |
6047 | 6047 | if ($encoding === 'UTF-8') { |
6048 | - return (string) \mb_substr($str, 0, $offset); |
|
6048 | + return (string)\mb_substr($str, 0, $offset); |
|
6049 | 6049 | } |
6050 | 6050 | |
6051 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6051 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6052 | 6052 | } |
6053 | 6053 | |
6054 | 6054 | /** |
@@ -6072,7 +6072,7 @@ discard block |
||
6072 | 6072 | return ''; |
6073 | 6073 | } |
6074 | 6074 | |
6075 | - return (string) \mb_substr($str, 0, $offset); |
|
6075 | + return (string)\mb_substr($str, 0, $offset); |
|
6076 | 6076 | } |
6077 | 6077 | |
6078 | 6078 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6080,7 +6080,7 @@ discard block |
||
6080 | 6080 | return ''; |
6081 | 6081 | } |
6082 | 6082 | |
6083 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6083 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6084 | 6084 | } |
6085 | 6085 | |
6086 | 6086 | /** |
@@ -6168,12 +6168,12 @@ discard block |
||
6168 | 6168 | } |
6169 | 6169 | |
6170 | 6170 | if ($encoding === 'UTF-8') { |
6171 | - return (string) \mb_substr($str, -$n); |
|
6171 | + return (string)\mb_substr($str, -$n); |
|
6172 | 6172 | } |
6173 | 6173 | |
6174 | 6174 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6175 | 6175 | |
6176 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6176 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6177 | 6177 | } |
6178 | 6178 | |
6179 | 6179 | /** |
@@ -6197,21 +6197,21 @@ discard block |
||
6197 | 6197 | } |
6198 | 6198 | |
6199 | 6199 | if ($encoding === 'UTF-8') { |
6200 | - if ((int) \mb_strlen($str) <= $length) { |
|
6200 | + if ((int)\mb_strlen($str) <= $length) { |
|
6201 | 6201 | return $str; |
6202 | 6202 | } |
6203 | 6203 | |
6204 | 6204 | /** @noinspection UnnecessaryCastingInspection */ |
6205 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($strAddOn)) . $strAddOn; |
|
6205 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($strAddOn)).$strAddOn; |
|
6206 | 6206 | } |
6207 | 6207 | |
6208 | 6208 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6209 | 6209 | |
6210 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6210 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6211 | 6211 | return $str; |
6212 | 6212 | } |
6213 | 6213 | |
6214 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($strAddOn), $encoding)) . $strAddOn; |
|
6214 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($strAddOn), $encoding)).$strAddOn; |
|
6215 | 6215 | } |
6216 | 6216 | |
6217 | 6217 | /** |
@@ -6236,12 +6236,12 @@ discard block |
||
6236 | 6236 | |
6237 | 6237 | if ($encoding === 'UTF-8') { |
6238 | 6238 | /** @noinspection UnnecessaryCastingInspection */ |
6239 | - if ((int) \mb_strlen($str) <= $length) { |
|
6239 | + if ((int)\mb_strlen($str) <= $length) { |
|
6240 | 6240 | return $str; |
6241 | 6241 | } |
6242 | 6242 | |
6243 | 6243 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6244 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6244 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6245 | 6245 | } |
6246 | 6246 | |
6247 | 6247 | $str = \mb_substr($str, 0, $length); |
@@ -6251,20 +6251,20 @@ discard block |
||
6251 | 6251 | $new_str = \implode(' ', $array); |
6252 | 6252 | |
6253 | 6253 | if ($new_str === '') { |
6254 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6254 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6255 | 6255 | } |
6256 | 6256 | } else { |
6257 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6257 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6258 | 6258 | return $str; |
6259 | 6259 | } |
6260 | 6260 | |
6261 | 6261 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
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 | $str = self::substr($str, 0, $length, $encoding); |
6266 | 6266 | if ($str === false) { |
6267 | - return '' . $strAddOn; |
|
6267 | + return ''.$strAddOn; |
|
6268 | 6268 | } |
6269 | 6269 | |
6270 | 6270 | $array = \explode(' ', $str); |
@@ -6272,11 +6272,11 @@ discard block |
||
6272 | 6272 | $new_str = \implode(' ', $array); |
6273 | 6273 | |
6274 | 6274 | if ($new_str === '') { |
6275 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6275 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6276 | 6276 | } |
6277 | 6277 | } |
6278 | 6278 | |
6279 | - return $new_str . $strAddOn; |
|
6279 | + return $new_str.$strAddOn; |
|
6280 | 6280 | } |
6281 | 6281 | |
6282 | 6282 | /** |
@@ -6294,7 +6294,7 @@ discard block |
||
6294 | 6294 | $longestCommonPrefix = ''; |
6295 | 6295 | |
6296 | 6296 | if ($encoding === 'UTF-8') { |
6297 | - $maxLength = (int) \min( |
|
6297 | + $maxLength = (int)\min( |
|
6298 | 6298 | \mb_strlen($str), |
6299 | 6299 | \mb_strlen($otherStr) |
6300 | 6300 | ); |
@@ -6315,7 +6315,7 @@ discard block |
||
6315 | 6315 | } else { |
6316 | 6316 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6317 | 6317 | |
6318 | - $maxLength = (int) \min( |
|
6318 | + $maxLength = (int)\min( |
|
6319 | 6319 | self::strlen($str, $encoding), |
6320 | 6320 | self::strlen($otherStr, $encoding) |
6321 | 6321 | ); |
@@ -6358,13 +6358,13 @@ discard block |
||
6358 | 6358 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6359 | 6359 | |
6360 | 6360 | if ($encoding === 'UTF-8') { |
6361 | - $strLength = (int) \mb_strlen($str); |
|
6362 | - $otherLength = (int) \mb_strlen($otherStr); |
|
6361 | + $strLength = (int)\mb_strlen($str); |
|
6362 | + $otherLength = (int)\mb_strlen($otherStr); |
|
6363 | 6363 | } else { |
6364 | 6364 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6365 | 6365 | |
6366 | - $strLength = (int) self::strlen($str, $encoding); |
|
6367 | - $otherLength = (int) self::strlen($otherStr, $encoding); |
|
6366 | + $strLength = (int)self::strlen($str, $encoding); |
|
6367 | + $otherLength = (int)self::strlen($otherStr, $encoding); |
|
6368 | 6368 | } |
6369 | 6369 | |
6370 | 6370 | // Return if either string is empty |
@@ -6417,10 +6417,10 @@ discard block |
||
6417 | 6417 | } |
6418 | 6418 | |
6419 | 6419 | if ($encoding === 'UTF-8') { |
6420 | - return (string) \mb_substr($str, $end - $len, $len); |
|
6420 | + return (string)\mb_substr($str, $end - $len, $len); |
|
6421 | 6421 | } |
6422 | 6422 | |
6423 | - return (string) self::substr($str, $end - $len, $len, $encoding); |
|
6423 | + return (string)self::substr($str, $end - $len, $len, $encoding); |
|
6424 | 6424 | } |
6425 | 6425 | |
6426 | 6426 | /** |
@@ -6439,7 +6439,7 @@ discard block |
||
6439 | 6439 | } |
6440 | 6440 | |
6441 | 6441 | if ($encoding === 'UTF-8') { |
6442 | - $maxLength = (int) \min( |
|
6442 | + $maxLength = (int)\min( |
|
6443 | 6443 | \mb_strlen($str, $encoding), |
6444 | 6444 | \mb_strlen($otherStr, $encoding) |
6445 | 6445 | ); |
@@ -6453,7 +6453,7 @@ discard block |
||
6453 | 6453 | && |
6454 | 6454 | $char === \mb_substr($otherStr, -$i, 1) |
6455 | 6455 | ) { |
6456 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6456 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6457 | 6457 | } else { |
6458 | 6458 | break; |
6459 | 6459 | } |
@@ -6461,7 +6461,7 @@ discard block |
||
6461 | 6461 | } else { |
6462 | 6462 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6463 | 6463 | |
6464 | - $maxLength = (int) \min( |
|
6464 | + $maxLength = (int)\min( |
|
6465 | 6465 | self::strlen($str, $encoding), |
6466 | 6466 | self::strlen($otherStr, $encoding) |
6467 | 6467 | ); |
@@ -6475,7 +6475,7 @@ discard block |
||
6475 | 6475 | && |
6476 | 6476 | $char === self::substr($otherStr, -$i, 1, $encoding) |
6477 | 6477 | ) { |
6478 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6478 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6479 | 6479 | } else { |
6480 | 6480 | break; |
6481 | 6481 | } |
@@ -6495,7 +6495,7 @@ discard block |
||
6495 | 6495 | */ |
6496 | 6496 | public static function str_matches_pattern(string $str, string $pattern): bool |
6497 | 6497 | { |
6498 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
6498 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
6499 | 6499 | } |
6500 | 6500 | |
6501 | 6501 | /** |
@@ -6512,7 +6512,7 @@ discard block |
||
6512 | 6512 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
6513 | 6513 | { |
6514 | 6514 | // init |
6515 | - $length = (int) self::strlen($str, $encoding); |
|
6515 | + $length = (int)self::strlen($str, $encoding); |
|
6516 | 6516 | |
6517 | 6517 | if ($offset >= 0) { |
6518 | 6518 | return $length > $offset; |
@@ -6538,7 +6538,7 @@ discard block |
||
6538 | 6538 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
6539 | 6539 | { |
6540 | 6540 | // init |
6541 | - $length = (int) self::strlen($str); |
|
6541 | + $length = (int)self::strlen($str); |
|
6542 | 6542 | |
6543 | 6543 | if ( |
6544 | 6544 | ($index >= 0 && $length <= $index) |
@@ -6577,7 +6577,7 @@ discard block |
||
6577 | 6577 | return $str; |
6578 | 6578 | } |
6579 | 6579 | |
6580 | - if ($pad_type !== (int) $pad_type) { |
|
6580 | + if ($pad_type !== (int)$pad_type) { |
|
6581 | 6581 | if ($pad_type === 'left') { |
6582 | 6582 | $pad_type = \STR_PAD_LEFT; |
6583 | 6583 | } elseif ($pad_type === 'right') { |
@@ -6586,23 +6586,23 @@ discard block |
||
6586 | 6586 | $pad_type = \STR_PAD_BOTH; |
6587 | 6587 | } else { |
6588 | 6588 | throw new \InvalidArgumentException( |
6589 | - 'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
6589 | + 'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
6590 | 6590 | ); |
6591 | 6591 | } |
6592 | 6592 | } |
6593 | 6593 | |
6594 | 6594 | if ($encoding === 'UTF-8') { |
6595 | - $str_length = (int) \mb_strlen($str); |
|
6595 | + $str_length = (int)\mb_strlen($str); |
|
6596 | 6596 | |
6597 | 6597 | if ($pad_length >= $str_length) { |
6598 | 6598 | switch ($pad_type) { |
6599 | 6599 | case \STR_PAD_LEFT: |
6600 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6600 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6601 | 6601 | |
6602 | 6602 | $diff = ($pad_length - $str_length); |
6603 | 6603 | |
6604 | - $pre = (string) \mb_substr( |
|
6605 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6604 | + $pre = (string)\mb_substr( |
|
6605 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6606 | 6606 | 0, |
6607 | 6607 | $diff |
6608 | 6608 | ); |
@@ -6613,16 +6613,16 @@ discard block |
||
6613 | 6613 | case \STR_PAD_BOTH: |
6614 | 6614 | $diff = ($pad_length - $str_length); |
6615 | 6615 | |
6616 | - $ps_length_left = (int) \floor($diff / 2); |
|
6616 | + $ps_length_left = (int)\floor($diff / 2); |
|
6617 | 6617 | |
6618 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6618 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6619 | 6619 | |
6620 | - $pre = (string) \mb_substr( |
|
6620 | + $pre = (string)\mb_substr( |
|
6621 | 6621 | \str_repeat($pad_string, $ps_length_left), |
6622 | 6622 | 0, |
6623 | 6623 | $ps_length_left |
6624 | 6624 | ); |
6625 | - $post = (string) \mb_substr( |
|
6625 | + $post = (string)\mb_substr( |
|
6626 | 6626 | \str_repeat($pad_string, $ps_length_right), |
6627 | 6627 | 0, |
6628 | 6628 | $ps_length_right |
@@ -6632,19 +6632,19 @@ discard block |
||
6632 | 6632 | |
6633 | 6633 | case \STR_PAD_RIGHT: |
6634 | 6634 | default: |
6635 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6635 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6636 | 6636 | |
6637 | 6637 | $diff = ($pad_length - $str_length); |
6638 | 6638 | |
6639 | - $post = (string) \mb_substr( |
|
6640 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6639 | + $post = (string)\mb_substr( |
|
6640 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6641 | 6641 | 0, |
6642 | 6642 | $diff |
6643 | 6643 | ); |
6644 | 6644 | $pre = ''; |
6645 | 6645 | } |
6646 | 6646 | |
6647 | - return $pre . $str . $post; |
|
6647 | + return $pre.$str.$post; |
|
6648 | 6648 | } |
6649 | 6649 | |
6650 | 6650 | return $str; |
@@ -6652,17 +6652,17 @@ discard block |
||
6652 | 6652 | |
6653 | 6653 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6654 | 6654 | |
6655 | - $str_length = (int) self::strlen($str, $encoding); |
|
6655 | + $str_length = (int)self::strlen($str, $encoding); |
|
6656 | 6656 | |
6657 | 6657 | if ($pad_length >= $str_length) { |
6658 | 6658 | switch ($pad_type) { |
6659 | 6659 | case \STR_PAD_LEFT: |
6660 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6660 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6661 | 6661 | |
6662 | 6662 | $diff = ($pad_length - $str_length); |
6663 | 6663 | |
6664 | - $pre = (string) self::substr( |
|
6665 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6664 | + $pre = (string)self::substr( |
|
6665 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6666 | 6666 | 0, |
6667 | 6667 | $diff, |
6668 | 6668 | $encoding |
@@ -6674,17 +6674,17 @@ discard block |
||
6674 | 6674 | case \STR_PAD_BOTH: |
6675 | 6675 | $diff = ($pad_length - $str_length); |
6676 | 6676 | |
6677 | - $ps_length_left = (int) \floor($diff / 2); |
|
6677 | + $ps_length_left = (int)\floor($diff / 2); |
|
6678 | 6678 | |
6679 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6679 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6680 | 6680 | |
6681 | - $pre = (string) self::substr( |
|
6681 | + $pre = (string)self::substr( |
|
6682 | 6682 | \str_repeat($pad_string, $ps_length_left), |
6683 | 6683 | 0, |
6684 | 6684 | $ps_length_left, |
6685 | 6685 | $encoding |
6686 | 6686 | ); |
6687 | - $post = (string) self::substr( |
|
6687 | + $post = (string)self::substr( |
|
6688 | 6688 | \str_repeat($pad_string, $ps_length_right), |
6689 | 6689 | 0, |
6690 | 6690 | $ps_length_right, |
@@ -6695,12 +6695,12 @@ discard block |
||
6695 | 6695 | |
6696 | 6696 | case \STR_PAD_RIGHT: |
6697 | 6697 | default: |
6698 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6698 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6699 | 6699 | |
6700 | 6700 | $diff = ($pad_length - $str_length); |
6701 | 6701 | |
6702 | - $post = (string) self::substr( |
|
6703 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6702 | + $post = (string)self::substr( |
|
6703 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6704 | 6704 | 0, |
6705 | 6705 | $diff, |
6706 | 6706 | $encoding |
@@ -6708,7 +6708,7 @@ discard block |
||
6708 | 6708 | $pre = ''; |
6709 | 6709 | } |
6710 | 6710 | |
6711 | - return $pre . $str . $post; |
|
6711 | + return $pre.$str.$post; |
|
6712 | 6712 | } |
6713 | 6713 | |
6714 | 6714 | return $str; |
@@ -6860,11 +6860,11 @@ discard block |
||
6860 | 6860 | } |
6861 | 6861 | |
6862 | 6862 | if ($search === '') { |
6863 | - return $str . $replacement; |
|
6863 | + return $str.$replacement; |
|
6864 | 6864 | } |
6865 | 6865 | |
6866 | 6866 | if (\strpos($str, $search) === 0) { |
6867 | - return $replacement . \substr($str, \strlen($search)); |
|
6867 | + return $replacement.\substr($str, \strlen($search)); |
|
6868 | 6868 | } |
6869 | 6869 | |
6870 | 6870 | return $str; |
@@ -6892,11 +6892,11 @@ discard block |
||
6892 | 6892 | } |
6893 | 6893 | |
6894 | 6894 | if ($search === '') { |
6895 | - return $str . $replacement; |
|
6895 | + return $str.$replacement; |
|
6896 | 6896 | } |
6897 | 6897 | |
6898 | 6898 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6899 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6899 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6900 | 6900 | } |
6901 | 6901 | |
6902 | 6902 | return $str; |
@@ -6919,7 +6919,7 @@ discard block |
||
6919 | 6919 | |
6920 | 6920 | if ($pos !== false) { |
6921 | 6921 | /** @psalm-suppress InvalidReturnStatement */ |
6922 | - return self::substr_replace($subject, $replace, $pos, (int) self::strlen($search)); |
|
6922 | + return self::substr_replace($subject, $replace, $pos, (int)self::strlen($search)); |
|
6923 | 6923 | } |
6924 | 6924 | |
6925 | 6925 | return $subject; |
@@ -6944,7 +6944,7 @@ discard block |
||
6944 | 6944 | $pos = self::strrpos($subject, $search); |
6945 | 6945 | if ($pos !== false) { |
6946 | 6946 | /** @psalm-suppress InvalidReturnStatement */ |
6947 | - return self::substr_replace($subject, $replace, $pos, (int) self::strlen($search)); |
|
6947 | + return self::substr_replace($subject, $replace, $pos, (int)self::strlen($search)); |
|
6948 | 6948 | } |
6949 | 6949 | |
6950 | 6950 | return $subject; |
@@ -6963,7 +6963,7 @@ discard block |
||
6963 | 6963 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
6964 | 6964 | { |
6965 | 6965 | if ($encoding === 'UTF-8') { |
6966 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
6966 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
6967 | 6967 | /** @noinspection NonSecureShuffleUsageInspection */ |
6968 | 6968 | \shuffle($indexes); |
6969 | 6969 | |
@@ -6979,7 +6979,7 @@ discard block |
||
6979 | 6979 | } else { |
6980 | 6980 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6981 | 6981 | |
6982 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
6982 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
6983 | 6983 | /** @noinspection NonSecureShuffleUsageInspection */ |
6984 | 6984 | \shuffle($indexes); |
6985 | 6985 | |
@@ -7020,11 +7020,11 @@ discard block |
||
7020 | 7020 | ) { |
7021 | 7021 | if ($encoding === 'UTF-8') { |
7022 | 7022 | if ($end === null) { |
7023 | - $length = (int) \mb_strlen($str); |
|
7023 | + $length = (int)\mb_strlen($str); |
|
7024 | 7024 | } elseif ($end >= 0 && $end <= $start) { |
7025 | 7025 | return ''; |
7026 | 7026 | } elseif ($end < 0) { |
7027 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7027 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7028 | 7028 | } else { |
7029 | 7029 | $length = $end - $start; |
7030 | 7030 | } |
@@ -7035,11 +7035,11 @@ discard block |
||
7035 | 7035 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7036 | 7036 | |
7037 | 7037 | if ($end === null) { |
7038 | - $length = (int) self::strlen($str, $encoding); |
|
7038 | + $length = (int)self::strlen($str, $encoding); |
|
7039 | 7039 | } elseif ($end >= 0 && $end <= $start) { |
7040 | 7040 | return ''; |
7041 | 7041 | } elseif ($end < 0) { |
7042 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7042 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7043 | 7043 | } else { |
7044 | 7044 | $length = $end - $start; |
7045 | 7045 | } |
@@ -7071,35 +7071,35 @@ discard block |
||
7071 | 7071 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7072 | 7072 | } |
7073 | 7073 | |
7074 | - $str = (string) \preg_replace_callback( |
|
7074 | + $str = (string)\preg_replace_callback( |
|
7075 | 7075 | '/([\d|A-Z])/u', |
7076 | 7076 | /** |
7077 | 7077 | * @param string[] $matches |
7078 | 7078 | * |
7079 | 7079 | * @return string |
7080 | 7080 | */ |
7081 | - static function (array $matches) use ($encoding): string { |
|
7081 | + static function(array $matches) use ($encoding): string { |
|
7082 | 7082 | $match = $matches[1]; |
7083 | - $matchInt = (int) $match; |
|
7083 | + $matchInt = (int)$match; |
|
7084 | 7084 | |
7085 | - if ((string) $matchInt === $match) { |
|
7086 | - return '_' . $match . '_'; |
|
7085 | + if ((string)$matchInt === $match) { |
|
7086 | + return '_'.$match.'_'; |
|
7087 | 7087 | } |
7088 | 7088 | |
7089 | 7089 | if ($encoding === 'UTF-8') { |
7090 | - return '_' . \mb_strtolower($match); |
|
7090 | + return '_'.\mb_strtolower($match); |
|
7091 | 7091 | } |
7092 | 7092 | |
7093 | - return '_' . self::strtolower($match, $encoding); |
|
7093 | + return '_'.self::strtolower($match, $encoding); |
|
7094 | 7094 | }, |
7095 | 7095 | $str |
7096 | 7096 | ); |
7097 | 7097 | |
7098 | - $str = (string) \preg_replace( |
|
7098 | + $str = (string)\preg_replace( |
|
7099 | 7099 | [ |
7100 | - '/\s+/', // convert spaces to "_" |
|
7101 | - '/^\s+|\s+$/', // trim leading & trailing spaces |
|
7102 | - '/_+/', // remove double "_" |
|
7100 | + '/\s+/', // convert spaces to "_" |
|
7101 | + '/^\s+|\s+$/', // trim leading & trailing spaces |
|
7102 | + '/_+/', // remove double "_" |
|
7103 | 7103 | ], |
7104 | 7104 | [ |
7105 | 7105 | '_', |
@@ -7183,7 +7183,7 @@ discard block |
||
7183 | 7183 | /** @noinspection PhpComposerExtensionStubsInspection */ |
7184 | 7184 | return \array_filter( |
7185 | 7185 | \mb_split($pattern, $str), |
7186 | - static function () use (&$limit): bool { |
|
7186 | + static function() use (&$limit): bool { |
|
7187 | 7187 | return --$limit >= 0; |
7188 | 7188 | } |
7189 | 7189 | ); |
@@ -7199,7 +7199,7 @@ discard block |
||
7199 | 7199 | $limit = -1; |
7200 | 7200 | } |
7201 | 7201 | |
7202 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7202 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7203 | 7203 | |
7204 | 7204 | if ($array === false) { |
7205 | 7205 | return []; |
@@ -7275,9 +7275,9 @@ discard block |
||
7275 | 7275 | return ''; |
7276 | 7276 | } |
7277 | 7277 | |
7278 | - return (string) \mb_substr( |
|
7278 | + return (string)\mb_substr( |
|
7279 | 7279 | $str, |
7280 | - $offset + (int) \mb_strlen($separator) |
|
7280 | + $offset + (int)\mb_strlen($separator) |
|
7281 | 7281 | ); |
7282 | 7282 | } |
7283 | 7283 | |
@@ -7286,9 +7286,9 @@ discard block |
||
7286 | 7286 | return ''; |
7287 | 7287 | } |
7288 | 7288 | |
7289 | - return (string) \mb_substr( |
|
7289 | + return (string)\mb_substr( |
|
7290 | 7290 | $str, |
7291 | - $offset + (int) self::strlen($separator, $encoding), |
|
7291 | + $offset + (int)self::strlen($separator, $encoding), |
|
7292 | 7292 | null, |
7293 | 7293 | $encoding |
7294 | 7294 | ); |
@@ -7315,9 +7315,9 @@ discard block |
||
7315 | 7315 | return ''; |
7316 | 7316 | } |
7317 | 7317 | |
7318 | - return (string) \mb_substr( |
|
7318 | + return (string)\mb_substr( |
|
7319 | 7319 | $str, |
7320 | - $offset + (int) \mb_strlen($separator) |
|
7320 | + $offset + (int)\mb_strlen($separator) |
|
7321 | 7321 | ); |
7322 | 7322 | } |
7323 | 7323 | |
@@ -7326,9 +7326,9 @@ discard block |
||
7326 | 7326 | return ''; |
7327 | 7327 | } |
7328 | 7328 | |
7329 | - return (string) self::substr( |
|
7329 | + return (string)self::substr( |
|
7330 | 7330 | $str, |
7331 | - $offset + (int) self::strlen($separator, $encoding), |
|
7331 | + $offset + (int)self::strlen($separator, $encoding), |
|
7332 | 7332 | null, |
7333 | 7333 | $encoding |
7334 | 7334 | ); |
@@ -7358,7 +7358,7 @@ discard block |
||
7358 | 7358 | return ''; |
7359 | 7359 | } |
7360 | 7360 | |
7361 | - return (string) \mb_substr( |
|
7361 | + return (string)\mb_substr( |
|
7362 | 7362 | $str, |
7363 | 7363 | 0, |
7364 | 7364 | $offset |
@@ -7370,7 +7370,7 @@ discard block |
||
7370 | 7370 | return ''; |
7371 | 7371 | } |
7372 | 7372 | |
7373 | - return (string) self::substr( |
|
7373 | + return (string)self::substr( |
|
7374 | 7374 | $str, |
7375 | 7375 | 0, |
7376 | 7376 | $offset, |
@@ -7399,7 +7399,7 @@ discard block |
||
7399 | 7399 | return ''; |
7400 | 7400 | } |
7401 | 7401 | |
7402 | - return (string) \mb_substr( |
|
7402 | + return (string)\mb_substr( |
|
7403 | 7403 | $str, |
7404 | 7404 | 0, |
7405 | 7405 | $offset |
@@ -7413,7 +7413,7 @@ discard block |
||
7413 | 7413 | |
7414 | 7414 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7415 | 7415 | |
7416 | - return (string) self::substr( |
|
7416 | + return (string)self::substr( |
|
7417 | 7417 | $str, |
7418 | 7418 | 0, |
7419 | 7419 | $offset, |
@@ -7521,7 +7521,7 @@ discard block |
||
7521 | 7521 | */ |
7522 | 7522 | public static function str_surround(string $str, string $substring): string |
7523 | 7523 | { |
7524 | - return $substring . $str . $substring; |
|
7524 | + return $substring.$str.$substring; |
|
7525 | 7525 | } |
7526 | 7526 | |
7527 | 7527 | /** |
@@ -7565,9 +7565,9 @@ discard block |
||
7565 | 7565 | |
7566 | 7566 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
7567 | 7567 | |
7568 | - return (string) \preg_replace_callback( |
|
7568 | + return (string)\preg_replace_callback( |
|
7569 | 7569 | '/([\S]+)/u', |
7570 | - static function (array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7570 | + static function(array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7571 | 7571 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
7572 | 7572 | return $match[0]; |
7573 | 7573 | } |
@@ -7653,16 +7653,16 @@ discard block |
||
7653 | 7653 | } |
7654 | 7654 | |
7655 | 7655 | // the main substitutions |
7656 | - $str = (string) \preg_replace_callback( |
|
7656 | + $str = (string)\preg_replace_callback( |
|
7657 | 7657 | '~\b (_*) (?: # 1. Leading underscore and |
7658 | 7658 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
7659 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) # URL, domain, or email |
|
7659 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) # URL, domain, or email |
|
7660 | 7660 | | |
7661 | - ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' ) # 3. or small word (case-insensitive) |
|
7661 | + ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' ) # 3. or small word (case-insensitive) |
|
7662 | 7662 | | |
7663 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 4. or word w/o internal caps |
|
7663 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 4. or word w/o internal caps |
|
7664 | 7664 | | |
7665 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 5. or some other word |
|
7665 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 5. or some other word |
|
7666 | 7666 | ) (_*) \b # 6. With trailing underscore |
7667 | 7667 | ~ux', |
7668 | 7668 | /** |
@@ -7670,7 +7670,7 @@ discard block |
||
7670 | 7670 | * |
7671 | 7671 | * @return string |
7672 | 7672 | */ |
7673 | - static function (array $matches) use ($encoding): string { |
|
7673 | + static function(array $matches) use ($encoding): string { |
|
7674 | 7674 | // preserve leading underscore |
7675 | 7675 | $str = $matches[1]; |
7676 | 7676 | if ($matches[2]) { |
@@ -7695,26 +7695,26 @@ discard block |
||
7695 | 7695 | ); |
7696 | 7696 | |
7697 | 7697 | // Exceptions for small words: capitalize at start of title... |
7698 | - $str = (string) \preg_replace_callback( |
|
7698 | + $str = (string)\preg_replace_callback( |
|
7699 | 7699 | '~( \A [[:punct:]]* # start of title... |
7700 | 7700 | | [:.;?!][ ]+ # or of subsentence... |
7701 | 7701 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
7702 | - ( ' . $smallWordsRx . ' ) \b # ...followed by small word |
|
7702 | + ( ' . $smallWordsRx.' ) \b # ...followed by small word |
|
7703 | 7703 | ~uxi', |
7704 | 7704 | /** |
7705 | 7705 | * @param string[] $matches |
7706 | 7706 | * |
7707 | 7707 | * @return string |
7708 | 7708 | */ |
7709 | - static function (array $matches) use ($encoding): string { |
|
7710 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7709 | + static function(array $matches) use ($encoding): string { |
|
7710 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7711 | 7711 | }, |
7712 | 7712 | $str |
7713 | 7713 | ); |
7714 | 7714 | |
7715 | 7715 | // ...and end of title |
7716 | - $str = (string) \preg_replace_callback( |
|
7717 | - '~\b ( ' . $smallWordsRx . ' ) # small word... |
|
7716 | + $str = (string)\preg_replace_callback( |
|
7717 | + '~\b ( '.$smallWordsRx.' ) # small word... |
|
7718 | 7718 | (?= [[:punct:]]* \Z # ...at the end of the title... |
7719 | 7719 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
7720 | 7720 | ~uxi', |
@@ -7723,7 +7723,7 @@ discard block |
||
7723 | 7723 | * |
7724 | 7724 | * @return string |
7725 | 7725 | */ |
7726 | - static function (array $matches) use ($encoding): string { |
|
7726 | + static function(array $matches) use ($encoding): string { |
|
7727 | 7727 | return static::str_upper_first($matches[1], $encoding); |
7728 | 7728 | }, |
7729 | 7729 | $str |
@@ -7731,10 +7731,10 @@ discard block |
||
7731 | 7731 | |
7732 | 7732 | // Exceptions for small words in hyphenated compound words. |
7733 | 7733 | // e.g. "in-flight" -> In-Flight |
7734 | - $str = (string) \preg_replace_callback( |
|
7734 | + $str = (string)\preg_replace_callback( |
|
7735 | 7735 | '~\b |
7736 | 7736 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
7737 | - ( ' . $smallWordsRx . ' ) |
|
7737 | + ( ' . $smallWordsRx.' ) |
|
7738 | 7738 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
7739 | 7739 | ~uxi', |
7740 | 7740 | /** |
@@ -7742,18 +7742,18 @@ discard block |
||
7742 | 7742 | * |
7743 | 7743 | * @return string |
7744 | 7744 | */ |
7745 | - static function (array $matches) use ($encoding): string { |
|
7745 | + static function(array $matches) use ($encoding): string { |
|
7746 | 7746 | return static::str_upper_first($matches[1], $encoding); |
7747 | 7747 | }, |
7748 | 7748 | $str |
7749 | 7749 | ); |
7750 | 7750 | |
7751 | 7751 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
7752 | - $str = (string) \preg_replace_callback( |
|
7752 | + $str = (string)\preg_replace_callback( |
|
7753 | 7753 | '~\b |
7754 | 7754 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
7755 | 7755 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
7756 | - ( ' . $smallWordsRx . ' ) # ...followed by small word |
|
7756 | + ( ' . $smallWordsRx.' ) # ...followed by small word |
|
7757 | 7757 | (?! - ) # Negative lookahead for another - |
7758 | 7758 | ~uxi', |
7759 | 7759 | /** |
@@ -7761,8 +7761,8 @@ discard block |
||
7761 | 7761 | * |
7762 | 7762 | * @return string |
7763 | 7763 | */ |
7764 | - static function (array $matches) use ($encoding): string { |
|
7765 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7764 | + static function(array $matches) use ($encoding): string { |
|
7765 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7766 | 7766 | }, |
7767 | 7767 | $str |
7768 | 7768 | ); |
@@ -7865,7 +7865,7 @@ discard block |
||
7865 | 7865 | ); |
7866 | 7866 | |
7867 | 7867 | foreach ($tmpReturn as &$item) { |
7868 | - $item = (string) $item; |
|
7868 | + $item = (string)$item; |
|
7869 | 7869 | } |
7870 | 7870 | |
7871 | 7871 | return $tmpReturn; |
@@ -7910,37 +7910,37 @@ discard block |
||
7910 | 7910 | } |
7911 | 7911 | |
7912 | 7912 | if ($encoding === 'UTF-8') { |
7913 | - if ($length >= (int) \mb_strlen($str)) { |
|
7913 | + if ($length >= (int)\mb_strlen($str)) { |
|
7914 | 7914 | return $str; |
7915 | 7915 | } |
7916 | 7916 | |
7917 | 7917 | if ($substring !== '') { |
7918 | - $length -= (int) \mb_strlen($substring); |
|
7918 | + $length -= (int)\mb_strlen($substring); |
|
7919 | 7919 | |
7920 | 7920 | /** @noinspection UnnecessaryCastingInspection */ |
7921 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
7921 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
7922 | 7922 | } |
7923 | 7923 | |
7924 | 7924 | /** @noinspection UnnecessaryCastingInspection */ |
7925 | - return (string) \mb_substr($str, 0, $length); |
|
7925 | + return (string)\mb_substr($str, 0, $length); |
|
7926 | 7926 | } |
7927 | 7927 | |
7928 | 7928 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7929 | 7929 | |
7930 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
7930 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
7931 | 7931 | return $str; |
7932 | 7932 | } |
7933 | 7933 | |
7934 | 7934 | if ($substring !== '') { |
7935 | - $length -= (int) self::strlen($substring, $encoding); |
|
7935 | + $length -= (int)self::strlen($substring, $encoding); |
|
7936 | 7936 | } |
7937 | 7937 | |
7938 | - return ((string) self::substr( |
|
7938 | + return ((string)self::substr( |
|
7939 | 7939 | $str, |
7940 | 7940 | 0, |
7941 | 7941 | $length, |
7942 | 7942 | $encoding |
7943 | - )) . $substring; |
|
7943 | + )).$substring; |
|
7944 | 7944 | } |
7945 | 7945 | |
7946 | 7946 | /** |
@@ -7970,12 +7970,12 @@ discard block |
||
7970 | 7970 | } |
7971 | 7971 | |
7972 | 7972 | if ($encoding === 'UTF-8') { |
7973 | - if ($length >= (int) \mb_strlen($str)) { |
|
7973 | + if ($length >= (int)\mb_strlen($str)) { |
|
7974 | 7974 | return $str; |
7975 | 7975 | } |
7976 | 7976 | |
7977 | 7977 | // need to further trim the string so we can append the substring |
7978 | - $length -= (int) \mb_strlen($substring); |
|
7978 | + $length -= (int)\mb_strlen($substring); |
|
7979 | 7979 | if ($length <= 0) { |
7980 | 7980 | return $substring; |
7981 | 7981 | } |
@@ -7997,18 +7997,18 @@ discard block |
||
7997 | 7997 | || |
7998 | 7998 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
7999 | 7999 | ) { |
8000 | - $truncated = (string) \mb_substr($truncated, 0, (int) $lastPos); |
|
8000 | + $truncated = (string)\mb_substr($truncated, 0, (int)$lastPos); |
|
8001 | 8001 | } |
8002 | 8002 | } |
8003 | 8003 | } else { |
8004 | 8004 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8005 | 8005 | |
8006 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8006 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8007 | 8007 | return $str; |
8008 | 8008 | } |
8009 | 8009 | |
8010 | 8010 | // need to further trim the string so we can append the substring |
8011 | - $length -= (int) self::strlen($substring, $encoding); |
|
8011 | + $length -= (int)self::strlen($substring, $encoding); |
|
8012 | 8012 | if ($length <= 0) { |
8013 | 8013 | return $substring; |
8014 | 8014 | } |
@@ -8030,12 +8030,12 @@ discard block |
||
8030 | 8030 | || |
8031 | 8031 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8032 | 8032 | ) { |
8033 | - $truncated = (string) self::substr($truncated, 0, (int) $lastPos, $encoding); |
|
8033 | + $truncated = (string)self::substr($truncated, 0, (int)$lastPos, $encoding); |
|
8034 | 8034 | } |
8035 | 8035 | } |
8036 | 8036 | } |
8037 | 8037 | |
8038 | - return $truncated . $substring; |
|
8038 | + return $truncated.$substring; |
|
8039 | 8039 | } |
8040 | 8040 | |
8041 | 8041 | /** |
@@ -8125,13 +8125,13 @@ discard block |
||
8125 | 8125 | } |
8126 | 8126 | } elseif ($format === 2) { |
8127 | 8127 | $numberOfWords = []; |
8128 | - $offset = (int) self::strlen($strParts[0]); |
|
8128 | + $offset = (int)self::strlen($strParts[0]); |
|
8129 | 8129 | for ($i = 1; $i < $len; $i += 2) { |
8130 | 8130 | $numberOfWords[$offset] = $strParts[$i]; |
8131 | - $offset += (int) self::strlen($strParts[$i]) + (int) self::strlen($strParts[$i + 1]); |
|
8131 | + $offset += (int)self::strlen($strParts[$i]) + (int)self::strlen($strParts[$i + 1]); |
|
8132 | 8132 | } |
8133 | 8133 | } else { |
8134 | - $numberOfWords = (int) (($len - 1) / 2); |
|
8134 | + $numberOfWords = (int)(($len - 1) / 2); |
|
8135 | 8135 | } |
8136 | 8136 | |
8137 | 8137 | return $numberOfWords; |
@@ -8195,7 +8195,7 @@ discard block |
||
8195 | 8195 | */ |
8196 | 8196 | public static function strcmp(string $str1, string $str2): int |
8197 | 8197 | { |
8198 | - return $str1 . '' === $str2 . '' ? 0 : \strcmp( |
|
8198 | + return $str1.'' === $str2.'' ? 0 : \strcmp( |
|
8199 | 8199 | \Normalizer::normalize($str1, \Normalizer::NFD), |
8200 | 8200 | \Normalizer::normalize($str2, \Normalizer::NFD) |
8201 | 8201 | ); |
@@ -8224,21 +8224,21 @@ discard block |
||
8224 | 8224 | } |
8225 | 8225 | |
8226 | 8226 | if ($charList === '') { |
8227 | - return (int) self::strlen($str, $encoding); |
|
8227 | + return (int)self::strlen($str, $encoding); |
|
8228 | 8228 | } |
8229 | 8229 | |
8230 | 8230 | if ($offset !== null || $length !== null) { |
8231 | 8231 | if ($encoding === 'UTF-8') { |
8232 | 8232 | if ($length === null) { |
8233 | 8233 | /** @noinspection UnnecessaryCastingInspection */ |
8234 | - $strTmp = \mb_substr($str, (int) $offset); |
|
8234 | + $strTmp = \mb_substr($str, (int)$offset); |
|
8235 | 8235 | } else { |
8236 | 8236 | /** @noinspection UnnecessaryCastingInspection */ |
8237 | - $strTmp = \mb_substr($str, (int) $offset, $length); |
|
8237 | + $strTmp = \mb_substr($str, (int)$offset, $length); |
|
8238 | 8238 | } |
8239 | 8239 | } else { |
8240 | 8240 | /** @noinspection UnnecessaryCastingInspection */ |
8241 | - $strTmp = self::substr($str, (int) $offset, $length, $encoding); |
|
8241 | + $strTmp = self::substr($str, (int)$offset, $length, $encoding); |
|
8242 | 8242 | } |
8243 | 8243 | if ($strTmp === false) { |
8244 | 8244 | return 0; |
@@ -8251,7 +8251,7 @@ discard block |
||
8251 | 8251 | } |
8252 | 8252 | |
8253 | 8253 | $matches = []; |
8254 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $matches)) { |
|
8254 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $matches)) { |
|
8255 | 8255 | $return = self::strlen($matches[1], $encoding); |
8256 | 8256 | if ($return === false) { |
8257 | 8257 | return 0; |
@@ -8260,7 +8260,7 @@ discard block |
||
8260 | 8260 | return $return; |
8261 | 8261 | } |
8262 | 8262 | |
8263 | - return (int) self::strlen($str, $encoding); |
|
8263 | + return (int)self::strlen($str, $encoding); |
|
8264 | 8264 | } |
8265 | 8265 | |
8266 | 8266 | /** |
@@ -8378,7 +8378,7 @@ discard block |
||
8378 | 8378 | return ''; |
8379 | 8379 | } |
8380 | 8380 | |
8381 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
8381 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
8382 | 8382 | } |
8383 | 8383 | |
8384 | 8384 | /** |
@@ -8443,7 +8443,7 @@ discard block |
||
8443 | 8443 | // fallback for ascii only |
8444 | 8444 | // |
8445 | 8445 | |
8446 | - if (self::is_ascii($haystack . $needle)) { |
|
8446 | + if (self::is_ascii($haystack.$needle)) { |
|
8447 | 8447 | return \stripos($haystack, $needle, $offset); |
8448 | 8448 | } |
8449 | 8449 | |
@@ -8510,7 +8510,7 @@ discard block |
||
8510 | 8510 | && |
8511 | 8511 | self::$SUPPORT['mbstring'] === false |
8512 | 8512 | ) { |
8513 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8513 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8514 | 8514 | } |
8515 | 8515 | |
8516 | 8516 | if ( |
@@ -8524,11 +8524,11 @@ discard block |
||
8524 | 8524 | } |
8525 | 8525 | } |
8526 | 8526 | |
8527 | - if (self::is_ascii($needle . $haystack)) { |
|
8527 | + if (self::is_ascii($needle.$haystack)) { |
|
8528 | 8528 | return \stristr($haystack, $needle, $before_needle); |
8529 | 8529 | } |
8530 | 8530 | |
8531 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
8531 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
8532 | 8532 | |
8533 | 8533 | if (!isset($match[1])) { |
8534 | 8534 | return false; |
@@ -8538,7 +8538,7 @@ discard block |
||
8538 | 8538 | return $match[1]; |
8539 | 8539 | } |
8540 | 8540 | |
8541 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
8541 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
8542 | 8542 | } |
8543 | 8543 | |
8544 | 8544 | /** |
@@ -8605,7 +8605,7 @@ discard block |
||
8605 | 8605 | && |
8606 | 8606 | self::$SUPPORT['iconv'] === false |
8607 | 8607 | ) { |
8608 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8608 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8609 | 8609 | } |
8610 | 8610 | |
8611 | 8611 | // |
@@ -8716,7 +8716,7 @@ discard block |
||
8716 | 8716 | */ |
8717 | 8717 | public static function strnatcmp(string $str1, string $str2): int |
8718 | 8718 | { |
8719 | - return $str1 . '' === $str2 . '' ? 0 : \strnatcmp((string) self::strtonatfold($str1), (string) self::strtonatfold($str2)); |
|
8719 | + return $str1.'' === $str2.'' ? 0 : \strnatcmp((string)self::strtonatfold($str1), (string)self::strtonatfold($str2)); |
|
8720 | 8720 | } |
8721 | 8721 | |
8722 | 8722 | /** |
@@ -8773,11 +8773,11 @@ discard block |
||
8773 | 8773 | } |
8774 | 8774 | |
8775 | 8775 | if ($encoding === 'UTF-8') { |
8776 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
8777 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
8776 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
8777 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
8778 | 8778 | } else { |
8779 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
8780 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
8779 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
8780 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
8781 | 8781 | } |
8782 | 8782 | |
8783 | 8783 | return self::strcmp($str1, $str2); |
@@ -8799,8 +8799,8 @@ discard block |
||
8799 | 8799 | return false; |
8800 | 8800 | } |
8801 | 8801 | |
8802 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
8803 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
8802 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
8803 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
8804 | 8804 | } |
8805 | 8805 | |
8806 | 8806 | return false; |
@@ -8833,10 +8833,10 @@ discard block |
||
8833 | 8833 | } |
8834 | 8834 | |
8835 | 8835 | // iconv and mbstring do not support integer $needle |
8836 | - if ((int) $needle === $needle) { |
|
8837 | - $needle = (string) self::chr($needle); |
|
8836 | + if ((int)$needle === $needle) { |
|
8837 | + $needle = (string)self::chr($needle); |
|
8838 | 8838 | } |
8839 | - $needle = (string) $needle; |
|
8839 | + $needle = (string)$needle; |
|
8840 | 8840 | |
8841 | 8841 | if ($needle === '') { |
8842 | 8842 | return false; |
@@ -8883,7 +8883,7 @@ discard block |
||
8883 | 8883 | && |
8884 | 8884 | self::$SUPPORT['mbstring'] === false |
8885 | 8885 | ) { |
8886 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8886 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8887 | 8887 | } |
8888 | 8888 | |
8889 | 8889 | // |
@@ -8924,7 +8924,7 @@ discard block |
||
8924 | 8924 | // fallback for ascii only |
8925 | 8925 | // |
8926 | 8926 | |
8927 | - if (self::is_ascii($haystack . $needle)) { |
|
8927 | + if (self::is_ascii($haystack.$needle)) { |
|
8928 | 8928 | return \strpos($haystack, $needle, $offset); |
8929 | 8929 | } |
8930 | 8930 | |
@@ -8936,7 +8936,7 @@ discard block |
||
8936 | 8936 | if ($haystackTmp === false) { |
8937 | 8937 | $haystackTmp = ''; |
8938 | 8938 | } |
8939 | - $haystack = (string) $haystackTmp; |
|
8939 | + $haystack = (string)$haystackTmp; |
|
8940 | 8940 | |
8941 | 8941 | if ($offset < 0) { |
8942 | 8942 | $offset = 0; |
@@ -8948,7 +8948,7 @@ discard block |
||
8948 | 8948 | } |
8949 | 8949 | |
8950 | 8950 | if ($pos) { |
8951 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
8951 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
8952 | 8952 | } |
8953 | 8953 | |
8954 | 8954 | return $offset + 0; |
@@ -9059,7 +9059,7 @@ discard block |
||
9059 | 9059 | && |
9060 | 9060 | self::$SUPPORT['mbstring'] === false |
9061 | 9061 | ) { |
9062 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9062 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9063 | 9063 | } |
9064 | 9064 | |
9065 | 9065 | // |
@@ -9071,7 +9071,7 @@ discard block |
||
9071 | 9071 | if ($needleTmp === false) { |
9072 | 9072 | return false; |
9073 | 9073 | } |
9074 | - $needle = (string) $needleTmp; |
|
9074 | + $needle = (string)$needleTmp; |
|
9075 | 9075 | |
9076 | 9076 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
9077 | 9077 | if ($pos === false) { |
@@ -9093,7 +9093,7 @@ discard block |
||
9093 | 9093 | if ($needleTmp === false) { |
9094 | 9094 | return false; |
9095 | 9095 | } |
9096 | - $needle = (string) $needleTmp; |
|
9096 | + $needle = (string)$needleTmp; |
|
9097 | 9097 | |
9098 | 9098 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
9099 | 9099 | if ($pos === false) { |
@@ -9125,7 +9125,7 @@ discard block |
||
9125 | 9125 | $reversed = ''; |
9126 | 9126 | |
9127 | 9127 | if ($encoding === 'UTF-8') { |
9128 | - $i = (int) \mb_strlen($str); |
|
9128 | + $i = (int)\mb_strlen($str); |
|
9129 | 9129 | while ($i--) { |
9130 | 9130 | $reversedTmp = \mb_substr($str, $i, 1); |
9131 | 9131 | if ($reversedTmp !== false) { |
@@ -9135,7 +9135,7 @@ discard block |
||
9135 | 9135 | } else { |
9136 | 9136 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9137 | 9137 | |
9138 | - $i = (int) self::strlen($str, $encoding); |
|
9138 | + $i = (int)self::strlen($str, $encoding); |
|
9139 | 9139 | while ($i--) { |
9140 | 9140 | $reversedTmp = self::substr($str, $i, 1, $encoding); |
9141 | 9141 | if ($reversedTmp !== false) { |
@@ -9209,7 +9209,7 @@ discard block |
||
9209 | 9209 | if ($needleTmp === false) { |
9210 | 9210 | return false; |
9211 | 9211 | } |
9212 | - $needle = (string) $needleTmp; |
|
9212 | + $needle = (string)$needleTmp; |
|
9213 | 9213 | |
9214 | 9214 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
9215 | 9215 | if ($pos === false) { |
@@ -9248,10 +9248,10 @@ discard block |
||
9248 | 9248 | } |
9249 | 9249 | |
9250 | 9250 | // iconv and mbstring do not support integer $needle |
9251 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9252 | - $needle = (string) self::chr($needle); |
|
9251 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9252 | + $needle = (string)self::chr($needle); |
|
9253 | 9253 | } |
9254 | - $needle = (string) $needle; |
|
9254 | + $needle = (string)$needle; |
|
9255 | 9255 | |
9256 | 9256 | if ($needle === '') { |
9257 | 9257 | return false; |
@@ -9296,7 +9296,7 @@ discard block |
||
9296 | 9296 | && |
9297 | 9297 | self::$SUPPORT['mbstring'] === false |
9298 | 9298 | ) { |
9299 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9299 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9300 | 9300 | } |
9301 | 9301 | |
9302 | 9302 | // |
@@ -9320,7 +9320,7 @@ discard block |
||
9320 | 9320 | // fallback for ascii only |
9321 | 9321 | // |
9322 | 9322 | |
9323 | - if (self::is_ascii($haystack . $needle)) { |
|
9323 | + if (self::is_ascii($haystack.$needle)) { |
|
9324 | 9324 | return \strripos($haystack, $needle, $offset); |
9325 | 9325 | } |
9326 | 9326 | |
@@ -9396,10 +9396,10 @@ discard block |
||
9396 | 9396 | } |
9397 | 9397 | |
9398 | 9398 | // iconv and mbstring do not support integer $needle |
9399 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9400 | - $needle = (string) self::chr($needle); |
|
9399 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9400 | + $needle = (string)self::chr($needle); |
|
9401 | 9401 | } |
9402 | - $needle = (string) $needle; |
|
9402 | + $needle = (string)$needle; |
|
9403 | 9403 | |
9404 | 9404 | if ($needle === '' || $haystack === '') { |
9405 | 9405 | return false; |
@@ -9444,7 +9444,7 @@ discard block |
||
9444 | 9444 | && |
9445 | 9445 | self::$SUPPORT['mbstring'] === false |
9446 | 9446 | ) { |
9447 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9447 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9448 | 9448 | } |
9449 | 9449 | |
9450 | 9450 | // |
@@ -9468,7 +9468,7 @@ discard block |
||
9468 | 9468 | // fallback for ascii only |
9469 | 9469 | // |
9470 | 9470 | |
9471 | - if (self::is_ascii($haystack . $needle)) { |
|
9471 | + if (self::is_ascii($haystack.$needle)) { |
|
9472 | 9472 | return \strrpos($haystack, $needle, $offset); |
9473 | 9473 | } |
9474 | 9474 | |
@@ -9488,7 +9488,7 @@ discard block |
||
9488 | 9488 | if ($haystackTmp === false) { |
9489 | 9489 | $haystackTmp = ''; |
9490 | 9490 | } |
9491 | - $haystack = (string) $haystackTmp; |
|
9491 | + $haystack = (string)$haystackTmp; |
|
9492 | 9492 | } |
9493 | 9493 | |
9494 | 9494 | $pos = \strrpos($haystack, $needle); |
@@ -9501,7 +9501,7 @@ discard block |
||
9501 | 9501 | return false; |
9502 | 9502 | } |
9503 | 9503 | |
9504 | - return $offset + (int) self::strlen($strTmp); |
|
9504 | + return $offset + (int)self::strlen($strTmp); |
|
9505 | 9505 | } |
9506 | 9506 | |
9507 | 9507 | /** |
@@ -9561,12 +9561,12 @@ discard block |
||
9561 | 9561 | if ($offset || $length !== null) { |
9562 | 9562 | if ($encoding === 'UTF-8') { |
9563 | 9563 | if ($length === null) { |
9564 | - $str = (string) \mb_substr($str, $offset); |
|
9564 | + $str = (string)\mb_substr($str, $offset); |
|
9565 | 9565 | } else { |
9566 | - $str = (string) \mb_substr($str, $offset, $length); |
|
9566 | + $str = (string)\mb_substr($str, $offset, $length); |
|
9567 | 9567 | } |
9568 | 9568 | } else { |
9569 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
9569 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
9570 | 9570 | } |
9571 | 9571 | } |
9572 | 9572 | |
@@ -9576,7 +9576,7 @@ discard block |
||
9576 | 9576 | |
9577 | 9577 | $matches = []; |
9578 | 9578 | |
9579 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
9579 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
9580 | 9580 | } |
9581 | 9581 | |
9582 | 9582 | /** |
@@ -9645,7 +9645,7 @@ discard block |
||
9645 | 9645 | && |
9646 | 9646 | self::$SUPPORT['mbstring'] === false |
9647 | 9647 | ) { |
9648 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9648 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9649 | 9649 | } |
9650 | 9650 | |
9651 | 9651 | // |
@@ -9667,7 +9667,7 @@ discard block |
||
9667 | 9667 | // fallback for ascii only |
9668 | 9668 | // |
9669 | 9669 | |
9670 | - if (self::is_ascii($haystack . $needle)) { |
|
9670 | + if (self::is_ascii($haystack.$needle)) { |
|
9671 | 9671 | return \strstr($haystack, $needle, $before_needle); |
9672 | 9672 | } |
9673 | 9673 | |
@@ -9675,7 +9675,7 @@ discard block |
||
9675 | 9675 | // fallback via vanilla php |
9676 | 9676 | // |
9677 | 9677 | |
9678 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
9678 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
9679 | 9679 | |
9680 | 9680 | if (!isset($match[1])) { |
9681 | 9681 | return false; |
@@ -9685,7 +9685,7 @@ discard block |
||
9685 | 9685 | return $match[1]; |
9686 | 9686 | } |
9687 | 9687 | |
9688 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
9688 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
9689 | 9689 | } |
9690 | 9690 | |
9691 | 9691 | /** |
@@ -9799,7 +9799,7 @@ discard block |
||
9799 | 9799 | bool $tryToKeepStringLength = false |
9800 | 9800 | ): string { |
9801 | 9801 | // init |
9802 | - $str = (string) $str; |
|
9802 | + $str = (string)$str; |
|
9803 | 9803 | |
9804 | 9804 | if ($str === '') { |
9805 | 9805 | return ''; |
@@ -9824,19 +9824,19 @@ discard block |
||
9824 | 9824 | |
9825 | 9825 | if ($lang !== null) { |
9826 | 9826 | if (self::$SUPPORT['intl'] === true) { |
9827 | - $langCode = $lang . '-Lower'; |
|
9827 | + $langCode = $lang.'-Lower'; |
|
9828 | 9828 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
9829 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, \E_USER_WARNING); |
|
9829 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, \E_USER_WARNING); |
|
9830 | 9830 | |
9831 | 9831 | $langCode = 'Any-Lower'; |
9832 | 9832 | } |
9833 | 9833 | |
9834 | 9834 | /** @noinspection PhpComposerExtensionStubsInspection */ |
9835 | 9835 | /** @noinspection UnnecessaryCastingInspection */ |
9836 | - return (string) \transliterator_transliterate($langCode, $str); |
|
9836 | + return (string)\transliterator_transliterate($langCode, $str); |
|
9837 | 9837 | } |
9838 | 9838 | |
9839 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
9839 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
9840 | 9840 | } |
9841 | 9841 | |
9842 | 9842 | // always fallback via symfony polyfill |
@@ -9865,7 +9865,7 @@ discard block |
||
9865 | 9865 | bool $tryToKeepStringLength = false |
9866 | 9866 | ): string { |
9867 | 9867 | // init |
9868 | - $str = (string) $str; |
|
9868 | + $str = (string)$str; |
|
9869 | 9869 | |
9870 | 9870 | if ($str === '') { |
9871 | 9871 | return ''; |
@@ -9890,19 +9890,19 @@ discard block |
||
9890 | 9890 | |
9891 | 9891 | if ($lang !== null) { |
9892 | 9892 | if (self::$SUPPORT['intl'] === true) { |
9893 | - $langCode = $lang . '-Upper'; |
|
9893 | + $langCode = $lang.'-Upper'; |
|
9894 | 9894 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
9895 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
9895 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
9896 | 9896 | |
9897 | 9897 | $langCode = 'Any-Upper'; |
9898 | 9898 | } |
9899 | 9899 | |
9900 | 9900 | /** @noinspection PhpComposerExtensionStubsInspection */ |
9901 | 9901 | /** @noinspection UnnecessaryCastingInspection */ |
9902 | - return (string) \transliterator_transliterate($langCode, $str); |
|
9902 | + return (string)\transliterator_transliterate($langCode, $str); |
|
9903 | 9903 | } |
9904 | 9904 | |
9905 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
9905 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
9906 | 9906 | } |
9907 | 9907 | |
9908 | 9908 | // always fallback via symfony polyfill |
@@ -9946,7 +9946,7 @@ discard block |
||
9946 | 9946 | |
9947 | 9947 | $from = \array_combine($from, $to); |
9948 | 9948 | if ($from === false) { |
9949 | - 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) . ')'); |
|
9949 | + 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).')'); |
|
9950 | 9950 | } |
9951 | 9951 | } |
9952 | 9952 | |
@@ -10003,9 +10003,9 @@ discard block |
||
10003 | 10003 | } |
10004 | 10004 | |
10005 | 10005 | $wide = 0; |
10006 | - $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); |
|
10006 | + $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); |
|
10007 | 10007 | |
10008 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
10008 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
10009 | 10009 | } |
10010 | 10010 | |
10011 | 10011 | /** |
@@ -10101,9 +10101,9 @@ discard block |
||
10101 | 10101 | } |
10102 | 10102 | |
10103 | 10103 | if ($length === null) { |
10104 | - $length = (int) $str_length; |
|
10104 | + $length = (int)$str_length; |
|
10105 | 10105 | } else { |
10106 | - $length = (int) $length; |
|
10106 | + $length = (int)$length; |
|
10107 | 10107 | } |
10108 | 10108 | |
10109 | 10109 | if ( |
@@ -10111,7 +10111,7 @@ discard block |
||
10111 | 10111 | && |
10112 | 10112 | self::$SUPPORT['mbstring'] === false |
10113 | 10113 | ) { |
10114 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10114 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10115 | 10115 | } |
10116 | 10116 | |
10117 | 10117 | // |
@@ -10199,16 +10199,16 @@ discard block |
||
10199 | 10199 | ) { |
10200 | 10200 | if ($encoding === 'UTF-8') { |
10201 | 10201 | if ($length === null) { |
10202 | - $str1 = (string) \mb_substr($str1, $offset); |
|
10202 | + $str1 = (string)\mb_substr($str1, $offset); |
|
10203 | 10203 | } else { |
10204 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
10204 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
10205 | 10205 | } |
10206 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
10206 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
10207 | 10207 | } else { |
10208 | 10208 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10209 | 10209 | |
10210 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
10211 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
10210 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
10211 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
10212 | 10212 | } |
10213 | 10213 | } |
10214 | 10214 | |
@@ -10270,13 +10270,13 @@ discard block |
||
10270 | 10270 | if ($lengthTmp === false) { |
10271 | 10271 | return false; |
10272 | 10272 | } |
10273 | - $length = (int) $lengthTmp; |
|
10273 | + $length = (int)$lengthTmp; |
|
10274 | 10274 | } |
10275 | 10275 | |
10276 | 10276 | if ($encoding === 'UTF-8') { |
10277 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
10277 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
10278 | 10278 | } else { |
10279 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
10279 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
10280 | 10280 | } |
10281 | 10281 | } |
10282 | 10282 | |
@@ -10285,7 +10285,7 @@ discard block |
||
10285 | 10285 | && |
10286 | 10286 | self::$SUPPORT['mbstring'] === false |
10287 | 10287 | ) { |
10288 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10288 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10289 | 10289 | } |
10290 | 10290 | |
10291 | 10291 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10296,7 +10296,7 @@ discard block |
||
10296 | 10296 | return \mb_substr_count($haystack, $needle, $encoding); |
10297 | 10297 | } |
10298 | 10298 | |
10299 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10299 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10300 | 10300 | |
10301 | 10301 | return \count($matches); |
10302 | 10302 | } |
@@ -10343,7 +10343,7 @@ discard block |
||
10343 | 10343 | if ($lengthTmp === false) { |
10344 | 10344 | return false; |
10345 | 10345 | } |
10346 | - $length = (int) $lengthTmp; |
|
10346 | + $length = (int)$lengthTmp; |
|
10347 | 10347 | } |
10348 | 10348 | |
10349 | 10349 | if ( |
@@ -10364,7 +10364,7 @@ discard block |
||
10364 | 10364 | if ($haystackTmp === false) { |
10365 | 10365 | $haystackTmp = ''; |
10366 | 10366 | } |
10367 | - $haystack = (string) $haystackTmp; |
|
10367 | + $haystack = (string)$haystackTmp; |
|
10368 | 10368 | } |
10369 | 10369 | |
10370 | 10370 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10403,10 +10403,10 @@ discard block |
||
10403 | 10403 | |
10404 | 10404 | if ($encoding === 'UTF-8') { |
10405 | 10405 | if ($caseSensitive) { |
10406 | - return (int) \mb_substr_count($str, $substring); |
|
10406 | + return (int)\mb_substr_count($str, $substring); |
|
10407 | 10407 | } |
10408 | 10408 | |
10409 | - return (int) \mb_substr_count( |
|
10409 | + return (int)\mb_substr_count( |
|
10410 | 10410 | \mb_strtoupper($str), |
10411 | 10411 | \mb_strtoupper($substring) |
10412 | 10412 | |
@@ -10416,10 +10416,10 @@ discard block |
||
10416 | 10416 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10417 | 10417 | |
10418 | 10418 | if ($caseSensitive) { |
10419 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
10419 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
10420 | 10420 | } |
10421 | 10421 | |
10422 | - return (int) \mb_substr_count( |
|
10422 | + return (int)\mb_substr_count( |
|
10423 | 10423 | self::strtocasefold($str, true, false, $encoding, null, false), |
10424 | 10424 | self::strtocasefold($substring, true, false, $encoding, null, false), |
10425 | 10425 | $encoding |
@@ -10445,7 +10445,7 @@ discard block |
||
10445 | 10445 | } |
10446 | 10446 | |
10447 | 10447 | if (self::str_istarts_with($haystack, $needle) === true) { |
10448 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10448 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10449 | 10449 | } |
10450 | 10450 | |
10451 | 10451 | return $haystack; |
@@ -10502,7 +10502,7 @@ discard block |
||
10502 | 10502 | } |
10503 | 10503 | |
10504 | 10504 | if (self::str_iends_with($haystack, $needle) === true) { |
10505 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
10505 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
10506 | 10506 | } |
10507 | 10507 | |
10508 | 10508 | return $haystack; |
@@ -10527,7 +10527,7 @@ discard block |
||
10527 | 10527 | } |
10528 | 10528 | |
10529 | 10529 | if (self::str_starts_with($haystack, $needle) === true) { |
10530 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10530 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10531 | 10531 | } |
10532 | 10532 | |
10533 | 10533 | return $haystack; |
@@ -10579,7 +10579,7 @@ discard block |
||
10579 | 10579 | if (\is_array($offset) === true) { |
10580 | 10580 | $offset = \array_slice($offset, 0, $num); |
10581 | 10581 | foreach ($offset as &$valueTmp) { |
10582 | - $valueTmp = (int) $valueTmp === $valueTmp ? $valueTmp : 0; |
|
10582 | + $valueTmp = (int)$valueTmp === $valueTmp ? $valueTmp : 0; |
|
10583 | 10583 | } |
10584 | 10584 | unset($valueTmp); |
10585 | 10585 | } else { |
@@ -10592,7 +10592,7 @@ discard block |
||
10592 | 10592 | } elseif (\is_array($length) === true) { |
10593 | 10593 | $length = \array_slice($length, 0, $num); |
10594 | 10594 | foreach ($length as &$valueTmpV2) { |
10595 | - $valueTmpV2 = (int) $valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10595 | + $valueTmpV2 = (int)$valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10596 | 10596 | } |
10597 | 10597 | unset($valueTmpV2); |
10598 | 10598 | } else { |
@@ -10612,8 +10612,8 @@ discard block |
||
10612 | 10612 | } |
10613 | 10613 | |
10614 | 10614 | // init |
10615 | - $str = (string) $str; |
|
10616 | - $replacement = (string) $replacement; |
|
10615 | + $str = (string)$str; |
|
10616 | + $replacement = (string)$replacement; |
|
10617 | 10617 | |
10618 | 10618 | if (\is_array($length) === true) { |
10619 | 10619 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -10628,16 +10628,16 @@ discard block |
||
10628 | 10628 | } |
10629 | 10629 | |
10630 | 10630 | if (self::$SUPPORT['mbstring'] === true) { |
10631 | - $string_length = (int) self::strlen($str, $encoding); |
|
10631 | + $string_length = (int)self::strlen($str, $encoding); |
|
10632 | 10632 | |
10633 | 10633 | if ($offset < 0) { |
10634 | - $offset = (int) \max(0, $string_length + $offset); |
|
10634 | + $offset = (int)\max(0, $string_length + $offset); |
|
10635 | 10635 | } elseif ($offset > $string_length) { |
10636 | 10636 | $offset = $string_length; |
10637 | 10637 | } |
10638 | 10638 | |
10639 | 10639 | if ($length !== null && $length < 0) { |
10640 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
10640 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
10641 | 10641 | } elseif ($length === null || $length > $string_length) { |
10642 | 10642 | $length = $string_length; |
10643 | 10643 | } |
@@ -10648,9 +10648,9 @@ discard block |
||
10648 | 10648 | } |
10649 | 10649 | |
10650 | 10650 | /** @noinspection AdditionOperationOnArraysInspection */ |
10651 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
10652 | - $replacement . |
|
10653 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10651 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
10652 | + $replacement. |
|
10653 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10654 | 10654 | } |
10655 | 10655 | |
10656 | 10656 | // |
@@ -10659,8 +10659,7 @@ discard block |
||
10659 | 10659 | |
10660 | 10660 | if (self::is_ascii($str)) { |
10661 | 10661 | return ($length === null) ? |
10662 | - \substr_replace($str, $replacement, $offset) : |
|
10663 | - \substr_replace($str, $replacement, $offset, $length); |
|
10662 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
10664 | 10663 | } |
10665 | 10664 | |
10666 | 10665 | // |
@@ -10676,7 +10675,7 @@ discard block |
||
10676 | 10675 | // e.g.: non mbstring support + invalid chars |
10677 | 10676 | return ''; |
10678 | 10677 | } |
10679 | - $length = (int) $lengthTmp; |
|
10678 | + $length = (int)$lengthTmp; |
|
10680 | 10679 | } |
10681 | 10680 | |
10682 | 10681 | \array_splice($smatches[0], $offset, $length, $rmatches[0]); |
@@ -10711,14 +10710,14 @@ discard block |
||
10711 | 10710 | && |
10712 | 10711 | \substr($haystack, -\strlen($needle)) === $needle |
10713 | 10712 | ) { |
10714 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
10713 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
10715 | 10714 | } |
10716 | 10715 | |
10717 | 10716 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
10718 | - return (string) self::substr( |
|
10717 | + return (string)self::substr( |
|
10719 | 10718 | $haystack, |
10720 | 10719 | 0, |
10721 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
10720 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
10722 | 10721 | $encoding |
10723 | 10722 | ); |
10724 | 10723 | } |
@@ -10748,10 +10747,10 @@ discard block |
||
10748 | 10747 | } |
10749 | 10748 | |
10750 | 10749 | if ($encoding === 'UTF-8') { |
10751 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10750 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10752 | 10751 | } |
10753 | 10752 | |
10754 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10753 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10755 | 10754 | } |
10756 | 10755 | |
10757 | 10756 | /** |
@@ -10947,7 +10946,7 @@ discard block |
||
10947 | 10946 | // INFO: https://unicode.org/cldr/utility/character.jsp?a=%E2%84%8C |
10948 | 10947 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10949 | 10948 | /** @noinspection UnnecessaryCastingInspection */ |
10950 | - $str = (string) \transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
10949 | + $str = (string)\transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
10951 | 10950 | |
10952 | 10951 | // check again, if we only have ASCII, now ... |
10953 | 10952 | if (self::is_ascii($str) === true) { |
@@ -11070,7 +11069,7 @@ discard block |
||
11070 | 11069 | public static function to_boolean($str): bool |
11071 | 11070 | { |
11072 | 11071 | // init |
11073 | - $str = (string) $str; |
|
11072 | + $str = (string)$str; |
|
11074 | 11073 | |
11075 | 11074 | if ($str === '') { |
11076 | 11075 | return false; |
@@ -11098,10 +11097,10 @@ discard block |
||
11098 | 11097 | } |
11099 | 11098 | |
11100 | 11099 | if (\is_numeric($str)) { |
11101 | - return ((float) $str + 0) > 0; |
|
11100 | + return ((float)$str + 0) > 0; |
|
11102 | 11101 | } |
11103 | 11102 | |
11104 | - return (bool) \trim($str); |
|
11103 | + return (bool)\trim($str); |
|
11105 | 11104 | } |
11106 | 11105 | |
11107 | 11106 | /** |
@@ -11122,11 +11121,11 @@ discard block |
||
11122 | 11121 | |
11123 | 11122 | $fallback_char_escaped = \preg_quote($fallback_char, '/'); |
11124 | 11123 | |
11125 | - $string = (string) \preg_replace( |
|
11124 | + $string = (string)\preg_replace( |
|
11126 | 11125 | [ |
11127 | - '/[^' . $fallback_char_escaped . '\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
11128 | - '/[\s]+/', // 2) convert spaces to $fallback_char |
|
11129 | - '/[' . $fallback_char_escaped . ']+/', // 3) remove double $fallback_char's |
|
11126 | + '/[^'.$fallback_char_escaped.'\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
11127 | + '/[\s]+/', // 2) convert spaces to $fallback_char |
|
11128 | + '/['.$fallback_char_escaped.']+/', // 3) remove double $fallback_char's |
|
11130 | 11129 | ], |
11131 | 11130 | [ |
11132 | 11131 | '', |
@@ -11157,7 +11156,7 @@ discard block |
||
11157 | 11156 | return $str; |
11158 | 11157 | } |
11159 | 11158 | |
11160 | - $str = (string) $str; |
|
11159 | + $str = (string)$str; |
|
11161 | 11160 | if ($str === '') { |
11162 | 11161 | return ''; |
11163 | 11162 | } |
@@ -11204,7 +11203,7 @@ discard block |
||
11204 | 11203 | return $str; |
11205 | 11204 | } |
11206 | 11205 | |
11207 | - $str = (string) $str; |
|
11206 | + $str = (string)$str; |
|
11208 | 11207 | if ($str === '') { |
11209 | 11208 | return $str; |
11210 | 11209 | } |
@@ -11222,7 +11221,7 @@ discard block |
||
11222 | 11221 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
11223 | 11222 | |
11224 | 11223 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11225 | - $buf .= $c1 . $c2; |
|
11224 | + $buf .= $c1.$c2; |
|
11226 | 11225 | ++$i; |
11227 | 11226 | } else { // not valid UTF8 - convert it |
11228 | 11227 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11233,7 +11232,7 @@ discard block |
||
11233 | 11232 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
11234 | 11233 | |
11235 | 11234 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11236 | - $buf .= $c1 . $c2 . $c3; |
|
11235 | + $buf .= $c1.$c2.$c3; |
|
11237 | 11236 | $i += 2; |
11238 | 11237 | } else { // not valid UTF8 - convert it |
11239 | 11238 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11245,7 +11244,7 @@ discard block |
||
11245 | 11244 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
11246 | 11245 | |
11247 | 11246 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11248 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
11247 | + $buf .= $c1.$c2.$c3.$c4; |
|
11249 | 11248 | $i += 3; |
11250 | 11249 | } else { // not valid UTF8 - convert it |
11251 | 11250 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11269,7 +11268,7 @@ discard block |
||
11269 | 11268 | * |
11270 | 11269 | * @return string |
11271 | 11270 | */ |
11272 | - static function (array $match): string { |
|
11271 | + static function(array $match): string { |
|
11273 | 11272 | return \mb_convert_encoding(\pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); |
11274 | 11273 | }, |
11275 | 11274 | $buf |
@@ -11315,7 +11314,7 @@ discard block |
||
11315 | 11314 | |
11316 | 11315 | if (self::$SUPPORT['mbstring'] === true) { |
11317 | 11316 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11318 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
11317 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
11319 | 11318 | } |
11320 | 11319 | |
11321 | 11320 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -11352,15 +11351,15 @@ discard block |
||
11352 | 11351 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
11353 | 11352 | |
11354 | 11353 | if ($encoding === 'UTF-8') { |
11355 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
11354 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
11356 | 11355 | |
11357 | 11356 | if ($useMbFunction === true) { |
11358 | 11357 | $strPartOne = \mb_strtoupper( |
11359 | - (string) \mb_substr($str, 0, 1) |
|
11358 | + (string)\mb_substr($str, 0, 1) |
|
11360 | 11359 | ); |
11361 | 11360 | } else { |
11362 | 11361 | $strPartOne = self::strtoupper( |
11363 | - (string) \mb_substr($str, 0, 1), |
|
11362 | + (string)\mb_substr($str, 0, 1), |
|
11364 | 11363 | $encoding, |
11365 | 11364 | false, |
11366 | 11365 | $lang, |
@@ -11370,16 +11369,16 @@ discard block |
||
11370 | 11369 | } else { |
11371 | 11370 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11372 | 11371 | |
11373 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
11372 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
11374 | 11373 | |
11375 | 11374 | if ($useMbFunction === true) { |
11376 | 11375 | $strPartOne = \mb_strtoupper( |
11377 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
11376 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
11378 | 11377 | $encoding |
11379 | 11378 | ); |
11380 | 11379 | } else { |
11381 | 11380 | $strPartOne = self::strtoupper( |
11382 | - (string) self::substr($str, 0, 1, $encoding), |
|
11381 | + (string)self::substr($str, 0, 1, $encoding), |
|
11383 | 11382 | $encoding, |
11384 | 11383 | false, |
11385 | 11384 | $lang, |
@@ -11388,7 +11387,7 @@ discard block |
||
11388 | 11387 | } |
11389 | 11388 | } |
11390 | 11389 | |
11391 | - return $strPartOne . $strPartTwo; |
|
11390 | + return $strPartOne.$strPartTwo; |
|
11392 | 11391 | } |
11393 | 11392 | |
11394 | 11393 | /** |
@@ -11439,7 +11438,7 @@ discard block |
||
11439 | 11438 | $str = self::clean($str); |
11440 | 11439 | } |
11441 | 11440 | |
11442 | - $usePhpDefaultFunctions = !(bool) ($charlist . \implode('', $exceptions)); |
|
11441 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
11443 | 11442 | |
11444 | 11443 | if ( |
11445 | 11444 | $usePhpDefaultFunctions === true |
@@ -11496,7 +11495,7 @@ discard block |
||
11496 | 11495 | |
11497 | 11496 | $pattern = '/%u([0-9a-f]{3,4})/i'; |
11498 | 11497 | if (\preg_match($pattern, $str)) { |
11499 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
11498 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
11500 | 11499 | } |
11501 | 11500 | |
11502 | 11501 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -11835,7 +11834,7 @@ discard block |
||
11835 | 11834 | if ( |
11836 | 11835 | $keepUtf8Chars === true |
11837 | 11836 | && |
11838 | - self::strlen($return) >= (int) self::strlen($str_backup) |
|
11837 | + self::strlen($return) >= (int)self::strlen($str_backup) |
|
11839 | 11838 | ) { |
11840 | 11839 | return $str_backup; |
11841 | 11840 | } |
@@ -11929,17 +11928,17 @@ discard block |
||
11929 | 11928 | return ''; |
11930 | 11929 | } |
11931 | 11930 | |
11932 | - \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches); |
|
11931 | + \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches); |
|
11933 | 11932 | |
11934 | 11933 | if ( |
11935 | 11934 | !isset($matches[0]) |
11936 | 11935 | || |
11937 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
11936 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
11938 | 11937 | ) { |
11939 | 11938 | return $str; |
11940 | 11939 | } |
11941 | 11940 | |
11942 | - return \rtrim($matches[0]) . $strAddOn; |
|
11941 | + return \rtrim($matches[0]).$strAddOn; |
|
11943 | 11942 | } |
11944 | 11943 | |
11945 | 11944 | /** |
@@ -12009,7 +12008,7 @@ discard block |
||
12009 | 12008 | $strReturn .= $break; |
12010 | 12009 | } |
12011 | 12010 | |
12012 | - return $strReturn . \implode('', $chars); |
|
12011 | + return $strReturn.\implode('', $chars); |
|
12013 | 12012 | } |
12014 | 12013 | |
12015 | 12014 | /** |
@@ -12022,7 +12021,7 @@ discard block |
||
12022 | 12021 | */ |
12023 | 12022 | public static function wordwrap_per_line(string $str, int $limit): string |
12024 | 12023 | { |
12025 | - $strings = (array) \preg_split('/\\r\\n|\\r|\\n/', $str); |
|
12024 | + $strings = (array)\preg_split('/\\r\\n|\\r|\\n/', $str); |
|
12026 | 12025 | |
12027 | 12026 | $string = ''; |
12028 | 12027 | foreach ($strings as &$value) { |
@@ -12101,7 +12100,7 @@ discard block |
||
12101 | 12100 | /** @noinspection PhpIncludeInspection */ |
12102 | 12101 | /** @noinspection UsingInclusionReturnValueInspection */ |
12103 | 12102 | /** @psalm-suppress UnresolvableInclude */ |
12104 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
12103 | + return include __DIR__.'/data/'.$file.'.php'; |
|
12105 | 12104 | } |
12106 | 12105 | |
12107 | 12106 | /** |
@@ -12113,7 +12112,7 @@ discard block |
||
12113 | 12112 | */ |
12114 | 12113 | private static function getDataIfExists(string $file) |
12115 | 12114 | { |
12116 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
12115 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
12117 | 12116 | if (\file_exists($file)) { |
12118 | 12117 | /** @noinspection PhpIncludeInspection */ |
12119 | 12118 | /** @noinspection UsingInclusionReturnValueInspection */ |
@@ -12138,7 +12137,7 @@ discard block |
||
12138 | 12137 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
12139 | 12138 | return \defined('MB_OVERLOAD_STRING') |
12140 | 12139 | && |
12141 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12140 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12142 | 12141 | } |
12143 | 12142 | |
12144 | 12143 | /** |
@@ -12188,7 +12187,7 @@ discard block |
||
12188 | 12187 | { |
12189 | 12188 | static $RX_CLASSS_CACHE = []; |
12190 | 12189 | |
12191 | - $cacheKey = $s . $class; |
|
12190 | + $cacheKey = $s.$class; |
|
12192 | 12191 | |
12193 | 12192 | if (isset($RX_CLASSS_CACHE[$cacheKey])) { |
12194 | 12193 | return $RX_CLASSS_CACHE[$cacheKey]; |
@@ -12200,7 +12199,7 @@ discard block |
||
12200 | 12199 | /** @noinspection AlterInForeachInspection */ |
12201 | 12200 | foreach (self::str_split($s) as &$s) { |
12202 | 12201 | if ($s === '-') { |
12203 | - $class[0] = '-' . $class[0]; |
|
12202 | + $class[0] = '-'.$class[0]; |
|
12204 | 12203 | } elseif (!isset($s[2])) { |
12205 | 12204 | $class[0] .= \preg_quote($s, '/'); |
12206 | 12205 | } elseif (self::strlen($s) === 1) { |
@@ -12211,13 +12210,13 @@ discard block |
||
12211 | 12210 | } |
12212 | 12211 | |
12213 | 12212 | if ($class[0]) { |
12214 | - $class[0] = '[' . $class[0] . ']'; |
|
12213 | + $class[0] = '['.$class[0].']'; |
|
12215 | 12214 | } |
12216 | 12215 | |
12217 | 12216 | if (\count($class) === 1) { |
12218 | 12217 | $return = $class[0]; |
12219 | 12218 | } else { |
12220 | - $return = '(?:' . \implode('|', $class) . ')'; |
|
12219 | + $return = '(?:'.\implode('|', $class).')'; |
|
12221 | 12220 | } |
12222 | 12221 | |
12223 | 12222 | $RX_CLASSS_CACHE[$cacheKey] = $return; |
@@ -12291,7 +12290,7 @@ discard block |
||
12291 | 12290 | $continue = false; |
12292 | 12291 | |
12293 | 12292 | if ($delimiter === '-') { |
12294 | - foreach ((array) $specialCases['names'] as &$beginning) { |
|
12293 | + foreach ((array)$specialCases['names'] as &$beginning) { |
|
12295 | 12294 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12296 | 12295 | $continue = true; |
12297 | 12296 | } |
@@ -12299,7 +12298,7 @@ discard block |
||
12299 | 12298 | unset($beginning); |
12300 | 12299 | } |
12301 | 12300 | |
12302 | - foreach ((array) $specialCases['prefixes'] as &$beginning) { |
|
12301 | + foreach ((array)$specialCases['prefixes'] as &$beginning) { |
|
12303 | 12302 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12304 | 12303 | $continue = true; |
12305 | 12304 | } |
@@ -12355,8 +12354,8 @@ discard block |
||
12355 | 12354 | $buf .= self::$WIN1252_TO_UTF8[$ordC1]; |
12356 | 12355 | } else { |
12357 | 12356 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
12358 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
12359 | - $buf .= $cc1 . $cc2; |
|
12357 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
12358 | + $buf .= $cc1.$cc2; |
|
12360 | 12359 | } |
12361 | 12360 | |
12362 | 12361 | return $buf; |