@@ -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 | /** |
@@ -1895,7 +1895,7 @@ discard block |
||
1895 | 1895 | */ |
1896 | 1896 | public static function fits_inside(string $str, int $box_size): bool |
1897 | 1897 | { |
1898 | - return (int) self::strlen($str) <= $box_size; |
|
1898 | + return (int)self::strlen($str) <= $box_size; |
|
1899 | 1899 | } |
1900 | 1900 | |
1901 | 1901 | /** |
@@ -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; |
@@ -2439,7 +2439,7 @@ discard block |
||
2439 | 2439 | return \implode( |
2440 | 2440 | '', |
2441 | 2441 | \array_map( |
2442 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2442 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2443 | 2443 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
2444 | 2444 | }, |
2445 | 2445 | self::str_split($str) |
@@ -2546,7 +2546,7 @@ discard block |
||
2546 | 2546 | && |
2547 | 2547 | self::$SUPPORT['mbstring'] === false |
2548 | 2548 | ) { |
2549 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2549 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2550 | 2550 | } |
2551 | 2551 | |
2552 | 2552 | do { |
@@ -2577,7 +2577,7 @@ discard block |
||
2577 | 2577 | if (\strpos($str, '&') !== false) { |
2578 | 2578 | if (\strpos($str, '&#') !== false) { |
2579 | 2579 | // decode also numeric & UTF16 two byte entities |
2580 | - $str = (string) \preg_replace( |
|
2580 | + $str = (string)\preg_replace( |
|
2581 | 2581 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
2582 | 2582 | '$1;', |
2583 | 2583 | $str |
@@ -2623,7 +2623,7 @@ discard block |
||
2623 | 2623 | */ |
2624 | 2624 | public static function html_stripe_empty_tags(string $str): string |
2625 | 2625 | { |
2626 | - return (string) \preg_replace( |
|
2626 | + return (string)\preg_replace( |
|
2627 | 2627 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
2628 | 2628 | '', |
2629 | 2629 | $str |
@@ -2932,9 +2932,9 @@ discard block |
||
2932 | 2932 | { |
2933 | 2933 | $hex = \dechex($int); |
2934 | 2934 | |
2935 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
2935 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
2936 | 2936 | |
2937 | - return $prefix . $hex . ''; |
|
2937 | + return $prefix.$hex.''; |
|
2938 | 2938 | } |
2939 | 2939 | |
2940 | 2940 | /** |
@@ -3192,7 +3192,7 @@ discard block |
||
3192 | 3192 | */ |
3193 | 3193 | public static function is_binary($input, bool $strict = false): bool |
3194 | 3194 | { |
3195 | - $input = (string) $input; |
|
3195 | + $input = (string)$input; |
|
3196 | 3196 | if ($input === '') { |
3197 | 3197 | return false; |
3198 | 3198 | } |
@@ -3455,7 +3455,7 @@ discard block |
||
3455 | 3455 | public static function is_utf16($str, $check_if_string_is_binary = true) |
3456 | 3456 | { |
3457 | 3457 | // init |
3458 | - $str = (string) $str; |
|
3458 | + $str = (string)$str; |
|
3459 | 3459 | $str_chars = []; |
3460 | 3460 | |
3461 | 3461 | if ( |
@@ -3533,7 +3533,7 @@ discard block |
||
3533 | 3533 | public static function is_utf32($str, $check_if_string_is_binary = true) |
3534 | 3534 | { |
3535 | 3535 | // init |
3536 | - $str = (string) $str; |
|
3536 | + $str = (string)$str; |
|
3537 | 3537 | $str_chars = []; |
3538 | 3538 | |
3539 | 3539 | if ( |
@@ -3617,7 +3617,7 @@ discard block |
||
3617 | 3617 | return true; |
3618 | 3618 | } |
3619 | 3619 | |
3620 | - return self::is_utf8_string((string) $str, $strict); |
|
3620 | + return self::is_utf8_string((string)$str, $strict); |
|
3621 | 3621 | } |
3622 | 3622 | |
3623 | 3623 | /** |
@@ -3757,15 +3757,15 @@ discard block |
||
3757 | 3757 | $use_mb_functions = ($lang === null && $try_to_keep_the_string_length === false); |
3758 | 3758 | |
3759 | 3759 | if ($encoding === 'UTF-8') { |
3760 | - $str_part_two = (string) \mb_substr($str, 1); |
|
3760 | + $str_part_two = (string)\mb_substr($str, 1); |
|
3761 | 3761 | |
3762 | 3762 | if ($use_mb_functions === true) { |
3763 | 3763 | $str_part_one = \mb_strtolower( |
3764 | - (string) \mb_substr($str, 0, 1) |
|
3764 | + (string)\mb_substr($str, 0, 1) |
|
3765 | 3765 | ); |
3766 | 3766 | } else { |
3767 | 3767 | $str_part_one = self::strtolower( |
3768 | - (string) \mb_substr($str, 0, 1), |
|
3768 | + (string)\mb_substr($str, 0, 1), |
|
3769 | 3769 | $encoding, |
3770 | 3770 | false, |
3771 | 3771 | $lang, |
@@ -3775,10 +3775,10 @@ discard block |
||
3775 | 3775 | } else { |
3776 | 3776 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
3777 | 3777 | |
3778 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
3778 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
3779 | 3779 | |
3780 | 3780 | $str_part_one = self::strtolower( |
3781 | - (string) self::substr($str, 0, 1, $encoding), |
|
3781 | + (string)self::substr($str, 0, 1, $encoding), |
|
3782 | 3782 | $encoding, |
3783 | 3783 | false, |
3784 | 3784 | $lang, |
@@ -3786,7 +3786,7 @@ discard block |
||
3786 | 3786 | ); |
3787 | 3787 | } |
3788 | 3788 | |
3789 | - return $str_part_one . $str_part_two; |
|
3789 | + return $str_part_one.$str_part_two; |
|
3790 | 3790 | } |
3791 | 3791 | |
3792 | 3792 | /** |
@@ -3905,7 +3905,7 @@ discard block |
||
3905 | 3905 | |
3906 | 3906 | if (self::$SUPPORT['mbstring'] === true) { |
3907 | 3907 | /** @noinspection PhpComposerExtensionStubsInspection */ |
3908 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
3908 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
3909 | 3909 | } |
3910 | 3910 | |
3911 | 3911 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -3946,7 +3946,7 @@ discard block |
||
3946 | 3946 | { |
3947 | 3947 | $bytes = self::chr_size_list($str); |
3948 | 3948 | if (\count($bytes) > 0) { |
3949 | - return (int) \max($bytes); |
|
3949 | + return (int)\max($bytes); |
|
3950 | 3950 | } |
3951 | 3951 | |
3952 | 3952 | return 0; |
@@ -4015,7 +4015,7 @@ discard block |
||
4015 | 4015 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4016 | 4016 | |
4017 | 4017 | // init |
4018 | - $encoding = (string) $encoding; |
|
4018 | + $encoding = (string)$encoding; |
|
4019 | 4019 | |
4020 | 4020 | if (!$encoding) { |
4021 | 4021 | return $fallback; |
@@ -4069,7 +4069,7 @@ discard block |
||
4069 | 4069 | |
4070 | 4070 | $encoding_original = $encoding; |
4071 | 4071 | $encoding = \strtoupper($encoding); |
4072 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4072 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4073 | 4073 | |
4074 | 4074 | $equivalences = [ |
4075 | 4075 | 'ISO8859' => 'ISO-8859-1', |
@@ -4209,13 +4209,13 @@ discard block |
||
4209 | 4209 | static $CHAR_CACHE = []; |
4210 | 4210 | |
4211 | 4211 | // init |
4212 | - $chr = (string) $chr; |
|
4212 | + $chr = (string)$chr; |
|
4213 | 4213 | |
4214 | 4214 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
4215 | 4215 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4216 | 4216 | } |
4217 | 4217 | |
4218 | - $cache_key = $chr . $encoding; |
|
4218 | + $cache_key = $chr.$encoding; |
|
4219 | 4219 | if (isset($CHAR_CACHE[$cache_key]) === true) { |
4220 | 4220 | return $CHAR_CACHE[$cache_key]; |
4221 | 4221 | } |
@@ -4250,7 +4250,7 @@ discard block |
||
4250 | 4250 | // |
4251 | 4251 | |
4252 | 4252 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
4253 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
4253 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
4254 | 4254 | /** @noinspection OffsetOperationsInspection */ |
4255 | 4255 | $code = $chr ? $chr[1] : 0; |
4256 | 4256 | |
@@ -4258,21 +4258,21 @@ discard block |
||
4258 | 4258 | if ($code >= 0xF0 && isset($chr[4])) { |
4259 | 4259 | /** @noinspection UnnecessaryCastingInspection */ |
4260 | 4260 | /** @noinspection OffsetOperationsInspection */ |
4261 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4261 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4262 | 4262 | } |
4263 | 4263 | |
4264 | 4264 | /** @noinspection OffsetOperationsInspection */ |
4265 | 4265 | if ($code >= 0xE0 && isset($chr[3])) { |
4266 | 4266 | /** @noinspection UnnecessaryCastingInspection */ |
4267 | 4267 | /** @noinspection OffsetOperationsInspection */ |
4268 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4268 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4269 | 4269 | } |
4270 | 4270 | |
4271 | 4271 | /** @noinspection OffsetOperationsInspection */ |
4272 | 4272 | if ($code >= 0xC0 && isset($chr[2])) { |
4273 | 4273 | /** @noinspection UnnecessaryCastingInspection */ |
4274 | 4274 | /** @noinspection OffsetOperationsInspection */ |
4275 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4275 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4276 | 4276 | } |
4277 | 4277 | |
4278 | 4278 | return $CHAR_CACHE[$cache_key] = $code; |
@@ -4321,7 +4321,7 @@ discard block |
||
4321 | 4321 | public static function pcre_utf8_support(): bool |
4322 | 4322 | { |
4323 | 4323 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4324 | - return (bool) @\preg_match('//u', ''); |
|
4324 | + return (bool)@\preg_match('//u', ''); |
|
4325 | 4325 | } |
4326 | 4326 | |
4327 | 4327 | /** |
@@ -4353,11 +4353,11 @@ discard block |
||
4353 | 4353 | |
4354 | 4354 | if ($step !== 1) { |
4355 | 4355 | if (!\is_numeric($step)) { |
4356 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
4356 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
4357 | 4357 | } |
4358 | 4358 | |
4359 | 4359 | if ($step <= 0) { |
4360 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
4360 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
4361 | 4361 | } |
4362 | 4362 | } |
4363 | 4363 | |
@@ -4369,14 +4369,14 @@ discard block |
||
4369 | 4369 | $is_xdigit = false; |
4370 | 4370 | |
4371 | 4371 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4372 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
4372 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
4373 | 4373 | $is_digit = true; |
4374 | - $start = (int) $var1; |
|
4374 | + $start = (int)$var1; |
|
4375 | 4375 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
4376 | 4376 | $is_xdigit = true; |
4377 | - $start = (int) self::hex_to_int($var1); |
|
4377 | + $start = (int)self::hex_to_int($var1); |
|
4378 | 4378 | } elseif (!$use_ctype && \is_numeric($var1)) { |
4379 | - $start = (int) $var1; |
|
4379 | + $start = (int)$var1; |
|
4380 | 4380 | } else { |
4381 | 4381 | $start = self::ord($var1); |
4382 | 4382 | } |
@@ -4386,11 +4386,11 @@ discard block |
||
4386 | 4386 | } |
4387 | 4387 | |
4388 | 4388 | if ($is_digit) { |
4389 | - $end = (int) $var2; |
|
4389 | + $end = (int)$var2; |
|
4390 | 4390 | } elseif ($is_xdigit) { |
4391 | - $end = (int) self::hex_to_int($var2); |
|
4391 | + $end = (int)self::hex_to_int($var2); |
|
4392 | 4392 | } elseif (!$use_ctype && \is_numeric($var2)) { |
4393 | - $end = (int) $var2; |
|
4393 | + $end = (int)$var2; |
|
4394 | 4394 | } else { |
4395 | 4395 | $end = self::ord($var2); |
4396 | 4396 | } |
@@ -4401,7 +4401,7 @@ discard block |
||
4401 | 4401 | |
4402 | 4402 | $array = []; |
4403 | 4403 | foreach (\range($start, $end, $step) as $i) { |
4404 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
4404 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
4405 | 4405 | } |
4406 | 4406 | |
4407 | 4407 | return $array; |
@@ -4492,8 +4492,8 @@ discard block |
||
4492 | 4492 | $delimiter = '/'; |
4493 | 4493 | } |
4494 | 4494 | |
4495 | - return (string) \preg_replace( |
|
4496 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4495 | + return (string)\preg_replace( |
|
4496 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4497 | 4497 | $replacement, |
4498 | 4498 | $str |
4499 | 4499 | ); |
@@ -4535,9 +4535,9 @@ discard block |
||
4535 | 4535 | return ''; |
4536 | 4536 | } |
4537 | 4537 | |
4538 | - $str_length -= (int) $bom_byte_length; |
|
4538 | + $str_length -= (int)$bom_byte_length; |
|
4539 | 4539 | |
4540 | - $str = (string) $str_tmp; |
|
4540 | + $str = (string)$str_tmp; |
|
4541 | 4541 | } |
4542 | 4542 | } |
4543 | 4543 | |
@@ -4561,7 +4561,7 @@ discard block |
||
4561 | 4561 | if (\is_array($what) === true) { |
4562 | 4562 | /** @noinspection ForeachSourceInspection */ |
4563 | 4563 | foreach ($what as $item) { |
4564 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/u') . ')+/u', $item, $str); |
|
4564 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/u').')+/u', $item, $str); |
|
4565 | 4565 | } |
4566 | 4566 | } |
4567 | 4567 | |
@@ -4593,7 +4593,7 @@ discard block |
||
4593 | 4593 | */ |
4594 | 4594 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
4595 | 4595 | { |
4596 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4596 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4597 | 4597 | } |
4598 | 4598 | |
4599 | 4599 | /** |
@@ -4637,17 +4637,17 @@ discard block |
||
4637 | 4637 | ): string { |
4638 | 4638 | if ($substring && \strpos($str, $substring) === 0) { |
4639 | 4639 | if ($encoding === 'UTF-8') { |
4640 | - return (string) \mb_substr( |
|
4640 | + return (string)\mb_substr( |
|
4641 | 4641 | $str, |
4642 | - (int) \mb_strlen($substring) |
|
4642 | + (int)\mb_strlen($substring) |
|
4643 | 4643 | ); |
4644 | 4644 | } |
4645 | 4645 | |
4646 | 4646 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4647 | 4647 | |
4648 | - return (string) self::substr( |
|
4648 | + return (string)self::substr( |
|
4649 | 4649 | $str, |
4650 | - (int) self::strlen($substring, $encoding), |
|
4650 | + (int)self::strlen($substring, $encoding), |
|
4651 | 4651 | null, |
4652 | 4652 | $encoding |
4653 | 4653 | ); |
@@ -4672,19 +4672,19 @@ discard block |
||
4672 | 4672 | ): string { |
4673 | 4673 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
4674 | 4674 | if ($encoding === 'UTF-8') { |
4675 | - return (string) \mb_substr( |
|
4675 | + return (string)\mb_substr( |
|
4676 | 4676 | $str, |
4677 | 4677 | 0, |
4678 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
4678 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
4679 | 4679 | ); |
4680 | 4680 | } |
4681 | 4681 | |
4682 | 4682 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4683 | 4683 | |
4684 | - return (string) self::substr( |
|
4684 | + return (string)self::substr( |
|
4685 | 4685 | $str, |
4686 | 4686 | 0, |
4687 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
4687 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
4688 | 4688 | $encoding |
4689 | 4689 | ); |
4690 | 4690 | } |
@@ -4771,7 +4771,7 @@ discard block |
||
4771 | 4771 | $save = \mb_substitute_character(); |
4772 | 4772 | \mb_substitute_character($replacement_char_helper); |
4773 | 4773 | // the polyfill maybe return false, so cast to string |
4774 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4774 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4775 | 4775 | \mb_substitute_character($save); |
4776 | 4776 | } |
4777 | 4777 | |
@@ -4811,7 +4811,7 @@ discard block |
||
4811 | 4811 | |
4812 | 4812 | if (self::$SUPPORT['mbstring'] === true) { |
4813 | 4813 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4814 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4814 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4815 | 4815 | } |
4816 | 4816 | |
4817 | 4817 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -4826,7 +4826,7 @@ discard block |
||
4826 | 4826 | { |
4827 | 4827 | echo '<pre>'; |
4828 | 4828 | foreach (self::$SUPPORT as $key => &$value) { |
4829 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
4829 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
4830 | 4830 | } |
4831 | 4831 | unset($value); |
4832 | 4832 | echo '</pre>'; |
@@ -4858,7 +4858,7 @@ discard block |
||
4858 | 4858 | return $char; |
4859 | 4859 | } |
4860 | 4860 | |
4861 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
4861 | + return '&#'.self::ord($char, $encoding).';'; |
|
4862 | 4862 | } |
4863 | 4863 | |
4864 | 4864 | /** |
@@ -4949,18 +4949,18 @@ discard block |
||
4949 | 4949 | $lang, |
4950 | 4950 | $try_to_keep_the_string_length |
4951 | 4951 | ); |
4952 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
4952 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
4953 | 4953 | |
4954 | 4954 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
4955 | 4955 | |
4956 | - $str = (string) \preg_replace_callback( |
|
4956 | + $str = (string)\preg_replace_callback( |
|
4957 | 4957 | '/[-_\\s]+(.)?/u', |
4958 | 4958 | /** |
4959 | 4959 | * @param array $match |
4960 | 4960 | * |
4961 | 4961 | * @return string |
4962 | 4962 | */ |
4963 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
4963 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
4964 | 4964 | if (isset($match[1])) { |
4965 | 4965 | if ($use_mb_functions === true) { |
4966 | 4966 | if ($encoding === 'UTF-8') { |
@@ -4978,14 +4978,14 @@ discard block |
||
4978 | 4978 | $str |
4979 | 4979 | ); |
4980 | 4980 | |
4981 | - return (string) \preg_replace_callback( |
|
4981 | + return (string)\preg_replace_callback( |
|
4982 | 4982 | '/[\\p{N}]+(.)?/u', |
4983 | 4983 | /** |
4984 | 4984 | * @param array $match |
4985 | 4985 | * |
4986 | 4986 | * @return string |
4987 | 4987 | */ |
4988 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
4988 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
4989 | 4989 | if ($use_mb_functions === true) { |
4990 | 4990 | if ($encoding === 'UTF-8') { |
4991 | 4991 | return \mb_strtoupper($match[0]); |
@@ -5163,7 +5163,7 @@ discard block |
||
5163 | 5163 | ): string { |
5164 | 5164 | if (self::$SUPPORT['mbstring'] === true) { |
5165 | 5165 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5166 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5166 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5167 | 5167 | |
5168 | 5168 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
5169 | 5169 | if ($use_mb_functions === true && $encoding === 'UTF-8') { |
@@ -5173,10 +5173,10 @@ discard block |
||
5173 | 5173 | } |
5174 | 5174 | |
5175 | 5175 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5176 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5176 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5177 | 5177 | } |
5178 | 5178 | |
5179 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5179 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5180 | 5180 | |
5181 | 5181 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
5182 | 5182 | if ($use_mb_functions === true && $encoding === 'UTF-8') { |
@@ -5185,7 +5185,7 @@ discard block |
||
5185 | 5185 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
5186 | 5186 | } |
5187 | 5187 | |
5188 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5188 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5189 | 5189 | } |
5190 | 5190 | |
5191 | 5191 | /** |
@@ -5200,7 +5200,7 @@ discard block |
||
5200 | 5200 | public static function str_detect_encoding($str) |
5201 | 5201 | { |
5202 | 5202 | // init |
5203 | - $str = (string) $str; |
|
5203 | + $str = (string)$str; |
|
5204 | 5204 | |
5205 | 5205 | // |
5206 | 5206 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5302,7 +5302,7 @@ discard block |
||
5302 | 5302 | foreach (self::$ENCODINGS as $encoding_tmp) { |
5303 | 5303 | // INFO: //IGNORE but still throw notice |
5304 | 5304 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5305 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
5305 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
5306 | 5306 | return $encoding_tmp; |
5307 | 5307 | } |
5308 | 5308 | } |
@@ -5390,7 +5390,7 @@ discard block |
||
5390 | 5390 | return $str; |
5391 | 5391 | } |
5392 | 5392 | |
5393 | - return $substring . $str; |
|
5393 | + return $substring.$str; |
|
5394 | 5394 | } |
5395 | 5395 | |
5396 | 5396 | /** |
@@ -5644,27 +5644,27 @@ discard block |
||
5644 | 5644 | string $encoding = 'UTF-8' |
5645 | 5645 | ): string { |
5646 | 5646 | if ($encoding === 'UTF-8') { |
5647 | - $len = (int) \mb_strlen($str); |
|
5647 | + $len = (int)\mb_strlen($str); |
|
5648 | 5648 | if ($index > $len) { |
5649 | 5649 | return $str; |
5650 | 5650 | } |
5651 | 5651 | |
5652 | 5652 | /** @noinspection UnnecessaryCastingInspection */ |
5653 | - return (string) \mb_substr($str, 0, $index) . |
|
5654 | - $substring . |
|
5655 | - (string) \mb_substr($str, $index, $len); |
|
5653 | + return (string)\mb_substr($str, 0, $index). |
|
5654 | + $substring. |
|
5655 | + (string)\mb_substr($str, $index, $len); |
|
5656 | 5656 | } |
5657 | 5657 | |
5658 | 5658 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5659 | 5659 | |
5660 | - $len = (int) self::strlen($str, $encoding); |
|
5660 | + $len = (int)self::strlen($str, $encoding); |
|
5661 | 5661 | if ($index > $len) { |
5662 | 5662 | return $str; |
5663 | 5663 | } |
5664 | 5664 | |
5665 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
5666 | - $substring . |
|
5667 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5665 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
5666 | + $substring. |
|
5667 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
5668 | 5668 | } |
5669 | 5669 | |
5670 | 5670 | /** |
@@ -5694,15 +5694,15 @@ discard block |
||
5694 | 5694 | */ |
5695 | 5695 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
5696 | 5696 | { |
5697 | - $search = (array) $search; |
|
5697 | + $search = (array)$search; |
|
5698 | 5698 | |
5699 | 5699 | /** @noinspection AlterInForeachInspection */ |
5700 | 5700 | foreach ($search as &$s) { |
5701 | - $s = (string) $s; |
|
5701 | + $s = (string)$s; |
|
5702 | 5702 | if ($s === '') { |
5703 | 5703 | $s = '/^(?<=.)$/'; |
5704 | 5704 | } else { |
5705 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5705 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5706 | 5706 | } |
5707 | 5707 | } |
5708 | 5708 | |
@@ -5734,11 +5734,11 @@ discard block |
||
5734 | 5734 | } |
5735 | 5735 | |
5736 | 5736 | if ($search === '') { |
5737 | - return $str . $replacement; |
|
5737 | + return $str.$replacement; |
|
5738 | 5738 | } |
5739 | 5739 | |
5740 | 5740 | if (\stripos($str, $search) === 0) { |
5741 | - return $replacement . \substr($str, \strlen($search)); |
|
5741 | + return $replacement.\substr($str, \strlen($search)); |
|
5742 | 5742 | } |
5743 | 5743 | |
5744 | 5744 | return $str; |
@@ -5766,11 +5766,11 @@ discard block |
||
5766 | 5766 | } |
5767 | 5767 | |
5768 | 5768 | if ($search === '') { |
5769 | - return $str . $replacement; |
|
5769 | + return $str.$replacement; |
|
5770 | 5770 | } |
5771 | 5771 | |
5772 | 5772 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
5773 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
5773 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
5774 | 5774 | } |
5775 | 5775 | |
5776 | 5776 | return $str; |
@@ -5850,15 +5850,15 @@ discard block |
||
5850 | 5850 | } |
5851 | 5851 | |
5852 | 5852 | if ($encoding === 'UTF-8') { |
5853 | - return (string) \mb_substr( |
|
5853 | + return (string)\mb_substr( |
|
5854 | 5854 | $str, |
5855 | - $offset + (int) \mb_strlen($separator) |
|
5855 | + $offset + (int)\mb_strlen($separator) |
|
5856 | 5856 | ); |
5857 | 5857 | } |
5858 | 5858 | |
5859 | - return (string) self::substr( |
|
5859 | + return (string)self::substr( |
|
5860 | 5860 | $str, |
5861 | - $offset + (int) self::strlen($separator, $encoding), |
|
5861 | + $offset + (int)self::strlen($separator, $encoding), |
|
5862 | 5862 | null, |
5863 | 5863 | $encoding |
5864 | 5864 | ); |
@@ -5888,15 +5888,15 @@ discard block |
||
5888 | 5888 | } |
5889 | 5889 | |
5890 | 5890 | if ($encoding === 'UTF-8') { |
5891 | - return (string) \mb_substr( |
|
5891 | + return (string)\mb_substr( |
|
5892 | 5892 | $str, |
5893 | - $offset + (int) self::strlen($separator) |
|
5893 | + $offset + (int)self::strlen($separator) |
|
5894 | 5894 | ); |
5895 | 5895 | } |
5896 | 5896 | |
5897 | - return (string) self::substr( |
|
5897 | + return (string)self::substr( |
|
5898 | 5898 | $str, |
5899 | - $offset + (int) self::strlen($separator, $encoding), |
|
5899 | + $offset + (int)self::strlen($separator, $encoding), |
|
5900 | 5900 | null, |
5901 | 5901 | $encoding |
5902 | 5902 | ); |
@@ -5926,10 +5926,10 @@ discard block |
||
5926 | 5926 | } |
5927 | 5927 | |
5928 | 5928 | if ($encoding === 'UTF-8') { |
5929 | - return (string) \mb_substr($str, 0, $offset); |
|
5929 | + return (string)\mb_substr($str, 0, $offset); |
|
5930 | 5930 | } |
5931 | 5931 | |
5932 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
5932 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
5933 | 5933 | } |
5934 | 5934 | |
5935 | 5935 | /** |
@@ -5956,7 +5956,7 @@ discard block |
||
5956 | 5956 | return ''; |
5957 | 5957 | } |
5958 | 5958 | |
5959 | - return (string) \mb_substr($str, 0, $offset); |
|
5959 | + return (string)\mb_substr($str, 0, $offset); |
|
5960 | 5960 | } |
5961 | 5961 | |
5962 | 5962 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -5964,7 +5964,7 @@ discard block |
||
5964 | 5964 | return ''; |
5965 | 5965 | } |
5966 | 5966 | |
5967 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
5967 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
5968 | 5968 | } |
5969 | 5969 | |
5970 | 5970 | /** |
@@ -6060,12 +6060,12 @@ discard block |
||
6060 | 6060 | } |
6061 | 6061 | |
6062 | 6062 | if ($encoding === 'UTF-8') { |
6063 | - return (string) \mb_substr($str, -$n); |
|
6063 | + return (string)\mb_substr($str, -$n); |
|
6064 | 6064 | } |
6065 | 6065 | |
6066 | 6066 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6067 | 6067 | |
6068 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6068 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6069 | 6069 | } |
6070 | 6070 | |
6071 | 6071 | /** |
@@ -6089,21 +6089,21 @@ discard block |
||
6089 | 6089 | } |
6090 | 6090 | |
6091 | 6091 | if ($encoding === 'UTF-8') { |
6092 | - if ((int) \mb_strlen($str) <= $length) { |
|
6092 | + if ((int)\mb_strlen($str) <= $length) { |
|
6093 | 6093 | return $str; |
6094 | 6094 | } |
6095 | 6095 | |
6096 | 6096 | /** @noinspection UnnecessaryCastingInspection */ |
6097 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
6097 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
6098 | 6098 | } |
6099 | 6099 | |
6100 | 6100 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6101 | 6101 | |
6102 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6102 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6103 | 6103 | return $str; |
6104 | 6104 | } |
6105 | 6105 | |
6106 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
6106 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
6107 | 6107 | } |
6108 | 6108 | |
6109 | 6109 | /** |
@@ -6128,12 +6128,12 @@ discard block |
||
6128 | 6128 | |
6129 | 6129 | if ($encoding === 'UTF-8') { |
6130 | 6130 | /** @noinspection UnnecessaryCastingInspection */ |
6131 | - if ((int) \mb_strlen($str) <= $length) { |
|
6131 | + if ((int)\mb_strlen($str) <= $length) { |
|
6132 | 6132 | return $str; |
6133 | 6133 | } |
6134 | 6134 | |
6135 | 6135 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6136 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6136 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6137 | 6137 | } |
6138 | 6138 | |
6139 | 6139 | $str = \mb_substr($str, 0, $length); |
@@ -6143,22 +6143,22 @@ discard block |
||
6143 | 6143 | $new_str = \implode(' ', $array); |
6144 | 6144 | |
6145 | 6145 | if ($new_str === '') { |
6146 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6146 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6147 | 6147 | } |
6148 | 6148 | } else { |
6149 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6149 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6150 | 6150 | return $str; |
6151 | 6151 | } |
6152 | 6152 | |
6153 | 6153 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6154 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6154 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6155 | 6155 | } |
6156 | 6156 | |
6157 | 6157 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6158 | 6158 | $str = self::substr($str, 0, $length, $encoding); |
6159 | 6159 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6160 | 6160 | if ($str === false) { |
6161 | - return '' . $str_add_on; |
|
6161 | + return ''.$str_add_on; |
|
6162 | 6162 | } |
6163 | 6163 | |
6164 | 6164 | $array = \explode(' ', $str); |
@@ -6166,11 +6166,11 @@ discard block |
||
6166 | 6166 | $new_str = \implode(' ', $array); |
6167 | 6167 | |
6168 | 6168 | if ($new_str === '') { |
6169 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6169 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6170 | 6170 | } |
6171 | 6171 | } |
6172 | 6172 | |
6173 | - return $new_str . $str_add_on; |
|
6173 | + return $new_str.$str_add_on; |
|
6174 | 6174 | } |
6175 | 6175 | |
6176 | 6176 | /** |
@@ -6191,7 +6191,7 @@ discard block |
||
6191 | 6191 | $longest_common_prefix = ''; |
6192 | 6192 | |
6193 | 6193 | if ($encoding === 'UTF-8') { |
6194 | - $max_length = (int) \min( |
|
6194 | + $max_length = (int)\min( |
|
6195 | 6195 | \mb_strlen($str1), |
6196 | 6196 | \mb_strlen($str2) |
6197 | 6197 | ); |
@@ -6212,7 +6212,7 @@ discard block |
||
6212 | 6212 | } else { |
6213 | 6213 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6214 | 6214 | |
6215 | - $max_length = (int) \min( |
|
6215 | + $max_length = (int)\min( |
|
6216 | 6216 | self::strlen($str1, $encoding), |
6217 | 6217 | self::strlen($str2, $encoding) |
6218 | 6218 | ); |
@@ -6258,13 +6258,13 @@ discard block |
||
6258 | 6258 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6259 | 6259 | |
6260 | 6260 | if ($encoding === 'UTF-8') { |
6261 | - $str_length = (int) \mb_strlen($str1); |
|
6262 | - $other_length = (int) \mb_strlen($str2); |
|
6261 | + $str_length = (int)\mb_strlen($str1); |
|
6262 | + $other_length = (int)\mb_strlen($str2); |
|
6263 | 6263 | } else { |
6264 | 6264 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6265 | 6265 | |
6266 | - $str_length = (int) self::strlen($str1, $encoding); |
|
6267 | - $other_length = (int) self::strlen($str2, $encoding); |
|
6266 | + $str_length = (int)self::strlen($str1, $encoding); |
|
6267 | + $other_length = (int)self::strlen($str2, $encoding); |
|
6268 | 6268 | } |
6269 | 6269 | |
6270 | 6270 | // Return if either string is empty |
@@ -6317,10 +6317,10 @@ discard block |
||
6317 | 6317 | } |
6318 | 6318 | |
6319 | 6319 | if ($encoding === 'UTF-8') { |
6320 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
6320 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
6321 | 6321 | } |
6322 | 6322 | |
6323 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
6323 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
6324 | 6324 | } |
6325 | 6325 | |
6326 | 6326 | /** |
@@ -6342,7 +6342,7 @@ discard block |
||
6342 | 6342 | } |
6343 | 6343 | |
6344 | 6344 | if ($encoding === 'UTF-8') { |
6345 | - $max_length = (int) \min( |
|
6345 | + $max_length = (int)\min( |
|
6346 | 6346 | \mb_strlen($str1, $encoding), |
6347 | 6347 | \mb_strlen($str2, $encoding) |
6348 | 6348 | ); |
@@ -6356,7 +6356,7 @@ discard block |
||
6356 | 6356 | && |
6357 | 6357 | $char === \mb_substr($str2, -$i, 1) |
6358 | 6358 | ) { |
6359 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
6359 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
6360 | 6360 | } else { |
6361 | 6361 | break; |
6362 | 6362 | } |
@@ -6364,7 +6364,7 @@ discard block |
||
6364 | 6364 | } else { |
6365 | 6365 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6366 | 6366 | |
6367 | - $max_length = (int) \min( |
|
6367 | + $max_length = (int)\min( |
|
6368 | 6368 | self::strlen($str1, $encoding), |
6369 | 6369 | self::strlen($str2, $encoding) |
6370 | 6370 | ); |
@@ -6378,7 +6378,7 @@ discard block |
||
6378 | 6378 | && |
6379 | 6379 | $char === self::substr($str2, -$i, 1, $encoding) |
6380 | 6380 | ) { |
6381 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
6381 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
6382 | 6382 | } else { |
6383 | 6383 | break; |
6384 | 6384 | } |
@@ -6398,7 +6398,7 @@ discard block |
||
6398 | 6398 | */ |
6399 | 6399 | public static function str_matches_pattern(string $str, string $pattern): bool |
6400 | 6400 | { |
6401 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
6401 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
6402 | 6402 | } |
6403 | 6403 | |
6404 | 6404 | /** |
@@ -6415,7 +6415,7 @@ discard block |
||
6415 | 6415 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
6416 | 6416 | { |
6417 | 6417 | // init |
6418 | - $length = (int) self::strlen($str, $encoding); |
|
6418 | + $length = (int)self::strlen($str, $encoding); |
|
6419 | 6419 | |
6420 | 6420 | if ($offset >= 0) { |
6421 | 6421 | return $length > $offset; |
@@ -6441,7 +6441,7 @@ discard block |
||
6441 | 6441 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
6442 | 6442 | { |
6443 | 6443 | // init |
6444 | - $length = (int) self::strlen($str); |
|
6444 | + $length = (int)self::strlen($str); |
|
6445 | 6445 | |
6446 | 6446 | if ( |
6447 | 6447 | ($index >= 0 && $length <= $index) |
@@ -6480,7 +6480,7 @@ discard block |
||
6480 | 6480 | return $str; |
6481 | 6481 | } |
6482 | 6482 | |
6483 | - if ($pad_type !== (int) $pad_type) { |
|
6483 | + if ($pad_type !== (int)$pad_type) { |
|
6484 | 6484 | if ($pad_type === 'left') { |
6485 | 6485 | $pad_type = \STR_PAD_LEFT; |
6486 | 6486 | } elseif ($pad_type === 'right') { |
@@ -6489,23 +6489,23 @@ discard block |
||
6489 | 6489 | $pad_type = \STR_PAD_BOTH; |
6490 | 6490 | } else { |
6491 | 6491 | throw new \InvalidArgumentException( |
6492 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
6492 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
6493 | 6493 | ); |
6494 | 6494 | } |
6495 | 6495 | } |
6496 | 6496 | |
6497 | 6497 | if ($encoding === 'UTF-8') { |
6498 | - $str_length = (int) \mb_strlen($str); |
|
6498 | + $str_length = (int)\mb_strlen($str); |
|
6499 | 6499 | |
6500 | 6500 | if ($pad_length >= $str_length) { |
6501 | 6501 | switch ($pad_type) { |
6502 | 6502 | case \STR_PAD_LEFT: |
6503 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6503 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6504 | 6504 | |
6505 | 6505 | $diff = ($pad_length - $str_length); |
6506 | 6506 | |
6507 | - $pre = (string) \mb_substr( |
|
6508 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6507 | + $pre = (string)\mb_substr( |
|
6508 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6509 | 6509 | 0, |
6510 | 6510 | $diff |
6511 | 6511 | ); |
@@ -6516,16 +6516,16 @@ discard block |
||
6516 | 6516 | case \STR_PAD_BOTH: |
6517 | 6517 | $diff = ($pad_length - $str_length); |
6518 | 6518 | |
6519 | - $ps_length_left = (int) \floor($diff / 2); |
|
6519 | + $ps_length_left = (int)\floor($diff / 2); |
|
6520 | 6520 | |
6521 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6521 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6522 | 6522 | |
6523 | - $pre = (string) \mb_substr( |
|
6523 | + $pre = (string)\mb_substr( |
|
6524 | 6524 | \str_repeat($pad_string, $ps_length_left), |
6525 | 6525 | 0, |
6526 | 6526 | $ps_length_left |
6527 | 6527 | ); |
6528 | - $post = (string) \mb_substr( |
|
6528 | + $post = (string)\mb_substr( |
|
6529 | 6529 | \str_repeat($pad_string, $ps_length_right), |
6530 | 6530 | 0, |
6531 | 6531 | $ps_length_right |
@@ -6535,19 +6535,19 @@ discard block |
||
6535 | 6535 | |
6536 | 6536 | case \STR_PAD_RIGHT: |
6537 | 6537 | default: |
6538 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6538 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6539 | 6539 | |
6540 | 6540 | $diff = ($pad_length - $str_length); |
6541 | 6541 | |
6542 | - $post = (string) \mb_substr( |
|
6543 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6542 | + $post = (string)\mb_substr( |
|
6543 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6544 | 6544 | 0, |
6545 | 6545 | $diff |
6546 | 6546 | ); |
6547 | 6547 | $pre = ''; |
6548 | 6548 | } |
6549 | 6549 | |
6550 | - return $pre . $str . $post; |
|
6550 | + return $pre.$str.$post; |
|
6551 | 6551 | } |
6552 | 6552 | |
6553 | 6553 | return $str; |
@@ -6555,17 +6555,17 @@ discard block |
||
6555 | 6555 | |
6556 | 6556 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6557 | 6557 | |
6558 | - $str_length = (int) self::strlen($str, $encoding); |
|
6558 | + $str_length = (int)self::strlen($str, $encoding); |
|
6559 | 6559 | |
6560 | 6560 | if ($pad_length >= $str_length) { |
6561 | 6561 | switch ($pad_type) { |
6562 | 6562 | case \STR_PAD_LEFT: |
6563 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6563 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6564 | 6564 | |
6565 | 6565 | $diff = ($pad_length - $str_length); |
6566 | 6566 | |
6567 | - $pre = (string) self::substr( |
|
6568 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6567 | + $pre = (string)self::substr( |
|
6568 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6569 | 6569 | 0, |
6570 | 6570 | $diff, |
6571 | 6571 | $encoding |
@@ -6577,17 +6577,17 @@ discard block |
||
6577 | 6577 | case \STR_PAD_BOTH: |
6578 | 6578 | $diff = ($pad_length - $str_length); |
6579 | 6579 | |
6580 | - $ps_length_left = (int) \floor($diff / 2); |
|
6580 | + $ps_length_left = (int)\floor($diff / 2); |
|
6581 | 6581 | |
6582 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6582 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6583 | 6583 | |
6584 | - $pre = (string) self::substr( |
|
6584 | + $pre = (string)self::substr( |
|
6585 | 6585 | \str_repeat($pad_string, $ps_length_left), |
6586 | 6586 | 0, |
6587 | 6587 | $ps_length_left, |
6588 | 6588 | $encoding |
6589 | 6589 | ); |
6590 | - $post = (string) self::substr( |
|
6590 | + $post = (string)self::substr( |
|
6591 | 6591 | \str_repeat($pad_string, $ps_length_right), |
6592 | 6592 | 0, |
6593 | 6593 | $ps_length_right, |
@@ -6598,12 +6598,12 @@ discard block |
||
6598 | 6598 | |
6599 | 6599 | case \STR_PAD_RIGHT: |
6600 | 6600 | default: |
6601 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6601 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6602 | 6602 | |
6603 | 6603 | $diff = ($pad_length - $str_length); |
6604 | 6604 | |
6605 | - $post = (string) self::substr( |
|
6606 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6605 | + $post = (string)self::substr( |
|
6606 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6607 | 6607 | 0, |
6608 | 6608 | $diff, |
6609 | 6609 | $encoding |
@@ -6611,7 +6611,7 @@ discard block |
||
6611 | 6611 | $pre = ''; |
6612 | 6612 | } |
6613 | 6613 | |
6614 | - return $pre . $str . $post; |
|
6614 | + return $pre.$str.$post; |
|
6615 | 6615 | } |
6616 | 6616 | |
6617 | 6617 | return $str; |
@@ -6791,11 +6791,11 @@ discard block |
||
6791 | 6791 | } |
6792 | 6792 | |
6793 | 6793 | if ($search === '') { |
6794 | - return $str . $replacement; |
|
6794 | + return $str.$replacement; |
|
6795 | 6795 | } |
6796 | 6796 | |
6797 | 6797 | if (\strpos($str, $search) === 0) { |
6798 | - return $replacement . \substr($str, \strlen($search)); |
|
6798 | + return $replacement.\substr($str, \strlen($search)); |
|
6799 | 6799 | } |
6800 | 6800 | |
6801 | 6801 | return $str; |
@@ -6826,11 +6826,11 @@ discard block |
||
6826 | 6826 | } |
6827 | 6827 | |
6828 | 6828 | if ($search === '') { |
6829 | - return $str . $replacement; |
|
6829 | + return $str.$replacement; |
|
6830 | 6830 | } |
6831 | 6831 | |
6832 | 6832 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6833 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6833 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6834 | 6834 | } |
6835 | 6835 | |
6836 | 6836 | return $str; |
@@ -6862,7 +6862,7 @@ discard block |
||
6862 | 6862 | $subject, |
6863 | 6863 | $replace, |
6864 | 6864 | $pos, |
6865 | - (int) self::strlen($search) |
|
6865 | + (int)self::strlen($search) |
|
6866 | 6866 | ); |
6867 | 6867 | } |
6868 | 6868 | |
@@ -6894,7 +6894,7 @@ discard block |
||
6894 | 6894 | $subject, |
6895 | 6895 | $replace, |
6896 | 6896 | $pos, |
6897 | - (int) self::strlen($search) |
|
6897 | + (int)self::strlen($search) |
|
6898 | 6898 | ); |
6899 | 6899 | } |
6900 | 6900 | |
@@ -6914,7 +6914,7 @@ discard block |
||
6914 | 6914 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
6915 | 6915 | { |
6916 | 6916 | if ($encoding === 'UTF-8') { |
6917 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
6917 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
6918 | 6918 | /** @noinspection NonSecureShuffleUsageInspection */ |
6919 | 6919 | \shuffle($indexes); |
6920 | 6920 | |
@@ -6930,7 +6930,7 @@ discard block |
||
6930 | 6930 | } else { |
6931 | 6931 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6932 | 6932 | |
6933 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
6933 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
6934 | 6934 | /** @noinspection NonSecureShuffleUsageInspection */ |
6935 | 6935 | \shuffle($indexes); |
6936 | 6936 | |
@@ -6971,11 +6971,11 @@ discard block |
||
6971 | 6971 | ) { |
6972 | 6972 | if ($encoding === 'UTF-8') { |
6973 | 6973 | if ($end === null) { |
6974 | - $length = (int) \mb_strlen($str); |
|
6974 | + $length = (int)\mb_strlen($str); |
|
6975 | 6975 | } elseif ($end >= 0 && $end <= $start) { |
6976 | 6976 | return ''; |
6977 | 6977 | } elseif ($end < 0) { |
6978 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
6978 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
6979 | 6979 | } else { |
6980 | 6980 | $length = $end - $start; |
6981 | 6981 | } |
@@ -6986,11 +6986,11 @@ discard block |
||
6986 | 6986 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6987 | 6987 | |
6988 | 6988 | if ($end === null) { |
6989 | - $length = (int) self::strlen($str, $encoding); |
|
6989 | + $length = (int)self::strlen($str, $encoding); |
|
6990 | 6990 | } elseif ($end >= 0 && $end <= $start) { |
6991 | 6991 | return ''; |
6992 | 6992 | } elseif ($end < 0) { |
6993 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
6993 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
6994 | 6994 | } else { |
6995 | 6995 | $length = $end - $start; |
6996 | 6996 | } |
@@ -7022,35 +7022,35 @@ discard block |
||
7022 | 7022 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7023 | 7023 | } |
7024 | 7024 | |
7025 | - $str = (string) \preg_replace_callback( |
|
7025 | + $str = (string)\preg_replace_callback( |
|
7026 | 7026 | '/([\\p{N}|\\p{Lu}])/u', |
7027 | 7027 | /** |
7028 | 7028 | * @param string[] $matches |
7029 | 7029 | * |
7030 | 7030 | * @return string |
7031 | 7031 | */ |
7032 | - static function (array $matches) use ($encoding): string { |
|
7032 | + static function(array $matches) use ($encoding): string { |
|
7033 | 7033 | $match = $matches[1]; |
7034 | - $match_int = (int) $match; |
|
7034 | + $match_int = (int)$match; |
|
7035 | 7035 | |
7036 | - if ((string) $match_int === $match) { |
|
7037 | - return '_' . $match . '_'; |
|
7036 | + if ((string)$match_int === $match) { |
|
7037 | + return '_'.$match.'_'; |
|
7038 | 7038 | } |
7039 | 7039 | |
7040 | 7040 | if ($encoding === 'UTF-8') { |
7041 | - return '_' . \mb_strtolower($match); |
|
7041 | + return '_'.\mb_strtolower($match); |
|
7042 | 7042 | } |
7043 | 7043 | |
7044 | - return '_' . self::strtolower($match, $encoding); |
|
7044 | + return '_'.self::strtolower($match, $encoding); |
|
7045 | 7045 | }, |
7046 | 7046 | $str |
7047 | 7047 | ); |
7048 | 7048 | |
7049 | - $str = (string) \preg_replace( |
|
7049 | + $str = (string)\preg_replace( |
|
7050 | 7050 | [ |
7051 | - '/\\s+/u', // convert spaces to "_" |
|
7051 | + '/\\s+/u', // convert spaces to "_" |
|
7052 | 7052 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
7053 | - '/_+/', // remove double "_" |
|
7053 | + '/_+/', // remove double "_" |
|
7054 | 7054 | ], |
7055 | 7055 | [ |
7056 | 7056 | '_', |
@@ -7126,7 +7126,7 @@ discard block |
||
7126 | 7126 | } |
7127 | 7127 | |
7128 | 7128 | // init |
7129 | - $str = (string) $str; |
|
7129 | + $str = (string)$str; |
|
7130 | 7130 | |
7131 | 7131 | if ($str === '') { |
7132 | 7132 | return []; |
@@ -7173,7 +7173,7 @@ discard block |
||
7173 | 7173 | ($str[$i] & "\xE0") === "\xC0" |
7174 | 7174 | ) { |
7175 | 7175 | if (($str[$i + 1] & "\xC0") === "\x80") { |
7176 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
7176 | + $ret[] = $str[$i].$str[$i + 1]; |
|
7177 | 7177 | |
7178 | 7178 | ++$i; |
7179 | 7179 | } |
@@ -7187,7 +7187,7 @@ discard block |
||
7187 | 7187 | && |
7188 | 7188 | ($str[$i + 2] & "\xC0") === "\x80" |
7189 | 7189 | ) { |
7190 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
7190 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
7191 | 7191 | |
7192 | 7192 | $i += 2; |
7193 | 7193 | } |
@@ -7203,7 +7203,7 @@ discard block |
||
7203 | 7203 | && |
7204 | 7204 | ($str[$i + 3] & "\xC0") === "\x80" |
7205 | 7205 | ) { |
7206 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
7206 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
7207 | 7207 | |
7208 | 7208 | $i += 3; |
7209 | 7209 | } |
@@ -7215,7 +7215,7 @@ discard block |
||
7215 | 7215 | $ret = \array_chunk($ret, $length); |
7216 | 7216 | |
7217 | 7217 | return \array_map( |
7218 | - static function (array &$item): string { |
|
7218 | + static function(array &$item): string { |
|
7219 | 7219 | return \implode('', $item); |
7220 | 7220 | }, |
7221 | 7221 | $ret |
@@ -7278,7 +7278,7 @@ discard block |
||
7278 | 7278 | $limit = -1; |
7279 | 7279 | } |
7280 | 7280 | |
7281 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7281 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7282 | 7282 | |
7283 | 7283 | if ($array === false) { |
7284 | 7284 | return []; |
@@ -7362,9 +7362,9 @@ discard block |
||
7362 | 7362 | return ''; |
7363 | 7363 | } |
7364 | 7364 | |
7365 | - return (string) \mb_substr( |
|
7365 | + return (string)\mb_substr( |
|
7366 | 7366 | $str, |
7367 | - $offset + (int) \mb_strlen($separator) |
|
7367 | + $offset + (int)\mb_strlen($separator) |
|
7368 | 7368 | ); |
7369 | 7369 | } |
7370 | 7370 | |
@@ -7373,9 +7373,9 @@ discard block |
||
7373 | 7373 | return ''; |
7374 | 7374 | } |
7375 | 7375 | |
7376 | - return (string) \mb_substr( |
|
7376 | + return (string)\mb_substr( |
|
7377 | 7377 | $str, |
7378 | - $offset + (int) self::strlen($separator, $encoding), |
|
7378 | + $offset + (int)self::strlen($separator, $encoding), |
|
7379 | 7379 | null, |
7380 | 7380 | $encoding |
7381 | 7381 | ); |
@@ -7402,9 +7402,9 @@ discard block |
||
7402 | 7402 | return ''; |
7403 | 7403 | } |
7404 | 7404 | |
7405 | - return (string) \mb_substr( |
|
7405 | + return (string)\mb_substr( |
|
7406 | 7406 | $str, |
7407 | - $offset + (int) \mb_strlen($separator) |
|
7407 | + $offset + (int)\mb_strlen($separator) |
|
7408 | 7408 | ); |
7409 | 7409 | } |
7410 | 7410 | |
@@ -7413,9 +7413,9 @@ discard block |
||
7413 | 7413 | return ''; |
7414 | 7414 | } |
7415 | 7415 | |
7416 | - return (string) self::substr( |
|
7416 | + return (string)self::substr( |
|
7417 | 7417 | $str, |
7418 | - $offset + (int) self::strlen($separator, $encoding), |
|
7418 | + $offset + (int)self::strlen($separator, $encoding), |
|
7419 | 7419 | null, |
7420 | 7420 | $encoding |
7421 | 7421 | ); |
@@ -7445,7 +7445,7 @@ discard block |
||
7445 | 7445 | return ''; |
7446 | 7446 | } |
7447 | 7447 | |
7448 | - return (string) \mb_substr( |
|
7448 | + return (string)\mb_substr( |
|
7449 | 7449 | $str, |
7450 | 7450 | 0, |
7451 | 7451 | $offset |
@@ -7457,7 +7457,7 @@ discard block |
||
7457 | 7457 | return ''; |
7458 | 7458 | } |
7459 | 7459 | |
7460 | - return (string) self::substr( |
|
7460 | + return (string)self::substr( |
|
7461 | 7461 | $str, |
7462 | 7462 | 0, |
7463 | 7463 | $offset, |
@@ -7486,7 +7486,7 @@ discard block |
||
7486 | 7486 | return ''; |
7487 | 7487 | } |
7488 | 7488 | |
7489 | - return (string) \mb_substr( |
|
7489 | + return (string)\mb_substr( |
|
7490 | 7490 | $str, |
7491 | 7491 | 0, |
7492 | 7492 | $offset |
@@ -7500,7 +7500,7 @@ discard block |
||
7500 | 7500 | |
7501 | 7501 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7502 | 7502 | |
7503 | - return (string) self::substr( |
|
7503 | + return (string)self::substr( |
|
7504 | 7504 | $str, |
7505 | 7505 | 0, |
7506 | 7506 | $offset, |
@@ -7608,7 +7608,7 @@ discard block |
||
7608 | 7608 | */ |
7609 | 7609 | public static function str_surround(string $str, string $substring): string |
7610 | 7610 | { |
7611 | - return $substring . $str . $substring; |
|
7611 | + return $substring.$str.$substring; |
|
7612 | 7612 | } |
7613 | 7613 | |
7614 | 7614 | /** |
@@ -7665,9 +7665,9 @@ discard block |
||
7665 | 7665 | $word_define_chars = ''; |
7666 | 7666 | } |
7667 | 7667 | |
7668 | - $str = (string) \preg_replace_callback( |
|
7669 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
7670 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
7668 | + $str = (string)\preg_replace_callback( |
|
7669 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
7670 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
7671 | 7671 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
7672 | 7672 | return $match[0]; |
7673 | 7673 | } |
@@ -7758,16 +7758,16 @@ discard block |
||
7758 | 7758 | } |
7759 | 7759 | |
7760 | 7760 | // the main substitutions |
7761 | - $str = (string) \preg_replace_callback( |
|
7761 | + $str = (string)\preg_replace_callback( |
|
7762 | 7762 | '~\\b (_*) (?: # 1. Leading underscore and |
7763 | 7763 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
7764 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
7764 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
7765 | 7765 | | |
7766 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
7766 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
7767 | 7767 | | |
7768 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
7768 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
7769 | 7769 | | |
7770 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
7770 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
7771 | 7771 | ) (_*) \\b # 6. With trailing underscore |
7772 | 7772 | ~ux', |
7773 | 7773 | /** |
@@ -7775,7 +7775,7 @@ discard block |
||
7775 | 7775 | * |
7776 | 7776 | * @return string |
7777 | 7777 | */ |
7778 | - static function (array $matches) use ($encoding): string { |
|
7778 | + static function(array $matches) use ($encoding): string { |
|
7779 | 7779 | // preserve leading underscore |
7780 | 7780 | $str = $matches[1]; |
7781 | 7781 | if ($matches[2]) { |
@@ -7800,26 +7800,26 @@ discard block |
||
7800 | 7800 | ); |
7801 | 7801 | |
7802 | 7802 | // Exceptions for small words: capitalize at start of title... |
7803 | - $str = (string) \preg_replace_callback( |
|
7803 | + $str = (string)\preg_replace_callback( |
|
7804 | 7804 | '~( \\A [[:punct:]]* # start of title... |
7805 | 7805 | | [:.;?!][ ]+ # or of subsentence... |
7806 | 7806 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
7807 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
7807 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
7808 | 7808 | ~uxi', |
7809 | 7809 | /** |
7810 | 7810 | * @param string[] $matches |
7811 | 7811 | * |
7812 | 7812 | * @return string |
7813 | 7813 | */ |
7814 | - static function (array $matches) use ($encoding): string { |
|
7815 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
7814 | + static function(array $matches) use ($encoding): string { |
|
7815 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
7816 | 7816 | }, |
7817 | 7817 | $str |
7818 | 7818 | ); |
7819 | 7819 | |
7820 | 7820 | // ...and end of title |
7821 | - $str = (string) \preg_replace_callback( |
|
7822 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
7821 | + $str = (string)\preg_replace_callback( |
|
7822 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
7823 | 7823 | (?= [[:punct:]]* \Z # ...at the end of the title... |
7824 | 7824 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
7825 | 7825 | ~uxi', |
@@ -7828,7 +7828,7 @@ discard block |
||
7828 | 7828 | * |
7829 | 7829 | * @return string |
7830 | 7830 | */ |
7831 | - static function (array $matches) use ($encoding): string { |
|
7831 | + static function(array $matches) use ($encoding): string { |
|
7832 | 7832 | return static::ucfirst($matches[1], $encoding); |
7833 | 7833 | }, |
7834 | 7834 | $str |
@@ -7836,10 +7836,10 @@ discard block |
||
7836 | 7836 | |
7837 | 7837 | // Exceptions for small words in hyphenated compound words. |
7838 | 7838 | // e.g. "in-flight" -> In-Flight |
7839 | - $str = (string) \preg_replace_callback( |
|
7839 | + $str = (string)\preg_replace_callback( |
|
7840 | 7840 | '~\\b |
7841 | 7841 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
7842 | - ( ' . $small_words_rx . ' ) |
|
7842 | + ( ' . $small_words_rx.' ) |
|
7843 | 7843 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
7844 | 7844 | ~uxi', |
7845 | 7845 | /** |
@@ -7847,18 +7847,18 @@ discard block |
||
7847 | 7847 | * |
7848 | 7848 | * @return string |
7849 | 7849 | */ |
7850 | - static function (array $matches) use ($encoding): string { |
|
7850 | + static function(array $matches) use ($encoding): string { |
|
7851 | 7851 | return static::ucfirst($matches[1], $encoding); |
7852 | 7852 | }, |
7853 | 7853 | $str |
7854 | 7854 | ); |
7855 | 7855 | |
7856 | 7856 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
7857 | - $str = (string) \preg_replace_callback( |
|
7857 | + $str = (string)\preg_replace_callback( |
|
7858 | 7858 | '~\\b |
7859 | 7859 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
7860 | 7860 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
7861 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
7861 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
7862 | 7862 | (?! - ) # Negative lookahead for another - |
7863 | 7863 | ~uxi', |
7864 | 7864 | /** |
@@ -7866,8 +7866,8 @@ discard block |
||
7866 | 7866 | * |
7867 | 7867 | * @return string |
7868 | 7868 | */ |
7869 | - static function (array $matches) use ($encoding): string { |
|
7870 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
7869 | + static function(array $matches) use ($encoding): string { |
|
7870 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
7871 | 7871 | }, |
7872 | 7872 | $str |
7873 | 7873 | ); |
@@ -7975,7 +7975,7 @@ discard block |
||
7975 | 7975 | ); |
7976 | 7976 | |
7977 | 7977 | foreach ($tmp_return as &$item) { |
7978 | - $item = (string) $item; |
|
7978 | + $item = (string)$item; |
|
7979 | 7979 | } |
7980 | 7980 | |
7981 | 7981 | return $tmp_return; |
@@ -8024,39 +8024,39 @@ discard block |
||
8024 | 8024 | } |
8025 | 8025 | |
8026 | 8026 | if ($encoding === 'UTF-8') { |
8027 | - if ($length >= (int) \mb_strlen($str)) { |
|
8027 | + if ($length >= (int)\mb_strlen($str)) { |
|
8028 | 8028 | return $str; |
8029 | 8029 | } |
8030 | 8030 | |
8031 | 8031 | if ($substring !== '') { |
8032 | - $length -= (int) \mb_strlen($substring); |
|
8032 | + $length -= (int)\mb_strlen($substring); |
|
8033 | 8033 | |
8034 | 8034 | /** @noinspection UnnecessaryCastingInspection */ |
8035 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
8035 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
8036 | 8036 | } |
8037 | 8037 | |
8038 | 8038 | /** @noinspection UnnecessaryCastingInspection */ |
8039 | - return (string) \mb_substr($str, 0, $length); |
|
8039 | + return (string)\mb_substr($str, 0, $length); |
|
8040 | 8040 | } |
8041 | 8041 | |
8042 | 8042 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8043 | 8043 | |
8044 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8044 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8045 | 8045 | return $str; |
8046 | 8046 | } |
8047 | 8047 | |
8048 | 8048 | if ($substring !== '') { |
8049 | - $length -= (int) self::strlen($substring, $encoding); |
|
8049 | + $length -= (int)self::strlen($substring, $encoding); |
|
8050 | 8050 | } |
8051 | 8051 | |
8052 | 8052 | return ( |
8053 | - (string) self::substr( |
|
8053 | + (string)self::substr( |
|
8054 | 8054 | $str, |
8055 | 8055 | 0, |
8056 | 8056 | $length, |
8057 | 8057 | $encoding |
8058 | 8058 | ) |
8059 | - ) . $substring; |
|
8059 | + ).$substring; |
|
8060 | 8060 | } |
8061 | 8061 | |
8062 | 8062 | /** |
@@ -8086,12 +8086,12 @@ discard block |
||
8086 | 8086 | } |
8087 | 8087 | |
8088 | 8088 | if ($encoding === 'UTF-8') { |
8089 | - if ($length >= (int) \mb_strlen($str)) { |
|
8089 | + if ($length >= (int)\mb_strlen($str)) { |
|
8090 | 8090 | return $str; |
8091 | 8091 | } |
8092 | 8092 | |
8093 | 8093 | // need to further trim the string so we can append the substring |
8094 | - $length -= (int) \mb_strlen($substring); |
|
8094 | + $length -= (int)\mb_strlen($substring); |
|
8095 | 8095 | if ($length <= 0) { |
8096 | 8096 | return $substring; |
8097 | 8097 | } |
@@ -8113,18 +8113,18 @@ discard block |
||
8113 | 8113 | || |
8114 | 8114 | ($space_position !== false && $ignore_do_not_split_words_for_one_word === false) |
8115 | 8115 | ) { |
8116 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
8116 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
8117 | 8117 | } |
8118 | 8118 | } |
8119 | 8119 | } else { |
8120 | 8120 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8121 | 8121 | |
8122 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8122 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8123 | 8123 | return $str; |
8124 | 8124 | } |
8125 | 8125 | |
8126 | 8126 | // need to further trim the string so we can append the substring |
8127 | - $length -= (int) self::strlen($substring, $encoding); |
|
8127 | + $length -= (int)self::strlen($substring, $encoding); |
|
8128 | 8128 | if ($length <= 0) { |
8129 | 8129 | return $substring; |
8130 | 8130 | } |
@@ -8146,12 +8146,12 @@ discard block |
||
8146 | 8146 | || |
8147 | 8147 | ($space_position !== false && $ignore_do_not_split_words_for_one_word === false) |
8148 | 8148 | ) { |
8149 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
8149 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
8150 | 8150 | } |
8151 | 8151 | } |
8152 | 8152 | } |
8153 | 8153 | |
8154 | - return $truncated . $substring; |
|
8154 | + return $truncated.$substring; |
|
8155 | 8155 | } |
8156 | 8156 | |
8157 | 8157 | /** |
@@ -8248,13 +8248,13 @@ discard block |
||
8248 | 8248 | } |
8249 | 8249 | } elseif ($format === 2) { |
8250 | 8250 | $number_of_words = []; |
8251 | - $offset = (int) self::strlen($str_parts[0]); |
|
8251 | + $offset = (int)self::strlen($str_parts[0]); |
|
8252 | 8252 | for ($i = 1; $i < $len; $i += 2) { |
8253 | 8253 | $number_of_words[$offset] = $str_parts[$i]; |
8254 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
8254 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
8255 | 8255 | } |
8256 | 8256 | } else { |
8257 | - $number_of_words = (int) (($len - 1) / 2); |
|
8257 | + $number_of_words = (int)(($len - 1) / 2); |
|
8258 | 8258 | } |
8259 | 8259 | |
8260 | 8260 | return $number_of_words; |
@@ -8374,21 +8374,21 @@ discard block |
||
8374 | 8374 | } |
8375 | 8375 | |
8376 | 8376 | if ($char_list === '') { |
8377 | - return (int) self::strlen($str, $encoding); |
|
8377 | + return (int)self::strlen($str, $encoding); |
|
8378 | 8378 | } |
8379 | 8379 | |
8380 | 8380 | if ($offset !== null || $length !== null) { |
8381 | 8381 | if ($encoding === 'UTF-8') { |
8382 | 8382 | if ($length === null) { |
8383 | 8383 | /** @noinspection UnnecessaryCastingInspection */ |
8384 | - $str_tmp = \mb_substr($str, (int) $offset); |
|
8384 | + $str_tmp = \mb_substr($str, (int)$offset); |
|
8385 | 8385 | } else { |
8386 | 8386 | /** @noinspection UnnecessaryCastingInspection */ |
8387 | - $str_tmp = \mb_substr($str, (int) $offset, $length); |
|
8387 | + $str_tmp = \mb_substr($str, (int)$offset, $length); |
|
8388 | 8388 | } |
8389 | 8389 | } else { |
8390 | 8390 | /** @noinspection UnnecessaryCastingInspection */ |
8391 | - $str_tmp = self::substr($str, (int) $offset, $length, $encoding); |
|
8391 | + $str_tmp = self::substr($str, (int)$offset, $length, $encoding); |
|
8392 | 8392 | } |
8393 | 8393 | |
8394 | 8394 | if ($str_tmp === false) { |
@@ -8404,7 +8404,7 @@ discard block |
||
8404 | 8404 | } |
8405 | 8405 | |
8406 | 8406 | $matches = []; |
8407 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
8407 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
8408 | 8408 | $return = self::strlen($matches[1], $encoding); |
8409 | 8409 | if ($return === false) { |
8410 | 8410 | return 0; |
@@ -8413,7 +8413,7 @@ discard block |
||
8413 | 8413 | return $return; |
8414 | 8414 | } |
8415 | 8415 | |
8416 | - return (int) self::strlen($str, $encoding); |
|
8416 | + return (int)self::strlen($str, $encoding); |
|
8417 | 8417 | } |
8418 | 8418 | |
8419 | 8419 | /** |
@@ -8545,7 +8545,7 @@ discard block |
||
8545 | 8545 | return ''; |
8546 | 8546 | } |
8547 | 8547 | |
8548 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
8548 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
8549 | 8549 | } |
8550 | 8550 | |
8551 | 8551 | /** |
@@ -8610,7 +8610,7 @@ discard block |
||
8610 | 8610 | // fallback for ascii only |
8611 | 8611 | // |
8612 | 8612 | |
8613 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
8613 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
8614 | 8614 | return \stripos($haystack, $needle, $offset); |
8615 | 8615 | } |
8616 | 8616 | |
@@ -8678,7 +8678,7 @@ discard block |
||
8678 | 8678 | && |
8679 | 8679 | self::$SUPPORT['mbstring'] === false |
8680 | 8680 | ) { |
8681 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8681 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8682 | 8682 | } |
8683 | 8683 | |
8684 | 8684 | if ( |
@@ -8692,11 +8692,11 @@ discard block |
||
8692 | 8692 | } |
8693 | 8693 | } |
8694 | 8694 | |
8695 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
8695 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
8696 | 8696 | return \stristr($haystack, $needle, $before_needle); |
8697 | 8697 | } |
8698 | 8698 | |
8699 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
8699 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
8700 | 8700 | |
8701 | 8701 | if (!isset($match[1])) { |
8702 | 8702 | return false; |
@@ -8706,7 +8706,7 @@ discard block |
||
8706 | 8706 | return $match[1]; |
8707 | 8707 | } |
8708 | 8708 | |
8709 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
8709 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
8710 | 8710 | } |
8711 | 8711 | |
8712 | 8712 | /** |
@@ -8778,7 +8778,7 @@ discard block |
||
8778 | 8778 | && |
8779 | 8779 | self::$SUPPORT['iconv'] === false |
8780 | 8780 | ) { |
8781 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8781 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8782 | 8782 | } |
8783 | 8783 | |
8784 | 8784 | // |
@@ -8894,8 +8894,8 @@ discard block |
||
8894 | 8894 | } |
8895 | 8895 | |
8896 | 8896 | return \strnatcmp( |
8897 | - (string) self::strtonatfold($str1), |
|
8898 | - (string) self::strtonatfold($str2) |
|
8897 | + (string)self::strtonatfold($str1), |
|
8898 | + (string)self::strtonatfold($str2) |
|
8899 | 8899 | ); |
8900 | 8900 | } |
8901 | 8901 | |
@@ -8953,11 +8953,11 @@ discard block |
||
8953 | 8953 | } |
8954 | 8954 | |
8955 | 8955 | if ($encoding === 'UTF-8') { |
8956 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
8957 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
8956 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
8957 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
8958 | 8958 | } else { |
8959 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
8960 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
8959 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
8960 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
8961 | 8961 | } |
8962 | 8962 | |
8963 | 8963 | return self::strcmp($str1, $str2); |
@@ -8979,8 +8979,8 @@ discard block |
||
8979 | 8979 | return false; |
8980 | 8980 | } |
8981 | 8981 | |
8982 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
8983 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
8982 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
8983 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
8984 | 8984 | } |
8985 | 8985 | |
8986 | 8986 | return false; |
@@ -9013,10 +9013,10 @@ discard block |
||
9013 | 9013 | } |
9014 | 9014 | |
9015 | 9015 | // iconv and mbstring do not support integer $needle |
9016 | - if ((int) $needle === $needle) { |
|
9017 | - $needle = (string) self::chr($needle); |
|
9016 | + if ((int)$needle === $needle) { |
|
9017 | + $needle = (string)self::chr($needle); |
|
9018 | 9018 | } |
9019 | - $needle = (string) $needle; |
|
9019 | + $needle = (string)$needle; |
|
9020 | 9020 | |
9021 | 9021 | if ($needle === '') { |
9022 | 9022 | return false; |
@@ -9063,7 +9063,7 @@ discard block |
||
9063 | 9063 | && |
9064 | 9064 | self::$SUPPORT['mbstring'] === false |
9065 | 9065 | ) { |
9066 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9066 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9067 | 9067 | } |
9068 | 9068 | |
9069 | 9069 | // |
@@ -9104,7 +9104,7 @@ discard block |
||
9104 | 9104 | // fallback for ascii only |
9105 | 9105 | // |
9106 | 9106 | |
9107 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9107 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9108 | 9108 | return \strpos($haystack, $needle, $offset); |
9109 | 9109 | } |
9110 | 9110 | |
@@ -9116,7 +9116,7 @@ discard block |
||
9116 | 9116 | if ($haystack_tmp === false) { |
9117 | 9117 | $haystack_tmp = ''; |
9118 | 9118 | } |
9119 | - $haystack = (string) $haystack_tmp; |
|
9119 | + $haystack = (string)$haystack_tmp; |
|
9120 | 9120 | |
9121 | 9121 | if ($offset < 0) { |
9122 | 9122 | $offset = 0; |
@@ -9128,7 +9128,7 @@ discard block |
||
9128 | 9128 | } |
9129 | 9129 | |
9130 | 9130 | if ($pos) { |
9131 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9131 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9132 | 9132 | } |
9133 | 9133 | |
9134 | 9134 | return $offset + 0; |
@@ -9239,7 +9239,7 @@ discard block |
||
9239 | 9239 | && |
9240 | 9240 | self::$SUPPORT['mbstring'] === false |
9241 | 9241 | ) { |
9242 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9242 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9243 | 9243 | } |
9244 | 9244 | |
9245 | 9245 | // |
@@ -9251,7 +9251,7 @@ discard block |
||
9251 | 9251 | if ($needle_tmp === false) { |
9252 | 9252 | return false; |
9253 | 9253 | } |
9254 | - $needle = (string) $needle_tmp; |
|
9254 | + $needle = (string)$needle_tmp; |
|
9255 | 9255 | |
9256 | 9256 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
9257 | 9257 | if ($pos === false) { |
@@ -9273,7 +9273,7 @@ discard block |
||
9273 | 9273 | if ($needle_tmp === false) { |
9274 | 9274 | return false; |
9275 | 9275 | } |
9276 | - $needle = (string) $needle_tmp; |
|
9276 | + $needle = (string)$needle_tmp; |
|
9277 | 9277 | |
9278 | 9278 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
9279 | 9279 | if ($pos === false) { |
@@ -9309,7 +9309,7 @@ discard block |
||
9309 | 9309 | if ($encoding === 'UTF-8') { |
9310 | 9310 | if (self::$SUPPORT['intl'] === true) { |
9311 | 9311 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
9312 | - $i = (int) \grapheme_strlen($str); |
|
9312 | + $i = (int)\grapheme_strlen($str); |
|
9313 | 9313 | while ($i--) { |
9314 | 9314 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
9315 | 9315 | if ($reversed_tmp !== false) { |
@@ -9317,7 +9317,7 @@ discard block |
||
9317 | 9317 | } |
9318 | 9318 | } |
9319 | 9319 | } else { |
9320 | - $i = (int) \mb_strlen($str); |
|
9320 | + $i = (int)\mb_strlen($str); |
|
9321 | 9321 | while ($i--) { |
9322 | 9322 | $reversed_tmp = \mb_substr($str, $i, 1); |
9323 | 9323 | if ($reversed_tmp !== false) { |
@@ -9328,7 +9328,7 @@ discard block |
||
9328 | 9328 | } else { |
9329 | 9329 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9330 | 9330 | |
9331 | - $i = (int) self::strlen($str, $encoding); |
|
9331 | + $i = (int)self::strlen($str, $encoding); |
|
9332 | 9332 | while ($i--) { |
9333 | 9333 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
9334 | 9334 | if ($reversed_tmp !== false) { |
@@ -9402,7 +9402,7 @@ discard block |
||
9402 | 9402 | if ($needle_tmp === false) { |
9403 | 9403 | return false; |
9404 | 9404 | } |
9405 | - $needle = (string) $needle_tmp; |
|
9405 | + $needle = (string)$needle_tmp; |
|
9406 | 9406 | |
9407 | 9407 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
9408 | 9408 | if ($pos === false) { |
@@ -9441,10 +9441,10 @@ discard block |
||
9441 | 9441 | } |
9442 | 9442 | |
9443 | 9443 | // iconv and mbstring do not support integer $needle |
9444 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9445 | - $needle = (string) self::chr($needle); |
|
9444 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9445 | + $needle = (string)self::chr($needle); |
|
9446 | 9446 | } |
9447 | - $needle = (string) $needle; |
|
9447 | + $needle = (string)$needle; |
|
9448 | 9448 | |
9449 | 9449 | if ($needle === '') { |
9450 | 9450 | return false; |
@@ -9489,7 +9489,7 @@ discard block |
||
9489 | 9489 | && |
9490 | 9490 | self::$SUPPORT['mbstring'] === false |
9491 | 9491 | ) { |
9492 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9492 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9493 | 9493 | } |
9494 | 9494 | |
9495 | 9495 | // |
@@ -9513,7 +9513,7 @@ discard block |
||
9513 | 9513 | // fallback for ascii only |
9514 | 9514 | // |
9515 | 9515 | |
9516 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9516 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9517 | 9517 | return \strripos($haystack, $needle, $offset); |
9518 | 9518 | } |
9519 | 9519 | |
@@ -9590,10 +9590,10 @@ discard block |
||
9590 | 9590 | } |
9591 | 9591 | |
9592 | 9592 | // iconv and mbstring do not support integer $needle |
9593 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9594 | - $needle = (string) self::chr($needle); |
|
9593 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9594 | + $needle = (string)self::chr($needle); |
|
9595 | 9595 | } |
9596 | - $needle = (string) $needle; |
|
9596 | + $needle = (string)$needle; |
|
9597 | 9597 | |
9598 | 9598 | if ($needle === '') { |
9599 | 9599 | return false; |
@@ -9638,7 +9638,7 @@ discard block |
||
9638 | 9638 | && |
9639 | 9639 | self::$SUPPORT['mbstring'] === false |
9640 | 9640 | ) { |
9641 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9641 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9642 | 9642 | } |
9643 | 9643 | |
9644 | 9644 | // |
@@ -9662,7 +9662,7 @@ discard block |
||
9662 | 9662 | // fallback for ascii only |
9663 | 9663 | // |
9664 | 9664 | |
9665 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9665 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9666 | 9666 | return \strrpos($haystack, $needle, $offset); |
9667 | 9667 | } |
9668 | 9668 | |
@@ -9682,7 +9682,7 @@ discard block |
||
9682 | 9682 | if ($haystack_tmp === false) { |
9683 | 9683 | $haystack_tmp = ''; |
9684 | 9684 | } |
9685 | - $haystack = (string) $haystack_tmp; |
|
9685 | + $haystack = (string)$haystack_tmp; |
|
9686 | 9686 | } |
9687 | 9687 | |
9688 | 9688 | $pos = \strrpos($haystack, $needle); |
@@ -9695,7 +9695,7 @@ discard block |
||
9695 | 9695 | return false; |
9696 | 9696 | } |
9697 | 9697 | |
9698 | - return $offset + (int) self::strlen($str_tmp); |
|
9698 | + return $offset + (int)self::strlen($str_tmp); |
|
9699 | 9699 | } |
9700 | 9700 | |
9701 | 9701 | /** |
@@ -9757,12 +9757,12 @@ discard block |
||
9757 | 9757 | if ($offset || $length !== null) { |
9758 | 9758 | if ($encoding === 'UTF-8') { |
9759 | 9759 | if ($length === null) { |
9760 | - $str = (string) \mb_substr($str, $offset); |
|
9760 | + $str = (string)\mb_substr($str, $offset); |
|
9761 | 9761 | } else { |
9762 | - $str = (string) \mb_substr($str, $offset, $length); |
|
9762 | + $str = (string)\mb_substr($str, $offset, $length); |
|
9763 | 9763 | } |
9764 | 9764 | } else { |
9765 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
9765 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
9766 | 9766 | } |
9767 | 9767 | } |
9768 | 9768 | |
@@ -9772,7 +9772,7 @@ discard block |
||
9772 | 9772 | |
9773 | 9773 | $matches = []; |
9774 | 9774 | |
9775 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
9775 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
9776 | 9776 | } |
9777 | 9777 | |
9778 | 9778 | /** |
@@ -9841,7 +9841,7 @@ discard block |
||
9841 | 9841 | && |
9842 | 9842 | self::$SUPPORT['mbstring'] === false |
9843 | 9843 | ) { |
9844 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9844 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9845 | 9845 | } |
9846 | 9846 | |
9847 | 9847 | // |
@@ -9863,7 +9863,7 @@ discard block |
||
9863 | 9863 | // fallback for ascii only |
9864 | 9864 | // |
9865 | 9865 | |
9866 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9866 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9867 | 9867 | return \strstr($haystack, $needle, $before_needle); |
9868 | 9868 | } |
9869 | 9869 | |
@@ -9871,7 +9871,7 @@ discard block |
||
9871 | 9871 | // fallback via vanilla php |
9872 | 9872 | // |
9873 | 9873 | |
9874 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
9874 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
9875 | 9875 | |
9876 | 9876 | if (!isset($match[1])) { |
9877 | 9877 | return false; |
@@ -9881,7 +9881,7 @@ discard block |
||
9881 | 9881 | return $match[1]; |
9882 | 9882 | } |
9883 | 9883 | |
9884 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
9884 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
9885 | 9885 | } |
9886 | 9886 | |
9887 | 9887 | /** |
@@ -9999,7 +9999,7 @@ discard block |
||
9999 | 9999 | bool $try_to_keep_the_string_length = false |
10000 | 10000 | ): string { |
10001 | 10001 | // init |
10002 | - $str = (string) $str; |
|
10002 | + $str = (string)$str; |
|
10003 | 10003 | |
10004 | 10004 | if ($str === '') { |
10005 | 10005 | return ''; |
@@ -10028,19 +10028,19 @@ discard block |
||
10028 | 10028 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10029 | 10029 | } |
10030 | 10030 | |
10031 | - $language_code = $lang . '-Lower'; |
|
10031 | + $language_code = $lang.'-Lower'; |
|
10032 | 10032 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10033 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
10033 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
10034 | 10034 | |
10035 | 10035 | $language_code = 'Any-Lower'; |
10036 | 10036 | } |
10037 | 10037 | |
10038 | 10038 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10039 | 10039 | /** @noinspection UnnecessaryCastingInspection */ |
10040 | - return (string) \transliterator_transliterate($language_code, $str); |
|
10040 | + return (string)\transliterator_transliterate($language_code, $str); |
|
10041 | 10041 | } |
10042 | 10042 | |
10043 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
10043 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
10044 | 10044 | } |
10045 | 10045 | |
10046 | 10046 | // always fallback via symfony polyfill |
@@ -10069,7 +10069,7 @@ discard block |
||
10069 | 10069 | bool $try_to_keep_the_string_length = false |
10070 | 10070 | ): string { |
10071 | 10071 | // init |
10072 | - $str = (string) $str; |
|
10072 | + $str = (string)$str; |
|
10073 | 10073 | |
10074 | 10074 | if ($str === '') { |
10075 | 10075 | return ''; |
@@ -10098,19 +10098,19 @@ discard block |
||
10098 | 10098 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10099 | 10099 | } |
10100 | 10100 | |
10101 | - $language_code = $lang . '-Upper'; |
|
10101 | + $language_code = $lang.'-Upper'; |
|
10102 | 10102 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10103 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
10103 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
10104 | 10104 | |
10105 | 10105 | $language_code = 'Any-Upper'; |
10106 | 10106 | } |
10107 | 10107 | |
10108 | 10108 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10109 | 10109 | /** @noinspection UnnecessaryCastingInspection */ |
10110 | - return (string) \transliterator_transliterate($language_code, $str); |
|
10110 | + return (string)\transliterator_transliterate($language_code, $str); |
|
10111 | 10111 | } |
10112 | 10112 | |
10113 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
10113 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
10114 | 10114 | } |
10115 | 10115 | |
10116 | 10116 | // always fallback via symfony polyfill |
@@ -10155,7 +10155,7 @@ discard block |
||
10155 | 10155 | $from = \array_combine($from, $to); |
10156 | 10156 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
10157 | 10157 | if ($from === false) { |
10158 | - 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) . ')'); |
|
10158 | + 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).')'); |
|
10159 | 10159 | } |
10160 | 10160 | } |
10161 | 10161 | |
@@ -10215,9 +10215,9 @@ discard block |
||
10215 | 10215 | } |
10216 | 10216 | |
10217 | 10217 | $wide = 0; |
10218 | - $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); |
|
10218 | + $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); |
|
10219 | 10219 | |
10220 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
10220 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
10221 | 10221 | } |
10222 | 10222 | |
10223 | 10223 | /** |
@@ -10317,9 +10317,9 @@ discard block |
||
10317 | 10317 | } |
10318 | 10318 | |
10319 | 10319 | if ($length === null) { |
10320 | - $length = (int) $str_length; |
|
10320 | + $length = (int)$str_length; |
|
10321 | 10321 | } else { |
10322 | - $length = (int) $length; |
|
10322 | + $length = (int)$length; |
|
10323 | 10323 | } |
10324 | 10324 | |
10325 | 10325 | if ( |
@@ -10327,7 +10327,7 @@ discard block |
||
10327 | 10327 | && |
10328 | 10328 | self::$SUPPORT['mbstring'] === false |
10329 | 10329 | ) { |
10330 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10330 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10331 | 10331 | } |
10332 | 10332 | |
10333 | 10333 | // |
@@ -10415,16 +10415,16 @@ discard block |
||
10415 | 10415 | ) { |
10416 | 10416 | if ($encoding === 'UTF-8') { |
10417 | 10417 | if ($length === null) { |
10418 | - $str1 = (string) \mb_substr($str1, $offset); |
|
10418 | + $str1 = (string)\mb_substr($str1, $offset); |
|
10419 | 10419 | } else { |
10420 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
10420 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
10421 | 10421 | } |
10422 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
10422 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
10423 | 10423 | } else { |
10424 | 10424 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10425 | 10425 | |
10426 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
10427 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
10426 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
10427 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
10428 | 10428 | } |
10429 | 10429 | } |
10430 | 10430 | |
@@ -10486,13 +10486,13 @@ discard block |
||
10486 | 10486 | if ($length_tmp === false) { |
10487 | 10487 | return false; |
10488 | 10488 | } |
10489 | - $length = (int) $length_tmp; |
|
10489 | + $length = (int)$length_tmp; |
|
10490 | 10490 | } |
10491 | 10491 | |
10492 | 10492 | if ($encoding === 'UTF-8') { |
10493 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
10493 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
10494 | 10494 | } else { |
10495 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
10495 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
10496 | 10496 | } |
10497 | 10497 | } |
10498 | 10498 | |
@@ -10501,7 +10501,7 @@ discard block |
||
10501 | 10501 | && |
10502 | 10502 | self::$SUPPORT['mbstring'] === false |
10503 | 10503 | ) { |
10504 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10504 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10505 | 10505 | } |
10506 | 10506 | |
10507 | 10507 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10512,7 +10512,7 @@ discard block |
||
10512 | 10512 | return \mb_substr_count($haystack, $needle, $encoding); |
10513 | 10513 | } |
10514 | 10514 | |
10515 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10515 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10516 | 10516 | |
10517 | 10517 | return \count($matches); |
10518 | 10518 | } |
@@ -10559,7 +10559,7 @@ discard block |
||
10559 | 10559 | if ($length_tmp === false) { |
10560 | 10560 | return false; |
10561 | 10561 | } |
10562 | - $length = (int) $length_tmp; |
|
10562 | + $length = (int)$length_tmp; |
|
10563 | 10563 | } |
10564 | 10564 | |
10565 | 10565 | if ( |
@@ -10580,7 +10580,7 @@ discard block |
||
10580 | 10580 | if ($haystack_tmp === false) { |
10581 | 10581 | $haystack_tmp = ''; |
10582 | 10582 | } |
10583 | - $haystack = (string) $haystack_tmp; |
|
10583 | + $haystack = (string)$haystack_tmp; |
|
10584 | 10584 | } |
10585 | 10585 | |
10586 | 10586 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10619,10 +10619,10 @@ discard block |
||
10619 | 10619 | |
10620 | 10620 | if ($encoding === 'UTF-8') { |
10621 | 10621 | if ($case_sensitive) { |
10622 | - return (int) \mb_substr_count($str, $substring); |
|
10622 | + return (int)\mb_substr_count($str, $substring); |
|
10623 | 10623 | } |
10624 | 10624 | |
10625 | - return (int) \mb_substr_count( |
|
10625 | + return (int)\mb_substr_count( |
|
10626 | 10626 | \mb_strtoupper($str), |
10627 | 10627 | \mb_strtoupper($substring) |
10628 | 10628 | ); |
@@ -10631,10 +10631,10 @@ discard block |
||
10631 | 10631 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10632 | 10632 | |
10633 | 10633 | if ($case_sensitive) { |
10634 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
10634 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
10635 | 10635 | } |
10636 | 10636 | |
10637 | - return (int) \mb_substr_count( |
|
10637 | + return (int)\mb_substr_count( |
|
10638 | 10638 | self::strtocasefold($str, true, false, $encoding, null, false), |
10639 | 10639 | self::strtocasefold($substring, true, false, $encoding, null, false), |
10640 | 10640 | $encoding |
@@ -10660,7 +10660,7 @@ discard block |
||
10660 | 10660 | } |
10661 | 10661 | |
10662 | 10662 | if (self::str_istarts_with($haystack, $needle) === true) { |
10663 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10663 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10664 | 10664 | } |
10665 | 10665 | |
10666 | 10666 | return $haystack; |
@@ -10717,7 +10717,7 @@ discard block |
||
10717 | 10717 | } |
10718 | 10718 | |
10719 | 10719 | if (self::str_iends_with($haystack, $needle) === true) { |
10720 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
10720 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
10721 | 10721 | } |
10722 | 10722 | |
10723 | 10723 | return $haystack; |
@@ -10742,7 +10742,7 @@ discard block |
||
10742 | 10742 | } |
10743 | 10743 | |
10744 | 10744 | if (self::str_starts_with($haystack, $needle) === true) { |
10745 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10745 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10746 | 10746 | } |
10747 | 10747 | |
10748 | 10748 | return $haystack; |
@@ -10794,7 +10794,7 @@ discard block |
||
10794 | 10794 | if (\is_array($offset) === true) { |
10795 | 10795 | $offset = \array_slice($offset, 0, $num); |
10796 | 10796 | foreach ($offset as &$value_tmp) { |
10797 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
10797 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
10798 | 10798 | } |
10799 | 10799 | unset($value_tmp); |
10800 | 10800 | } else { |
@@ -10807,7 +10807,7 @@ discard block |
||
10807 | 10807 | } elseif (\is_array($length) === true) { |
10808 | 10808 | $length = \array_slice($length, 0, $num); |
10809 | 10809 | foreach ($length as &$value_tmp_V2) { |
10810 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
10810 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
10811 | 10811 | } |
10812 | 10812 | unset($value_tmp_V2); |
10813 | 10813 | } else { |
@@ -10827,8 +10827,8 @@ discard block |
||
10827 | 10827 | } |
10828 | 10828 | |
10829 | 10829 | // init |
10830 | - $str = (string) $str; |
|
10831 | - $replacement = (string) $replacement; |
|
10830 | + $str = (string)$str; |
|
10831 | + $replacement = (string)$replacement; |
|
10832 | 10832 | |
10833 | 10833 | if (\is_array($length) === true) { |
10834 | 10834 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -10843,16 +10843,16 @@ discard block |
||
10843 | 10843 | } |
10844 | 10844 | |
10845 | 10845 | if (self::$SUPPORT['mbstring'] === true) { |
10846 | - $string_length = (int) self::strlen($str, $encoding); |
|
10846 | + $string_length = (int)self::strlen($str, $encoding); |
|
10847 | 10847 | |
10848 | 10848 | if ($offset < 0) { |
10849 | - $offset = (int) \max(0, $string_length + $offset); |
|
10849 | + $offset = (int)\max(0, $string_length + $offset); |
|
10850 | 10850 | } elseif ($offset > $string_length) { |
10851 | 10851 | $offset = $string_length; |
10852 | 10852 | } |
10853 | 10853 | |
10854 | 10854 | if ($length !== null && $length < 0) { |
10855 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
10855 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
10856 | 10856 | } elseif ($length === null || $length > $string_length) { |
10857 | 10857 | $length = $string_length; |
10858 | 10858 | } |
@@ -10863,9 +10863,9 @@ discard block |
||
10863 | 10863 | } |
10864 | 10864 | |
10865 | 10865 | /** @noinspection AdditionOperationOnArraysInspection */ |
10866 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
10867 | - $replacement . |
|
10868 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10866 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
10867 | + $replacement. |
|
10868 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10869 | 10869 | } |
10870 | 10870 | |
10871 | 10871 | // |
@@ -10874,8 +10874,7 @@ discard block |
||
10874 | 10874 | |
10875 | 10875 | if (ASCII::is_ascii($str)) { |
10876 | 10876 | return ($length === null) ? |
10877 | - \substr_replace($str, $replacement, $offset) : |
|
10878 | - \substr_replace($str, $replacement, $offset, $length); |
|
10877 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
10879 | 10878 | } |
10880 | 10879 | |
10881 | 10880 | // |
@@ -10891,7 +10890,7 @@ discard block |
||
10891 | 10890 | // e.g.: non mbstring support + invalid chars |
10892 | 10891 | return ''; |
10893 | 10892 | } |
10894 | - $length = (int) $length_tmp; |
|
10893 | + $length = (int)$length_tmp; |
|
10895 | 10894 | } |
10896 | 10895 | |
10897 | 10896 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -10926,14 +10925,14 @@ discard block |
||
10926 | 10925 | && |
10927 | 10926 | \substr($haystack, -\strlen($needle)) === $needle |
10928 | 10927 | ) { |
10929 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
10928 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
10930 | 10929 | } |
10931 | 10930 | |
10932 | 10931 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
10933 | - return (string) self::substr( |
|
10932 | + return (string)self::substr( |
|
10934 | 10933 | $haystack, |
10935 | 10934 | 0, |
10936 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
10935 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
10937 | 10936 | $encoding |
10938 | 10937 | ); |
10939 | 10938 | } |
@@ -10963,10 +10962,10 @@ discard block |
||
10963 | 10962 | } |
10964 | 10963 | |
10965 | 10964 | if ($encoding === 'UTF-8') { |
10966 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10965 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10967 | 10966 | } |
10968 | 10967 | |
10969 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10968 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10970 | 10969 | } |
10971 | 10970 | |
10972 | 10971 | /** |
@@ -11150,7 +11149,7 @@ discard block |
||
11150 | 11149 | public static function to_boolean($str): bool |
11151 | 11150 | { |
11152 | 11151 | // init |
11153 | - $str = (string) $str; |
|
11152 | + $str = (string)$str; |
|
11154 | 11153 | |
11155 | 11154 | if ($str === '') { |
11156 | 11155 | return false; |
@@ -11178,10 +11177,10 @@ discard block |
||
11178 | 11177 | } |
11179 | 11178 | |
11180 | 11179 | if (\is_numeric($str)) { |
11181 | - return ((float) $str + 0) > 0; |
|
11180 | + return ((float)$str + 0) > 0; |
|
11182 | 11181 | } |
11183 | 11182 | |
11184 | - return (bool) \trim($str); |
|
11183 | + return (bool)\trim($str); |
|
11185 | 11184 | } |
11186 | 11185 | |
11187 | 11186 | /** |
@@ -11223,7 +11222,7 @@ discard block |
||
11223 | 11222 | return $str; |
11224 | 11223 | } |
11225 | 11224 | |
11226 | - $str = (string) $str; |
|
11225 | + $str = (string)$str; |
|
11227 | 11226 | if ($str === '') { |
11228 | 11227 | return ''; |
11229 | 11228 | } |
@@ -11270,7 +11269,7 @@ discard block |
||
11270 | 11269 | return $str; |
11271 | 11270 | } |
11272 | 11271 | |
11273 | - $str = (string) $str; |
|
11272 | + $str = (string)$str; |
|
11274 | 11273 | if ($str === '') { |
11275 | 11274 | return $str; |
11276 | 11275 | } |
@@ -11288,7 +11287,7 @@ discard block |
||
11288 | 11287 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
11289 | 11288 | |
11290 | 11289 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11291 | - $buf .= $c1 . $c2; |
|
11290 | + $buf .= $c1.$c2; |
|
11292 | 11291 | ++$i; |
11293 | 11292 | } else { // not valid UTF8 - convert it |
11294 | 11293 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11299,7 +11298,7 @@ discard block |
||
11299 | 11298 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
11300 | 11299 | |
11301 | 11300 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11302 | - $buf .= $c1 . $c2 . $c3; |
|
11301 | + $buf .= $c1.$c2.$c3; |
|
11303 | 11302 | $i += 2; |
11304 | 11303 | } else { // not valid UTF8 - convert it |
11305 | 11304 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11311,7 +11310,7 @@ discard block |
||
11311 | 11310 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
11312 | 11311 | |
11313 | 11312 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11314 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
11313 | + $buf .= $c1.$c2.$c3.$c4; |
|
11315 | 11314 | $i += 3; |
11316 | 11315 | } else { // not valid UTF8 - convert it |
11317 | 11316 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11337,13 +11336,13 @@ discard block |
||
11337 | 11336 | * |
11338 | 11337 | * @return string |
11339 | 11338 | */ |
11340 | - static function (array $matches): string { |
|
11339 | + static function(array $matches): string { |
|
11341 | 11340 | if (isset($matches[3])) { |
11342 | - $cp = (int) \hexdec($matches[3]); |
|
11341 | + $cp = (int)\hexdec($matches[3]); |
|
11343 | 11342 | } else { |
11344 | 11343 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
11345 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
11346 | - + (int) \hexdec($matches[2]) |
|
11344 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
11345 | + + (int)\hexdec($matches[2]) |
|
11347 | 11346 | + 0x10000 |
11348 | 11347 | - (0xD800 << 10) |
11349 | 11348 | - 0xDC00; |
@@ -11354,12 +11353,12 @@ discard block |
||
11354 | 11353 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
11355 | 11354 | |
11356 | 11355 | if ($cp < 0x80) { |
11357 | - return (string) self::chr($cp); |
|
11356 | + return (string)self::chr($cp); |
|
11358 | 11357 | } |
11359 | 11358 | |
11360 | 11359 | if ($cp < 0xA0) { |
11361 | 11360 | /** @noinspection UnnecessaryCastingInspection */ |
11362 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
11361 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
11363 | 11362 | } |
11364 | 11363 | |
11365 | 11364 | return self::decimal_to_chr($cp); |
@@ -11407,7 +11406,7 @@ discard block |
||
11407 | 11406 | |
11408 | 11407 | if (self::$SUPPORT['mbstring'] === true) { |
11409 | 11408 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11410 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
11409 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
11411 | 11410 | } |
11412 | 11411 | |
11413 | 11412 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -11444,15 +11443,15 @@ discard block |
||
11444 | 11443 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
11445 | 11444 | |
11446 | 11445 | if ($encoding === 'UTF-8') { |
11447 | - $str_part_two = (string) \mb_substr($str, 1); |
|
11446 | + $str_part_two = (string)\mb_substr($str, 1); |
|
11448 | 11447 | |
11449 | 11448 | if ($use_mb_functions === true) { |
11450 | 11449 | $str_part_one = \mb_strtoupper( |
11451 | - (string) \mb_substr($str, 0, 1) |
|
11450 | + (string)\mb_substr($str, 0, 1) |
|
11452 | 11451 | ); |
11453 | 11452 | } else { |
11454 | 11453 | $str_part_one = self::strtoupper( |
11455 | - (string) \mb_substr($str, 0, 1), |
|
11454 | + (string)\mb_substr($str, 0, 1), |
|
11456 | 11455 | $encoding, |
11457 | 11456 | false, |
11458 | 11457 | $lang, |
@@ -11462,16 +11461,16 @@ discard block |
||
11462 | 11461 | } else { |
11463 | 11462 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11464 | 11463 | |
11465 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
11464 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
11466 | 11465 | |
11467 | 11466 | if ($use_mb_functions === true) { |
11468 | 11467 | $str_part_one = \mb_strtoupper( |
11469 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
11468 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
11470 | 11469 | $encoding |
11471 | 11470 | ); |
11472 | 11471 | } else { |
11473 | 11472 | $str_part_one = self::strtoupper( |
11474 | - (string) self::substr($str, 0, 1, $encoding), |
|
11473 | + (string)self::substr($str, 0, 1, $encoding), |
|
11475 | 11474 | $encoding, |
11476 | 11475 | false, |
11477 | 11476 | $lang, |
@@ -11480,7 +11479,7 @@ discard block |
||
11480 | 11479 | } |
11481 | 11480 | } |
11482 | 11481 | |
11483 | - return $str_part_one . $str_part_two; |
|
11482 | + return $str_part_one.$str_part_two; |
|
11484 | 11483 | } |
11485 | 11484 | |
11486 | 11485 | /** |
@@ -11534,7 +11533,7 @@ discard block |
||
11534 | 11533 | $str = self::clean($str); |
11535 | 11534 | } |
11536 | 11535 | |
11537 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
11536 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
11538 | 11537 | |
11539 | 11538 | if ( |
11540 | 11539 | $use_php_default_functions === true |
@@ -11921,7 +11920,7 @@ discard block |
||
11921 | 11920 | if ( |
11922 | 11921 | $keep_utf8_chars === true |
11923 | 11922 | && |
11924 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
11923 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
11925 | 11924 | ) { |
11926 | 11925 | return $str_backup; |
11927 | 11926 | } |
@@ -12000,17 +11999,17 @@ discard block |
||
12000 | 11999 | return ''; |
12001 | 12000 | } |
12002 | 12001 | |
12003 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
12002 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
12004 | 12003 | |
12005 | 12004 | if ( |
12006 | 12005 | !isset($matches[0]) |
12007 | 12006 | || |
12008 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
12007 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
12009 | 12008 | ) { |
12010 | 12009 | return $str; |
12011 | 12010 | } |
12012 | 12011 | |
12013 | - return \rtrim($matches[0]) . $str_add_on; |
|
12012 | + return \rtrim($matches[0]).$str_add_on; |
|
12014 | 12013 | } |
12015 | 12014 | |
12016 | 12015 | /** |
@@ -12097,7 +12096,7 @@ discard block |
||
12097 | 12096 | } |
12098 | 12097 | } |
12099 | 12098 | |
12100 | - return $str_return . \implode('', $chars); |
|
12099 | + return $str_return.\implode('', $chars); |
|
12101 | 12100 | } |
12102 | 12101 | |
12103 | 12102 | /** |
@@ -12149,7 +12148,7 @@ discard block |
||
12149 | 12148 | $final_break = ''; |
12150 | 12149 | } |
12151 | 12150 | |
12152 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
12151 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
12153 | 12152 | } |
12154 | 12153 | |
12155 | 12154 | /** |
@@ -12170,14 +12169,14 @@ discard block |
||
12170 | 12169 | */ |
12171 | 12170 | private static function html_entity_decode_helper(string $str, string $encoding): string |
12172 | 12171 | { |
12173 | - return (string) \preg_replace_callback( |
|
12172 | + return (string)\preg_replace_callback( |
|
12174 | 12173 | "/&#\d{2,6};/", |
12175 | 12174 | /** |
12176 | 12175 | * @param string[] $matches |
12177 | 12176 | * |
12178 | 12177 | * @return string |
12179 | 12178 | */ |
12180 | - static function (array $matches) use ($encoding): string { |
|
12179 | + static function(array $matches) use ($encoding): string { |
|
12181 | 12180 | $return_tmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
12182 | 12181 | if ($return_tmp !== '"' && $return_tmp !== "'") { |
12183 | 12182 | return $return_tmp; |
@@ -12392,7 +12391,7 @@ discard block |
||
12392 | 12391 | /** @noinspection PhpIncludeInspection */ |
12393 | 12392 | /** @noinspection UsingInclusionReturnValueInspection */ |
12394 | 12393 | /** @psalm-suppress UnresolvableInclude */ |
12395 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
12394 | + return include __DIR__.'/data/'.$file.'.php'; |
|
12396 | 12395 | } |
12397 | 12396 | |
12398 | 12397 | /** |
@@ -12407,7 +12406,7 @@ discard block |
||
12407 | 12406 | |
12408 | 12407 | \uksort( |
12409 | 12408 | self::$EMOJI, |
12410 | - static function (string $a, string $b): int { |
|
12409 | + static function(string $a, string $b): int { |
|
12411 | 12410 | return \strlen($b) <=> \strlen($a); |
12412 | 12411 | } |
12413 | 12412 | ); |
@@ -12417,7 +12416,7 @@ discard block |
||
12417 | 12416 | |
12418 | 12417 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
12419 | 12418 | $tmp_key = \crc32($key); |
12420 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
12419 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
12421 | 12420 | } |
12422 | 12421 | |
12423 | 12422 | return true; |
@@ -12441,7 +12440,7 @@ discard block |
||
12441 | 12440 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
12442 | 12441 | return \defined('MB_OVERLOAD_STRING') |
12443 | 12442 | && |
12444 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12443 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12445 | 12444 | } |
12446 | 12445 | |
12447 | 12446 | /** |
@@ -12494,7 +12493,7 @@ discard block |
||
12494 | 12493 | { |
12495 | 12494 | static $RX_CLASS_CACHE = []; |
12496 | 12495 | |
12497 | - $cache_key = $s . $class; |
|
12496 | + $cache_key = $s.$class; |
|
12498 | 12497 | |
12499 | 12498 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
12500 | 12499 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -12506,7 +12505,7 @@ discard block |
||
12506 | 12505 | /** @noinspection AlterInForeachInspection */ |
12507 | 12506 | foreach (self::str_split($s) as &$s) { |
12508 | 12507 | if ($s === '-') { |
12509 | - $class_array[0] = '-' . $class_array[0]; |
|
12508 | + $class_array[0] = '-'.$class_array[0]; |
|
12510 | 12509 | } elseif (!isset($s[2])) { |
12511 | 12510 | $class_array[0] .= \preg_quote($s, '/'); |
12512 | 12511 | } elseif (self::strlen($s) === 1) { |
@@ -12517,13 +12516,13 @@ discard block |
||
12517 | 12516 | } |
12518 | 12517 | |
12519 | 12518 | if ($class_array[0]) { |
12520 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
12519 | + $class_array[0] = '['.$class_array[0].']'; |
|
12521 | 12520 | } |
12522 | 12521 | |
12523 | 12522 | if (\count($class_array) === 1) { |
12524 | 12523 | $return = $class_array[0]; |
12525 | 12524 | } else { |
12526 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
12525 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
12527 | 12526 | } |
12528 | 12527 | |
12529 | 12528 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -12597,7 +12596,7 @@ discard block |
||
12597 | 12596 | |
12598 | 12597 | if ($delimiter === '-') { |
12599 | 12598 | /** @noinspection AlterInForeachInspection */ |
12600 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
12599 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
12601 | 12600 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12602 | 12601 | $continue = true; |
12603 | 12602 | } |
@@ -12605,7 +12604,7 @@ discard block |
||
12605 | 12604 | } |
12606 | 12605 | |
12607 | 12606 | /** @noinspection AlterInForeachInspection */ |
12608 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
12607 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
12609 | 12608 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12610 | 12609 | $continue = true; |
12611 | 12610 | } |
@@ -12666,8 +12665,8 @@ discard block |
||
12666 | 12665 | } else { |
12667 | 12666 | /** @noinspection OffsetOperationsInspection */ |
12668 | 12667 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
12669 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
12670 | - $buf .= $cc1 . $cc2; |
|
12668 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
12669 | + $buf .= $cc1.$cc2; |
|
12671 | 12670 | } |
12672 | 12671 | |
12673 | 12672 | return $buf; |
@@ -12682,7 +12681,7 @@ discard block |
||
12682 | 12681 | { |
12683 | 12682 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
12684 | 12683 | if (\preg_match($pattern, $str)) { |
12685 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
12684 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
12686 | 12685 | } |
12687 | 12686 | |
12688 | 12687 | return $str; |