@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | return false; |
71 | 71 | } |
72 | 72 | |
73 | - $uri = (string) $_SERVER['REQUEST_URI']; |
|
73 | + $uri = (string)$_SERVER['REQUEST_URI']; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | $uriOrig = $uri; |
@@ -87,27 +87,27 @@ discard block |
||
87 | 87 | // When not, assumes Windows-1252 and redirects to the corresponding UTF-8 encoded URL |
88 | 88 | // |
89 | 89 | |
90 | - $uri = (string) \preg_replace_callback( |
|
90 | + $uri = (string)\preg_replace_callback( |
|
91 | 91 | '/[\x80-\xFF]+/', |
92 | 92 | /** |
93 | 93 | * @param array $m |
94 | 94 | * |
95 | 95 | * @return string |
96 | 96 | */ |
97 | - static function (array $m): string { |
|
97 | + static function(array $m): string { |
|
98 | 98 | return \rawurlencode($m[0]); |
99 | 99 | }, |
100 | 100 | $uri |
101 | 101 | ); |
102 | 102 | |
103 | - $uri = (string) \preg_replace_callback( |
|
103 | + $uri = (string)\preg_replace_callback( |
|
104 | 104 | '/(?:%[89A-F][0-9A-F])+/i', |
105 | 105 | /** |
106 | 106 | * @param array $m |
107 | 107 | * |
108 | 108 | * @return string |
109 | 109 | */ |
110 | - static function (array $m): string { |
|
110 | + static function(array $m): string { |
|
111 | 111 | return \rawurlencode(UTF8::rawurldecode($m[0])); |
112 | 112 | }, |
113 | 113 | $uri |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | ) { |
123 | 123 | // Use ob_start() to buffer content and avoid problem of headers already sent... |
124 | 124 | $severProtocol = ($_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'); |
125 | - \header($severProtocol . ' 301 Moved Permanently'); |
|
126 | - \header('Location: ' . $uri); |
|
125 | + \header($severProtocol.' 301 Moved Permanently'); |
|
126 | + \header('Location: '.$uri); |
|
127 | 127 | exit(); |
128 | 128 | } |
129 | 129 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | return false; |
161 | 161 | } |
162 | 162 | |
163 | - $length = (int) $length; |
|
163 | + $length = (int)$length; |
|
164 | 164 | |
165 | 165 | if ($length <= 0) { |
166 | 166 | return false; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | { |
192 | 192 | static $_IS_PHP; |
193 | 193 | |
194 | - $version = (string) $version; |
|
194 | + $version = (string)$version; |
|
195 | 195 | |
196 | 196 | if (!isset($_IS_PHP[$version])) { |
197 | 197 | $_IS_PHP[$version] = \version_compare(\PHP_VERSION, $version, '>='); |
@@ -3,17 +3,17 @@ discard block |
||
3 | 3 | return [ |
4 | 4 | 0x80 => "\xe2\x82\xac", // € |
5 | 5 | 0x82 => "\xe2\x80\x9a", // ‚ |
6 | - 0x83 => "\xc6\x92", // ƒ |
|
6 | + 0x83 => "\xc6\x92", // ƒ |
|
7 | 7 | 0x84 => "\xe2\x80\x9e", // „ |
8 | 8 | 0x85 => "\xe2\x80\xa6", // … |
9 | 9 | 0x86 => "\xe2\x80\xa0", // † |
10 | 10 | 0x87 => "\xe2\x80\xa1", // ‡ |
11 | - 0x88 => "\xcb\x86", // ˆ |
|
11 | + 0x88 => "\xcb\x86", // ˆ |
|
12 | 12 | 0x89 => "\xe2\x80\xb0", // ‰ |
13 | - 0x8a => "\xc5\xa0", // Š |
|
13 | + 0x8a => "\xc5\xa0", // Š |
|
14 | 14 | 0x8b => "\xe2\x80\xb9", // ‹ |
15 | - 0x8c => "\xc5\x92", // Œ |
|
16 | - 0x8e => "\xc5\xbd", // Ž |
|
15 | + 0x8c => "\xc5\x92", // Œ |
|
16 | + 0x8e => "\xc5\xbd", // Ž |
|
17 | 17 | 0x91 => "\xe2\x80\x98", // ‘ |
18 | 18 | 0x92 => "\xe2\x80\x99", // ’ |
19 | 19 | 0x93 => "\xe2\x80\x9c", // “ |
@@ -21,106 +21,106 @@ discard block |
||
21 | 21 | 0x95 => "\xe2\x80\xa2", // • |
22 | 22 | 0x96 => "\xe2\x80\x93", // – |
23 | 23 | 0x97 => "\xe2\x80\x94", // — |
24 | - 0x98 => "\xcb\x9c", // ˜ |
|
24 | + 0x98 => "\xcb\x9c", // ˜ |
|
25 | 25 | 0x99 => "\xe2\x84\xa2", // ™ |
26 | - 0x9a => "\xc5\xa1", // š |
|
26 | + 0x9a => "\xc5\xa1", // š |
|
27 | 27 | 0x9b => "\xe2\x80\xba", // › |
28 | - 0x9c => "\xc5\x93", // œ |
|
29 | - 0x9e => "\xc5\xbe", // ž |
|
30 | - 0x9f => "\xc5\xb8", // Ÿ |
|
28 | + 0x9c => "\xc5\x93", // œ |
|
29 | + 0x9e => "\xc5\xbe", // ž |
|
30 | + 0x9f => "\xc5\xb8", // Ÿ |
|
31 | 31 | 0xa0 => "\xc2\xa0", |
32 | - 0xa1 => "\xc2\xa1", // ¡ |
|
33 | - 0xa2 => "\xc2\xa2", // ¢ |
|
34 | - 0xa3 => "\xc2\xa3", // £ |
|
35 | - 0xa4 => "\xc2\xa4", // ¤ |
|
36 | - 0xa5 => "\xc2\xa5", // ¥ |
|
37 | - 0xa6 => "\xc2\xa6", // ¦ |
|
38 | - 0xa7 => "\xc2\xa7", // § |
|
39 | - 0xa8 => "\xc2\xa8", // ¨ |
|
40 | - 0xa9 => "\xc2\xa9", // © |
|
41 | - 0xaa => "\xc2\xaa", // ª |
|
42 | - 0xab => "\xc2\xab", // « |
|
43 | - 0xac => "\xc2\xac", // ¬ |
|
44 | - 0xad => "\xc2\xad", // |
|
45 | - 0xae => "\xc2\xae", // ® |
|
46 | - 0xaf => "\xc2\xaf", // ¯ |
|
47 | - 0xb0 => "\xc2\xb0", // ° |
|
48 | - 0xb1 => "\xc2\xb1", // ± |
|
49 | - 0xb2 => "\xc2\xb2", // ² |
|
50 | - 0xb3 => "\xc2\xb3", // ³ |
|
51 | - 0xb4 => "\xc2\xb4", // ´ |
|
52 | - 0xb5 => "\xc2\xb5", // µ |
|
53 | - 0xb6 => "\xc2\xb6", // ¶ |
|
54 | - 0xb7 => "\xc2\xb7", // · |
|
55 | - 0xb8 => "\xc2\xb8", // ¸ |
|
56 | - 0xb9 => "\xc2\xb9", // ¹ |
|
57 | - 0xba => "\xc2\xba", // º |
|
58 | - 0xbb => "\xc2\xbb", // » |
|
59 | - 0xbc => "\xc2\xbc", // ¼ |
|
60 | - 0xbd => "\xc2\xbd", // ½ |
|
61 | - 0xbe => "\xc2\xbe", // ¾ |
|
62 | - 0xbf => "\xc2\xbf", // ¿ |
|
63 | - 0xc0 => "\xc3\x80", // À |
|
64 | - 0xc1 => "\xc3\x81", // Á |
|
65 | - 0xc2 => "\xc3\x82", // Â |
|
66 | - 0xc3 => "\xc3\x83", // Ã |
|
67 | - 0xc4 => "\xc3\x84", // Ä |
|
68 | - 0xc5 => "\xc3\x85", // Å |
|
69 | - 0xc6 => "\xc3\x86", // Æ |
|
70 | - 0xc7 => "\xc3\x87", // Ç |
|
71 | - 0xc8 => "\xc3\x88", // È |
|
72 | - 0xc9 => "\xc3\x89", // É |
|
73 | - 0xca => "\xc3\x8a", // Ê |
|
74 | - 0xcb => "\xc3\x8b", // Ë |
|
75 | - 0xcc => "\xc3\x8c", // Ì |
|
76 | - 0xcd => "\xc3\x8d", // Í |
|
77 | - 0xce => "\xc3\x8e", // Î |
|
78 | - 0xcf => "\xc3\x8f", // Ï |
|
79 | - 0xd0 => "\xc3\x90", // Ð |
|
80 | - 0xd1 => "\xc3\x91", // Ñ |
|
81 | - 0xd2 => "\xc3\x92", // Ò |
|
82 | - 0xd3 => "\xc3\x93", // Ó |
|
83 | - 0xd4 => "\xc3\x94", // Ô |
|
84 | - 0xd5 => "\xc3\x95", // Õ |
|
85 | - 0xd6 => "\xc3\x96", // Ö |
|
86 | - 0xd7 => "\xc3\x97", // × |
|
87 | - 0xd8 => "\xc3\x98", // Ø |
|
88 | - 0xd9 => "\xc3\x99", // Ù |
|
89 | - 0xda => "\xc3\x9a", // Ú |
|
90 | - 0xdb => "\xc3\x9b", // Û |
|
91 | - 0xdc => "\xc3\x9c", // Ü |
|
92 | - 0xdd => "\xc3\x9d", // Ý |
|
93 | - 0xde => "\xc3\x9e", // Þ |
|
94 | - 0xdf => "\xc3\x9f", // ß |
|
95 | - 0xe0 => "\xc3\xa0", // à |
|
96 | - 0xe1 => "\xc3\xa1", // á |
|
97 | - 0xe2 => "\xc3\xa2", // â |
|
98 | - 0xe3 => "\xc3\xa3", // ã |
|
99 | - 0xe4 => "\xc3\xa4", // ä |
|
100 | - 0xe5 => "\xc3\xa5", // å |
|
101 | - 0xe6 => "\xc3\xa6", // æ |
|
102 | - 0xe7 => "\xc3\xa7", // ç |
|
103 | - 0xe8 => "\xc3\xa8", // è |
|
104 | - 0xe9 => "\xc3\xa9", // é |
|
105 | - 0xea => "\xc3\xaa", // ê |
|
106 | - 0xeb => "\xc3\xab", // ë |
|
107 | - 0xec => "\xc3\xac", // ì |
|
108 | - 0xed => "\xc3\xad", // í |
|
109 | - 0xee => "\xc3\xae", // î |
|
110 | - 0xef => "\xc3\xaf", // ï |
|
111 | - 0xf0 => "\xc3\xb0", // ð |
|
112 | - 0xf1 => "\xc3\xb1", // ñ |
|
113 | - 0xf2 => "\xc3\xb2", // ò |
|
114 | - 0xf3 => "\xc3\xb3", // ó |
|
115 | - 0xf4 => "\xc3\xb4", // ô |
|
116 | - 0xf5 => "\xc3\xb5", // õ |
|
117 | - 0xf6 => "\xc3\xb6", // ö |
|
118 | - 0xf7 => "\xc3\xb7", // ÷ |
|
119 | - 0xf8 => "\xc3\xb8", // ø |
|
120 | - 0xf9 => "\xc3\xb9", // ù |
|
121 | - 0xfa => "\xc3\xba", // ú |
|
122 | - 0xfb => "\xc3\xbb", // û |
|
123 | - 0xfc => "\xc3\xbc", // ü |
|
124 | - 0xfd => "\xc3\xbd", // ý |
|
125 | - 0xfe => "\xc3\xbe", // þ |
|
32 | + 0xa1 => "\xc2\xa1", // ¡ |
|
33 | + 0xa2 => "\xc2\xa2", // ¢ |
|
34 | + 0xa3 => "\xc2\xa3", // £ |
|
35 | + 0xa4 => "\xc2\xa4", // ¤ |
|
36 | + 0xa5 => "\xc2\xa5", // ¥ |
|
37 | + 0xa6 => "\xc2\xa6", // ¦ |
|
38 | + 0xa7 => "\xc2\xa7", // § |
|
39 | + 0xa8 => "\xc2\xa8", // ¨ |
|
40 | + 0xa9 => "\xc2\xa9", // © |
|
41 | + 0xaa => "\xc2\xaa", // ª |
|
42 | + 0xab => "\xc2\xab", // « |
|
43 | + 0xac => "\xc2\xac", // ¬ |
|
44 | + 0xad => "\xc2\xad", // |
|
45 | + 0xae => "\xc2\xae", // ® |
|
46 | + 0xaf => "\xc2\xaf", // ¯ |
|
47 | + 0xb0 => "\xc2\xb0", // ° |
|
48 | + 0xb1 => "\xc2\xb1", // ± |
|
49 | + 0xb2 => "\xc2\xb2", // ² |
|
50 | + 0xb3 => "\xc2\xb3", // ³ |
|
51 | + 0xb4 => "\xc2\xb4", // ´ |
|
52 | + 0xb5 => "\xc2\xb5", // µ |
|
53 | + 0xb6 => "\xc2\xb6", // ¶ |
|
54 | + 0xb7 => "\xc2\xb7", // · |
|
55 | + 0xb8 => "\xc2\xb8", // ¸ |
|
56 | + 0xb9 => "\xc2\xb9", // ¹ |
|
57 | + 0xba => "\xc2\xba", // º |
|
58 | + 0xbb => "\xc2\xbb", // » |
|
59 | + 0xbc => "\xc2\xbc", // ¼ |
|
60 | + 0xbd => "\xc2\xbd", // ½ |
|
61 | + 0xbe => "\xc2\xbe", // ¾ |
|
62 | + 0xbf => "\xc2\xbf", // ¿ |
|
63 | + 0xc0 => "\xc3\x80", // À |
|
64 | + 0xc1 => "\xc3\x81", // Á |
|
65 | + 0xc2 => "\xc3\x82", // Â |
|
66 | + 0xc3 => "\xc3\x83", // Ã |
|
67 | + 0xc4 => "\xc3\x84", // Ä |
|
68 | + 0xc5 => "\xc3\x85", // Å |
|
69 | + 0xc6 => "\xc3\x86", // Æ |
|
70 | + 0xc7 => "\xc3\x87", // Ç |
|
71 | + 0xc8 => "\xc3\x88", // È |
|
72 | + 0xc9 => "\xc3\x89", // É |
|
73 | + 0xca => "\xc3\x8a", // Ê |
|
74 | + 0xcb => "\xc3\x8b", // Ë |
|
75 | + 0xcc => "\xc3\x8c", // Ì |
|
76 | + 0xcd => "\xc3\x8d", // Í |
|
77 | + 0xce => "\xc3\x8e", // Î |
|
78 | + 0xcf => "\xc3\x8f", // Ï |
|
79 | + 0xd0 => "\xc3\x90", // Ð |
|
80 | + 0xd1 => "\xc3\x91", // Ñ |
|
81 | + 0xd2 => "\xc3\x92", // Ò |
|
82 | + 0xd3 => "\xc3\x93", // Ó |
|
83 | + 0xd4 => "\xc3\x94", // Ô |
|
84 | + 0xd5 => "\xc3\x95", // Õ |
|
85 | + 0xd6 => "\xc3\x96", // Ö |
|
86 | + 0xd7 => "\xc3\x97", // × |
|
87 | + 0xd8 => "\xc3\x98", // Ø |
|
88 | + 0xd9 => "\xc3\x99", // Ù |
|
89 | + 0xda => "\xc3\x9a", // Ú |
|
90 | + 0xdb => "\xc3\x9b", // Û |
|
91 | + 0xdc => "\xc3\x9c", // Ü |
|
92 | + 0xdd => "\xc3\x9d", // Ý |
|
93 | + 0xde => "\xc3\x9e", // Þ |
|
94 | + 0xdf => "\xc3\x9f", // ß |
|
95 | + 0xe0 => "\xc3\xa0", // à |
|
96 | + 0xe1 => "\xc3\xa1", // á |
|
97 | + 0xe2 => "\xc3\xa2", // â |
|
98 | + 0xe3 => "\xc3\xa3", // ã |
|
99 | + 0xe4 => "\xc3\xa4", // ä |
|
100 | + 0xe5 => "\xc3\xa5", // å |
|
101 | + 0xe6 => "\xc3\xa6", // æ |
|
102 | + 0xe7 => "\xc3\xa7", // ç |
|
103 | + 0xe8 => "\xc3\xa8", // è |
|
104 | + 0xe9 => "\xc3\xa9", // é |
|
105 | + 0xea => "\xc3\xaa", // ê |
|
106 | + 0xeb => "\xc3\xab", // ë |
|
107 | + 0xec => "\xc3\xac", // ì |
|
108 | + 0xed => "\xc3\xad", // í |
|
109 | + 0xee => "\xc3\xae", // î |
|
110 | + 0xef => "\xc3\xaf", // ï |
|
111 | + 0xf0 => "\xc3\xb0", // ð |
|
112 | + 0xf1 => "\xc3\xb1", // ñ |
|
113 | + 0xf2 => "\xc3\xb2", // ò |
|
114 | + 0xf3 => "\xc3\xb3", // ó |
|
115 | + 0xf4 => "\xc3\xb4", // ô |
|
116 | + 0xf5 => "\xc3\xb5", // õ |
|
117 | + 0xf6 => "\xc3\xb6", // ö |
|
118 | + 0xf7 => "\xc3\xb7", // ÷ |
|
119 | + 0xf8 => "\xc3\xb8", // ø |
|
120 | + 0xf9 => "\xc3\xb9", // ù |
|
121 | + 0xfa => "\xc3\xba", // ú |
|
122 | + 0xfb => "\xc3\xbb", // û |
|
123 | + 0xfc => "\xc3\xbc", // ü |
|
124 | + 0xfd => "\xc3\xbd", // ý |
|
125 | + 0xfe => "\xc3\xbe", // þ |
|
126 | 126 | ]; |
@@ -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') { |
@@ -5655,8 +5655,8 @@ discard block |
||
5655 | 5655 | |
5656 | 5656 | /** @noinspection UnnecessaryCastingInspection */ |
5657 | 5657 | return (string) \mb_substr($str, 0, $index) . |
5658 | - $substring . |
|
5659 | - (string) \mb_substr($str, $index, $len); |
|
5658 | + $substring . |
|
5659 | + (string) \mb_substr($str, $index, $len); |
|
5660 | 5660 | } |
5661 | 5661 | |
5662 | 5662 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -5667,8 +5667,8 @@ discard block |
||
5667 | 5667 | } |
5668 | 5668 | |
5669 | 5669 | return ((string) self::substr($str, 0, $index, $encoding)) . |
5670 | - $substring . |
|
5671 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5670 | + $substring . |
|
5671 | + ((string) self::substr($str, $index, $len, $encoding)); |
|
5672 | 5672 | } |
5673 | 5673 | |
5674 | 5674 | /** |
@@ -7679,11 +7679,11 @@ discard block |
||
7679 | 7679 | if ($use_mb_functions === true) { |
7680 | 7680 | if ($encoding === 'UTF-8') { |
7681 | 7681 | return \mb_strtoupper(\mb_substr($match[0], 0, 1)) |
7682 | - . \mb_strtolower(\mb_substr($match[0], 1)); |
|
7682 | + . \mb_strtolower(\mb_substr($match[0], 1)); |
|
7683 | 7683 | } |
7684 | 7684 | |
7685 | 7685 | return \mb_strtoupper(\mb_substr($match[0], 0, 1, $encoding), $encoding) |
7686 | - . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
7686 | + . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
7687 | 7687 | } |
7688 | 7688 | |
7689 | 7689 | return self::ucfirst( |
@@ -8054,13 +8054,13 @@ discard block |
||
8054 | 8054 | } |
8055 | 8055 | |
8056 | 8056 | return ( |
8057 | - (string) self::substr( |
|
8058 | - $str, |
|
8059 | - 0, |
|
8060 | - $length, |
|
8061 | - $encoding |
|
8062 | - ) |
|
8063 | - ) . $substring; |
|
8057 | + (string) self::substr( |
|
8058 | + $str, |
|
8059 | + 0, |
|
8060 | + $length, |
|
8061 | + $encoding |
|
8062 | + ) |
|
8063 | + ) . $substring; |
|
8064 | 8064 | } |
8065 | 8065 | |
8066 | 8066 | /** |
@@ -10868,8 +10868,8 @@ discard block |
||
10868 | 10868 | |
10869 | 10869 | /** @noinspection AdditionOperationOnArraysInspection */ |
10870 | 10870 | return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
10871 | - $replacement . |
|
10872 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10871 | + $replacement . |
|
10872 | + ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10873 | 10873 | } |
10874 | 10874 | |
10875 | 10875 | // |
@@ -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; |
@@ -286,8 +286,8 @@ discard block |
||
286 | 286 | $return = []; |
287 | 287 | foreach ($array as $key => &$value) { |
288 | 288 | $key = $case === \CASE_LOWER |
289 | - ? self::strtolower((string) $key, $encoding) |
|
290 | - : self::strtoupper((string) $key, $encoding); |
|
289 | + ? self::strtolower((string)$key, $encoding) |
|
290 | + : self::strtoupper((string)$key, $encoding); |
|
291 | 291 | |
292 | 292 | $return[$key] = $value; |
293 | 293 | } |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | return ''; |
322 | 322 | } |
323 | 323 | |
324 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
324 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
325 | 325 | $end_position = \mb_strpos($str, $end, $substr_index); |
326 | 326 | if ( |
327 | 327 | $end_position === false |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | return ''; |
332 | 332 | } |
333 | 333 | |
334 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
334 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | return ''; |
342 | 342 | } |
343 | 343 | |
344 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
344 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
345 | 345 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
346 | 346 | if ( |
347 | 347 | $end_position === false |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | return ''; |
352 | 352 | } |
353 | 353 | |
354 | - return (string) self::substr( |
|
354 | + return (string)self::substr( |
|
355 | 355 | $str, |
356 | 356 | $substr_index, |
357 | 357 | $end_position - $substr_index, |
@@ -419,10 +419,10 @@ discard block |
||
419 | 419 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
420 | 420 | { |
421 | 421 | if ($encoding === 'UTF-8') { |
422 | - return (string) \mb_substr($str, $index, 1); |
|
422 | + return (string)\mb_substr($str, $index, 1); |
|
423 | 423 | } |
424 | 424 | |
425 | - return (string) self::substr($str, $index, 1, $encoding); |
|
425 | + return (string)self::substr($str, $index, 1, $encoding); |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | /** |
@@ -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 | - $cache_key = $code_point . $encoding; |
|
527 | + $cache_key = $code_point.$encoding; |
|
528 | 528 | if (isset($CHAR_CACHE[$cache_key]) === true) { |
529 | 529 | return $CHAR_CACHE[$cache_key]; |
530 | 530 | } |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | self::$CHR = 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), $prefix); |
|
713 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
714 | 714 | } |
715 | 715 | |
716 | 716 | /** |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
786 | 786 | /x'; |
787 | 787 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
788 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
788 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
789 | 789 | |
790 | 790 | if ($replace_diamond_question_mark === true) { |
791 | 791 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | public static function cleanup($str): string |
821 | 821 | { |
822 | 822 | // init |
823 | - $str = (string) $str; |
|
823 | + $str = (string)$str; |
|
824 | 824 | |
825 | 825 | if ($str === '') { |
826 | 826 | return ''; |
@@ -903,7 +903,7 @@ discard block |
||
903 | 903 | { |
904 | 904 | if (self::$SUPPORT['mbstring'] === true) { |
905 | 905 | /** @noinspection PhpComposerExtensionStubsInspection */ |
906 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
906 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
907 | 907 | } |
908 | 908 | |
909 | 909 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -943,7 +943,7 @@ discard block |
||
943 | 943 | */ |
944 | 944 | public static function css_stripe_media_queries(string $str): string |
945 | 945 | { |
946 | - return (string) \preg_replace( |
|
946 | + return (string)\preg_replace( |
|
947 | 947 | '#@media\\s+(?:only\\s)?(?:[\\s{\\(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
948 | 948 | '', |
949 | 949 | $str |
@@ -970,7 +970,7 @@ discard block |
||
970 | 970 | */ |
971 | 971 | public static function decimal_to_chr($int): string |
972 | 972 | { |
973 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
973 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
974 | 974 | } |
975 | 975 | |
976 | 976 | /** |
@@ -1017,16 +1017,16 @@ discard block |
||
1017 | 1017 | self::initEmojiData(); |
1018 | 1018 | |
1019 | 1019 | if ($use_reversible_string_mappings === true) { |
1020 | - return (string) \str_replace( |
|
1021 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1022 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1020 | + return (string)\str_replace( |
|
1021 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1022 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1023 | 1023 | $str |
1024 | 1024 | ); |
1025 | 1025 | } |
1026 | 1026 | |
1027 | - return (string) \str_replace( |
|
1028 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1029 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1027 | + return (string)\str_replace( |
|
1028 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1029 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1030 | 1030 | $str |
1031 | 1031 | ); |
1032 | 1032 | } |
@@ -1048,16 +1048,16 @@ discard block |
||
1048 | 1048 | self::initEmojiData(); |
1049 | 1049 | |
1050 | 1050 | if ($use_reversible_string_mappings === true) { |
1051 | - return (string) \str_replace( |
|
1052 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1053 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1051 | + return (string)\str_replace( |
|
1052 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1053 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1054 | 1054 | $str |
1055 | 1055 | ); |
1056 | 1056 | } |
1057 | 1057 | |
1058 | - return (string) \str_replace( |
|
1059 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1060 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1058 | + return (string)\str_replace( |
|
1059 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1060 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1061 | 1061 | $str |
1062 | 1062 | ); |
1063 | 1063 | } |
@@ -1111,7 +1111,7 @@ discard block |
||
1111 | 1111 | if ($to_encoding === 'JSON') { |
1112 | 1112 | $return = self::json_encode($str); |
1113 | 1113 | if ($return === false) { |
1114 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1114 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1115 | 1115 | } |
1116 | 1116 | |
1117 | 1117 | return $return; |
@@ -1198,7 +1198,7 @@ discard block |
||
1198 | 1198 | && |
1199 | 1199 | self::$SUPPORT['mbstring'] === false |
1200 | 1200 | ) { |
1201 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
1201 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
1202 | 1202 | } |
1203 | 1203 | |
1204 | 1204 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1292,31 +1292,31 @@ discard block |
||
1292 | 1292 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1293 | 1293 | |
1294 | 1294 | if ($length === null) { |
1295 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
1295 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
1296 | 1296 | } |
1297 | 1297 | |
1298 | 1298 | if ($search === '') { |
1299 | 1299 | if ($encoding === 'UTF-8') { |
1300 | 1300 | if ($length > 0) { |
1301 | - $string_length = (int) \mb_strlen($str); |
|
1301 | + $string_length = (int)\mb_strlen($str); |
|
1302 | 1302 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1303 | 1303 | } else { |
1304 | 1304 | $end = 0; |
1305 | 1305 | } |
1306 | 1306 | |
1307 | - $pos = (int) \min( |
|
1307 | + $pos = (int)\min( |
|
1308 | 1308 | \mb_strpos($str, ' ', $end), |
1309 | 1309 | \mb_strpos($str, '.', $end) |
1310 | 1310 | ); |
1311 | 1311 | } else { |
1312 | 1312 | if ($length > 0) { |
1313 | - $string_length = (int) self::strlen($str, $encoding); |
|
1313 | + $string_length = (int)self::strlen($str, $encoding); |
|
1314 | 1314 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1315 | 1315 | } else { |
1316 | 1316 | $end = 0; |
1317 | 1317 | } |
1318 | 1318 | |
1319 | - $pos = (int) \min( |
|
1319 | + $pos = (int)\min( |
|
1320 | 1320 | self::strpos($str, ' ', $end, $encoding), |
1321 | 1321 | self::strpos($str, '.', $end, $encoding) |
1322 | 1322 | ); |
@@ -1333,18 +1333,18 @@ discard block |
||
1333 | 1333 | return ''; |
1334 | 1334 | } |
1335 | 1335 | |
1336 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1336 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1337 | 1337 | } |
1338 | 1338 | |
1339 | 1339 | return $str; |
1340 | 1340 | } |
1341 | 1341 | |
1342 | 1342 | if ($encoding === 'UTF-8') { |
1343 | - $word_position = (int) \mb_stripos($str, $search); |
|
1344 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1343 | + $word_position = (int)\mb_stripos($str, $search); |
|
1344 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1345 | 1345 | } else { |
1346 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
1347 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1346 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
1347 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1348 | 1348 | } |
1349 | 1349 | |
1350 | 1350 | $pos_start = 0; |
@@ -1356,12 +1356,12 @@ discard block |
||
1356 | 1356 | } |
1357 | 1357 | if ($half_text !== false) { |
1358 | 1358 | if ($encoding === 'UTF-8') { |
1359 | - $pos_start = (int) \max( |
|
1359 | + $pos_start = (int)\max( |
|
1360 | 1360 | \mb_strrpos($half_text, ' '), |
1361 | 1361 | \mb_strrpos($half_text, '.') |
1362 | 1362 | ); |
1363 | 1363 | } else { |
1364 | - $pos_start = (int) \max( |
|
1364 | + $pos_start = (int)\max( |
|
1365 | 1365 | self::strrpos($half_text, ' ', 0, $encoding), |
1366 | 1366 | self::strrpos($half_text, '.', 0, $encoding) |
1367 | 1367 | ); |
@@ -1371,19 +1371,19 @@ discard block |
||
1371 | 1371 | |
1372 | 1372 | if ($word_position && $half_side > 0) { |
1373 | 1373 | $offset = $pos_start + $length - 1; |
1374 | - $real_length = (int) self::strlen($str, $encoding); |
|
1374 | + $real_length = (int)self::strlen($str, $encoding); |
|
1375 | 1375 | |
1376 | 1376 | if ($offset > $real_length) { |
1377 | 1377 | $offset = $real_length; |
1378 | 1378 | } |
1379 | 1379 | |
1380 | 1380 | if ($encoding === 'UTF-8') { |
1381 | - $pos_end = (int) \min( |
|
1381 | + $pos_end = (int)\min( |
|
1382 | 1382 | \mb_strpos($str, ' ', $offset), |
1383 | 1383 | \mb_strpos($str, '.', $offset) |
1384 | 1384 | ) - $pos_start; |
1385 | 1385 | } else { |
1386 | - $pos_end = (int) \min( |
|
1386 | + $pos_end = (int)\min( |
|
1387 | 1387 | self::strpos($str, ' ', $offset, $encoding), |
1388 | 1388 | self::strpos($str, '.', $offset, $encoding) |
1389 | 1389 | ) - $pos_start; |
@@ -1391,12 +1391,12 @@ discard block |
||
1391 | 1391 | |
1392 | 1392 | if (!$pos_end || $pos_end <= 0) { |
1393 | 1393 | if ($encoding === 'UTF-8') { |
1394 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1394 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1395 | 1395 | } else { |
1396 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1396 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1397 | 1397 | } |
1398 | 1398 | if ($str_sub !== false) { |
1399 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
1399 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
1400 | 1400 | } else { |
1401 | 1401 | $extract = ''; |
1402 | 1402 | } |
@@ -1407,26 +1407,26 @@ discard block |
||
1407 | 1407 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
1408 | 1408 | } |
1409 | 1409 | if ($str_sub !== false) { |
1410 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1410 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1411 | 1411 | } else { |
1412 | 1412 | $extract = ''; |
1413 | 1413 | } |
1414 | 1414 | } |
1415 | 1415 | } else { |
1416 | 1416 | $offset = $length - 1; |
1417 | - $true_length = (int) self::strlen($str, $encoding); |
|
1417 | + $true_length = (int)self::strlen($str, $encoding); |
|
1418 | 1418 | |
1419 | 1419 | if ($offset > $true_length) { |
1420 | 1420 | $offset = $true_length; |
1421 | 1421 | } |
1422 | 1422 | |
1423 | 1423 | if ($encoding === 'UTF-8') { |
1424 | - $pos_end = (int) \min( |
|
1424 | + $pos_end = (int)\min( |
|
1425 | 1425 | \mb_strpos($str, ' ', $offset), |
1426 | 1426 | \mb_strpos($str, '.', $offset) |
1427 | 1427 | ); |
1428 | 1428 | } else { |
1429 | - $pos_end = (int) \min( |
|
1429 | + $pos_end = (int)\min( |
|
1430 | 1430 | self::strpos($str, ' ', $offset, $encoding), |
1431 | 1431 | self::strpos($str, '.', $offset, $encoding) |
1432 | 1432 | ); |
@@ -1439,7 +1439,7 @@ discard block |
||
1439 | 1439 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
1440 | 1440 | } |
1441 | 1441 | if ($str_sub !== false) { |
1442 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1442 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1443 | 1443 | } else { |
1444 | 1444 | $extract = ''; |
1445 | 1445 | } |
@@ -1562,7 +1562,7 @@ discard block |
||
1562 | 1562 | { |
1563 | 1563 | $file_content = \file_get_contents($file_path); |
1564 | 1564 | if ($file_content === false) { |
1565 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1565 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1566 | 1566 | } |
1567 | 1567 | |
1568 | 1568 | return self::string_has_bom($file_content); |
@@ -1628,7 +1628,7 @@ discard block |
||
1628 | 1628 | ) { |
1629 | 1629 | // Prevent leading combining chars |
1630 | 1630 | // for NFC-safe concatenations. |
1631 | - $var = $leading_combining . $var; |
|
1631 | + $var = $leading_combining.$var; |
|
1632 | 1632 | } |
1633 | 1633 | } |
1634 | 1634 | |
@@ -1879,10 +1879,10 @@ discard block |
||
1879 | 1879 | } |
1880 | 1880 | |
1881 | 1881 | if ($encoding === 'UTF-8') { |
1882 | - return (string) \mb_substr($str, 0, $n); |
|
1882 | + return (string)\mb_substr($str, 0, $n); |
|
1883 | 1883 | } |
1884 | 1884 | |
1885 | - return (string) self::substr($str, 0, $n, $encoding); |
|
1885 | + return (string)self::substr($str, 0, $n, $encoding); |
|
1886 | 1886 | } |
1887 | 1887 | |
1888 | 1888 | /** |
@@ -1957,7 +1957,7 @@ discard block |
||
1957 | 1957 | return $str; |
1958 | 1958 | } |
1959 | 1959 | |
1960 | - $str = (string) $str; |
|
1960 | + $str = (string)$str; |
|
1961 | 1961 | $last = ''; |
1962 | 1962 | while ($last !== $str) { |
1963 | 1963 | $last = $str; |
@@ -2149,7 +2149,7 @@ discard block |
||
2149 | 2149 | return $fallback; |
2150 | 2150 | } |
2151 | 2151 | /** @noinspection OffsetOperationsInspection */ |
2152 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2152 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2153 | 2153 | |
2154 | 2154 | // DEBUG |
2155 | 2155 | //var_dump($type_code); |
@@ -2207,7 +2207,7 @@ discard block |
||
2207 | 2207 | // |
2208 | 2208 | |
2209 | 2209 | if ($encoding === 'UTF-8') { |
2210 | - $max_length = (int) \mb_strlen($possible_chars); |
|
2210 | + $max_length = (int)\mb_strlen($possible_chars); |
|
2211 | 2211 | if ($max_length === 0) { |
2212 | 2212 | return ''; |
2213 | 2213 | } |
@@ -2228,7 +2228,7 @@ discard block |
||
2228 | 2228 | } else { |
2229 | 2229 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2230 | 2230 | |
2231 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
2231 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
2232 | 2232 | if ($max_length === 0) { |
2233 | 2233 | return ''; |
2234 | 2234 | } |
@@ -2259,16 +2259,16 @@ discard block |
||
2259 | 2259 | */ |
2260 | 2260 | public static function get_unique_string($entropy_extra = '', bool $use_md5 = true): string |
2261 | 2261 | { |
2262 | - $unique_helper = \random_int(0, \mt_getrandmax()) . |
|
2263 | - \session_id() . |
|
2264 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2265 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2262 | + $unique_helper = \random_int(0, \mt_getrandmax()). |
|
2263 | + \session_id(). |
|
2264 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2265 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2266 | 2266 | $entropy_extra; |
2267 | 2267 | |
2268 | 2268 | $unique_string = \uniqid($unique_helper, true); |
2269 | 2269 | |
2270 | 2270 | if ($use_md5) { |
2271 | - $unique_string = \md5($unique_string . $unique_helper); |
|
2271 | + $unique_string = \md5($unique_string.$unique_helper); |
|
2272 | 2272 | } |
2273 | 2273 | |
2274 | 2274 | return $unique_string; |
@@ -2347,7 +2347,7 @@ discard block |
||
2347 | 2347 | public static function hex_to_int($hexdec) |
2348 | 2348 | { |
2349 | 2349 | // init |
2350 | - $hexdec = (string) $hexdec; |
|
2350 | + $hexdec = (string)$hexdec; |
|
2351 | 2351 | |
2352 | 2352 | if ($hexdec === '') { |
2353 | 2353 | return false; |
@@ -2431,7 +2431,7 @@ discard block |
||
2431 | 2431 | return \implode( |
2432 | 2432 | '', |
2433 | 2433 | \array_map( |
2434 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2434 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2435 | 2435 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
2436 | 2436 | }, |
2437 | 2437 | self::str_split($str) |
@@ -2538,7 +2538,7 @@ discard block |
||
2538 | 2538 | && |
2539 | 2539 | self::$SUPPORT['mbstring'] === false |
2540 | 2540 | ) { |
2541 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2541 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2542 | 2542 | } |
2543 | 2543 | |
2544 | 2544 | do { |
@@ -2559,14 +2559,14 @@ discard block |
||
2559 | 2559 | ); |
2560 | 2560 | } |
2561 | 2561 | } else { |
2562 | - $str = (string) \preg_replace_callback( |
|
2562 | + $str = (string)\preg_replace_callback( |
|
2563 | 2563 | "/&#\d{2,6};/", |
2564 | 2564 | /** |
2565 | 2565 | * @param string[] $matches |
2566 | 2566 | * |
2567 | 2567 | * @return string |
2568 | 2568 | */ |
2569 | - static function (array $matches) use ($encoding): string { |
|
2569 | + static function(array $matches) use ($encoding): string { |
|
2570 | 2570 | $return_tmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
2571 | 2571 | if ($return_tmp !== '"' && $return_tmp !== "'") { |
2572 | 2572 | return $return_tmp; |
@@ -2581,7 +2581,7 @@ discard block |
||
2581 | 2581 | if (\strpos($str, '&') !== false) { |
2582 | 2582 | if (\strpos($str, '&#') !== false) { |
2583 | 2583 | // decode also numeric & UTF16 two byte entities |
2584 | - $str = (string) \preg_replace( |
|
2584 | + $str = (string)\preg_replace( |
|
2585 | 2585 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
2586 | 2586 | '$1;', |
2587 | 2587 | $str |
@@ -2627,7 +2627,7 @@ discard block |
||
2627 | 2627 | */ |
2628 | 2628 | public static function html_stripe_empty_tags(string $str): string |
2629 | 2629 | { |
2630 | - return (string) \preg_replace( |
|
2630 | + return (string)\preg_replace( |
|
2631 | 2631 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
2632 | 2632 | '', |
2633 | 2633 | $str |
@@ -2936,9 +2936,9 @@ discard block |
||
2936 | 2936 | { |
2937 | 2937 | $hex = \dechex($int); |
2938 | 2938 | |
2939 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
2939 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
2940 | 2940 | |
2941 | - return $prefix . $hex . ''; |
|
2941 | + return $prefix.$hex.''; |
|
2942 | 2942 | } |
2943 | 2943 | |
2944 | 2944 | /** |
@@ -3196,7 +3196,7 @@ discard block |
||
3196 | 3196 | */ |
3197 | 3197 | public static function is_binary($input, bool $strict = false): bool |
3198 | 3198 | { |
3199 | - $input = (string) $input; |
|
3199 | + $input = (string)$input; |
|
3200 | 3200 | if ($input === '') { |
3201 | 3201 | return false; |
3202 | 3202 | } |
@@ -3459,7 +3459,7 @@ discard block |
||
3459 | 3459 | public static function is_utf16($str, $check_if_string_is_binary = true) |
3460 | 3460 | { |
3461 | 3461 | // init |
3462 | - $str = (string) $str; |
|
3462 | + $str = (string)$str; |
|
3463 | 3463 | $str_chars = []; |
3464 | 3464 | |
3465 | 3465 | if ( |
@@ -3537,7 +3537,7 @@ discard block |
||
3537 | 3537 | public static function is_utf32($str, $check_if_string_is_binary = true) |
3538 | 3538 | { |
3539 | 3539 | // init |
3540 | - $str = (string) $str; |
|
3540 | + $str = (string)$str; |
|
3541 | 3541 | $str_chars = []; |
3542 | 3542 | |
3543 | 3543 | if ( |
@@ -3621,7 +3621,7 @@ discard block |
||
3621 | 3621 | return true; |
3622 | 3622 | } |
3623 | 3623 | |
3624 | - return self::is_utf8_string((string) $str, $strict); |
|
3624 | + return self::is_utf8_string((string)$str, $strict); |
|
3625 | 3625 | } |
3626 | 3626 | |
3627 | 3627 | /** |
@@ -3761,15 +3761,15 @@ discard block |
||
3761 | 3761 | $use_mb_functions = ($lang === null && $try_to_keep_the_string_length === false); |
3762 | 3762 | |
3763 | 3763 | if ($encoding === 'UTF-8') { |
3764 | - $str_part_two = (string) \mb_substr($str, 1); |
|
3764 | + $str_part_two = (string)\mb_substr($str, 1); |
|
3765 | 3765 | |
3766 | 3766 | if ($use_mb_functions === true) { |
3767 | 3767 | $str_part_one = \mb_strtolower( |
3768 | - (string) \mb_substr($str, 0, 1) |
|
3768 | + (string)\mb_substr($str, 0, 1) |
|
3769 | 3769 | ); |
3770 | 3770 | } else { |
3771 | 3771 | $str_part_one = self::strtolower( |
3772 | - (string) \mb_substr($str, 0, 1), |
|
3772 | + (string)\mb_substr($str, 0, 1), |
|
3773 | 3773 | $encoding, |
3774 | 3774 | false, |
3775 | 3775 | $lang, |
@@ -3779,10 +3779,10 @@ discard block |
||
3779 | 3779 | } else { |
3780 | 3780 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
3781 | 3781 | |
3782 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
3782 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
3783 | 3783 | |
3784 | 3784 | $str_part_one = self::strtolower( |
3785 | - (string) self::substr($str, 0, 1, $encoding), |
|
3785 | + (string)self::substr($str, 0, 1, $encoding), |
|
3786 | 3786 | $encoding, |
3787 | 3787 | false, |
3788 | 3788 | $lang, |
@@ -3790,7 +3790,7 @@ discard block |
||
3790 | 3790 | ); |
3791 | 3791 | } |
3792 | 3792 | |
3793 | - return $str_part_one . $str_part_two; |
|
3793 | + return $str_part_one.$str_part_two; |
|
3794 | 3794 | } |
3795 | 3795 | |
3796 | 3796 | /** |
@@ -3909,7 +3909,7 @@ discard block |
||
3909 | 3909 | |
3910 | 3910 | if (self::$SUPPORT['mbstring'] === true) { |
3911 | 3911 | /** @noinspection PhpComposerExtensionStubsInspection */ |
3912 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
3912 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
3913 | 3913 | } |
3914 | 3914 | |
3915 | 3915 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -3950,7 +3950,7 @@ discard block |
||
3950 | 3950 | { |
3951 | 3951 | $bytes = self::chr_size_list($str); |
3952 | 3952 | if (\count($bytes) > 0) { |
3953 | - return (int) \max($bytes); |
|
3953 | + return (int)\max($bytes); |
|
3954 | 3954 | } |
3955 | 3955 | |
3956 | 3956 | return 0; |
@@ -4019,7 +4019,7 @@ discard block |
||
4019 | 4019 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4020 | 4020 | |
4021 | 4021 | // init |
4022 | - $encoding = (string) $encoding; |
|
4022 | + $encoding = (string)$encoding; |
|
4023 | 4023 | |
4024 | 4024 | if (!$encoding) { |
4025 | 4025 | return $fallback; |
@@ -4073,7 +4073,7 @@ discard block |
||
4073 | 4073 | |
4074 | 4074 | $encoding_original = $encoding; |
4075 | 4075 | $encoding = \strtoupper($encoding); |
4076 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4076 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4077 | 4077 | |
4078 | 4078 | $equivalences = [ |
4079 | 4079 | 'ISO8859' => 'ISO-8859-1', |
@@ -4213,13 +4213,13 @@ discard block |
||
4213 | 4213 | static $CHAR_CACHE = []; |
4214 | 4214 | |
4215 | 4215 | // init |
4216 | - $chr = (string) $chr; |
|
4216 | + $chr = (string)$chr; |
|
4217 | 4217 | |
4218 | 4218 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
4219 | 4219 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4220 | 4220 | } |
4221 | 4221 | |
4222 | - $cache_key = $chr . $encoding; |
|
4222 | + $cache_key = $chr.$encoding; |
|
4223 | 4223 | if (isset($CHAR_CACHE[$cache_key]) === true) { |
4224 | 4224 | return $CHAR_CACHE[$cache_key]; |
4225 | 4225 | } |
@@ -4254,7 +4254,7 @@ discard block |
||
4254 | 4254 | // |
4255 | 4255 | |
4256 | 4256 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
4257 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
4257 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
4258 | 4258 | /** @noinspection OffsetOperationsInspection */ |
4259 | 4259 | $code = $chr ? $chr[1] : 0; |
4260 | 4260 | |
@@ -4262,21 +4262,21 @@ discard block |
||
4262 | 4262 | if ($code >= 0xF0 && isset($chr[4])) { |
4263 | 4263 | /** @noinspection UnnecessaryCastingInspection */ |
4264 | 4264 | /** @noinspection OffsetOperationsInspection */ |
4265 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4265 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4266 | 4266 | } |
4267 | 4267 | |
4268 | 4268 | /** @noinspection OffsetOperationsInspection */ |
4269 | 4269 | if ($code >= 0xE0 && isset($chr[3])) { |
4270 | 4270 | /** @noinspection UnnecessaryCastingInspection */ |
4271 | 4271 | /** @noinspection OffsetOperationsInspection */ |
4272 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4272 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4273 | 4273 | } |
4274 | 4274 | |
4275 | 4275 | /** @noinspection OffsetOperationsInspection */ |
4276 | 4276 | if ($code >= 0xC0 && isset($chr[2])) { |
4277 | 4277 | /** @noinspection UnnecessaryCastingInspection */ |
4278 | 4278 | /** @noinspection OffsetOperationsInspection */ |
4279 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4279 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4280 | 4280 | } |
4281 | 4281 | |
4282 | 4282 | return $CHAR_CACHE[$cache_key] = $code; |
@@ -4325,7 +4325,7 @@ discard block |
||
4325 | 4325 | public static function pcre_utf8_support(): bool |
4326 | 4326 | { |
4327 | 4327 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4328 | - return (bool) @\preg_match('//u', ''); |
|
4328 | + return (bool)@\preg_match('//u', ''); |
|
4329 | 4329 | } |
4330 | 4330 | |
4331 | 4331 | /** |
@@ -4357,11 +4357,11 @@ discard block |
||
4357 | 4357 | |
4358 | 4358 | if ($step !== 1) { |
4359 | 4359 | if (!\is_numeric($step)) { |
4360 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
4360 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
4361 | 4361 | } |
4362 | 4362 | |
4363 | 4363 | if ($step <= 0) { |
4364 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
4364 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
4365 | 4365 | } |
4366 | 4366 | } |
4367 | 4367 | |
@@ -4373,14 +4373,14 @@ discard block |
||
4373 | 4373 | $is_xdigit = false; |
4374 | 4374 | |
4375 | 4375 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4376 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
4376 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
4377 | 4377 | $is_digit = true; |
4378 | - $start = (int) $var1; |
|
4378 | + $start = (int)$var1; |
|
4379 | 4379 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
4380 | 4380 | $is_xdigit = true; |
4381 | - $start = (int) self::hex_to_int($var1); |
|
4381 | + $start = (int)self::hex_to_int($var1); |
|
4382 | 4382 | } elseif (!$use_ctype && \is_numeric($var1)) { |
4383 | - $start = (int) $var1; |
|
4383 | + $start = (int)$var1; |
|
4384 | 4384 | } else { |
4385 | 4385 | $start = self::ord($var1); |
4386 | 4386 | } |
@@ -4390,11 +4390,11 @@ discard block |
||
4390 | 4390 | } |
4391 | 4391 | |
4392 | 4392 | if ($is_digit) { |
4393 | - $end = (int) $var2; |
|
4393 | + $end = (int)$var2; |
|
4394 | 4394 | } elseif ($is_xdigit) { |
4395 | - $end = (int) self::hex_to_int($var2); |
|
4395 | + $end = (int)self::hex_to_int($var2); |
|
4396 | 4396 | } elseif (!$use_ctype && \is_numeric($var2)) { |
4397 | - $end = (int) $var2; |
|
4397 | + $end = (int)$var2; |
|
4398 | 4398 | } else { |
4399 | 4399 | $end = self::ord($var2); |
4400 | 4400 | } |
@@ -4405,7 +4405,7 @@ discard block |
||
4405 | 4405 | |
4406 | 4406 | $array = []; |
4407 | 4407 | foreach (\range($start, $end, $step) as $i) { |
4408 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
4408 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
4409 | 4409 | } |
4410 | 4410 | |
4411 | 4411 | return $array; |
@@ -4496,8 +4496,8 @@ discard block |
||
4496 | 4496 | $delimiter = '/'; |
4497 | 4497 | } |
4498 | 4498 | |
4499 | - return (string) \preg_replace( |
|
4500 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4499 | + return (string)\preg_replace( |
|
4500 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4501 | 4501 | $replacement, |
4502 | 4502 | $str |
4503 | 4503 | ); |
@@ -4539,9 +4539,9 @@ discard block |
||
4539 | 4539 | return ''; |
4540 | 4540 | } |
4541 | 4541 | |
4542 | - $str_length -= (int) $bom_byte_length; |
|
4542 | + $str_length -= (int)$bom_byte_length; |
|
4543 | 4543 | |
4544 | - $str = (string) $str_tmp; |
|
4544 | + $str = (string)$str_tmp; |
|
4545 | 4545 | } |
4546 | 4546 | } |
4547 | 4547 | |
@@ -4565,7 +4565,7 @@ discard block |
||
4565 | 4565 | if (\is_array($what) === true) { |
4566 | 4566 | /** @noinspection ForeachSourceInspection */ |
4567 | 4567 | foreach ($what as $item) { |
4568 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/u') . ')+/u', $item, $str); |
|
4568 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/u').')+/u', $item, $str); |
|
4569 | 4569 | } |
4570 | 4570 | } |
4571 | 4571 | |
@@ -4597,7 +4597,7 @@ discard block |
||
4597 | 4597 | */ |
4598 | 4598 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
4599 | 4599 | { |
4600 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4600 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4601 | 4601 | } |
4602 | 4602 | |
4603 | 4603 | /** |
@@ -4641,17 +4641,17 @@ discard block |
||
4641 | 4641 | ): string { |
4642 | 4642 | if ($substring && \strpos($str, $substring) === 0) { |
4643 | 4643 | if ($encoding === 'UTF-8') { |
4644 | - return (string) \mb_substr( |
|
4644 | + return (string)\mb_substr( |
|
4645 | 4645 | $str, |
4646 | - (int) \mb_strlen($substring) |
|
4646 | + (int)\mb_strlen($substring) |
|
4647 | 4647 | ); |
4648 | 4648 | } |
4649 | 4649 | |
4650 | 4650 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4651 | 4651 | |
4652 | - return (string) self::substr( |
|
4652 | + return (string)self::substr( |
|
4653 | 4653 | $str, |
4654 | - (int) self::strlen($substring, $encoding), |
|
4654 | + (int)self::strlen($substring, $encoding), |
|
4655 | 4655 | null, |
4656 | 4656 | $encoding |
4657 | 4657 | ); |
@@ -4676,19 +4676,19 @@ discard block |
||
4676 | 4676 | ): string { |
4677 | 4677 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
4678 | 4678 | if ($encoding === 'UTF-8') { |
4679 | - return (string) \mb_substr( |
|
4679 | + return (string)\mb_substr( |
|
4680 | 4680 | $str, |
4681 | 4681 | 0, |
4682 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
4682 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
4683 | 4683 | ); |
4684 | 4684 | } |
4685 | 4685 | |
4686 | 4686 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4687 | 4687 | |
4688 | - return (string) self::substr( |
|
4688 | + return (string)self::substr( |
|
4689 | 4689 | $str, |
4690 | 4690 | 0, |
4691 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
4691 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
4692 | 4692 | $encoding |
4693 | 4693 | ); |
4694 | 4694 | } |
@@ -4775,7 +4775,7 @@ discard block |
||
4775 | 4775 | $save = \mb_substitute_character(); |
4776 | 4776 | \mb_substitute_character($replacement_char_helper); |
4777 | 4777 | // the polyfill maybe return false, so cast to string |
4778 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4778 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4779 | 4779 | \mb_substitute_character($save); |
4780 | 4780 | } |
4781 | 4781 | |
@@ -4815,7 +4815,7 @@ discard block |
||
4815 | 4815 | |
4816 | 4816 | if (self::$SUPPORT['mbstring'] === true) { |
4817 | 4817 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4818 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4818 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4819 | 4819 | } |
4820 | 4820 | |
4821 | 4821 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -4830,7 +4830,7 @@ discard block |
||
4830 | 4830 | { |
4831 | 4831 | echo '<pre>'; |
4832 | 4832 | foreach (self::$SUPPORT as $key => &$value) { |
4833 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
4833 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
4834 | 4834 | } |
4835 | 4835 | unset($value); |
4836 | 4836 | echo '</pre>'; |
@@ -4862,7 +4862,7 @@ discard block |
||
4862 | 4862 | return $char; |
4863 | 4863 | } |
4864 | 4864 | |
4865 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
4865 | + return '&#'.self::ord($char, $encoding).';'; |
|
4866 | 4866 | } |
4867 | 4867 | |
4868 | 4868 | /** |
@@ -4953,18 +4953,18 @@ discard block |
||
4953 | 4953 | $lang, |
4954 | 4954 | $try_to_keep_the_string_length |
4955 | 4955 | ); |
4956 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
4956 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
4957 | 4957 | |
4958 | 4958 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
4959 | 4959 | |
4960 | - $str = (string) \preg_replace_callback( |
|
4960 | + $str = (string)\preg_replace_callback( |
|
4961 | 4961 | '/[-_\\s]+(.)?/u', |
4962 | 4962 | /** |
4963 | 4963 | * @param array $match |
4964 | 4964 | * |
4965 | 4965 | * @return string |
4966 | 4966 | */ |
4967 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
4967 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
4968 | 4968 | if (isset($match[1])) { |
4969 | 4969 | if ($use_mb_functions === true) { |
4970 | 4970 | if ($encoding === 'UTF-8') { |
@@ -4982,14 +4982,14 @@ discard block |
||
4982 | 4982 | $str |
4983 | 4983 | ); |
4984 | 4984 | |
4985 | - return (string) \preg_replace_callback( |
|
4985 | + return (string)\preg_replace_callback( |
|
4986 | 4986 | '/[\\p{N}]+(.)?/u', |
4987 | 4987 | /** |
4988 | 4988 | * @param array $match |
4989 | 4989 | * |
4990 | 4990 | * @return string |
4991 | 4991 | */ |
4992 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
4992 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
4993 | 4993 | if ($use_mb_functions === true) { |
4994 | 4994 | if ($encoding === 'UTF-8') { |
4995 | 4995 | return \mb_strtoupper($match[0]); |
@@ -5167,7 +5167,7 @@ discard block |
||
5167 | 5167 | ): string { |
5168 | 5168 | if (self::$SUPPORT['mbstring'] === true) { |
5169 | 5169 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5170 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5170 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5171 | 5171 | |
5172 | 5172 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
5173 | 5173 | if ($use_mb_functions === true && $encoding === 'UTF-8') { |
@@ -5177,10 +5177,10 @@ discard block |
||
5177 | 5177 | } |
5178 | 5178 | |
5179 | 5179 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5180 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5180 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5181 | 5181 | } |
5182 | 5182 | |
5183 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5183 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5184 | 5184 | |
5185 | 5185 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
5186 | 5186 | if ($use_mb_functions === true && $encoding === 'UTF-8') { |
@@ -5189,7 +5189,7 @@ discard block |
||
5189 | 5189 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
5190 | 5190 | } |
5191 | 5191 | |
5192 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5192 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5193 | 5193 | } |
5194 | 5194 | |
5195 | 5195 | /** |
@@ -5204,7 +5204,7 @@ discard block |
||
5204 | 5204 | public static function str_detect_encoding($str) |
5205 | 5205 | { |
5206 | 5206 | // init |
5207 | - $str = (string) $str; |
|
5207 | + $str = (string)$str; |
|
5208 | 5208 | |
5209 | 5209 | // |
5210 | 5210 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5306,7 +5306,7 @@ discard block |
||
5306 | 5306 | foreach (self::$ENCODINGS as $encoding_tmp) { |
5307 | 5307 | // INFO: //IGNORE but still throw notice |
5308 | 5308 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5309 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
5309 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
5310 | 5310 | return $encoding_tmp; |
5311 | 5311 | } |
5312 | 5312 | } |
@@ -5394,7 +5394,7 @@ discard block |
||
5394 | 5394 | return $str; |
5395 | 5395 | } |
5396 | 5396 | |
5397 | - return $substring . $str; |
|
5397 | + return $substring.$str; |
|
5398 | 5398 | } |
5399 | 5399 | |
5400 | 5400 | /** |
@@ -5648,27 +5648,27 @@ discard block |
||
5648 | 5648 | string $encoding = 'UTF-8' |
5649 | 5649 | ): string { |
5650 | 5650 | if ($encoding === 'UTF-8') { |
5651 | - $len = (int) \mb_strlen($str); |
|
5651 | + $len = (int)\mb_strlen($str); |
|
5652 | 5652 | if ($index > $len) { |
5653 | 5653 | return $str; |
5654 | 5654 | } |
5655 | 5655 | |
5656 | 5656 | /** @noinspection UnnecessaryCastingInspection */ |
5657 | - return (string) \mb_substr($str, 0, $index) . |
|
5658 | - $substring . |
|
5659 | - (string) \mb_substr($str, $index, $len); |
|
5657 | + return (string)\mb_substr($str, 0, $index). |
|
5658 | + $substring. |
|
5659 | + (string)\mb_substr($str, $index, $len); |
|
5660 | 5660 | } |
5661 | 5661 | |
5662 | 5662 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5663 | 5663 | |
5664 | - $len = (int) self::strlen($str, $encoding); |
|
5664 | + $len = (int)self::strlen($str, $encoding); |
|
5665 | 5665 | if ($index > $len) { |
5666 | 5666 | return $str; |
5667 | 5667 | } |
5668 | 5668 | |
5669 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
5670 | - $substring . |
|
5671 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5669 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
5670 | + $substring. |
|
5671 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
5672 | 5672 | } |
5673 | 5673 | |
5674 | 5674 | /** |
@@ -5698,15 +5698,15 @@ discard block |
||
5698 | 5698 | */ |
5699 | 5699 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
5700 | 5700 | { |
5701 | - $search = (array) $search; |
|
5701 | + $search = (array)$search; |
|
5702 | 5702 | |
5703 | 5703 | /** @noinspection AlterInForeachInspection */ |
5704 | 5704 | foreach ($search as &$s) { |
5705 | - $s = (string) $s; |
|
5705 | + $s = (string)$s; |
|
5706 | 5706 | if ($s === '') { |
5707 | 5707 | $s = '/^(?<=.)$/'; |
5708 | 5708 | } else { |
5709 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5709 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5710 | 5710 | } |
5711 | 5711 | } |
5712 | 5712 | |
@@ -5738,11 +5738,11 @@ discard block |
||
5738 | 5738 | } |
5739 | 5739 | |
5740 | 5740 | if ($search === '') { |
5741 | - return $str . $replacement; |
|
5741 | + return $str.$replacement; |
|
5742 | 5742 | } |
5743 | 5743 | |
5744 | 5744 | if (\stripos($str, $search) === 0) { |
5745 | - return $replacement . \substr($str, \strlen($search)); |
|
5745 | + return $replacement.\substr($str, \strlen($search)); |
|
5746 | 5746 | } |
5747 | 5747 | |
5748 | 5748 | return $str; |
@@ -5770,11 +5770,11 @@ discard block |
||
5770 | 5770 | } |
5771 | 5771 | |
5772 | 5772 | if ($search === '') { |
5773 | - return $str . $replacement; |
|
5773 | + return $str.$replacement; |
|
5774 | 5774 | } |
5775 | 5775 | |
5776 | 5776 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
5777 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
5777 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
5778 | 5778 | } |
5779 | 5779 | |
5780 | 5780 | return $str; |
@@ -5854,15 +5854,15 @@ discard block |
||
5854 | 5854 | } |
5855 | 5855 | |
5856 | 5856 | if ($encoding === 'UTF-8') { |
5857 | - return (string) \mb_substr( |
|
5857 | + return (string)\mb_substr( |
|
5858 | 5858 | $str, |
5859 | - $offset + (int) \mb_strlen($separator) |
|
5859 | + $offset + (int)\mb_strlen($separator) |
|
5860 | 5860 | ); |
5861 | 5861 | } |
5862 | 5862 | |
5863 | - return (string) self::substr( |
|
5863 | + return (string)self::substr( |
|
5864 | 5864 | $str, |
5865 | - $offset + (int) self::strlen($separator, $encoding), |
|
5865 | + $offset + (int)self::strlen($separator, $encoding), |
|
5866 | 5866 | null, |
5867 | 5867 | $encoding |
5868 | 5868 | ); |
@@ -5892,15 +5892,15 @@ discard block |
||
5892 | 5892 | } |
5893 | 5893 | |
5894 | 5894 | if ($encoding === 'UTF-8') { |
5895 | - return (string) \mb_substr( |
|
5895 | + return (string)\mb_substr( |
|
5896 | 5896 | $str, |
5897 | - $offset + (int) self::strlen($separator) |
|
5897 | + $offset + (int)self::strlen($separator) |
|
5898 | 5898 | ); |
5899 | 5899 | } |
5900 | 5900 | |
5901 | - return (string) self::substr( |
|
5901 | + return (string)self::substr( |
|
5902 | 5902 | $str, |
5903 | - $offset + (int) self::strlen($separator, $encoding), |
|
5903 | + $offset + (int)self::strlen($separator, $encoding), |
|
5904 | 5904 | null, |
5905 | 5905 | $encoding |
5906 | 5906 | ); |
@@ -5930,10 +5930,10 @@ discard block |
||
5930 | 5930 | } |
5931 | 5931 | |
5932 | 5932 | if ($encoding === 'UTF-8') { |
5933 | - return (string) \mb_substr($str, 0, $offset); |
|
5933 | + return (string)\mb_substr($str, 0, $offset); |
|
5934 | 5934 | } |
5935 | 5935 | |
5936 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
5936 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
5937 | 5937 | } |
5938 | 5938 | |
5939 | 5939 | /** |
@@ -5960,7 +5960,7 @@ discard block |
||
5960 | 5960 | return ''; |
5961 | 5961 | } |
5962 | 5962 | |
5963 | - return (string) \mb_substr($str, 0, $offset); |
|
5963 | + return (string)\mb_substr($str, 0, $offset); |
|
5964 | 5964 | } |
5965 | 5965 | |
5966 | 5966 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -5968,7 +5968,7 @@ discard block |
||
5968 | 5968 | return ''; |
5969 | 5969 | } |
5970 | 5970 | |
5971 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
5971 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
5972 | 5972 | } |
5973 | 5973 | |
5974 | 5974 | /** |
@@ -6064,12 +6064,12 @@ discard block |
||
6064 | 6064 | } |
6065 | 6065 | |
6066 | 6066 | if ($encoding === 'UTF-8') { |
6067 | - return (string) \mb_substr($str, -$n); |
|
6067 | + return (string)\mb_substr($str, -$n); |
|
6068 | 6068 | } |
6069 | 6069 | |
6070 | 6070 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6071 | 6071 | |
6072 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6072 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6073 | 6073 | } |
6074 | 6074 | |
6075 | 6075 | /** |
@@ -6093,21 +6093,21 @@ discard block |
||
6093 | 6093 | } |
6094 | 6094 | |
6095 | 6095 | if ($encoding === 'UTF-8') { |
6096 | - if ((int) \mb_strlen($str) <= $length) { |
|
6096 | + if ((int)\mb_strlen($str) <= $length) { |
|
6097 | 6097 | return $str; |
6098 | 6098 | } |
6099 | 6099 | |
6100 | 6100 | /** @noinspection UnnecessaryCastingInspection */ |
6101 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
6101 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
6102 | 6102 | } |
6103 | 6103 | |
6104 | 6104 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6105 | 6105 | |
6106 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6106 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6107 | 6107 | return $str; |
6108 | 6108 | } |
6109 | 6109 | |
6110 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
6110 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
6111 | 6111 | } |
6112 | 6112 | |
6113 | 6113 | /** |
@@ -6132,12 +6132,12 @@ discard block |
||
6132 | 6132 | |
6133 | 6133 | if ($encoding === 'UTF-8') { |
6134 | 6134 | /** @noinspection UnnecessaryCastingInspection */ |
6135 | - if ((int) \mb_strlen($str) <= $length) { |
|
6135 | + if ((int)\mb_strlen($str) <= $length) { |
|
6136 | 6136 | return $str; |
6137 | 6137 | } |
6138 | 6138 | |
6139 | 6139 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6140 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6140 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6141 | 6141 | } |
6142 | 6142 | |
6143 | 6143 | $str = \mb_substr($str, 0, $length); |
@@ -6147,22 +6147,22 @@ discard block |
||
6147 | 6147 | $new_str = \implode(' ', $array); |
6148 | 6148 | |
6149 | 6149 | if ($new_str === '') { |
6150 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6150 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6151 | 6151 | } |
6152 | 6152 | } else { |
6153 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6153 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6154 | 6154 | return $str; |
6155 | 6155 | } |
6156 | 6156 | |
6157 | 6157 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6158 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6158 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6159 | 6159 | } |
6160 | 6160 | |
6161 | 6161 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6162 | 6162 | $str = self::substr($str, 0, $length, $encoding); |
6163 | 6163 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6164 | 6164 | if ($str === false) { |
6165 | - return '' . $str_add_on; |
|
6165 | + return ''.$str_add_on; |
|
6166 | 6166 | } |
6167 | 6167 | |
6168 | 6168 | $array = \explode(' ', $str); |
@@ -6170,11 +6170,11 @@ discard block |
||
6170 | 6170 | $new_str = \implode(' ', $array); |
6171 | 6171 | |
6172 | 6172 | if ($new_str === '') { |
6173 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6173 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6174 | 6174 | } |
6175 | 6175 | } |
6176 | 6176 | |
6177 | - return $new_str . $str_add_on; |
|
6177 | + return $new_str.$str_add_on; |
|
6178 | 6178 | } |
6179 | 6179 | |
6180 | 6180 | /** |
@@ -6195,7 +6195,7 @@ discard block |
||
6195 | 6195 | $longest_common_prefix = ''; |
6196 | 6196 | |
6197 | 6197 | if ($encoding === 'UTF-8') { |
6198 | - $max_length = (int) \min( |
|
6198 | + $max_length = (int)\min( |
|
6199 | 6199 | \mb_strlen($str1), |
6200 | 6200 | \mb_strlen($str2) |
6201 | 6201 | ); |
@@ -6216,7 +6216,7 @@ discard block |
||
6216 | 6216 | } else { |
6217 | 6217 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6218 | 6218 | |
6219 | - $max_length = (int) \min( |
|
6219 | + $max_length = (int)\min( |
|
6220 | 6220 | self::strlen($str1, $encoding), |
6221 | 6221 | self::strlen($str2, $encoding) |
6222 | 6222 | ); |
@@ -6262,13 +6262,13 @@ discard block |
||
6262 | 6262 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6263 | 6263 | |
6264 | 6264 | if ($encoding === 'UTF-8') { |
6265 | - $str_length = (int) \mb_strlen($str1); |
|
6266 | - $other_length = (int) \mb_strlen($str2); |
|
6265 | + $str_length = (int)\mb_strlen($str1); |
|
6266 | + $other_length = (int)\mb_strlen($str2); |
|
6267 | 6267 | } else { |
6268 | 6268 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6269 | 6269 | |
6270 | - $str_length = (int) self::strlen($str1, $encoding); |
|
6271 | - $other_length = (int) self::strlen($str2, $encoding); |
|
6270 | + $str_length = (int)self::strlen($str1, $encoding); |
|
6271 | + $other_length = (int)self::strlen($str2, $encoding); |
|
6272 | 6272 | } |
6273 | 6273 | |
6274 | 6274 | // Return if either string is empty |
@@ -6321,10 +6321,10 @@ discard block |
||
6321 | 6321 | } |
6322 | 6322 | |
6323 | 6323 | if ($encoding === 'UTF-8') { |
6324 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
6324 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
6325 | 6325 | } |
6326 | 6326 | |
6327 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
6327 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
6328 | 6328 | } |
6329 | 6329 | |
6330 | 6330 | /** |
@@ -6346,7 +6346,7 @@ discard block |
||
6346 | 6346 | } |
6347 | 6347 | |
6348 | 6348 | if ($encoding === 'UTF-8') { |
6349 | - $max_length = (int) \min( |
|
6349 | + $max_length = (int)\min( |
|
6350 | 6350 | \mb_strlen($str1, $encoding), |
6351 | 6351 | \mb_strlen($str2, $encoding) |
6352 | 6352 | ); |
@@ -6360,7 +6360,7 @@ discard block |
||
6360 | 6360 | && |
6361 | 6361 | $char === \mb_substr($str2, -$i, 1) |
6362 | 6362 | ) { |
6363 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
6363 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
6364 | 6364 | } else { |
6365 | 6365 | break; |
6366 | 6366 | } |
@@ -6368,7 +6368,7 @@ discard block |
||
6368 | 6368 | } else { |
6369 | 6369 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6370 | 6370 | |
6371 | - $max_length = (int) \min( |
|
6371 | + $max_length = (int)\min( |
|
6372 | 6372 | self::strlen($str1, $encoding), |
6373 | 6373 | self::strlen($str2, $encoding) |
6374 | 6374 | ); |
@@ -6382,7 +6382,7 @@ discard block |
||
6382 | 6382 | && |
6383 | 6383 | $char === self::substr($str2, -$i, 1, $encoding) |
6384 | 6384 | ) { |
6385 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
6385 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
6386 | 6386 | } else { |
6387 | 6387 | break; |
6388 | 6388 | } |
@@ -6402,7 +6402,7 @@ discard block |
||
6402 | 6402 | */ |
6403 | 6403 | public static function str_matches_pattern(string $str, string $pattern): bool |
6404 | 6404 | { |
6405 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
6405 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
6406 | 6406 | } |
6407 | 6407 | |
6408 | 6408 | /** |
@@ -6419,7 +6419,7 @@ discard block |
||
6419 | 6419 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
6420 | 6420 | { |
6421 | 6421 | // init |
6422 | - $length = (int) self::strlen($str, $encoding); |
|
6422 | + $length = (int)self::strlen($str, $encoding); |
|
6423 | 6423 | |
6424 | 6424 | if ($offset >= 0) { |
6425 | 6425 | return $length > $offset; |
@@ -6445,7 +6445,7 @@ discard block |
||
6445 | 6445 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
6446 | 6446 | { |
6447 | 6447 | // init |
6448 | - $length = (int) self::strlen($str); |
|
6448 | + $length = (int)self::strlen($str); |
|
6449 | 6449 | |
6450 | 6450 | if ( |
6451 | 6451 | ($index >= 0 && $length <= $index) |
@@ -6484,7 +6484,7 @@ discard block |
||
6484 | 6484 | return $str; |
6485 | 6485 | } |
6486 | 6486 | |
6487 | - if ($pad_type !== (int) $pad_type) { |
|
6487 | + if ($pad_type !== (int)$pad_type) { |
|
6488 | 6488 | if ($pad_type === 'left') { |
6489 | 6489 | $pad_type = \STR_PAD_LEFT; |
6490 | 6490 | } elseif ($pad_type === 'right') { |
@@ -6493,23 +6493,23 @@ discard block |
||
6493 | 6493 | $pad_type = \STR_PAD_BOTH; |
6494 | 6494 | } else { |
6495 | 6495 | throw new \InvalidArgumentException( |
6496 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
6496 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
6497 | 6497 | ); |
6498 | 6498 | } |
6499 | 6499 | } |
6500 | 6500 | |
6501 | 6501 | if ($encoding === 'UTF-8') { |
6502 | - $str_length = (int) \mb_strlen($str); |
|
6502 | + $str_length = (int)\mb_strlen($str); |
|
6503 | 6503 | |
6504 | 6504 | if ($pad_length >= $str_length) { |
6505 | 6505 | switch ($pad_type) { |
6506 | 6506 | case \STR_PAD_LEFT: |
6507 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6507 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6508 | 6508 | |
6509 | 6509 | $diff = ($pad_length - $str_length); |
6510 | 6510 | |
6511 | - $pre = (string) \mb_substr( |
|
6512 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6511 | + $pre = (string)\mb_substr( |
|
6512 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6513 | 6513 | 0, |
6514 | 6514 | $diff |
6515 | 6515 | ); |
@@ -6520,16 +6520,16 @@ discard block |
||
6520 | 6520 | case \STR_PAD_BOTH: |
6521 | 6521 | $diff = ($pad_length - $str_length); |
6522 | 6522 | |
6523 | - $ps_length_left = (int) \floor($diff / 2); |
|
6523 | + $ps_length_left = (int)\floor($diff / 2); |
|
6524 | 6524 | |
6525 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6525 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6526 | 6526 | |
6527 | - $pre = (string) \mb_substr( |
|
6527 | + $pre = (string)\mb_substr( |
|
6528 | 6528 | \str_repeat($pad_string, $ps_length_left), |
6529 | 6529 | 0, |
6530 | 6530 | $ps_length_left |
6531 | 6531 | ); |
6532 | - $post = (string) \mb_substr( |
|
6532 | + $post = (string)\mb_substr( |
|
6533 | 6533 | \str_repeat($pad_string, $ps_length_right), |
6534 | 6534 | 0, |
6535 | 6535 | $ps_length_right |
@@ -6539,19 +6539,19 @@ discard block |
||
6539 | 6539 | |
6540 | 6540 | case \STR_PAD_RIGHT: |
6541 | 6541 | default: |
6542 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6542 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6543 | 6543 | |
6544 | 6544 | $diff = ($pad_length - $str_length); |
6545 | 6545 | |
6546 | - $post = (string) \mb_substr( |
|
6547 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6546 | + $post = (string)\mb_substr( |
|
6547 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6548 | 6548 | 0, |
6549 | 6549 | $diff |
6550 | 6550 | ); |
6551 | 6551 | $pre = ''; |
6552 | 6552 | } |
6553 | 6553 | |
6554 | - return $pre . $str . $post; |
|
6554 | + return $pre.$str.$post; |
|
6555 | 6555 | } |
6556 | 6556 | |
6557 | 6557 | return $str; |
@@ -6559,17 +6559,17 @@ discard block |
||
6559 | 6559 | |
6560 | 6560 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6561 | 6561 | |
6562 | - $str_length = (int) self::strlen($str, $encoding); |
|
6562 | + $str_length = (int)self::strlen($str, $encoding); |
|
6563 | 6563 | |
6564 | 6564 | if ($pad_length >= $str_length) { |
6565 | 6565 | switch ($pad_type) { |
6566 | 6566 | case \STR_PAD_LEFT: |
6567 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6567 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6568 | 6568 | |
6569 | 6569 | $diff = ($pad_length - $str_length); |
6570 | 6570 | |
6571 | - $pre = (string) self::substr( |
|
6572 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6571 | + $pre = (string)self::substr( |
|
6572 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6573 | 6573 | 0, |
6574 | 6574 | $diff, |
6575 | 6575 | $encoding |
@@ -6581,17 +6581,17 @@ discard block |
||
6581 | 6581 | case \STR_PAD_BOTH: |
6582 | 6582 | $diff = ($pad_length - $str_length); |
6583 | 6583 | |
6584 | - $ps_length_left = (int) \floor($diff / 2); |
|
6584 | + $ps_length_left = (int)\floor($diff / 2); |
|
6585 | 6585 | |
6586 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6586 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6587 | 6587 | |
6588 | - $pre = (string) self::substr( |
|
6588 | + $pre = (string)self::substr( |
|
6589 | 6589 | \str_repeat($pad_string, $ps_length_left), |
6590 | 6590 | 0, |
6591 | 6591 | $ps_length_left, |
6592 | 6592 | $encoding |
6593 | 6593 | ); |
6594 | - $post = (string) self::substr( |
|
6594 | + $post = (string)self::substr( |
|
6595 | 6595 | \str_repeat($pad_string, $ps_length_right), |
6596 | 6596 | 0, |
6597 | 6597 | $ps_length_right, |
@@ -6602,12 +6602,12 @@ discard block |
||
6602 | 6602 | |
6603 | 6603 | case \STR_PAD_RIGHT: |
6604 | 6604 | default: |
6605 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6605 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6606 | 6606 | |
6607 | 6607 | $diff = ($pad_length - $str_length); |
6608 | 6608 | |
6609 | - $post = (string) self::substr( |
|
6610 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6609 | + $post = (string)self::substr( |
|
6610 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6611 | 6611 | 0, |
6612 | 6612 | $diff, |
6613 | 6613 | $encoding |
@@ -6615,7 +6615,7 @@ discard block |
||
6615 | 6615 | $pre = ''; |
6616 | 6616 | } |
6617 | 6617 | |
6618 | - return $pre . $str . $post; |
|
6618 | + return $pre.$str.$post; |
|
6619 | 6619 | } |
6620 | 6620 | |
6621 | 6621 | return $str; |
@@ -6795,11 +6795,11 @@ discard block |
||
6795 | 6795 | } |
6796 | 6796 | |
6797 | 6797 | if ($search === '') { |
6798 | - return $str . $replacement; |
|
6798 | + return $str.$replacement; |
|
6799 | 6799 | } |
6800 | 6800 | |
6801 | 6801 | if (\strpos($str, $search) === 0) { |
6802 | - return $replacement . \substr($str, \strlen($search)); |
|
6802 | + return $replacement.\substr($str, \strlen($search)); |
|
6803 | 6803 | } |
6804 | 6804 | |
6805 | 6805 | return $str; |
@@ -6830,11 +6830,11 @@ discard block |
||
6830 | 6830 | } |
6831 | 6831 | |
6832 | 6832 | if ($search === '') { |
6833 | - return $str . $replacement; |
|
6833 | + return $str.$replacement; |
|
6834 | 6834 | } |
6835 | 6835 | |
6836 | 6836 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6837 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6837 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6838 | 6838 | } |
6839 | 6839 | |
6840 | 6840 | return $str; |
@@ -6866,7 +6866,7 @@ discard block |
||
6866 | 6866 | $subject, |
6867 | 6867 | $replace, |
6868 | 6868 | $pos, |
6869 | - (int) self::strlen($search) |
|
6869 | + (int)self::strlen($search) |
|
6870 | 6870 | ); |
6871 | 6871 | } |
6872 | 6872 | |
@@ -6898,7 +6898,7 @@ discard block |
||
6898 | 6898 | $subject, |
6899 | 6899 | $replace, |
6900 | 6900 | $pos, |
6901 | - (int) self::strlen($search) |
|
6901 | + (int)self::strlen($search) |
|
6902 | 6902 | ); |
6903 | 6903 | } |
6904 | 6904 | |
@@ -6918,7 +6918,7 @@ discard block |
||
6918 | 6918 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
6919 | 6919 | { |
6920 | 6920 | if ($encoding === 'UTF-8') { |
6921 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
6921 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
6922 | 6922 | /** @noinspection NonSecureShuffleUsageInspection */ |
6923 | 6923 | \shuffle($indexes); |
6924 | 6924 | |
@@ -6934,7 +6934,7 @@ discard block |
||
6934 | 6934 | } else { |
6935 | 6935 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6936 | 6936 | |
6937 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
6937 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
6938 | 6938 | /** @noinspection NonSecureShuffleUsageInspection */ |
6939 | 6939 | \shuffle($indexes); |
6940 | 6940 | |
@@ -6975,11 +6975,11 @@ discard block |
||
6975 | 6975 | ) { |
6976 | 6976 | if ($encoding === 'UTF-8') { |
6977 | 6977 | if ($end === null) { |
6978 | - $length = (int) \mb_strlen($str); |
|
6978 | + $length = (int)\mb_strlen($str); |
|
6979 | 6979 | } elseif ($end >= 0 && $end <= $start) { |
6980 | 6980 | return ''; |
6981 | 6981 | } elseif ($end < 0) { |
6982 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
6982 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
6983 | 6983 | } else { |
6984 | 6984 | $length = $end - $start; |
6985 | 6985 | } |
@@ -6990,11 +6990,11 @@ discard block |
||
6990 | 6990 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6991 | 6991 | |
6992 | 6992 | if ($end === null) { |
6993 | - $length = (int) self::strlen($str, $encoding); |
|
6993 | + $length = (int)self::strlen($str, $encoding); |
|
6994 | 6994 | } elseif ($end >= 0 && $end <= $start) { |
6995 | 6995 | return ''; |
6996 | 6996 | } elseif ($end < 0) { |
6997 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
6997 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
6998 | 6998 | } else { |
6999 | 6999 | $length = $end - $start; |
7000 | 7000 | } |
@@ -7026,35 +7026,35 @@ discard block |
||
7026 | 7026 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7027 | 7027 | } |
7028 | 7028 | |
7029 | - $str = (string) \preg_replace_callback( |
|
7029 | + $str = (string)\preg_replace_callback( |
|
7030 | 7030 | '/([\\p{N}|\\p{Lu}])/u', |
7031 | 7031 | /** |
7032 | 7032 | * @param string[] $matches |
7033 | 7033 | * |
7034 | 7034 | * @return string |
7035 | 7035 | */ |
7036 | - static function (array $matches) use ($encoding): string { |
|
7036 | + static function(array $matches) use ($encoding): string { |
|
7037 | 7037 | $match = $matches[1]; |
7038 | - $match_int = (int) $match; |
|
7038 | + $match_int = (int)$match; |
|
7039 | 7039 | |
7040 | - if ((string) $match_int === $match) { |
|
7041 | - return '_' . $match . '_'; |
|
7040 | + if ((string)$match_int === $match) { |
|
7041 | + return '_'.$match.'_'; |
|
7042 | 7042 | } |
7043 | 7043 | |
7044 | 7044 | if ($encoding === 'UTF-8') { |
7045 | - return '_' . \mb_strtolower($match); |
|
7045 | + return '_'.\mb_strtolower($match); |
|
7046 | 7046 | } |
7047 | 7047 | |
7048 | - return '_' . self::strtolower($match, $encoding); |
|
7048 | + return '_'.self::strtolower($match, $encoding); |
|
7049 | 7049 | }, |
7050 | 7050 | $str |
7051 | 7051 | ); |
7052 | 7052 | |
7053 | - $str = (string) \preg_replace( |
|
7053 | + $str = (string)\preg_replace( |
|
7054 | 7054 | [ |
7055 | - '/\\s+/u', // convert spaces to "_" |
|
7055 | + '/\\s+/u', // convert spaces to "_" |
|
7056 | 7056 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
7057 | - '/_+/', // remove double "_" |
|
7057 | + '/_+/', // remove double "_" |
|
7058 | 7058 | ], |
7059 | 7059 | [ |
7060 | 7060 | '_', |
@@ -7130,7 +7130,7 @@ discard block |
||
7130 | 7130 | } |
7131 | 7131 | |
7132 | 7132 | // init |
7133 | - $str = (string) $str; |
|
7133 | + $str = (string)$str; |
|
7134 | 7134 | |
7135 | 7135 | if ($str === '') { |
7136 | 7136 | return []; |
@@ -7177,7 +7177,7 @@ discard block |
||
7177 | 7177 | ($str[$i] & "\xE0") === "\xC0" |
7178 | 7178 | ) { |
7179 | 7179 | if (($str[$i + 1] & "\xC0") === "\x80") { |
7180 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
7180 | + $ret[] = $str[$i].$str[$i + 1]; |
|
7181 | 7181 | |
7182 | 7182 | ++$i; |
7183 | 7183 | } |
@@ -7191,7 +7191,7 @@ discard block |
||
7191 | 7191 | && |
7192 | 7192 | ($str[$i + 2] & "\xC0") === "\x80" |
7193 | 7193 | ) { |
7194 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
7194 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
7195 | 7195 | |
7196 | 7196 | $i += 2; |
7197 | 7197 | } |
@@ -7207,7 +7207,7 @@ discard block |
||
7207 | 7207 | && |
7208 | 7208 | ($str[$i + 3] & "\xC0") === "\x80" |
7209 | 7209 | ) { |
7210 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
7210 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
7211 | 7211 | |
7212 | 7212 | $i += 3; |
7213 | 7213 | } |
@@ -7219,7 +7219,7 @@ discard block |
||
7219 | 7219 | $ret = \array_chunk($ret, $length); |
7220 | 7220 | |
7221 | 7221 | return \array_map( |
7222 | - static function (array &$item): string { |
|
7222 | + static function(array &$item): string { |
|
7223 | 7223 | return \implode('', $item); |
7224 | 7224 | }, |
7225 | 7225 | $ret |
@@ -7282,7 +7282,7 @@ discard block |
||
7282 | 7282 | $limit = -1; |
7283 | 7283 | } |
7284 | 7284 | |
7285 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7285 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7286 | 7286 | |
7287 | 7287 | if ($array === false) { |
7288 | 7288 | return []; |
@@ -7366,9 +7366,9 @@ discard block |
||
7366 | 7366 | return ''; |
7367 | 7367 | } |
7368 | 7368 | |
7369 | - return (string) \mb_substr( |
|
7369 | + return (string)\mb_substr( |
|
7370 | 7370 | $str, |
7371 | - $offset + (int) \mb_strlen($separator) |
|
7371 | + $offset + (int)\mb_strlen($separator) |
|
7372 | 7372 | ); |
7373 | 7373 | } |
7374 | 7374 | |
@@ -7377,9 +7377,9 @@ discard block |
||
7377 | 7377 | return ''; |
7378 | 7378 | } |
7379 | 7379 | |
7380 | - return (string) \mb_substr( |
|
7380 | + return (string)\mb_substr( |
|
7381 | 7381 | $str, |
7382 | - $offset + (int) self::strlen($separator, $encoding), |
|
7382 | + $offset + (int)self::strlen($separator, $encoding), |
|
7383 | 7383 | null, |
7384 | 7384 | $encoding |
7385 | 7385 | ); |
@@ -7406,9 +7406,9 @@ discard block |
||
7406 | 7406 | return ''; |
7407 | 7407 | } |
7408 | 7408 | |
7409 | - return (string) \mb_substr( |
|
7409 | + return (string)\mb_substr( |
|
7410 | 7410 | $str, |
7411 | - $offset + (int) \mb_strlen($separator) |
|
7411 | + $offset + (int)\mb_strlen($separator) |
|
7412 | 7412 | ); |
7413 | 7413 | } |
7414 | 7414 | |
@@ -7417,9 +7417,9 @@ discard block |
||
7417 | 7417 | return ''; |
7418 | 7418 | } |
7419 | 7419 | |
7420 | - return (string) self::substr( |
|
7420 | + return (string)self::substr( |
|
7421 | 7421 | $str, |
7422 | - $offset + (int) self::strlen($separator, $encoding), |
|
7422 | + $offset + (int)self::strlen($separator, $encoding), |
|
7423 | 7423 | null, |
7424 | 7424 | $encoding |
7425 | 7425 | ); |
@@ -7449,7 +7449,7 @@ discard block |
||
7449 | 7449 | return ''; |
7450 | 7450 | } |
7451 | 7451 | |
7452 | - return (string) \mb_substr( |
|
7452 | + return (string)\mb_substr( |
|
7453 | 7453 | $str, |
7454 | 7454 | 0, |
7455 | 7455 | $offset |
@@ -7461,7 +7461,7 @@ discard block |
||
7461 | 7461 | return ''; |
7462 | 7462 | } |
7463 | 7463 | |
7464 | - return (string) self::substr( |
|
7464 | + return (string)self::substr( |
|
7465 | 7465 | $str, |
7466 | 7466 | 0, |
7467 | 7467 | $offset, |
@@ -7490,7 +7490,7 @@ discard block |
||
7490 | 7490 | return ''; |
7491 | 7491 | } |
7492 | 7492 | |
7493 | - return (string) \mb_substr( |
|
7493 | + return (string)\mb_substr( |
|
7494 | 7494 | $str, |
7495 | 7495 | 0, |
7496 | 7496 | $offset |
@@ -7504,7 +7504,7 @@ discard block |
||
7504 | 7504 | |
7505 | 7505 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7506 | 7506 | |
7507 | - return (string) self::substr( |
|
7507 | + return (string)self::substr( |
|
7508 | 7508 | $str, |
7509 | 7509 | 0, |
7510 | 7510 | $offset, |
@@ -7612,7 +7612,7 @@ discard block |
||
7612 | 7612 | */ |
7613 | 7613 | public static function str_surround(string $str, string $substring): string |
7614 | 7614 | { |
7615 | - return $substring . $str . $substring; |
|
7615 | + return $substring.$str.$substring; |
|
7616 | 7616 | } |
7617 | 7617 | |
7618 | 7618 | /** |
@@ -7669,9 +7669,9 @@ discard block |
||
7669 | 7669 | $word_define_chars = ''; |
7670 | 7670 | } |
7671 | 7671 | |
7672 | - $str = (string) \preg_replace_callback( |
|
7673 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
7674 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
7672 | + $str = (string)\preg_replace_callback( |
|
7673 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
7674 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
7675 | 7675 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
7676 | 7676 | return $match[0]; |
7677 | 7677 | } |
@@ -7762,16 +7762,16 @@ discard block |
||
7762 | 7762 | } |
7763 | 7763 | |
7764 | 7764 | // the main substitutions |
7765 | - $str = (string) \preg_replace_callback( |
|
7765 | + $str = (string)\preg_replace_callback( |
|
7766 | 7766 | '~\\b (_*) (?: # 1. Leading underscore and |
7767 | 7767 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
7768 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
7768 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
7769 | 7769 | | |
7770 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
7770 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
7771 | 7771 | | |
7772 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
7772 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
7773 | 7773 | | |
7774 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
7774 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
7775 | 7775 | ) (_*) \\b # 6. With trailing underscore |
7776 | 7776 | ~ux', |
7777 | 7777 | /** |
@@ -7779,7 +7779,7 @@ discard block |
||
7779 | 7779 | * |
7780 | 7780 | * @return string |
7781 | 7781 | */ |
7782 | - static function (array $matches) use ($encoding): string { |
|
7782 | + static function(array $matches) use ($encoding): string { |
|
7783 | 7783 | // preserve leading underscore |
7784 | 7784 | $str = $matches[1]; |
7785 | 7785 | if ($matches[2]) { |
@@ -7804,26 +7804,26 @@ discard block |
||
7804 | 7804 | ); |
7805 | 7805 | |
7806 | 7806 | // Exceptions for small words: capitalize at start of title... |
7807 | - $str = (string) \preg_replace_callback( |
|
7807 | + $str = (string)\preg_replace_callback( |
|
7808 | 7808 | '~( \\A [[:punct:]]* # start of title... |
7809 | 7809 | | [:.;?!][ ]+ # or of subsentence... |
7810 | 7810 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
7811 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
7811 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
7812 | 7812 | ~uxi', |
7813 | 7813 | /** |
7814 | 7814 | * @param string[] $matches |
7815 | 7815 | * |
7816 | 7816 | * @return string |
7817 | 7817 | */ |
7818 | - static function (array $matches) use ($encoding): string { |
|
7819 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
7818 | + static function(array $matches) use ($encoding): string { |
|
7819 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
7820 | 7820 | }, |
7821 | 7821 | $str |
7822 | 7822 | ); |
7823 | 7823 | |
7824 | 7824 | // ...and end of title |
7825 | - $str = (string) \preg_replace_callback( |
|
7826 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
7825 | + $str = (string)\preg_replace_callback( |
|
7826 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
7827 | 7827 | (?= [[:punct:]]* \Z # ...at the end of the title... |
7828 | 7828 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
7829 | 7829 | ~uxi', |
@@ -7832,7 +7832,7 @@ discard block |
||
7832 | 7832 | * |
7833 | 7833 | * @return string |
7834 | 7834 | */ |
7835 | - static function (array $matches) use ($encoding): string { |
|
7835 | + static function(array $matches) use ($encoding): string { |
|
7836 | 7836 | return static::ucfirst($matches[1], $encoding); |
7837 | 7837 | }, |
7838 | 7838 | $str |
@@ -7840,10 +7840,10 @@ discard block |
||
7840 | 7840 | |
7841 | 7841 | // Exceptions for small words in hyphenated compound words. |
7842 | 7842 | // e.g. "in-flight" -> In-Flight |
7843 | - $str = (string) \preg_replace_callback( |
|
7843 | + $str = (string)\preg_replace_callback( |
|
7844 | 7844 | '~\\b |
7845 | 7845 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
7846 | - ( ' . $small_words_rx . ' ) |
|
7846 | + ( ' . $small_words_rx.' ) |
|
7847 | 7847 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
7848 | 7848 | ~uxi', |
7849 | 7849 | /** |
@@ -7851,18 +7851,18 @@ discard block |
||
7851 | 7851 | * |
7852 | 7852 | * @return string |
7853 | 7853 | */ |
7854 | - static function (array $matches) use ($encoding): string { |
|
7854 | + static function(array $matches) use ($encoding): string { |
|
7855 | 7855 | return static::ucfirst($matches[1], $encoding); |
7856 | 7856 | }, |
7857 | 7857 | $str |
7858 | 7858 | ); |
7859 | 7859 | |
7860 | 7860 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
7861 | - $str = (string) \preg_replace_callback( |
|
7861 | + $str = (string)\preg_replace_callback( |
|
7862 | 7862 | '~\\b |
7863 | 7863 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
7864 | 7864 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
7865 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
7865 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
7866 | 7866 | (?! - ) # Negative lookahead for another - |
7867 | 7867 | ~uxi', |
7868 | 7868 | /** |
@@ -7870,8 +7870,8 @@ discard block |
||
7870 | 7870 | * |
7871 | 7871 | * @return string |
7872 | 7872 | */ |
7873 | - static function (array $matches) use ($encoding): string { |
|
7874 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
7873 | + static function(array $matches) use ($encoding): string { |
|
7874 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
7875 | 7875 | }, |
7876 | 7876 | $str |
7877 | 7877 | ); |
@@ -7979,7 +7979,7 @@ discard block |
||
7979 | 7979 | ); |
7980 | 7980 | |
7981 | 7981 | foreach ($tmp_return as &$item) { |
7982 | - $item = (string) $item; |
|
7982 | + $item = (string)$item; |
|
7983 | 7983 | } |
7984 | 7984 | |
7985 | 7985 | return $tmp_return; |
@@ -8028,39 +8028,39 @@ discard block |
||
8028 | 8028 | } |
8029 | 8029 | |
8030 | 8030 | if ($encoding === 'UTF-8') { |
8031 | - if ($length >= (int) \mb_strlen($str)) { |
|
8031 | + if ($length >= (int)\mb_strlen($str)) { |
|
8032 | 8032 | return $str; |
8033 | 8033 | } |
8034 | 8034 | |
8035 | 8035 | if ($substring !== '') { |
8036 | - $length -= (int) \mb_strlen($substring); |
|
8036 | + $length -= (int)\mb_strlen($substring); |
|
8037 | 8037 | |
8038 | 8038 | /** @noinspection UnnecessaryCastingInspection */ |
8039 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
8039 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
8040 | 8040 | } |
8041 | 8041 | |
8042 | 8042 | /** @noinspection UnnecessaryCastingInspection */ |
8043 | - return (string) \mb_substr($str, 0, $length); |
|
8043 | + return (string)\mb_substr($str, 0, $length); |
|
8044 | 8044 | } |
8045 | 8045 | |
8046 | 8046 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8047 | 8047 | |
8048 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8048 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8049 | 8049 | return $str; |
8050 | 8050 | } |
8051 | 8051 | |
8052 | 8052 | if ($substring !== '') { |
8053 | - $length -= (int) self::strlen($substring, $encoding); |
|
8053 | + $length -= (int)self::strlen($substring, $encoding); |
|
8054 | 8054 | } |
8055 | 8055 | |
8056 | 8056 | return ( |
8057 | - (string) self::substr( |
|
8057 | + (string)self::substr( |
|
8058 | 8058 | $str, |
8059 | 8059 | 0, |
8060 | 8060 | $length, |
8061 | 8061 | $encoding |
8062 | 8062 | ) |
8063 | - ) . $substring; |
|
8063 | + ).$substring; |
|
8064 | 8064 | } |
8065 | 8065 | |
8066 | 8066 | /** |
@@ -8090,12 +8090,12 @@ discard block |
||
8090 | 8090 | } |
8091 | 8091 | |
8092 | 8092 | if ($encoding === 'UTF-8') { |
8093 | - if ($length >= (int) \mb_strlen($str)) { |
|
8093 | + if ($length >= (int)\mb_strlen($str)) { |
|
8094 | 8094 | return $str; |
8095 | 8095 | } |
8096 | 8096 | |
8097 | 8097 | // need to further trim the string so we can append the substring |
8098 | - $length -= (int) \mb_strlen($substring); |
|
8098 | + $length -= (int)\mb_strlen($substring); |
|
8099 | 8099 | if ($length <= 0) { |
8100 | 8100 | return $substring; |
8101 | 8101 | } |
@@ -8117,18 +8117,18 @@ discard block |
||
8117 | 8117 | || |
8118 | 8118 | ($space_position !== false && $ignore_do_not_split_words_for_one_word === false) |
8119 | 8119 | ) { |
8120 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
8120 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
8121 | 8121 | } |
8122 | 8122 | } |
8123 | 8123 | } else { |
8124 | 8124 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8125 | 8125 | |
8126 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8126 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8127 | 8127 | return $str; |
8128 | 8128 | } |
8129 | 8129 | |
8130 | 8130 | // need to further trim the string so we can append the substring |
8131 | - $length -= (int) self::strlen($substring, $encoding); |
|
8131 | + $length -= (int)self::strlen($substring, $encoding); |
|
8132 | 8132 | if ($length <= 0) { |
8133 | 8133 | return $substring; |
8134 | 8134 | } |
@@ -8150,12 +8150,12 @@ discard block |
||
8150 | 8150 | || |
8151 | 8151 | ($space_position !== false && $ignore_do_not_split_words_for_one_word === false) |
8152 | 8152 | ) { |
8153 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
8153 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
8154 | 8154 | } |
8155 | 8155 | } |
8156 | 8156 | } |
8157 | 8157 | |
8158 | - return $truncated . $substring; |
|
8158 | + return $truncated.$substring; |
|
8159 | 8159 | } |
8160 | 8160 | |
8161 | 8161 | /** |
@@ -8252,13 +8252,13 @@ discard block |
||
8252 | 8252 | } |
8253 | 8253 | } elseif ($format === 2) { |
8254 | 8254 | $number_of_words = []; |
8255 | - $offset = (int) self::strlen($str_parts[0]); |
|
8255 | + $offset = (int)self::strlen($str_parts[0]); |
|
8256 | 8256 | for ($i = 1; $i < $len; $i += 2) { |
8257 | 8257 | $number_of_words[$offset] = $str_parts[$i]; |
8258 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
8258 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
8259 | 8259 | } |
8260 | 8260 | } else { |
8261 | - $number_of_words = (int) (($len - 1) / 2); |
|
8261 | + $number_of_words = (int)(($len - 1) / 2); |
|
8262 | 8262 | } |
8263 | 8263 | |
8264 | 8264 | return $number_of_words; |
@@ -8378,21 +8378,21 @@ discard block |
||
8378 | 8378 | } |
8379 | 8379 | |
8380 | 8380 | if ($char_list === '') { |
8381 | - return (int) self::strlen($str, $encoding); |
|
8381 | + return (int)self::strlen($str, $encoding); |
|
8382 | 8382 | } |
8383 | 8383 | |
8384 | 8384 | if ($offset !== null || $length !== null) { |
8385 | 8385 | if ($encoding === 'UTF-8') { |
8386 | 8386 | if ($length === null) { |
8387 | 8387 | /** @noinspection UnnecessaryCastingInspection */ |
8388 | - $str_tmp = \mb_substr($str, (int) $offset); |
|
8388 | + $str_tmp = \mb_substr($str, (int)$offset); |
|
8389 | 8389 | } else { |
8390 | 8390 | /** @noinspection UnnecessaryCastingInspection */ |
8391 | - $str_tmp = \mb_substr($str, (int) $offset, $length); |
|
8391 | + $str_tmp = \mb_substr($str, (int)$offset, $length); |
|
8392 | 8392 | } |
8393 | 8393 | } else { |
8394 | 8394 | /** @noinspection UnnecessaryCastingInspection */ |
8395 | - $str_tmp = self::substr($str, (int) $offset, $length, $encoding); |
|
8395 | + $str_tmp = self::substr($str, (int)$offset, $length, $encoding); |
|
8396 | 8396 | } |
8397 | 8397 | |
8398 | 8398 | if ($str_tmp === false) { |
@@ -8408,7 +8408,7 @@ discard block |
||
8408 | 8408 | } |
8409 | 8409 | |
8410 | 8410 | $matches = []; |
8411 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
8411 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
8412 | 8412 | $return = self::strlen($matches[1], $encoding); |
8413 | 8413 | if ($return === false) { |
8414 | 8414 | return 0; |
@@ -8417,7 +8417,7 @@ discard block |
||
8417 | 8417 | return $return; |
8418 | 8418 | } |
8419 | 8419 | |
8420 | - return (int) self::strlen($str, $encoding); |
|
8420 | + return (int)self::strlen($str, $encoding); |
|
8421 | 8421 | } |
8422 | 8422 | |
8423 | 8423 | /** |
@@ -8549,7 +8549,7 @@ discard block |
||
8549 | 8549 | return ''; |
8550 | 8550 | } |
8551 | 8551 | |
8552 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
8552 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
8553 | 8553 | } |
8554 | 8554 | |
8555 | 8555 | /** |
@@ -8614,7 +8614,7 @@ discard block |
||
8614 | 8614 | // fallback for ascii only |
8615 | 8615 | // |
8616 | 8616 | |
8617 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
8617 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
8618 | 8618 | return \stripos($haystack, $needle, $offset); |
8619 | 8619 | } |
8620 | 8620 | |
@@ -8682,7 +8682,7 @@ discard block |
||
8682 | 8682 | && |
8683 | 8683 | self::$SUPPORT['mbstring'] === false |
8684 | 8684 | ) { |
8685 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8685 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8686 | 8686 | } |
8687 | 8687 | |
8688 | 8688 | if ( |
@@ -8696,11 +8696,11 @@ discard block |
||
8696 | 8696 | } |
8697 | 8697 | } |
8698 | 8698 | |
8699 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
8699 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
8700 | 8700 | return \stristr($haystack, $needle, $before_needle); |
8701 | 8701 | } |
8702 | 8702 | |
8703 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
8703 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
8704 | 8704 | |
8705 | 8705 | if (!isset($match[1])) { |
8706 | 8706 | return false; |
@@ -8710,7 +8710,7 @@ discard block |
||
8710 | 8710 | return $match[1]; |
8711 | 8711 | } |
8712 | 8712 | |
8713 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
8713 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
8714 | 8714 | } |
8715 | 8715 | |
8716 | 8716 | /** |
@@ -8782,7 +8782,7 @@ discard block |
||
8782 | 8782 | && |
8783 | 8783 | self::$SUPPORT['iconv'] === false |
8784 | 8784 | ) { |
8785 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8785 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8786 | 8786 | } |
8787 | 8787 | |
8788 | 8788 | // |
@@ -8898,8 +8898,8 @@ discard block |
||
8898 | 8898 | } |
8899 | 8899 | |
8900 | 8900 | return \strnatcmp( |
8901 | - (string) self::strtonatfold($str1), |
|
8902 | - (string) self::strtonatfold($str2) |
|
8901 | + (string)self::strtonatfold($str1), |
|
8902 | + (string)self::strtonatfold($str2) |
|
8903 | 8903 | ); |
8904 | 8904 | } |
8905 | 8905 | |
@@ -8957,11 +8957,11 @@ discard block |
||
8957 | 8957 | } |
8958 | 8958 | |
8959 | 8959 | if ($encoding === 'UTF-8') { |
8960 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
8961 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
8960 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
8961 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
8962 | 8962 | } else { |
8963 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
8964 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
8963 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
8964 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
8965 | 8965 | } |
8966 | 8966 | |
8967 | 8967 | return self::strcmp($str1, $str2); |
@@ -8983,8 +8983,8 @@ discard block |
||
8983 | 8983 | return false; |
8984 | 8984 | } |
8985 | 8985 | |
8986 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
8987 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
8986 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
8987 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
8988 | 8988 | } |
8989 | 8989 | |
8990 | 8990 | return false; |
@@ -9017,10 +9017,10 @@ discard block |
||
9017 | 9017 | } |
9018 | 9018 | |
9019 | 9019 | // iconv and mbstring do not support integer $needle |
9020 | - if ((int) $needle === $needle) { |
|
9021 | - $needle = (string) self::chr($needle); |
|
9020 | + if ((int)$needle === $needle) { |
|
9021 | + $needle = (string)self::chr($needle); |
|
9022 | 9022 | } |
9023 | - $needle = (string) $needle; |
|
9023 | + $needle = (string)$needle; |
|
9024 | 9024 | |
9025 | 9025 | if ($needle === '') { |
9026 | 9026 | return false; |
@@ -9067,7 +9067,7 @@ discard block |
||
9067 | 9067 | && |
9068 | 9068 | self::$SUPPORT['mbstring'] === false |
9069 | 9069 | ) { |
9070 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9070 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9071 | 9071 | } |
9072 | 9072 | |
9073 | 9073 | // |
@@ -9108,7 +9108,7 @@ discard block |
||
9108 | 9108 | // fallback for ascii only |
9109 | 9109 | // |
9110 | 9110 | |
9111 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9111 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9112 | 9112 | return \strpos($haystack, $needle, $offset); |
9113 | 9113 | } |
9114 | 9114 | |
@@ -9120,7 +9120,7 @@ discard block |
||
9120 | 9120 | if ($haystack_tmp === false) { |
9121 | 9121 | $haystack_tmp = ''; |
9122 | 9122 | } |
9123 | - $haystack = (string) $haystack_tmp; |
|
9123 | + $haystack = (string)$haystack_tmp; |
|
9124 | 9124 | |
9125 | 9125 | if ($offset < 0) { |
9126 | 9126 | $offset = 0; |
@@ -9132,7 +9132,7 @@ discard block |
||
9132 | 9132 | } |
9133 | 9133 | |
9134 | 9134 | if ($pos) { |
9135 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9135 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9136 | 9136 | } |
9137 | 9137 | |
9138 | 9138 | return $offset + 0; |
@@ -9243,7 +9243,7 @@ discard block |
||
9243 | 9243 | && |
9244 | 9244 | self::$SUPPORT['mbstring'] === false |
9245 | 9245 | ) { |
9246 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9246 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9247 | 9247 | } |
9248 | 9248 | |
9249 | 9249 | // |
@@ -9255,7 +9255,7 @@ discard block |
||
9255 | 9255 | if ($needle_tmp === false) { |
9256 | 9256 | return false; |
9257 | 9257 | } |
9258 | - $needle = (string) $needle_tmp; |
|
9258 | + $needle = (string)$needle_tmp; |
|
9259 | 9259 | |
9260 | 9260 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
9261 | 9261 | if ($pos === false) { |
@@ -9277,7 +9277,7 @@ discard block |
||
9277 | 9277 | if ($needle_tmp === false) { |
9278 | 9278 | return false; |
9279 | 9279 | } |
9280 | - $needle = (string) $needle_tmp; |
|
9280 | + $needle = (string)$needle_tmp; |
|
9281 | 9281 | |
9282 | 9282 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
9283 | 9283 | if ($pos === false) { |
@@ -9313,7 +9313,7 @@ discard block |
||
9313 | 9313 | if ($encoding === 'UTF-8') { |
9314 | 9314 | if (self::$SUPPORT['intl'] === true) { |
9315 | 9315 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
9316 | - $i = (int) \grapheme_strlen($str); |
|
9316 | + $i = (int)\grapheme_strlen($str); |
|
9317 | 9317 | while ($i--) { |
9318 | 9318 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
9319 | 9319 | if ($reversed_tmp !== false) { |
@@ -9321,7 +9321,7 @@ discard block |
||
9321 | 9321 | } |
9322 | 9322 | } |
9323 | 9323 | } else { |
9324 | - $i = (int) \mb_strlen($str); |
|
9324 | + $i = (int)\mb_strlen($str); |
|
9325 | 9325 | while ($i--) { |
9326 | 9326 | $reversed_tmp = \mb_substr($str, $i, 1); |
9327 | 9327 | if ($reversed_tmp !== false) { |
@@ -9332,7 +9332,7 @@ discard block |
||
9332 | 9332 | } else { |
9333 | 9333 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9334 | 9334 | |
9335 | - $i = (int) self::strlen($str, $encoding); |
|
9335 | + $i = (int)self::strlen($str, $encoding); |
|
9336 | 9336 | while ($i--) { |
9337 | 9337 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
9338 | 9338 | if ($reversed_tmp !== false) { |
@@ -9406,7 +9406,7 @@ discard block |
||
9406 | 9406 | if ($needle_tmp === false) { |
9407 | 9407 | return false; |
9408 | 9408 | } |
9409 | - $needle = (string) $needle_tmp; |
|
9409 | + $needle = (string)$needle_tmp; |
|
9410 | 9410 | |
9411 | 9411 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
9412 | 9412 | if ($pos === false) { |
@@ -9445,10 +9445,10 @@ discard block |
||
9445 | 9445 | } |
9446 | 9446 | |
9447 | 9447 | // iconv and mbstring do not support integer $needle |
9448 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9449 | - $needle = (string) self::chr($needle); |
|
9448 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9449 | + $needle = (string)self::chr($needle); |
|
9450 | 9450 | } |
9451 | - $needle = (string) $needle; |
|
9451 | + $needle = (string)$needle; |
|
9452 | 9452 | |
9453 | 9453 | if ($needle === '') { |
9454 | 9454 | return false; |
@@ -9493,7 +9493,7 @@ discard block |
||
9493 | 9493 | && |
9494 | 9494 | self::$SUPPORT['mbstring'] === false |
9495 | 9495 | ) { |
9496 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9496 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9497 | 9497 | } |
9498 | 9498 | |
9499 | 9499 | // |
@@ -9517,7 +9517,7 @@ discard block |
||
9517 | 9517 | // fallback for ascii only |
9518 | 9518 | // |
9519 | 9519 | |
9520 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9520 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9521 | 9521 | return \strripos($haystack, $needle, $offset); |
9522 | 9522 | } |
9523 | 9523 | |
@@ -9594,10 +9594,10 @@ discard block |
||
9594 | 9594 | } |
9595 | 9595 | |
9596 | 9596 | // iconv and mbstring do not support integer $needle |
9597 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9598 | - $needle = (string) self::chr($needle); |
|
9597 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9598 | + $needle = (string)self::chr($needle); |
|
9599 | 9599 | } |
9600 | - $needle = (string) $needle; |
|
9600 | + $needle = (string)$needle; |
|
9601 | 9601 | |
9602 | 9602 | if ($needle === '') { |
9603 | 9603 | return false; |
@@ -9642,7 +9642,7 @@ discard block |
||
9642 | 9642 | && |
9643 | 9643 | self::$SUPPORT['mbstring'] === false |
9644 | 9644 | ) { |
9645 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9645 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9646 | 9646 | } |
9647 | 9647 | |
9648 | 9648 | // |
@@ -9666,7 +9666,7 @@ discard block |
||
9666 | 9666 | // fallback for ascii only |
9667 | 9667 | // |
9668 | 9668 | |
9669 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9669 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9670 | 9670 | return \strrpos($haystack, $needle, $offset); |
9671 | 9671 | } |
9672 | 9672 | |
@@ -9686,7 +9686,7 @@ discard block |
||
9686 | 9686 | if ($haystack_tmp === false) { |
9687 | 9687 | $haystack_tmp = ''; |
9688 | 9688 | } |
9689 | - $haystack = (string) $haystack_tmp; |
|
9689 | + $haystack = (string)$haystack_tmp; |
|
9690 | 9690 | } |
9691 | 9691 | |
9692 | 9692 | $pos = \strrpos($haystack, $needle); |
@@ -9699,7 +9699,7 @@ discard block |
||
9699 | 9699 | return false; |
9700 | 9700 | } |
9701 | 9701 | |
9702 | - return $offset + (int) self::strlen($str_tmp); |
|
9702 | + return $offset + (int)self::strlen($str_tmp); |
|
9703 | 9703 | } |
9704 | 9704 | |
9705 | 9705 | /** |
@@ -9761,12 +9761,12 @@ discard block |
||
9761 | 9761 | if ($offset || $length !== null) { |
9762 | 9762 | if ($encoding === 'UTF-8') { |
9763 | 9763 | if ($length === null) { |
9764 | - $str = (string) \mb_substr($str, $offset); |
|
9764 | + $str = (string)\mb_substr($str, $offset); |
|
9765 | 9765 | } else { |
9766 | - $str = (string) \mb_substr($str, $offset, $length); |
|
9766 | + $str = (string)\mb_substr($str, $offset, $length); |
|
9767 | 9767 | } |
9768 | 9768 | } else { |
9769 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
9769 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
9770 | 9770 | } |
9771 | 9771 | } |
9772 | 9772 | |
@@ -9776,7 +9776,7 @@ discard block |
||
9776 | 9776 | |
9777 | 9777 | $matches = []; |
9778 | 9778 | |
9779 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
9779 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
9780 | 9780 | } |
9781 | 9781 | |
9782 | 9782 | /** |
@@ -9845,7 +9845,7 @@ discard block |
||
9845 | 9845 | && |
9846 | 9846 | self::$SUPPORT['mbstring'] === false |
9847 | 9847 | ) { |
9848 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9848 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9849 | 9849 | } |
9850 | 9850 | |
9851 | 9851 | // |
@@ -9867,7 +9867,7 @@ discard block |
||
9867 | 9867 | // fallback for ascii only |
9868 | 9868 | // |
9869 | 9869 | |
9870 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9870 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9871 | 9871 | return \strstr($haystack, $needle, $before_needle); |
9872 | 9872 | } |
9873 | 9873 | |
@@ -9875,7 +9875,7 @@ discard block |
||
9875 | 9875 | // fallback via vanilla php |
9876 | 9876 | // |
9877 | 9877 | |
9878 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
9878 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
9879 | 9879 | |
9880 | 9880 | if (!isset($match[1])) { |
9881 | 9881 | return false; |
@@ -9885,7 +9885,7 @@ discard block |
||
9885 | 9885 | return $match[1]; |
9886 | 9886 | } |
9887 | 9887 | |
9888 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
9888 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
9889 | 9889 | } |
9890 | 9890 | |
9891 | 9891 | /** |
@@ -10003,7 +10003,7 @@ discard block |
||
10003 | 10003 | bool $try_to_keep_the_string_length = false |
10004 | 10004 | ): string { |
10005 | 10005 | // init |
10006 | - $str = (string) $str; |
|
10006 | + $str = (string)$str; |
|
10007 | 10007 | |
10008 | 10008 | if ($str === '') { |
10009 | 10009 | return ''; |
@@ -10032,19 +10032,19 @@ discard block |
||
10032 | 10032 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10033 | 10033 | } |
10034 | 10034 | |
10035 | - $language_code = $lang . '-Lower'; |
|
10035 | + $language_code = $lang.'-Lower'; |
|
10036 | 10036 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10037 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
10037 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
10038 | 10038 | |
10039 | 10039 | $language_code = 'Any-Lower'; |
10040 | 10040 | } |
10041 | 10041 | |
10042 | 10042 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10043 | 10043 | /** @noinspection UnnecessaryCastingInspection */ |
10044 | - return (string) \transliterator_transliterate($language_code, $str); |
|
10044 | + return (string)\transliterator_transliterate($language_code, $str); |
|
10045 | 10045 | } |
10046 | 10046 | |
10047 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
10047 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
10048 | 10048 | } |
10049 | 10049 | |
10050 | 10050 | // always fallback via symfony polyfill |
@@ -10073,7 +10073,7 @@ discard block |
||
10073 | 10073 | bool $try_to_keep_the_string_length = false |
10074 | 10074 | ): string { |
10075 | 10075 | // init |
10076 | - $str = (string) $str; |
|
10076 | + $str = (string)$str; |
|
10077 | 10077 | |
10078 | 10078 | if ($str === '') { |
10079 | 10079 | return ''; |
@@ -10102,19 +10102,19 @@ discard block |
||
10102 | 10102 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10103 | 10103 | } |
10104 | 10104 | |
10105 | - $language_code = $lang . '-Upper'; |
|
10105 | + $language_code = $lang.'-Upper'; |
|
10106 | 10106 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10107 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
10107 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
10108 | 10108 | |
10109 | 10109 | $language_code = 'Any-Upper'; |
10110 | 10110 | } |
10111 | 10111 | |
10112 | 10112 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10113 | 10113 | /** @noinspection UnnecessaryCastingInspection */ |
10114 | - return (string) \transliterator_transliterate($language_code, $str); |
|
10114 | + return (string)\transliterator_transliterate($language_code, $str); |
|
10115 | 10115 | } |
10116 | 10116 | |
10117 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
10117 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
10118 | 10118 | } |
10119 | 10119 | |
10120 | 10120 | // always fallback via symfony polyfill |
@@ -10159,7 +10159,7 @@ discard block |
||
10159 | 10159 | $from = \array_combine($from, $to); |
10160 | 10160 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
10161 | 10161 | if ($from === false) { |
10162 | - 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) . ')'); |
|
10162 | + 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).')'); |
|
10163 | 10163 | } |
10164 | 10164 | } |
10165 | 10165 | |
@@ -10219,9 +10219,9 @@ discard block |
||
10219 | 10219 | } |
10220 | 10220 | |
10221 | 10221 | $wide = 0; |
10222 | - $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); |
|
10222 | + $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); |
|
10223 | 10223 | |
10224 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
10224 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
10225 | 10225 | } |
10226 | 10226 | |
10227 | 10227 | /** |
@@ -10321,9 +10321,9 @@ discard block |
||
10321 | 10321 | } |
10322 | 10322 | |
10323 | 10323 | if ($length === null) { |
10324 | - $length = (int) $str_length; |
|
10324 | + $length = (int)$str_length; |
|
10325 | 10325 | } else { |
10326 | - $length = (int) $length; |
|
10326 | + $length = (int)$length; |
|
10327 | 10327 | } |
10328 | 10328 | |
10329 | 10329 | if ( |
@@ -10331,7 +10331,7 @@ discard block |
||
10331 | 10331 | && |
10332 | 10332 | self::$SUPPORT['mbstring'] === false |
10333 | 10333 | ) { |
10334 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10334 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10335 | 10335 | } |
10336 | 10336 | |
10337 | 10337 | // |
@@ -10419,16 +10419,16 @@ discard block |
||
10419 | 10419 | ) { |
10420 | 10420 | if ($encoding === 'UTF-8') { |
10421 | 10421 | if ($length === null) { |
10422 | - $str1 = (string) \mb_substr($str1, $offset); |
|
10422 | + $str1 = (string)\mb_substr($str1, $offset); |
|
10423 | 10423 | } else { |
10424 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
10424 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
10425 | 10425 | } |
10426 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
10426 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
10427 | 10427 | } else { |
10428 | 10428 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10429 | 10429 | |
10430 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
10431 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
10430 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
10431 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
10432 | 10432 | } |
10433 | 10433 | } |
10434 | 10434 | |
@@ -10490,13 +10490,13 @@ discard block |
||
10490 | 10490 | if ($length_tmp === false) { |
10491 | 10491 | return false; |
10492 | 10492 | } |
10493 | - $length = (int) $length_tmp; |
|
10493 | + $length = (int)$length_tmp; |
|
10494 | 10494 | } |
10495 | 10495 | |
10496 | 10496 | if ($encoding === 'UTF-8') { |
10497 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
10497 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
10498 | 10498 | } else { |
10499 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
10499 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
10500 | 10500 | } |
10501 | 10501 | } |
10502 | 10502 | |
@@ -10505,7 +10505,7 @@ discard block |
||
10505 | 10505 | && |
10506 | 10506 | self::$SUPPORT['mbstring'] === false |
10507 | 10507 | ) { |
10508 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10508 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10509 | 10509 | } |
10510 | 10510 | |
10511 | 10511 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10516,7 +10516,7 @@ discard block |
||
10516 | 10516 | return \mb_substr_count($haystack, $needle, $encoding); |
10517 | 10517 | } |
10518 | 10518 | |
10519 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10519 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10520 | 10520 | |
10521 | 10521 | return \count($matches); |
10522 | 10522 | } |
@@ -10563,7 +10563,7 @@ discard block |
||
10563 | 10563 | if ($length_tmp === false) { |
10564 | 10564 | return false; |
10565 | 10565 | } |
10566 | - $length = (int) $length_tmp; |
|
10566 | + $length = (int)$length_tmp; |
|
10567 | 10567 | } |
10568 | 10568 | |
10569 | 10569 | if ( |
@@ -10584,7 +10584,7 @@ discard block |
||
10584 | 10584 | if ($haystack_tmp === false) { |
10585 | 10585 | $haystack_tmp = ''; |
10586 | 10586 | } |
10587 | - $haystack = (string) $haystack_tmp; |
|
10587 | + $haystack = (string)$haystack_tmp; |
|
10588 | 10588 | } |
10589 | 10589 | |
10590 | 10590 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10623,10 +10623,10 @@ discard block |
||
10623 | 10623 | |
10624 | 10624 | if ($encoding === 'UTF-8') { |
10625 | 10625 | if ($case_sensitive) { |
10626 | - return (int) \mb_substr_count($str, $substring); |
|
10626 | + return (int)\mb_substr_count($str, $substring); |
|
10627 | 10627 | } |
10628 | 10628 | |
10629 | - return (int) \mb_substr_count( |
|
10629 | + return (int)\mb_substr_count( |
|
10630 | 10630 | \mb_strtoupper($str), |
10631 | 10631 | \mb_strtoupper($substring) |
10632 | 10632 | ); |
@@ -10635,10 +10635,10 @@ discard block |
||
10635 | 10635 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10636 | 10636 | |
10637 | 10637 | if ($case_sensitive) { |
10638 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
10638 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
10639 | 10639 | } |
10640 | 10640 | |
10641 | - return (int) \mb_substr_count( |
|
10641 | + return (int)\mb_substr_count( |
|
10642 | 10642 | self::strtocasefold($str, true, false, $encoding, null, false), |
10643 | 10643 | self::strtocasefold($substring, true, false, $encoding, null, false), |
10644 | 10644 | $encoding |
@@ -10664,7 +10664,7 @@ discard block |
||
10664 | 10664 | } |
10665 | 10665 | |
10666 | 10666 | if (self::str_istarts_with($haystack, $needle) === true) { |
10667 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10667 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10668 | 10668 | } |
10669 | 10669 | |
10670 | 10670 | return $haystack; |
@@ -10721,7 +10721,7 @@ discard block |
||
10721 | 10721 | } |
10722 | 10722 | |
10723 | 10723 | if (self::str_iends_with($haystack, $needle) === true) { |
10724 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
10724 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
10725 | 10725 | } |
10726 | 10726 | |
10727 | 10727 | return $haystack; |
@@ -10746,7 +10746,7 @@ discard block |
||
10746 | 10746 | } |
10747 | 10747 | |
10748 | 10748 | if (self::str_starts_with($haystack, $needle) === true) { |
10749 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10749 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10750 | 10750 | } |
10751 | 10751 | |
10752 | 10752 | return $haystack; |
@@ -10798,7 +10798,7 @@ discard block |
||
10798 | 10798 | if (\is_array($offset) === true) { |
10799 | 10799 | $offset = \array_slice($offset, 0, $num); |
10800 | 10800 | foreach ($offset as &$value_tmp) { |
10801 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
10801 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
10802 | 10802 | } |
10803 | 10803 | unset($value_tmp); |
10804 | 10804 | } else { |
@@ -10811,7 +10811,7 @@ discard block |
||
10811 | 10811 | } elseif (\is_array($length) === true) { |
10812 | 10812 | $length = \array_slice($length, 0, $num); |
10813 | 10813 | foreach ($length as &$value_tmp_V2) { |
10814 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
10814 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
10815 | 10815 | } |
10816 | 10816 | unset($value_tmp_V2); |
10817 | 10817 | } else { |
@@ -10831,8 +10831,8 @@ discard block |
||
10831 | 10831 | } |
10832 | 10832 | |
10833 | 10833 | // init |
10834 | - $str = (string) $str; |
|
10835 | - $replacement = (string) $replacement; |
|
10834 | + $str = (string)$str; |
|
10835 | + $replacement = (string)$replacement; |
|
10836 | 10836 | |
10837 | 10837 | if (\is_array($length) === true) { |
10838 | 10838 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -10847,16 +10847,16 @@ discard block |
||
10847 | 10847 | } |
10848 | 10848 | |
10849 | 10849 | if (self::$SUPPORT['mbstring'] === true) { |
10850 | - $string_length = (int) self::strlen($str, $encoding); |
|
10850 | + $string_length = (int)self::strlen($str, $encoding); |
|
10851 | 10851 | |
10852 | 10852 | if ($offset < 0) { |
10853 | - $offset = (int) \max(0, $string_length + $offset); |
|
10853 | + $offset = (int)\max(0, $string_length + $offset); |
|
10854 | 10854 | } elseif ($offset > $string_length) { |
10855 | 10855 | $offset = $string_length; |
10856 | 10856 | } |
10857 | 10857 | |
10858 | 10858 | if ($length !== null && $length < 0) { |
10859 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
10859 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
10860 | 10860 | } elseif ($length === null || $length > $string_length) { |
10861 | 10861 | $length = $string_length; |
10862 | 10862 | } |
@@ -10867,9 +10867,9 @@ discard block |
||
10867 | 10867 | } |
10868 | 10868 | |
10869 | 10869 | /** @noinspection AdditionOperationOnArraysInspection */ |
10870 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
10871 | - $replacement . |
|
10872 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10870 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
10871 | + $replacement. |
|
10872 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10873 | 10873 | } |
10874 | 10874 | |
10875 | 10875 | // |
@@ -10878,8 +10878,7 @@ discard block |
||
10878 | 10878 | |
10879 | 10879 | if (ASCII::is_ascii($str)) { |
10880 | 10880 | return ($length === null) ? |
10881 | - \substr_replace($str, $replacement, $offset) : |
|
10882 | - \substr_replace($str, $replacement, $offset, $length); |
|
10881 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
10883 | 10882 | } |
10884 | 10883 | |
10885 | 10884 | // |
@@ -10895,7 +10894,7 @@ discard block |
||
10895 | 10894 | // e.g.: non mbstring support + invalid chars |
10896 | 10895 | return ''; |
10897 | 10896 | } |
10898 | - $length = (int) $length_tmp; |
|
10897 | + $length = (int)$length_tmp; |
|
10899 | 10898 | } |
10900 | 10899 | |
10901 | 10900 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -10930,14 +10929,14 @@ discard block |
||
10930 | 10929 | && |
10931 | 10930 | \substr($haystack, -\strlen($needle)) === $needle |
10932 | 10931 | ) { |
10933 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
10932 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
10934 | 10933 | } |
10935 | 10934 | |
10936 | 10935 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
10937 | - return (string) self::substr( |
|
10936 | + return (string)self::substr( |
|
10938 | 10937 | $haystack, |
10939 | 10938 | 0, |
10940 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
10939 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
10941 | 10940 | $encoding |
10942 | 10941 | ); |
10943 | 10942 | } |
@@ -10967,10 +10966,10 @@ discard block |
||
10967 | 10966 | } |
10968 | 10967 | |
10969 | 10968 | if ($encoding === 'UTF-8') { |
10970 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10969 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10971 | 10970 | } |
10972 | 10971 | |
10973 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10972 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10974 | 10973 | } |
10975 | 10974 | |
10976 | 10975 | /** |
@@ -11154,7 +11153,7 @@ discard block |
||
11154 | 11153 | public static function to_boolean($str): bool |
11155 | 11154 | { |
11156 | 11155 | // init |
11157 | - $str = (string) $str; |
|
11156 | + $str = (string)$str; |
|
11158 | 11157 | |
11159 | 11158 | if ($str === '') { |
11160 | 11159 | return false; |
@@ -11182,10 +11181,10 @@ discard block |
||
11182 | 11181 | } |
11183 | 11182 | |
11184 | 11183 | if (\is_numeric($str)) { |
11185 | - return ((float) $str + 0) > 0; |
|
11184 | + return ((float)$str + 0) > 0; |
|
11186 | 11185 | } |
11187 | 11186 | |
11188 | - return (bool) \trim($str); |
|
11187 | + return (bool)\trim($str); |
|
11189 | 11188 | } |
11190 | 11189 | |
11191 | 11190 | /** |
@@ -11227,7 +11226,7 @@ discard block |
||
11227 | 11226 | return $str; |
11228 | 11227 | } |
11229 | 11228 | |
11230 | - $str = (string) $str; |
|
11229 | + $str = (string)$str; |
|
11231 | 11230 | if ($str === '') { |
11232 | 11231 | return ''; |
11233 | 11232 | } |
@@ -11274,7 +11273,7 @@ discard block |
||
11274 | 11273 | return $str; |
11275 | 11274 | } |
11276 | 11275 | |
11277 | - $str = (string) $str; |
|
11276 | + $str = (string)$str; |
|
11278 | 11277 | if ($str === '') { |
11279 | 11278 | return $str; |
11280 | 11279 | } |
@@ -11292,7 +11291,7 @@ discard block |
||
11292 | 11291 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
11293 | 11292 | |
11294 | 11293 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11295 | - $buf .= $c1 . $c2; |
|
11294 | + $buf .= $c1.$c2; |
|
11296 | 11295 | ++$i; |
11297 | 11296 | } else { // not valid UTF8 - convert it |
11298 | 11297 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11303,7 +11302,7 @@ discard block |
||
11303 | 11302 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
11304 | 11303 | |
11305 | 11304 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11306 | - $buf .= $c1 . $c2 . $c3; |
|
11305 | + $buf .= $c1.$c2.$c3; |
|
11307 | 11306 | $i += 2; |
11308 | 11307 | } else { // not valid UTF8 - convert it |
11309 | 11308 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11315,7 +11314,7 @@ discard block |
||
11315 | 11314 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
11316 | 11315 | |
11317 | 11316 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11318 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
11317 | + $buf .= $c1.$c2.$c3.$c4; |
|
11319 | 11318 | $i += 3; |
11320 | 11319 | } else { // not valid UTF8 - convert it |
11321 | 11320 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11341,13 +11340,13 @@ discard block |
||
11341 | 11340 | * |
11342 | 11341 | * @return string |
11343 | 11342 | */ |
11344 | - static function (array $matches): string { |
|
11343 | + static function(array $matches): string { |
|
11345 | 11344 | if (isset($matches[3])) { |
11346 | - $cp = (int) \hexdec($matches[3]); |
|
11345 | + $cp = (int)\hexdec($matches[3]); |
|
11347 | 11346 | } else { |
11348 | 11347 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
11349 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
11350 | - + (int) \hexdec($matches[2]) |
|
11348 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
11349 | + + (int)\hexdec($matches[2]) |
|
11351 | 11350 | + 0x10000 |
11352 | 11351 | - (0xD800 << 10) |
11353 | 11352 | - 0xDC00; |
@@ -11358,12 +11357,12 @@ discard block |
||
11358 | 11357 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
11359 | 11358 | |
11360 | 11359 | if ($cp < 0x80) { |
11361 | - return (string) self::chr($cp); |
|
11360 | + return (string)self::chr($cp); |
|
11362 | 11361 | } |
11363 | 11362 | |
11364 | 11363 | if ($cp < 0xA0) { |
11365 | 11364 | /** @noinspection UnnecessaryCastingInspection */ |
11366 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
11365 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
11367 | 11366 | } |
11368 | 11367 | |
11369 | 11368 | return self::decimal_to_chr($cp); |
@@ -11411,7 +11410,7 @@ discard block |
||
11411 | 11410 | |
11412 | 11411 | if (self::$SUPPORT['mbstring'] === true) { |
11413 | 11412 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11414 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
11413 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
11415 | 11414 | } |
11416 | 11415 | |
11417 | 11416 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -11448,15 +11447,15 @@ discard block |
||
11448 | 11447 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
11449 | 11448 | |
11450 | 11449 | if ($encoding === 'UTF-8') { |
11451 | - $str_part_two = (string) \mb_substr($str, 1); |
|
11450 | + $str_part_two = (string)\mb_substr($str, 1); |
|
11452 | 11451 | |
11453 | 11452 | if ($use_mb_functions === true) { |
11454 | 11453 | $str_part_one = \mb_strtoupper( |
11455 | - (string) \mb_substr($str, 0, 1) |
|
11454 | + (string)\mb_substr($str, 0, 1) |
|
11456 | 11455 | ); |
11457 | 11456 | } else { |
11458 | 11457 | $str_part_one = self::strtoupper( |
11459 | - (string) \mb_substr($str, 0, 1), |
|
11458 | + (string)\mb_substr($str, 0, 1), |
|
11460 | 11459 | $encoding, |
11461 | 11460 | false, |
11462 | 11461 | $lang, |
@@ -11466,16 +11465,16 @@ discard block |
||
11466 | 11465 | } else { |
11467 | 11466 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11468 | 11467 | |
11469 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
11468 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
11470 | 11469 | |
11471 | 11470 | if ($use_mb_functions === true) { |
11472 | 11471 | $str_part_one = \mb_strtoupper( |
11473 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
11472 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
11474 | 11473 | $encoding |
11475 | 11474 | ); |
11476 | 11475 | } else { |
11477 | 11476 | $str_part_one = self::strtoupper( |
11478 | - (string) self::substr($str, 0, 1, $encoding), |
|
11477 | + (string)self::substr($str, 0, 1, $encoding), |
|
11479 | 11478 | $encoding, |
11480 | 11479 | false, |
11481 | 11480 | $lang, |
@@ -11484,7 +11483,7 @@ discard block |
||
11484 | 11483 | } |
11485 | 11484 | } |
11486 | 11485 | |
11487 | - return $str_part_one . $str_part_two; |
|
11486 | + return $str_part_one.$str_part_two; |
|
11488 | 11487 | } |
11489 | 11488 | |
11490 | 11489 | /** |
@@ -11538,7 +11537,7 @@ discard block |
||
11538 | 11537 | $str = self::clean($str); |
11539 | 11538 | } |
11540 | 11539 | |
11541 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
11540 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
11542 | 11541 | |
11543 | 11542 | if ( |
11544 | 11543 | $use_php_default_functions === true |
@@ -11925,7 +11924,7 @@ discard block |
||
11925 | 11924 | if ( |
11926 | 11925 | $keep_utf8_chars === true |
11927 | 11926 | && |
11928 | - self::strlen($return) >= (int) self::strlen($str_backup) |
|
11927 | + self::strlen($return) >= (int)self::strlen($str_backup) |
|
11929 | 11928 | ) { |
11930 | 11929 | return $str_backup; |
11931 | 11930 | } |
@@ -12004,17 +12003,17 @@ discard block |
||
12004 | 12003 | return ''; |
12005 | 12004 | } |
12006 | 12005 | |
12007 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
12006 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
12008 | 12007 | |
12009 | 12008 | if ( |
12010 | 12009 | !isset($matches[0]) |
12011 | 12010 | || |
12012 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
12011 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
12013 | 12012 | ) { |
12014 | 12013 | return $str; |
12015 | 12014 | } |
12016 | 12015 | |
12017 | - return \rtrim($matches[0]) . $str_add_on; |
|
12016 | + return \rtrim($matches[0]).$str_add_on; |
|
12018 | 12017 | } |
12019 | 12018 | |
12020 | 12019 | /** |
@@ -12101,7 +12100,7 @@ discard block |
||
12101 | 12100 | } |
12102 | 12101 | } |
12103 | 12102 | |
12104 | - return $str_return . \implode('', $chars); |
|
12103 | + return $str_return.\implode('', $chars); |
|
12105 | 12104 | } |
12106 | 12105 | |
12107 | 12106 | /** |
@@ -12153,7 +12152,7 @@ discard block |
||
12153 | 12152 | $final_break = ''; |
12154 | 12153 | } |
12155 | 12154 | |
12156 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
12155 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
12157 | 12156 | } |
12158 | 12157 | |
12159 | 12158 | /** |
@@ -12369,7 +12368,7 @@ discard block |
||
12369 | 12368 | /** @noinspection PhpIncludeInspection */ |
12370 | 12369 | /** @noinspection UsingInclusionReturnValueInspection */ |
12371 | 12370 | /** @psalm-suppress UnresolvableInclude */ |
12372 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
12371 | + return include __DIR__.'/data/'.$file.'.php'; |
|
12373 | 12372 | } |
12374 | 12373 | |
12375 | 12374 | /** |
@@ -12384,7 +12383,7 @@ discard block |
||
12384 | 12383 | |
12385 | 12384 | \uksort( |
12386 | 12385 | self::$EMOJI, |
12387 | - static function (string $a, string $b): int { |
|
12386 | + static function(string $a, string $b): int { |
|
12388 | 12387 | return \strlen($b) <=> \strlen($a); |
12389 | 12388 | } |
12390 | 12389 | ); |
@@ -12394,7 +12393,7 @@ discard block |
||
12394 | 12393 | |
12395 | 12394 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
12396 | 12395 | $tmp_key = \crc32($key); |
12397 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
12396 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
12398 | 12397 | } |
12399 | 12398 | |
12400 | 12399 | return true; |
@@ -12418,7 +12417,7 @@ discard block |
||
12418 | 12417 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
12419 | 12418 | return \defined('MB_OVERLOAD_STRING') |
12420 | 12419 | && |
12421 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12420 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12422 | 12421 | } |
12423 | 12422 | |
12424 | 12423 | /** |
@@ -12471,7 +12470,7 @@ discard block |
||
12471 | 12470 | { |
12472 | 12471 | static $RX_CLASS_CACHE = []; |
12473 | 12472 | |
12474 | - $cache_key = $s . $class; |
|
12473 | + $cache_key = $s.$class; |
|
12475 | 12474 | |
12476 | 12475 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
12477 | 12476 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -12483,7 +12482,7 @@ discard block |
||
12483 | 12482 | /** @noinspection AlterInForeachInspection */ |
12484 | 12483 | foreach (self::str_split($s) as &$s) { |
12485 | 12484 | if ($s === '-') { |
12486 | - $class_array[0] = '-' . $class_array[0]; |
|
12485 | + $class_array[0] = '-'.$class_array[0]; |
|
12487 | 12486 | } elseif (!isset($s[2])) { |
12488 | 12487 | $class_array[0] .= \preg_quote($s, '/'); |
12489 | 12488 | } elseif (self::strlen($s) === 1) { |
@@ -12494,13 +12493,13 @@ discard block |
||
12494 | 12493 | } |
12495 | 12494 | |
12496 | 12495 | if ($class_array[0]) { |
12497 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
12496 | + $class_array[0] = '['.$class_array[0].']'; |
|
12498 | 12497 | } |
12499 | 12498 | |
12500 | 12499 | if (\count($class_array) === 1) { |
12501 | 12500 | $return = $class_array[0]; |
12502 | 12501 | } else { |
12503 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
12502 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
12504 | 12503 | } |
12505 | 12504 | |
12506 | 12505 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -12574,7 +12573,7 @@ discard block |
||
12574 | 12573 | |
12575 | 12574 | if ($delimiter === '-') { |
12576 | 12575 | /** @noinspection AlterInForeachInspection */ |
12577 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
12576 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
12578 | 12577 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12579 | 12578 | $continue = true; |
12580 | 12579 | } |
@@ -12582,7 +12581,7 @@ discard block |
||
12582 | 12581 | } |
12583 | 12582 | |
12584 | 12583 | /** @noinspection AlterInForeachInspection */ |
12585 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
12584 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
12586 | 12585 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12587 | 12586 | $continue = true; |
12588 | 12587 | } |
@@ -12643,8 +12642,8 @@ discard block |
||
12643 | 12642 | } else { |
12644 | 12643 | /** @noinspection OffsetOperationsInspection */ |
12645 | 12644 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
12646 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
12647 | - $buf .= $cc1 . $cc2; |
|
12645 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
12646 | + $buf .= $cc1.$cc2; |
|
12648 | 12647 | } |
12649 | 12648 | |
12650 | 12649 | return $buf; |
@@ -12659,7 +12658,7 @@ discard block |
||
12659 | 12658 | { |
12660 | 12659 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
12661 | 12660 | if (\preg_match($pattern, $str)) { |
12662 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
12661 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
12663 | 12662 | } |
12664 | 12663 | |
12665 | 12664 | return $str; |