@@ -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 | ]; |
@@ -602,22 +602,22 @@ discard block |
||
602 | 602 | * @psalm-suppress PossiblyNullArrayAccess |
603 | 603 | */ |
604 | 604 | $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
605 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
605 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
606 | 606 | } elseif ($code_point <= 0xFFFF) { |
607 | 607 | /** |
608 | 608 | * @psalm-suppress PossiblyNullArrayAccess |
609 | 609 | */ |
610 | 610 | $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
611 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
612 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
611 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
612 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
613 | 613 | } else { |
614 | 614 | /** |
615 | 615 | * @psalm-suppress PossiblyNullArrayAccess |
616 | 616 | */ |
617 | 617 | $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
618 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
619 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
620 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
618 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
619 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
620 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
621 | 621 | } |
622 | 622 | |
623 | 623 | if ($encoding !== 'UTF-8') { |
@@ -5804,8 +5804,8 @@ discard block |
||
5804 | 5804 | |
5805 | 5805 | /** @noinspection UnnecessaryCastingInspection */ |
5806 | 5806 | return (string) \mb_substr($str, 0, $index) . |
5807 | - $substring . |
|
5808 | - (string) \mb_substr($str, $index, $len); |
|
5807 | + $substring . |
|
5808 | + (string) \mb_substr($str, $index, $len); |
|
5809 | 5809 | } |
5810 | 5810 | |
5811 | 5811 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -5816,8 +5816,8 @@ discard block |
||
5816 | 5816 | } |
5817 | 5817 | |
5818 | 5818 | return ((string) self::substr($str, 0, $index, $encoding)) . |
5819 | - $substring . |
|
5820 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5819 | + $substring . |
|
5820 | + ((string) self::substr($str, $index, $len, $encoding)); |
|
5821 | 5821 | } |
5822 | 5822 | |
5823 | 5823 | /** |
@@ -7757,11 +7757,11 @@ discard block |
||
7757 | 7757 | if ($useMbFunction === true) { |
7758 | 7758 | if ($encoding === 'UTF-8') { |
7759 | 7759 | return \mb_strtoupper(\mb_substr($match[0], 0, 1)) |
7760 | - . \mb_strtolower(\mb_substr($match[0], 1)); |
|
7760 | + . \mb_strtolower(\mb_substr($match[0], 1)); |
|
7761 | 7761 | } |
7762 | 7762 | |
7763 | 7763 | return \mb_strtoupper(\mb_substr($match[0], 0, 1, $encoding), $encoding) |
7764 | - . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
7764 | + . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
7765 | 7765 | } |
7766 | 7766 | |
7767 | 7767 | return self::ucfirst( |
@@ -8118,13 +8118,13 @@ discard block |
||
8118 | 8118 | } |
8119 | 8119 | |
8120 | 8120 | return ( |
8121 | - (string) self::substr( |
|
8122 | - $str, |
|
8123 | - 0, |
|
8124 | - $length, |
|
8125 | - $encoding |
|
8126 | - ) |
|
8127 | - ) . $substring; |
|
8121 | + (string) self::substr( |
|
8122 | + $str, |
|
8123 | + 0, |
|
8124 | + $length, |
|
8125 | + $encoding |
|
8126 | + ) |
|
8127 | + ) . $substring; |
|
8128 | 8128 | } |
8129 | 8129 | |
8130 | 8130 | /** |
@@ -10864,8 +10864,8 @@ discard block |
||
10864 | 10864 | |
10865 | 10865 | /** @noinspection AdditionOperationOnArraysInspection */ |
10866 | 10866 | return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
10867 | - $replacement . |
|
10868 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10867 | + $replacement . |
|
10868 | + ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10869 | 10869 | } |
10870 | 10870 | |
10871 | 10871 | // |
@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | } |
261 | 261 | |
262 | 262 | if ($encoding === 'UTF-8') { |
263 | - return (string) \mb_substr($str, $pos, 1); |
|
263 | + return (string)\mb_substr($str, $pos, 1); |
|
264 | 264 | } |
265 | 265 | |
266 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
266 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | public static function add_bom_to_string(string $str): string |
279 | 279 | { |
280 | 280 | if (self::string_has_bom($str) === false) { |
281 | - $str = self::bom() . $str; |
|
281 | + $str = self::bom().$str; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | return $str; |
@@ -307,8 +307,8 @@ discard block |
||
307 | 307 | $return = []; |
308 | 308 | foreach ($array as $key => &$value) { |
309 | 309 | $key = $case === \CASE_LOWER |
310 | - ? self::strtolower((string) $key, $encoding) |
|
311 | - : self::strtoupper((string) $key, $encoding); |
|
310 | + ? self::strtolower((string)$key, $encoding) |
|
311 | + : self::strtoupper((string)$key, $encoding); |
|
312 | 312 | |
313 | 313 | $return[$key] = $value; |
314 | 314 | } |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | return ''; |
343 | 343 | } |
344 | 344 | |
345 | - $substrIndex = $posStart + (int) \mb_strlen($start); |
|
345 | + $substrIndex = $posStart + (int)\mb_strlen($start); |
|
346 | 346 | $posEnd = \mb_strpos($str, $end, $substrIndex); |
347 | 347 | if ( |
348 | 348 | $posEnd === false |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | return ''; |
353 | 353 | } |
354 | 354 | |
355 | - return (string) \mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
355 | + return (string)\mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | return ''; |
363 | 363 | } |
364 | 364 | |
365 | - $substrIndex = $posStart + (int) self::strlen($start, $encoding); |
|
365 | + $substrIndex = $posStart + (int)self::strlen($start, $encoding); |
|
366 | 366 | $posEnd = self::strpos($str, $end, $substrIndex, $encoding); |
367 | 367 | if ( |
368 | 368 | $posEnd === false |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | return ''; |
373 | 373 | } |
374 | 374 | |
375 | - return (string) self::substr( |
|
375 | + return (string)self::substr( |
|
376 | 376 | $str, |
377 | 377 | $substrIndex, |
378 | 378 | $posEnd - $substrIndex, |
@@ -440,10 +440,10 @@ discard block |
||
440 | 440 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
441 | 441 | { |
442 | 442 | if ($encoding === 'UTF-8') { |
443 | - return (string) \mb_substr($str, $index, 1); |
|
443 | + return (string)\mb_substr($str, $index, 1); |
|
444 | 444 | } |
445 | 445 | |
446 | - return (string) self::substr($str, $index, 1, $encoding); |
|
446 | + return (string)self::substr($str, $index, 1, $encoding); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
@@ -542,10 +542,10 @@ discard block |
||
542 | 542 | && |
543 | 543 | self::$SUPPORT['mbstring'] === false |
544 | 544 | ) { |
545 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
545 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
546 | 546 | } |
547 | 547 | |
548 | - $cacheKey = $code_point . $encoding; |
|
548 | + $cacheKey = $code_point.$encoding; |
|
549 | 549 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
550 | 550 | return $CHAR_CACHE[$cacheKey]; |
551 | 551 | } |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | if ($code_point <= 127) { // use "simple"-char only until "\x80" |
554 | 554 | |
555 | 555 | if (self::$CHR === null) { |
556 | - self::$CHR = (array) self::getData('chr'); |
|
556 | + self::$CHR = (array)self::getData('chr'); |
|
557 | 557 | } |
558 | 558 | |
559 | 559 | /** |
@@ -588,10 +588,10 @@ discard block |
||
588 | 588 | // |
589 | 589 | |
590 | 590 | if (self::$CHR === null) { |
591 | - self::$CHR = (array) self::getData('chr'); |
|
591 | + self::$CHR = (array)self::getData('chr'); |
|
592 | 592 | } |
593 | 593 | |
594 | - $code_point = (int) $code_point; |
|
594 | + $code_point = (int)$code_point; |
|
595 | 595 | if ($code_point <= 0x7F) { |
596 | 596 | /** |
597 | 597 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -601,22 +601,22 @@ discard block |
||
601 | 601 | /** |
602 | 602 | * @psalm-suppress PossiblyNullArrayAccess |
603 | 603 | */ |
604 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
604 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
605 | 605 | self::$CHR[($code_point & 0x3F) + 0x80]; |
606 | 606 | } elseif ($code_point <= 0xFFFF) { |
607 | 607 | /** |
608 | 608 | * @psalm-suppress PossiblyNullArrayAccess |
609 | 609 | */ |
610 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
611 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
610 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
611 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
612 | 612 | self::$CHR[($code_point & 0x3F) + 0x80]; |
613 | 613 | } else { |
614 | 614 | /** |
615 | 615 | * @psalm-suppress PossiblyNullArrayAccess |
616 | 616 | */ |
617 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
618 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
619 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
617 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
618 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
619 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
620 | 620 | self::$CHR[($code_point & 0x3F) + 0x80]; |
621 | 621 | } |
622 | 622 | |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | |
664 | 664 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
665 | 665 | return \array_map( |
666 | - static function (string $data): int { |
|
666 | + static function(string $data): int { |
|
667 | 667 | // "mb_" is available if overload is used, so use it ... |
668 | 668 | return \mb_strlen($data, 'CP850'); // 8-BIT |
669 | 669 | }, |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | $char = ''; |
732 | 732 | } |
733 | 733 | |
734 | - return self::int_to_hex(self::ord((string) $char), $pfix); |
|
734 | + return self::int_to_hex(self::ord((string)$char), $pfix); |
|
735 | 735 | } |
736 | 736 | |
737 | 737 | /** |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | | ( [\x80-\xBF] ) # invalid byte in range 10000000 - 10111111 |
806 | 806 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
807 | 807 | /x'; |
808 | - $str = (string) \preg_replace($regx, '$1', $str); |
|
808 | + $str = (string)\preg_replace($regx, '$1', $str); |
|
809 | 809 | |
810 | 810 | if ($replace_diamond_question_mark === true) { |
811 | 811 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | public static function cleanup($str): string |
841 | 841 | { |
842 | 842 | // init |
843 | - $str = (string) $str; |
|
843 | + $str = (string)$str; |
|
844 | 844 | |
845 | 845 | if ($str === '') { |
846 | 846 | return ''; |
@@ -923,7 +923,7 @@ discard block |
||
923 | 923 | { |
924 | 924 | if (self::$SUPPORT['mbstring'] === true) { |
925 | 925 | /** @noinspection PhpComposerExtensionStubsInspection */ |
926 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
926 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
927 | 927 | } |
928 | 928 | |
929 | 929 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | */ |
964 | 964 | public static function css_stripe_media_queries(string $str): string |
965 | 965 | { |
966 | - return (string) \preg_replace( |
|
966 | + return (string)\preg_replace( |
|
967 | 967 | '#@media\\s+(?:only\\s)?(?:[\\s{\\(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
968 | 968 | '', |
969 | 969 | $str |
@@ -990,7 +990,7 @@ discard block |
||
990 | 990 | */ |
991 | 991 | public static function decimal_to_chr($int): string |
992 | 992 | { |
993 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
993 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
994 | 994 | } |
995 | 995 | |
996 | 996 | /** |
@@ -1035,16 +1035,16 @@ discard block |
||
1035 | 1035 | self::initEmojiData(); |
1036 | 1036 | |
1037 | 1037 | if ($useReversibleStringMapping === true) { |
1038 | - return (string) \str_replace( |
|
1039 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1040 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1038 | + return (string)\str_replace( |
|
1039 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1040 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1041 | 1041 | $str |
1042 | 1042 | ); |
1043 | 1043 | } |
1044 | 1044 | |
1045 | - return (string) \str_replace( |
|
1046 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1047 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1045 | + return (string)\str_replace( |
|
1046 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1047 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1048 | 1048 | $str |
1049 | 1049 | ); |
1050 | 1050 | } |
@@ -1064,16 +1064,16 @@ discard block |
||
1064 | 1064 | self::initEmojiData(); |
1065 | 1065 | |
1066 | 1066 | if ($useReversibleStringMapping === true) { |
1067 | - return (string) \str_replace( |
|
1068 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1069 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1067 | + return (string)\str_replace( |
|
1068 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1069 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1070 | 1070 | $str |
1071 | 1071 | ); |
1072 | 1072 | } |
1073 | 1073 | |
1074 | - return (string) \str_replace( |
|
1075 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1076 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1074 | + return (string)\str_replace( |
|
1075 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1076 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1077 | 1077 | $str |
1078 | 1078 | ); |
1079 | 1079 | } |
@@ -1127,7 +1127,7 @@ discard block |
||
1127 | 1127 | if ($toEncoding === 'JSON') { |
1128 | 1128 | $return = self::json_encode($str); |
1129 | 1129 | if ($return === false) { |
1130 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1130 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1131 | 1131 | } |
1132 | 1132 | |
1133 | 1133 | return $return; |
@@ -1213,7 +1213,7 @@ discard block |
||
1213 | 1213 | && |
1214 | 1214 | self::$SUPPORT['mbstring'] === false |
1215 | 1215 | ) { |
1216 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $toEncoding . '" encoding', \E_USER_WARNING); |
|
1216 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$toEncoding.'" encoding', \E_USER_WARNING); |
|
1217 | 1217 | } |
1218 | 1218 | |
1219 | 1219 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1307,31 +1307,31 @@ discard block |
||
1307 | 1307 | $trimChars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1308 | 1308 | |
1309 | 1309 | if ($length === null) { |
1310 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
1310 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
1311 | 1311 | } |
1312 | 1312 | |
1313 | 1313 | if ($search === '') { |
1314 | 1314 | if ($encoding === 'UTF-8') { |
1315 | 1315 | if ($length > 0) { |
1316 | - $stringLength = (int) \mb_strlen($str); |
|
1316 | + $stringLength = (int)\mb_strlen($str); |
|
1317 | 1317 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
1318 | 1318 | } else { |
1319 | 1319 | $end = 0; |
1320 | 1320 | } |
1321 | 1321 | |
1322 | - $pos = (int) \min( |
|
1322 | + $pos = (int)\min( |
|
1323 | 1323 | \mb_strpos($str, ' ', $end), |
1324 | 1324 | \mb_strpos($str, '.', $end) |
1325 | 1325 | ); |
1326 | 1326 | } else { |
1327 | 1327 | if ($length > 0) { |
1328 | - $stringLength = (int) self::strlen($str, $encoding); |
|
1328 | + $stringLength = (int)self::strlen($str, $encoding); |
|
1329 | 1329 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
1330 | 1330 | } else { |
1331 | 1331 | $end = 0; |
1332 | 1332 | } |
1333 | 1333 | |
1334 | - $pos = (int) \min( |
|
1334 | + $pos = (int)\min( |
|
1335 | 1335 | self::strpos($str, ' ', $end, $encoding), |
1336 | 1336 | self::strpos($str, '.', $end, $encoding) |
1337 | 1337 | ); |
@@ -1348,18 +1348,18 @@ discard block |
||
1348 | 1348 | return ''; |
1349 | 1349 | } |
1350 | 1350 | |
1351 | - return \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1351 | + return \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1352 | 1352 | } |
1353 | 1353 | |
1354 | 1354 | return $str; |
1355 | 1355 | } |
1356 | 1356 | |
1357 | 1357 | if ($encoding === 'UTF-8') { |
1358 | - $wordPos = (int) \mb_stripos($str, $search); |
|
1359 | - $halfSide = (int) ($wordPos - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1358 | + $wordPos = (int)\mb_stripos($str, $search); |
|
1359 | + $halfSide = (int)($wordPos - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1360 | 1360 | } else { |
1361 | - $wordPos = (int) self::stripos($str, $search, 0, $encoding); |
|
1362 | - $halfSide = (int) ($wordPos - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1361 | + $wordPos = (int)self::stripos($str, $search, 0, $encoding); |
|
1362 | + $halfSide = (int)($wordPos - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1363 | 1363 | } |
1364 | 1364 | |
1365 | 1365 | $pos_start = 0; |
@@ -1371,12 +1371,12 @@ discard block |
||
1371 | 1371 | } |
1372 | 1372 | if ($halfText !== false) { |
1373 | 1373 | if ($encoding === 'UTF-8') { |
1374 | - $pos_start = (int) \max( |
|
1374 | + $pos_start = (int)\max( |
|
1375 | 1375 | \mb_strrpos($halfText, ' '), |
1376 | 1376 | \mb_strrpos($halfText, '.') |
1377 | 1377 | ); |
1378 | 1378 | } else { |
1379 | - $pos_start = (int) \max( |
|
1379 | + $pos_start = (int)\max( |
|
1380 | 1380 | self::strrpos($halfText, ' ', 0, $encoding), |
1381 | 1381 | self::strrpos($halfText, '.', 0, $encoding) |
1382 | 1382 | ); |
@@ -1386,19 +1386,19 @@ discard block |
||
1386 | 1386 | |
1387 | 1387 | if ($wordPos && $halfSide > 0) { |
1388 | 1388 | $offset = $pos_start + $length - 1; |
1389 | - $realLength = (int) self::strlen($str, $encoding); |
|
1389 | + $realLength = (int)self::strlen($str, $encoding); |
|
1390 | 1390 | |
1391 | 1391 | if ($offset > $realLength) { |
1392 | 1392 | $offset = $realLength; |
1393 | 1393 | } |
1394 | 1394 | |
1395 | 1395 | if ($encoding === 'UTF-8') { |
1396 | - $pos_end = (int) \min( |
|
1396 | + $pos_end = (int)\min( |
|
1397 | 1397 | \mb_strpos($str, ' ', $offset), |
1398 | 1398 | \mb_strpos($str, '.', $offset) |
1399 | 1399 | ) - $pos_start; |
1400 | 1400 | } else { |
1401 | - $pos_end = (int) \min( |
|
1401 | + $pos_end = (int)\min( |
|
1402 | 1402 | self::strpos($str, ' ', $offset, $encoding), |
1403 | 1403 | self::strpos($str, '.', $offset, $encoding) |
1404 | 1404 | ) - $pos_start; |
@@ -1406,12 +1406,12 @@ discard block |
||
1406 | 1406 | |
1407 | 1407 | if (!$pos_end || $pos_end <= 0) { |
1408 | 1408 | if ($encoding === 'UTF-8') { |
1409 | - $strSub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1409 | + $strSub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1410 | 1410 | } else { |
1411 | - $strSub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1411 | + $strSub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1412 | 1412 | } |
1413 | 1413 | if ($strSub !== false) { |
1414 | - $extract = $replacerForSkippedText . \ltrim($strSub, $trimChars); |
|
1414 | + $extract = $replacerForSkippedText.\ltrim($strSub, $trimChars); |
|
1415 | 1415 | } else { |
1416 | 1416 | $extract = ''; |
1417 | 1417 | } |
@@ -1422,26 +1422,26 @@ discard block |
||
1422 | 1422 | $strSub = self::substr($str, $pos_start, $pos_end, $encoding); |
1423 | 1423 | } |
1424 | 1424 | if ($strSub !== false) { |
1425 | - $extract = $replacerForSkippedText . \trim($strSub, $trimChars) . $replacerForSkippedText; |
|
1425 | + $extract = $replacerForSkippedText.\trim($strSub, $trimChars).$replacerForSkippedText; |
|
1426 | 1426 | } else { |
1427 | 1427 | $extract = ''; |
1428 | 1428 | } |
1429 | 1429 | } |
1430 | 1430 | } else { |
1431 | 1431 | $offset = $length - 1; |
1432 | - $trueLength = (int) self::strlen($str, $encoding); |
|
1432 | + $trueLength = (int)self::strlen($str, $encoding); |
|
1433 | 1433 | |
1434 | 1434 | if ($offset > $trueLength) { |
1435 | 1435 | $offset = $trueLength; |
1436 | 1436 | } |
1437 | 1437 | |
1438 | 1438 | if ($encoding === 'UTF-8') { |
1439 | - $pos_end = (int) \min( |
|
1439 | + $pos_end = (int)\min( |
|
1440 | 1440 | \mb_strpos($str, ' ', $offset), |
1441 | 1441 | \mb_strpos($str, '.', $offset) |
1442 | 1442 | ); |
1443 | 1443 | } else { |
1444 | - $pos_end = (int) \min( |
|
1444 | + $pos_end = (int)\min( |
|
1445 | 1445 | self::strpos($str, ' ', $offset, $encoding), |
1446 | 1446 | self::strpos($str, '.', $offset, $encoding) |
1447 | 1447 | ); |
@@ -1454,7 +1454,7 @@ discard block |
||
1454 | 1454 | $strSub = self::substr($str, 0, $pos_end, $encoding); |
1455 | 1455 | } |
1456 | 1456 | if ($strSub !== false) { |
1457 | - $extract = \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1457 | + $extract = \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1458 | 1458 | } else { |
1459 | 1459 | $extract = ''; |
1460 | 1460 | } |
@@ -1578,7 +1578,7 @@ discard block |
||
1578 | 1578 | { |
1579 | 1579 | $file_content = \file_get_contents($file_path); |
1580 | 1580 | if ($file_content === false) { |
1581 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1581 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1582 | 1582 | } |
1583 | 1583 | |
1584 | 1584 | return self::string_has_bom($file_content); |
@@ -1639,7 +1639,7 @@ discard block |
||
1639 | 1639 | ) { |
1640 | 1640 | // Prevent leading combining chars |
1641 | 1641 | // for NFC-safe concatenations. |
1642 | - $var = $leading_combining . $var; |
|
1642 | + $var = $leading_combining.$var; |
|
1643 | 1643 | } |
1644 | 1644 | } |
1645 | 1645 | |
@@ -1878,10 +1878,10 @@ discard block |
||
1878 | 1878 | } |
1879 | 1879 | |
1880 | 1880 | if ($encoding === 'UTF-8') { |
1881 | - return (string) \mb_substr($str, 0, $n); |
|
1881 | + return (string)\mb_substr($str, 0, $n); |
|
1882 | 1882 | } |
1883 | 1883 | |
1884 | - return (string) self::substr($str, 0, $n, $encoding); |
|
1884 | + return (string)self::substr($str, 0, $n, $encoding); |
|
1885 | 1885 | } |
1886 | 1886 | |
1887 | 1887 | /** |
@@ -1956,7 +1956,7 @@ discard block |
||
1956 | 1956 | return $str; |
1957 | 1957 | } |
1958 | 1958 | |
1959 | - $str = (string) $str; |
|
1959 | + $str = (string)$str; |
|
1960 | 1960 | $last = ''; |
1961 | 1961 | while ($last !== $str) { |
1962 | 1962 | $last = $str; |
@@ -2144,7 +2144,7 @@ discard block |
||
2144 | 2144 | if ($str_info === false) { |
2145 | 2145 | return $fallback; |
2146 | 2146 | } |
2147 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2147 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2148 | 2148 | |
2149 | 2149 | // DEBUG |
2150 | 2150 | //var_dump($type_code); |
@@ -2239,7 +2239,7 @@ discard block |
||
2239 | 2239 | // |
2240 | 2240 | |
2241 | 2241 | if ($encoding === 'UTF-8') { |
2242 | - $maxlength = (int) \mb_strlen($possibleChars); |
|
2242 | + $maxlength = (int)\mb_strlen($possibleChars); |
|
2243 | 2243 | if ($maxlength === 0) { |
2244 | 2244 | return ''; |
2245 | 2245 | } |
@@ -2260,7 +2260,7 @@ discard block |
||
2260 | 2260 | } else { |
2261 | 2261 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2262 | 2262 | |
2263 | - $maxlength = (int) self::strlen($possibleChars, $encoding); |
|
2263 | + $maxlength = (int)self::strlen($possibleChars, $encoding); |
|
2264 | 2264 | if ($maxlength === 0) { |
2265 | 2265 | return ''; |
2266 | 2266 | } |
@@ -2291,16 +2291,16 @@ discard block |
||
2291 | 2291 | */ |
2292 | 2292 | public static function get_unique_string($entropyExtra = '', bool $md5 = true): string |
2293 | 2293 | { |
2294 | - $uniqueHelper = \random_int(0, \mt_getrandmax()) . |
|
2295 | - \session_id() . |
|
2296 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2297 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2294 | + $uniqueHelper = \random_int(0, \mt_getrandmax()). |
|
2295 | + \session_id(). |
|
2296 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2297 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2298 | 2298 | $entropyExtra; |
2299 | 2299 | |
2300 | 2300 | $uniqueString = \uniqid($uniqueHelper, true); |
2301 | 2301 | |
2302 | 2302 | if ($md5) { |
2303 | - $uniqueString = \md5($uniqueString . $uniqueHelper); |
|
2303 | + $uniqueString = \md5($uniqueString.$uniqueHelper); |
|
2304 | 2304 | } |
2305 | 2305 | |
2306 | 2306 | return $uniqueString; |
@@ -2379,7 +2379,7 @@ discard block |
||
2379 | 2379 | public static function hex_to_int($hexDec) |
2380 | 2380 | { |
2381 | 2381 | // init |
2382 | - $hexDec = (string) $hexDec; |
|
2382 | + $hexDec = (string)$hexDec; |
|
2383 | 2383 | |
2384 | 2384 | if ($hexDec === '') { |
2385 | 2385 | return false; |
@@ -2457,7 +2457,7 @@ discard block |
||
2457 | 2457 | return \implode( |
2458 | 2458 | '', |
2459 | 2459 | \array_map( |
2460 | - static function (string $chr) use ($keepAsciiChars, $encoding): string { |
|
2460 | + static function(string $chr) use ($keepAsciiChars, $encoding): string { |
|
2461 | 2461 | return self::single_chr_html_encode($chr, $keepAsciiChars, $encoding); |
2462 | 2462 | }, |
2463 | 2463 | self::str_split($str) |
@@ -2561,7 +2561,7 @@ discard block |
||
2561 | 2561 | && |
2562 | 2562 | self::$SUPPORT['mbstring'] === false |
2563 | 2563 | ) { |
2564 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2564 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2565 | 2565 | } |
2566 | 2566 | |
2567 | 2567 | do { |
@@ -2582,14 +2582,14 @@ discard block |
||
2582 | 2582 | ); |
2583 | 2583 | } |
2584 | 2584 | } else { |
2585 | - $str = (string) \preg_replace_callback( |
|
2585 | + $str = (string)\preg_replace_callback( |
|
2586 | 2586 | "/&#\d{2,6};/", |
2587 | 2587 | /** |
2588 | 2588 | * @param string[] $matches |
2589 | 2589 | * |
2590 | 2590 | * @return string |
2591 | 2591 | */ |
2592 | - static function (array $matches) use ($encoding): string { |
|
2592 | + static function(array $matches) use ($encoding): string { |
|
2593 | 2593 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
2594 | 2594 | if ($returnTmp !== '"' && $returnTmp !== "'") { |
2595 | 2595 | return $returnTmp; |
@@ -2604,7 +2604,7 @@ discard block |
||
2604 | 2604 | if (\strpos($str, '&') !== false) { |
2605 | 2605 | if (\strpos($str, '&#') !== false) { |
2606 | 2606 | // decode also numeric & UTF16 two byte entities |
2607 | - $str = (string) \preg_replace( |
|
2607 | + $str = (string)\preg_replace( |
|
2608 | 2608 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
2609 | 2609 | '$1;', |
2610 | 2610 | $str |
@@ -2650,7 +2650,7 @@ discard block |
||
2650 | 2650 | */ |
2651 | 2651 | public static function html_stripe_empty_tags(string $str): string |
2652 | 2652 | { |
2653 | - return (string) \preg_replace( |
|
2653 | + return (string)\preg_replace( |
|
2654 | 2654 | "/<[^\/>]*>(([\s]?)*|)<\/[^>]*>/u", |
2655 | 2655 | '', |
2656 | 2656 | $str |
@@ -2949,9 +2949,9 @@ discard block |
||
2949 | 2949 | { |
2950 | 2950 | $hex = \dechex($int); |
2951 | 2951 | |
2952 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
2952 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
2953 | 2953 | |
2954 | - return $pfix . $hex . ''; |
|
2954 | + return $pfix.$hex.''; |
|
2955 | 2955 | } |
2956 | 2956 | |
2957 | 2957 | /** |
@@ -3209,7 +3209,7 @@ discard block |
||
3209 | 3209 | */ |
3210 | 3210 | public static function is_binary($input, bool $strict = false): bool |
3211 | 3211 | { |
3212 | - $input = (string) $input; |
|
3212 | + $input = (string)$input; |
|
3213 | 3213 | if ($input === '') { |
3214 | 3214 | return false; |
3215 | 3215 | } |
@@ -3468,7 +3468,7 @@ discard block |
||
3468 | 3468 | public static function is_utf16($str, $checkIfStringIsBinary = true) |
3469 | 3469 | { |
3470 | 3470 | // init |
3471 | - $str = (string) $str; |
|
3471 | + $str = (string)$str; |
|
3472 | 3472 | $strChars = []; |
3473 | 3473 | |
3474 | 3474 | if ( |
@@ -3546,7 +3546,7 @@ discard block |
||
3546 | 3546 | public static function is_utf32($str, $checkIfStringIsBinary = true) |
3547 | 3547 | { |
3548 | 3548 | // init |
3549 | - $str = (string) $str; |
|
3549 | + $str = (string)$str; |
|
3550 | 3550 | $strChars = []; |
3551 | 3551 | |
3552 | 3552 | if ( |
@@ -3666,7 +3666,7 @@ discard block |
||
3666 | 3666 | self::$ORD = self::getData('ord'); |
3667 | 3667 | } |
3668 | 3668 | |
3669 | - $len = \strlen((string) $str); |
|
3669 | + $len = \strlen((string)$str); |
|
3670 | 3670 | /** @noinspection ForeachInvariantsInspection */ |
3671 | 3671 | for ($i = 0; $i < $len; ++$i) { |
3672 | 3672 | $in = self::$ORD[$str[$i]]; |
@@ -3903,15 +3903,15 @@ discard block |
||
3903 | 3903 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
3904 | 3904 | |
3905 | 3905 | if ($encoding === 'UTF-8') { |
3906 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
3906 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
3907 | 3907 | |
3908 | 3908 | if ($useMbFunction === true) { |
3909 | 3909 | $strPartOne = \mb_strtolower( |
3910 | - (string) \mb_substr($str, 0, 1) |
|
3910 | + (string)\mb_substr($str, 0, 1) |
|
3911 | 3911 | ); |
3912 | 3912 | } else { |
3913 | 3913 | $strPartOne = self::strtolower( |
3914 | - (string) \mb_substr($str, 0, 1), |
|
3914 | + (string)\mb_substr($str, 0, 1), |
|
3915 | 3915 | $encoding, |
3916 | 3916 | false, |
3917 | 3917 | $lang, |
@@ -3921,10 +3921,10 @@ discard block |
||
3921 | 3921 | } else { |
3922 | 3922 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
3923 | 3923 | |
3924 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
3924 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
3925 | 3925 | |
3926 | 3926 | $strPartOne = self::strtolower( |
3927 | - (string) self::substr($str, 0, 1, $encoding), |
|
3927 | + (string)self::substr($str, 0, 1, $encoding), |
|
3928 | 3928 | $encoding, |
3929 | 3929 | false, |
3930 | 3930 | $lang, |
@@ -3932,7 +3932,7 @@ discard block |
||
3932 | 3932 | ); |
3933 | 3933 | } |
3934 | 3934 | |
3935 | - return $strPartOne . $strPartTwo; |
|
3935 | + return $strPartOne.$strPartTwo; |
|
3936 | 3936 | } |
3937 | 3937 | |
3938 | 3938 | /** |
@@ -4051,7 +4051,7 @@ discard block |
||
4051 | 4051 | |
4052 | 4052 | if (self::$SUPPORT['mbstring'] === true) { |
4053 | 4053 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4054 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4054 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4055 | 4055 | } |
4056 | 4056 | |
4057 | 4057 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -4092,7 +4092,7 @@ discard block |
||
4092 | 4092 | { |
4093 | 4093 | $bytes = self::chr_size_list($str); |
4094 | 4094 | if (\count($bytes) > 0) { |
4095 | - return (int) \max($bytes); |
|
4095 | + return (int)\max($bytes); |
|
4096 | 4096 | } |
4097 | 4097 | |
4098 | 4098 | return 0; |
@@ -4161,7 +4161,7 @@ discard block |
||
4161 | 4161 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4162 | 4162 | |
4163 | 4163 | // init |
4164 | - $encoding = (string) $encoding; |
|
4164 | + $encoding = (string)$encoding; |
|
4165 | 4165 | |
4166 | 4166 | if (!$encoding) { |
4167 | 4167 | return $fallback; |
@@ -4215,7 +4215,7 @@ discard block |
||
4215 | 4215 | |
4216 | 4216 | $encodingOrig = $encoding; |
4217 | 4217 | $encoding = \strtoupper($encoding); |
4218 | - $encodingUpperHelper = (string) \preg_replace('/[^a-zA-Z0-9\s]/u', '', $encoding); |
|
4218 | + $encodingUpperHelper = (string)\preg_replace('/[^a-zA-Z0-9\s]/u', '', $encoding); |
|
4219 | 4219 | |
4220 | 4220 | $equivalences = [ |
4221 | 4221 | 'ISO8859' => 'ISO-8859-1', |
@@ -4373,7 +4373,7 @@ discard block |
||
4373 | 4373 | } |
4374 | 4374 | |
4375 | 4375 | static $WHITESPACE_CACHE = []; |
4376 | - $cacheKey = (int) $keepNonBreakingSpace; |
|
4376 | + $cacheKey = (int)$keepNonBreakingSpace; |
|
4377 | 4377 | |
4378 | 4378 | if (!isset($WHITESPACE_CACHE[$cacheKey])) { |
4379 | 4379 | $WHITESPACE_CACHE[$cacheKey] = self::$WHITESPACE_TABLE; |
@@ -4415,13 +4415,13 @@ discard block |
||
4415 | 4415 | static $CHAR_CACHE = []; |
4416 | 4416 | |
4417 | 4417 | // init |
4418 | - $chr = (string) $chr; |
|
4418 | + $chr = (string)$chr; |
|
4419 | 4419 | |
4420 | 4420 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
4421 | 4421 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4422 | 4422 | } |
4423 | 4423 | |
4424 | - $cacheKey = $chr . $encoding; |
|
4424 | + $cacheKey = $chr.$encoding; |
|
4425 | 4425 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
4426 | 4426 | return $CHAR_CACHE[$cacheKey]; |
4427 | 4427 | } |
@@ -4456,22 +4456,22 @@ discard block |
||
4456 | 4456 | // |
4457 | 4457 | |
4458 | 4458 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
4459 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
4459 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
4460 | 4460 | $code = $chr ? $chr[1] : 0; |
4461 | 4461 | |
4462 | 4462 | if ($code >= 0xF0 && isset($chr[4])) { |
4463 | 4463 | /** @noinspection UnnecessaryCastingInspection */ |
4464 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4464 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4465 | 4465 | } |
4466 | 4466 | |
4467 | 4467 | if ($code >= 0xE0 && isset($chr[3])) { |
4468 | 4468 | /** @noinspection UnnecessaryCastingInspection */ |
4469 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4469 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4470 | 4470 | } |
4471 | 4471 | |
4472 | 4472 | if ($code >= 0xC0 && isset($chr[2])) { |
4473 | 4473 | /** @noinspection UnnecessaryCastingInspection */ |
4474 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4474 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4475 | 4475 | } |
4476 | 4476 | |
4477 | 4477 | return $CHAR_CACHE[$cacheKey] = $code; |
@@ -4520,7 +4520,7 @@ discard block |
||
4520 | 4520 | public static function pcre_utf8_support(): bool |
4521 | 4521 | { |
4522 | 4522 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4523 | - return (bool) @\preg_match('//u', ''); |
|
4523 | + return (bool)@\preg_match('//u', ''); |
|
4524 | 4524 | } |
4525 | 4525 | |
4526 | 4526 | /** |
@@ -4542,10 +4542,10 @@ discard block |
||
4542 | 4542 | } |
4543 | 4543 | |
4544 | 4544 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4545 | - if (\ctype_digit((string) $var1)) { |
|
4546 | - $start = (int) $var1; |
|
4545 | + if (\ctype_digit((string)$var1)) { |
|
4546 | + $start = (int)$var1; |
|
4547 | 4547 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var1)) { |
4548 | - $start = (int) self::hex_to_int($var1); |
|
4548 | + $start = (int)self::hex_to_int($var1); |
|
4549 | 4549 | } else { |
4550 | 4550 | $start = self::ord($var1); |
4551 | 4551 | } |
@@ -4555,10 +4555,10 @@ discard block |
||
4555 | 4555 | } |
4556 | 4556 | |
4557 | 4557 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4558 | - if (\ctype_digit((string) $var2)) { |
|
4559 | - $end = (int) $var2; |
|
4558 | + if (\ctype_digit((string)$var2)) { |
|
4559 | + $end = (int)$var2; |
|
4560 | 4560 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var2)) { |
4561 | - $end = (int) self::hex_to_int($var2); |
|
4561 | + $end = (int)self::hex_to_int($var2); |
|
4562 | 4562 | } else { |
4563 | 4563 | $end = self::ord($var2); |
4564 | 4564 | } |
@@ -4568,8 +4568,8 @@ discard block |
||
4568 | 4568 | } |
4569 | 4569 | |
4570 | 4570 | return \array_map( |
4571 | - static function (int $i): string { |
|
4572 | - return (string) self::chr($i); |
|
4571 | + static function(int $i): string { |
|
4572 | + return (string)self::chr($i); |
|
4573 | 4573 | }, |
4574 | 4574 | \range($start, $end) |
4575 | 4575 | ); |
@@ -4660,8 +4660,8 @@ discard block |
||
4660 | 4660 | $delimiter = '/'; |
4661 | 4661 | } |
4662 | 4662 | |
4663 | - return (string) \preg_replace( |
|
4664 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4663 | + return (string)\preg_replace( |
|
4664 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4665 | 4665 | $replacement, |
4666 | 4666 | $str |
4667 | 4667 | ); |
@@ -4703,9 +4703,9 @@ discard block |
||
4703 | 4703 | return ''; |
4704 | 4704 | } |
4705 | 4705 | |
4706 | - $strLength -= (int) $bomByteLength; |
|
4706 | + $strLength -= (int)$bomByteLength; |
|
4707 | 4707 | |
4708 | - $str = (string) $strTmp; |
|
4708 | + $str = (string)$strTmp; |
|
4709 | 4709 | } |
4710 | 4710 | } |
4711 | 4711 | |
@@ -4729,7 +4729,7 @@ discard block |
||
4729 | 4729 | if (\is_array($what) === true) { |
4730 | 4730 | /** @noinspection ForeachSourceInspection */ |
4731 | 4731 | foreach ($what as $item) { |
4732 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
4732 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
4733 | 4733 | } |
4734 | 4734 | } |
4735 | 4735 | |
@@ -4761,7 +4761,7 @@ discard block |
||
4761 | 4761 | */ |
4762 | 4762 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
4763 | 4763 | { |
4764 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4764 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4765 | 4765 | } |
4766 | 4766 | |
4767 | 4767 | /** |
@@ -4792,7 +4792,7 @@ discard block |
||
4792 | 4792 | $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
4793 | 4793 | |
4794 | 4794 | do { |
4795 | - $str = (string) \preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4795 | + $str = (string)\preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4796 | 4796 | } while ($count !== 0); |
4797 | 4797 | |
4798 | 4798 | return $str; |
@@ -4811,17 +4811,17 @@ discard block |
||
4811 | 4811 | { |
4812 | 4812 | if ($substring && \strpos($str, $substring) === 0) { |
4813 | 4813 | if ($encoding === 'UTF-8') { |
4814 | - return (string) \mb_substr( |
|
4814 | + return (string)\mb_substr( |
|
4815 | 4815 | $str, |
4816 | - (int) \mb_strlen($substring) |
|
4816 | + (int)\mb_strlen($substring) |
|
4817 | 4817 | ); |
4818 | 4818 | } |
4819 | 4819 | |
4820 | 4820 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4821 | 4821 | |
4822 | - return (string) self::substr( |
|
4822 | + return (string)self::substr( |
|
4823 | 4823 | $str, |
4824 | - (int) self::strlen($substring, $encoding), |
|
4824 | + (int)self::strlen($substring, $encoding), |
|
4825 | 4825 | null, |
4826 | 4826 | $encoding |
4827 | 4827 | ); |
@@ -4843,19 +4843,19 @@ discard block |
||
4843 | 4843 | { |
4844 | 4844 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
4845 | 4845 | if ($encoding === 'UTF-8') { |
4846 | - return (string) \mb_substr( |
|
4846 | + return (string)\mb_substr( |
|
4847 | 4847 | $str, |
4848 | 4848 | 0, |
4849 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
4849 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
4850 | 4850 | ); |
4851 | 4851 | } |
4852 | 4852 | |
4853 | 4853 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4854 | 4854 | |
4855 | - return (string) self::substr( |
|
4855 | + return (string)self::substr( |
|
4856 | 4856 | $str, |
4857 | 4857 | 0, |
4858 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
4858 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
4859 | 4859 | $encoding |
4860 | 4860 | ); |
4861 | 4861 | } |
@@ -4939,7 +4939,7 @@ discard block |
||
4939 | 4939 | $save = \mb_substitute_character(); |
4940 | 4940 | \mb_substitute_character($replacementCharHelper); |
4941 | 4941 | // the polyfill maybe return false, so cast to string |
4942 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4942 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4943 | 4943 | \mb_substitute_character($save); |
4944 | 4944 | } |
4945 | 4945 | |
@@ -4979,7 +4979,7 @@ discard block |
||
4979 | 4979 | |
4980 | 4980 | if (self::$SUPPORT['mbstring'] === true) { |
4981 | 4981 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4982 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4982 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4983 | 4983 | } |
4984 | 4984 | |
4985 | 4985 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -4994,7 +4994,7 @@ discard block |
||
4994 | 4994 | { |
4995 | 4995 | echo '<pre>'; |
4996 | 4996 | foreach (self::$SUPPORT as $key => &$value) { |
4997 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
4997 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
4998 | 4998 | } |
4999 | 4999 | unset($value); |
5000 | 5000 | echo '</pre>'; |
@@ -5023,7 +5023,7 @@ discard block |
||
5023 | 5023 | return $char; |
5024 | 5024 | } |
5025 | 5025 | |
5026 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
5026 | + return '&#'.self::ord($char, $encoding).';'; |
|
5027 | 5027 | } |
5028 | 5028 | |
5029 | 5029 | /** |
@@ -5114,18 +5114,18 @@ discard block |
||
5114 | 5114 | $lang, |
5115 | 5115 | $tryToKeepStringLength |
5116 | 5116 | ); |
5117 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5117 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5118 | 5118 | |
5119 | 5119 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5120 | 5120 | |
5121 | - $str = (string) \preg_replace_callback( |
|
5121 | + $str = (string)\preg_replace_callback( |
|
5122 | 5122 | '/[-_\s]+(.)?/u', |
5123 | 5123 | /** |
5124 | 5124 | * @param array $match |
5125 | 5125 | * |
5126 | 5126 | * @return string |
5127 | 5127 | */ |
5128 | - static function (array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5128 | + static function(array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5129 | 5129 | if (isset($match[1])) { |
5130 | 5130 | if ($useMbFunction === true) { |
5131 | 5131 | if ($encoding === 'UTF-8') { |
@@ -5143,14 +5143,14 @@ discard block |
||
5143 | 5143 | $str |
5144 | 5144 | ); |
5145 | 5145 | |
5146 | - return (string) \preg_replace_callback( |
|
5146 | + return (string)\preg_replace_callback( |
|
5147 | 5147 | '/[\d]+(.)?/u', |
5148 | 5148 | /** |
5149 | 5149 | * @param array $match |
5150 | 5150 | * |
5151 | 5151 | * @return string |
5152 | 5152 | */ |
5153 | - static function (array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5153 | + static function(array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5154 | 5154 | if ($useMbFunction === true) { |
5155 | 5155 | if ($encoding === 'UTF-8') { |
5156 | 5156 | return \mb_strtoupper($match[0]); |
@@ -5322,7 +5322,7 @@ discard block |
||
5322 | 5322 | ): string { |
5323 | 5323 | if (self::$SUPPORT['mbstring'] === true) { |
5324 | 5324 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5325 | - $str = (string) \mb_ereg_replace('\B(\p{Lu})', '-\1', \trim($str)); |
|
5325 | + $str = (string)\mb_ereg_replace('\B(\p{Lu})', '-\1', \trim($str)); |
|
5326 | 5326 | |
5327 | 5327 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5328 | 5328 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5332,10 +5332,10 @@ discard block |
||
5332 | 5332 | } |
5333 | 5333 | |
5334 | 5334 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5335 | - return (string) \mb_ereg_replace('[\-_\s]+', $delimiter, $str); |
|
5335 | + return (string)\mb_ereg_replace('[\-_\s]+', $delimiter, $str); |
|
5336 | 5336 | } |
5337 | 5337 | |
5338 | - $str = (string) \preg_replace('/\B(\p{Lu})/u', '-\1', \trim($str)); |
|
5338 | + $str = (string)\preg_replace('/\B(\p{Lu})/u', '-\1', \trim($str)); |
|
5339 | 5339 | |
5340 | 5340 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5341 | 5341 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5344,7 +5344,7 @@ discard block |
||
5344 | 5344 | $str = self::strtolower($str, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
5345 | 5345 | } |
5346 | 5346 | |
5347 | - return (string) \preg_replace('/[\-_\s]+/u', $delimiter, $str); |
|
5347 | + return (string)\preg_replace('/[\-_\s]+/u', $delimiter, $str); |
|
5348 | 5348 | } |
5349 | 5349 | |
5350 | 5350 | /** |
@@ -5359,7 +5359,7 @@ discard block |
||
5359 | 5359 | public static function str_detect_encoding($str) |
5360 | 5360 | { |
5361 | 5361 | // init |
5362 | - $str = (string) $str; |
|
5362 | + $str = (string)$str; |
|
5363 | 5363 | |
5364 | 5364 | // |
5365 | 5365 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5461,7 +5461,7 @@ discard block |
||
5461 | 5461 | foreach (self::$ENCODINGS as $encodingTmp) { |
5462 | 5462 | // INFO: //IGNORE but still throw notice |
5463 | 5463 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5464 | - if ((string) @\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str) === $str) { |
|
5464 | + if ((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str) === $str) { |
|
5465 | 5465 | return $encodingTmp; |
5466 | 5466 | } |
5467 | 5467 | } |
@@ -5549,7 +5549,7 @@ discard block |
||
5549 | 5549 | return $str; |
5550 | 5550 | } |
5551 | 5551 | |
5552 | - return $substring . $str; |
|
5552 | + return $substring.$str; |
|
5553 | 5553 | } |
5554 | 5554 | |
5555 | 5555 | /** |
@@ -5803,27 +5803,27 @@ discard block |
||
5803 | 5803 | string $encoding = 'UTF-8' |
5804 | 5804 | ): string { |
5805 | 5805 | if ($encoding === 'UTF-8') { |
5806 | - $len = (int) \mb_strlen($str); |
|
5806 | + $len = (int)\mb_strlen($str); |
|
5807 | 5807 | if ($index > $len) { |
5808 | 5808 | return $str; |
5809 | 5809 | } |
5810 | 5810 | |
5811 | 5811 | /** @noinspection UnnecessaryCastingInspection */ |
5812 | - return (string) \mb_substr($str, 0, $index) . |
|
5813 | - $substring . |
|
5814 | - (string) \mb_substr($str, $index, $len); |
|
5812 | + return (string)\mb_substr($str, 0, $index). |
|
5813 | + $substring. |
|
5814 | + (string)\mb_substr($str, $index, $len); |
|
5815 | 5815 | } |
5816 | 5816 | |
5817 | 5817 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5818 | 5818 | |
5819 | - $len = (int) self::strlen($str, $encoding); |
|
5819 | + $len = (int)self::strlen($str, $encoding); |
|
5820 | 5820 | if ($index > $len) { |
5821 | 5821 | return $str; |
5822 | 5822 | } |
5823 | 5823 | |
5824 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
5825 | - $substring . |
|
5826 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5824 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
5825 | + $substring. |
|
5826 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
5827 | 5827 | } |
5828 | 5828 | |
5829 | 5829 | /** |
@@ -5853,15 +5853,15 @@ discard block |
||
5853 | 5853 | */ |
5854 | 5854 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
5855 | 5855 | { |
5856 | - $search = (array) $search; |
|
5856 | + $search = (array)$search; |
|
5857 | 5857 | |
5858 | 5858 | /** @noinspection AlterInForeachInspection */ |
5859 | 5859 | foreach ($search as &$s) { |
5860 | - $s = (string) $s; |
|
5860 | + $s = (string)$s; |
|
5861 | 5861 | if ($s === '') { |
5862 | 5862 | $s = '/^(?<=.)$/'; |
5863 | 5863 | } else { |
5864 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5864 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5865 | 5865 | } |
5866 | 5866 | } |
5867 | 5867 | |
@@ -5893,11 +5893,11 @@ discard block |
||
5893 | 5893 | } |
5894 | 5894 | |
5895 | 5895 | if ($search === '') { |
5896 | - return $str . $replacement; |
|
5896 | + return $str.$replacement; |
|
5897 | 5897 | } |
5898 | 5898 | |
5899 | 5899 | if (\stripos($str, $search) === 0) { |
5900 | - return $replacement . \substr($str, \strlen($search)); |
|
5900 | + return $replacement.\substr($str, \strlen($search)); |
|
5901 | 5901 | } |
5902 | 5902 | |
5903 | 5903 | return $str; |
@@ -5925,11 +5925,11 @@ discard block |
||
5925 | 5925 | } |
5926 | 5926 | |
5927 | 5927 | if ($search === '') { |
5928 | - return $str . $replacement; |
|
5928 | + return $str.$replacement; |
|
5929 | 5929 | } |
5930 | 5930 | |
5931 | 5931 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
5932 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
5932 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
5933 | 5933 | } |
5934 | 5934 | |
5935 | 5935 | return $str; |
@@ -6006,15 +6006,15 @@ discard block |
||
6006 | 6006 | } |
6007 | 6007 | |
6008 | 6008 | if ($encoding === 'UTF-8') { |
6009 | - return (string) \mb_substr( |
|
6009 | + return (string)\mb_substr( |
|
6010 | 6010 | $str, |
6011 | - $offset + (int) \mb_strlen($separator) |
|
6011 | + $offset + (int)\mb_strlen($separator) |
|
6012 | 6012 | ); |
6013 | 6013 | } |
6014 | 6014 | |
6015 | - return (string) self::substr( |
|
6015 | + return (string)self::substr( |
|
6016 | 6016 | $str, |
6017 | - $offset + (int) self::strlen($separator, $encoding), |
|
6017 | + $offset + (int)self::strlen($separator, $encoding), |
|
6018 | 6018 | null, |
6019 | 6019 | $encoding |
6020 | 6020 | ); |
@@ -6041,15 +6041,15 @@ discard block |
||
6041 | 6041 | } |
6042 | 6042 | |
6043 | 6043 | if ($encoding === 'UTF-8') { |
6044 | - return (string) \mb_substr( |
|
6044 | + return (string)\mb_substr( |
|
6045 | 6045 | $str, |
6046 | - $offset + (int) self::strlen($separator) |
|
6046 | + $offset + (int)self::strlen($separator) |
|
6047 | 6047 | ); |
6048 | 6048 | } |
6049 | 6049 | |
6050 | - return (string) self::substr( |
|
6050 | + return (string)self::substr( |
|
6051 | 6051 | $str, |
6052 | - $offset + (int) self::strlen($separator, $encoding), |
|
6052 | + $offset + (int)self::strlen($separator, $encoding), |
|
6053 | 6053 | null, |
6054 | 6054 | $encoding |
6055 | 6055 | ); |
@@ -6076,10 +6076,10 @@ discard block |
||
6076 | 6076 | } |
6077 | 6077 | |
6078 | 6078 | if ($encoding === 'UTF-8') { |
6079 | - return (string) \mb_substr($str, 0, $offset); |
|
6079 | + return (string)\mb_substr($str, 0, $offset); |
|
6080 | 6080 | } |
6081 | 6081 | |
6082 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6082 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6083 | 6083 | } |
6084 | 6084 | |
6085 | 6085 | /** |
@@ -6103,7 +6103,7 @@ discard block |
||
6103 | 6103 | return ''; |
6104 | 6104 | } |
6105 | 6105 | |
6106 | - return (string) \mb_substr($str, 0, $offset); |
|
6106 | + return (string)\mb_substr($str, 0, $offset); |
|
6107 | 6107 | } |
6108 | 6108 | |
6109 | 6109 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6111,7 +6111,7 @@ discard block |
||
6111 | 6111 | return ''; |
6112 | 6112 | } |
6113 | 6113 | |
6114 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6114 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6115 | 6115 | } |
6116 | 6116 | |
6117 | 6117 | /** |
@@ -6199,12 +6199,12 @@ discard block |
||
6199 | 6199 | } |
6200 | 6200 | |
6201 | 6201 | if ($encoding === 'UTF-8') { |
6202 | - return (string) \mb_substr($str, -$n); |
|
6202 | + return (string)\mb_substr($str, -$n); |
|
6203 | 6203 | } |
6204 | 6204 | |
6205 | 6205 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6206 | 6206 | |
6207 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6207 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6208 | 6208 | } |
6209 | 6209 | |
6210 | 6210 | /** |
@@ -6228,21 +6228,21 @@ discard block |
||
6228 | 6228 | } |
6229 | 6229 | |
6230 | 6230 | if ($encoding === 'UTF-8') { |
6231 | - if ((int) \mb_strlen($str) <= $length) { |
|
6231 | + if ((int)\mb_strlen($str) <= $length) { |
|
6232 | 6232 | return $str; |
6233 | 6233 | } |
6234 | 6234 | |
6235 | 6235 | /** @noinspection UnnecessaryCastingInspection */ |
6236 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($strAddOn)) . $strAddOn; |
|
6236 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($strAddOn)).$strAddOn; |
|
6237 | 6237 | } |
6238 | 6238 | |
6239 | 6239 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6240 | 6240 | |
6241 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6241 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6242 | 6242 | return $str; |
6243 | 6243 | } |
6244 | 6244 | |
6245 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($strAddOn), $encoding)) . $strAddOn; |
|
6245 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($strAddOn), $encoding)).$strAddOn; |
|
6246 | 6246 | } |
6247 | 6247 | |
6248 | 6248 | /** |
@@ -6267,12 +6267,12 @@ discard block |
||
6267 | 6267 | |
6268 | 6268 | if ($encoding === 'UTF-8') { |
6269 | 6269 | /** @noinspection UnnecessaryCastingInspection */ |
6270 | - if ((int) \mb_strlen($str) <= $length) { |
|
6270 | + if ((int)\mb_strlen($str) <= $length) { |
|
6271 | 6271 | return $str; |
6272 | 6272 | } |
6273 | 6273 | |
6274 | 6274 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6275 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6275 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6276 | 6276 | } |
6277 | 6277 | |
6278 | 6278 | $str = \mb_substr($str, 0, $length); |
@@ -6282,20 +6282,20 @@ discard block |
||
6282 | 6282 | $new_str = \implode(' ', $array); |
6283 | 6283 | |
6284 | 6284 | if ($new_str === '') { |
6285 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6285 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6286 | 6286 | } |
6287 | 6287 | } else { |
6288 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6288 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6289 | 6289 | return $str; |
6290 | 6290 | } |
6291 | 6291 | |
6292 | 6292 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6293 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6293 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6294 | 6294 | } |
6295 | 6295 | |
6296 | 6296 | $str = self::substr($str, 0, $length, $encoding); |
6297 | 6297 | if ($str === false) { |
6298 | - return '' . $strAddOn; |
|
6298 | + return ''.$strAddOn; |
|
6299 | 6299 | } |
6300 | 6300 | |
6301 | 6301 | $array = \explode(' ', $str); |
@@ -6303,11 +6303,11 @@ discard block |
||
6303 | 6303 | $new_str = \implode(' ', $array); |
6304 | 6304 | |
6305 | 6305 | if ($new_str === '') { |
6306 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6306 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6307 | 6307 | } |
6308 | 6308 | } |
6309 | 6309 | |
6310 | - return $new_str . $strAddOn; |
|
6310 | + return $new_str.$strAddOn; |
|
6311 | 6311 | } |
6312 | 6312 | |
6313 | 6313 | /** |
@@ -6325,7 +6325,7 @@ discard block |
||
6325 | 6325 | $longestCommonPrefix = ''; |
6326 | 6326 | |
6327 | 6327 | if ($encoding === 'UTF-8') { |
6328 | - $maxLength = (int) \min( |
|
6328 | + $maxLength = (int)\min( |
|
6329 | 6329 | \mb_strlen($str), |
6330 | 6330 | \mb_strlen($otherStr) |
6331 | 6331 | ); |
@@ -6346,7 +6346,7 @@ discard block |
||
6346 | 6346 | } else { |
6347 | 6347 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6348 | 6348 | |
6349 | - $maxLength = (int) \min( |
|
6349 | + $maxLength = (int)\min( |
|
6350 | 6350 | self::strlen($str, $encoding), |
6351 | 6351 | self::strlen($otherStr, $encoding) |
6352 | 6352 | ); |
@@ -6389,13 +6389,13 @@ discard block |
||
6389 | 6389 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6390 | 6390 | |
6391 | 6391 | if ($encoding === 'UTF-8') { |
6392 | - $strLength = (int) \mb_strlen($str); |
|
6393 | - $otherLength = (int) \mb_strlen($otherStr); |
|
6392 | + $strLength = (int)\mb_strlen($str); |
|
6393 | + $otherLength = (int)\mb_strlen($otherStr); |
|
6394 | 6394 | } else { |
6395 | 6395 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6396 | 6396 | |
6397 | - $strLength = (int) self::strlen($str, $encoding); |
|
6398 | - $otherLength = (int) self::strlen($otherStr, $encoding); |
|
6397 | + $strLength = (int)self::strlen($str, $encoding); |
|
6398 | + $otherLength = (int)self::strlen($otherStr, $encoding); |
|
6399 | 6399 | } |
6400 | 6400 | |
6401 | 6401 | // Return if either string is empty |
@@ -6448,10 +6448,10 @@ discard block |
||
6448 | 6448 | } |
6449 | 6449 | |
6450 | 6450 | if ($encoding === 'UTF-8') { |
6451 | - return (string) \mb_substr($str, $end - $len, $len); |
|
6451 | + return (string)\mb_substr($str, $end - $len, $len); |
|
6452 | 6452 | } |
6453 | 6453 | |
6454 | - return (string) self::substr($str, $end - $len, $len, $encoding); |
|
6454 | + return (string)self::substr($str, $end - $len, $len, $encoding); |
|
6455 | 6455 | } |
6456 | 6456 | |
6457 | 6457 | /** |
@@ -6470,7 +6470,7 @@ discard block |
||
6470 | 6470 | } |
6471 | 6471 | |
6472 | 6472 | if ($encoding === 'UTF-8') { |
6473 | - $maxLength = (int) \min( |
|
6473 | + $maxLength = (int)\min( |
|
6474 | 6474 | \mb_strlen($str, $encoding), |
6475 | 6475 | \mb_strlen($otherStr, $encoding) |
6476 | 6476 | ); |
@@ -6484,7 +6484,7 @@ discard block |
||
6484 | 6484 | && |
6485 | 6485 | $char === \mb_substr($otherStr, -$i, 1) |
6486 | 6486 | ) { |
6487 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6487 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6488 | 6488 | } else { |
6489 | 6489 | break; |
6490 | 6490 | } |
@@ -6492,7 +6492,7 @@ discard block |
||
6492 | 6492 | } else { |
6493 | 6493 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6494 | 6494 | |
6495 | - $maxLength = (int) \min( |
|
6495 | + $maxLength = (int)\min( |
|
6496 | 6496 | self::strlen($str, $encoding), |
6497 | 6497 | self::strlen($otherStr, $encoding) |
6498 | 6498 | ); |
@@ -6506,7 +6506,7 @@ discard block |
||
6506 | 6506 | && |
6507 | 6507 | $char === self::substr($otherStr, -$i, 1, $encoding) |
6508 | 6508 | ) { |
6509 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6509 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6510 | 6510 | } else { |
6511 | 6511 | break; |
6512 | 6512 | } |
@@ -6526,7 +6526,7 @@ discard block |
||
6526 | 6526 | */ |
6527 | 6527 | public static function str_matches_pattern(string $str, string $pattern): bool |
6528 | 6528 | { |
6529 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
6529 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
6530 | 6530 | } |
6531 | 6531 | |
6532 | 6532 | /** |
@@ -6543,7 +6543,7 @@ discard block |
||
6543 | 6543 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
6544 | 6544 | { |
6545 | 6545 | // init |
6546 | - $length = (int) self::strlen($str, $encoding); |
|
6546 | + $length = (int)self::strlen($str, $encoding); |
|
6547 | 6547 | |
6548 | 6548 | if ($offset >= 0) { |
6549 | 6549 | return $length > $offset; |
@@ -6569,7 +6569,7 @@ discard block |
||
6569 | 6569 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
6570 | 6570 | { |
6571 | 6571 | // init |
6572 | - $length = (int) self::strlen($str); |
|
6572 | + $length = (int)self::strlen($str); |
|
6573 | 6573 | |
6574 | 6574 | if ( |
6575 | 6575 | ($index >= 0 && $length <= $index) |
@@ -6608,7 +6608,7 @@ discard block |
||
6608 | 6608 | return $str; |
6609 | 6609 | } |
6610 | 6610 | |
6611 | - if ($pad_type !== (int) $pad_type) { |
|
6611 | + if ($pad_type !== (int)$pad_type) { |
|
6612 | 6612 | if ($pad_type === 'left') { |
6613 | 6613 | $pad_type = \STR_PAD_LEFT; |
6614 | 6614 | } elseif ($pad_type === 'right') { |
@@ -6617,23 +6617,23 @@ discard block |
||
6617 | 6617 | $pad_type = \STR_PAD_BOTH; |
6618 | 6618 | } else { |
6619 | 6619 | throw new \InvalidArgumentException( |
6620 | - 'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
6620 | + 'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
6621 | 6621 | ); |
6622 | 6622 | } |
6623 | 6623 | } |
6624 | 6624 | |
6625 | 6625 | if ($encoding === 'UTF-8') { |
6626 | - $str_length = (int) \mb_strlen($str); |
|
6626 | + $str_length = (int)\mb_strlen($str); |
|
6627 | 6627 | |
6628 | 6628 | if ($pad_length >= $str_length) { |
6629 | 6629 | switch ($pad_type) { |
6630 | 6630 | case \STR_PAD_LEFT: |
6631 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6631 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6632 | 6632 | |
6633 | 6633 | $diff = ($pad_length - $str_length); |
6634 | 6634 | |
6635 | - $pre = (string) \mb_substr( |
|
6636 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6635 | + $pre = (string)\mb_substr( |
|
6636 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6637 | 6637 | 0, |
6638 | 6638 | $diff |
6639 | 6639 | ); |
@@ -6644,16 +6644,16 @@ discard block |
||
6644 | 6644 | case \STR_PAD_BOTH: |
6645 | 6645 | $diff = ($pad_length - $str_length); |
6646 | 6646 | |
6647 | - $ps_length_left = (int) \floor($diff / 2); |
|
6647 | + $ps_length_left = (int)\floor($diff / 2); |
|
6648 | 6648 | |
6649 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6649 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6650 | 6650 | |
6651 | - $pre = (string) \mb_substr( |
|
6651 | + $pre = (string)\mb_substr( |
|
6652 | 6652 | \str_repeat($pad_string, $ps_length_left), |
6653 | 6653 | 0, |
6654 | 6654 | $ps_length_left |
6655 | 6655 | ); |
6656 | - $post = (string) \mb_substr( |
|
6656 | + $post = (string)\mb_substr( |
|
6657 | 6657 | \str_repeat($pad_string, $ps_length_right), |
6658 | 6658 | 0, |
6659 | 6659 | $ps_length_right |
@@ -6663,19 +6663,19 @@ discard block |
||
6663 | 6663 | |
6664 | 6664 | case \STR_PAD_RIGHT: |
6665 | 6665 | default: |
6666 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6666 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6667 | 6667 | |
6668 | 6668 | $diff = ($pad_length - $str_length); |
6669 | 6669 | |
6670 | - $post = (string) \mb_substr( |
|
6671 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6670 | + $post = (string)\mb_substr( |
|
6671 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6672 | 6672 | 0, |
6673 | 6673 | $diff |
6674 | 6674 | ); |
6675 | 6675 | $pre = ''; |
6676 | 6676 | } |
6677 | 6677 | |
6678 | - return $pre . $str . $post; |
|
6678 | + return $pre.$str.$post; |
|
6679 | 6679 | } |
6680 | 6680 | |
6681 | 6681 | return $str; |
@@ -6683,17 +6683,17 @@ discard block |
||
6683 | 6683 | |
6684 | 6684 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6685 | 6685 | |
6686 | - $str_length = (int) self::strlen($str, $encoding); |
|
6686 | + $str_length = (int)self::strlen($str, $encoding); |
|
6687 | 6687 | |
6688 | 6688 | if ($pad_length >= $str_length) { |
6689 | 6689 | switch ($pad_type) { |
6690 | 6690 | case \STR_PAD_LEFT: |
6691 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6691 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6692 | 6692 | |
6693 | 6693 | $diff = ($pad_length - $str_length); |
6694 | 6694 | |
6695 | - $pre = (string) self::substr( |
|
6696 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6695 | + $pre = (string)self::substr( |
|
6696 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6697 | 6697 | 0, |
6698 | 6698 | $diff, |
6699 | 6699 | $encoding |
@@ -6705,17 +6705,17 @@ discard block |
||
6705 | 6705 | case \STR_PAD_BOTH: |
6706 | 6706 | $diff = ($pad_length - $str_length); |
6707 | 6707 | |
6708 | - $ps_length_left = (int) \floor($diff / 2); |
|
6708 | + $ps_length_left = (int)\floor($diff / 2); |
|
6709 | 6709 | |
6710 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6710 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6711 | 6711 | |
6712 | - $pre = (string) self::substr( |
|
6712 | + $pre = (string)self::substr( |
|
6713 | 6713 | \str_repeat($pad_string, $ps_length_left), |
6714 | 6714 | 0, |
6715 | 6715 | $ps_length_left, |
6716 | 6716 | $encoding |
6717 | 6717 | ); |
6718 | - $post = (string) self::substr( |
|
6718 | + $post = (string)self::substr( |
|
6719 | 6719 | \str_repeat($pad_string, $ps_length_right), |
6720 | 6720 | 0, |
6721 | 6721 | $ps_length_right, |
@@ -6726,12 +6726,12 @@ discard block |
||
6726 | 6726 | |
6727 | 6727 | case \STR_PAD_RIGHT: |
6728 | 6728 | default: |
6729 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6729 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6730 | 6730 | |
6731 | 6731 | $diff = ($pad_length - $str_length); |
6732 | 6732 | |
6733 | - $post = (string) self::substr( |
|
6734 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6733 | + $post = (string)self::substr( |
|
6734 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6735 | 6735 | 0, |
6736 | 6736 | $diff, |
6737 | 6737 | $encoding |
@@ -6739,7 +6739,7 @@ discard block |
||
6739 | 6739 | $pre = ''; |
6740 | 6740 | } |
6741 | 6741 | |
6742 | - return $pre . $str . $post; |
|
6742 | + return $pre.$str.$post; |
|
6743 | 6743 | } |
6744 | 6744 | |
6745 | 6745 | return $str; |
@@ -6898,11 +6898,11 @@ discard block |
||
6898 | 6898 | } |
6899 | 6899 | |
6900 | 6900 | if ($search === '') { |
6901 | - return $str . $replacement; |
|
6901 | + return $str.$replacement; |
|
6902 | 6902 | } |
6903 | 6903 | |
6904 | 6904 | if (\strpos($str, $search) === 0) { |
6905 | - return $replacement . \substr($str, \strlen($search)); |
|
6905 | + return $replacement.\substr($str, \strlen($search)); |
|
6906 | 6906 | } |
6907 | 6907 | |
6908 | 6908 | return $str; |
@@ -6930,11 +6930,11 @@ discard block |
||
6930 | 6930 | } |
6931 | 6931 | |
6932 | 6932 | if ($search === '') { |
6933 | - return $str . $replacement; |
|
6933 | + return $str.$replacement; |
|
6934 | 6934 | } |
6935 | 6935 | |
6936 | 6936 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6937 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6937 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6938 | 6938 | } |
6939 | 6939 | |
6940 | 6940 | return $str; |
@@ -6963,7 +6963,7 @@ discard block |
||
6963 | 6963 | $subject, |
6964 | 6964 | $replace, |
6965 | 6965 | $pos, |
6966 | - (int) self::strlen($search) |
|
6966 | + (int)self::strlen($search) |
|
6967 | 6967 | ); |
6968 | 6968 | } |
6969 | 6969 | |
@@ -6995,7 +6995,7 @@ discard block |
||
6995 | 6995 | $subject, |
6996 | 6996 | $replace, |
6997 | 6997 | $pos, |
6998 | - (int) self::strlen($search) |
|
6998 | + (int)self::strlen($search) |
|
6999 | 6999 | ); |
7000 | 7000 | } |
7001 | 7001 | |
@@ -7015,7 +7015,7 @@ discard block |
||
7015 | 7015 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
7016 | 7016 | { |
7017 | 7017 | if ($encoding === 'UTF-8') { |
7018 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
7018 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
7019 | 7019 | /** @noinspection NonSecureShuffleUsageInspection */ |
7020 | 7020 | \shuffle($indexes); |
7021 | 7021 | |
@@ -7031,7 +7031,7 @@ discard block |
||
7031 | 7031 | } else { |
7032 | 7032 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7033 | 7033 | |
7034 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
7034 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
7035 | 7035 | /** @noinspection NonSecureShuffleUsageInspection */ |
7036 | 7036 | \shuffle($indexes); |
7037 | 7037 | |
@@ -7072,11 +7072,11 @@ discard block |
||
7072 | 7072 | ) { |
7073 | 7073 | if ($encoding === 'UTF-8') { |
7074 | 7074 | if ($end === null) { |
7075 | - $length = (int) \mb_strlen($str); |
|
7075 | + $length = (int)\mb_strlen($str); |
|
7076 | 7076 | } elseif ($end >= 0 && $end <= $start) { |
7077 | 7077 | return ''; |
7078 | 7078 | } elseif ($end < 0) { |
7079 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7079 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7080 | 7080 | } else { |
7081 | 7081 | $length = $end - $start; |
7082 | 7082 | } |
@@ -7087,11 +7087,11 @@ discard block |
||
7087 | 7087 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7088 | 7088 | |
7089 | 7089 | if ($end === null) { |
7090 | - $length = (int) self::strlen($str, $encoding); |
|
7090 | + $length = (int)self::strlen($str, $encoding); |
|
7091 | 7091 | } elseif ($end >= 0 && $end <= $start) { |
7092 | 7092 | return ''; |
7093 | 7093 | } elseif ($end < 0) { |
7094 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7094 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7095 | 7095 | } else { |
7096 | 7096 | $length = $end - $start; |
7097 | 7097 | } |
@@ -7123,35 +7123,35 @@ discard block |
||
7123 | 7123 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7124 | 7124 | } |
7125 | 7125 | |
7126 | - $str = (string) \preg_replace_callback( |
|
7126 | + $str = (string)\preg_replace_callback( |
|
7127 | 7127 | '/([\d|\p{Lu}])/u', |
7128 | 7128 | /** |
7129 | 7129 | * @param string[] $matches |
7130 | 7130 | * |
7131 | 7131 | * @return string |
7132 | 7132 | */ |
7133 | - static function (array $matches) use ($encoding): string { |
|
7133 | + static function(array $matches) use ($encoding): string { |
|
7134 | 7134 | $match = $matches[1]; |
7135 | - $matchInt = (int) $match; |
|
7135 | + $matchInt = (int)$match; |
|
7136 | 7136 | |
7137 | - if ((string) $matchInt === $match) { |
|
7138 | - return '_' . $match . '_'; |
|
7137 | + if ((string)$matchInt === $match) { |
|
7138 | + return '_'.$match.'_'; |
|
7139 | 7139 | } |
7140 | 7140 | |
7141 | 7141 | if ($encoding === 'UTF-8') { |
7142 | - return '_' . \mb_strtolower($match); |
|
7142 | + return '_'.\mb_strtolower($match); |
|
7143 | 7143 | } |
7144 | 7144 | |
7145 | - return '_' . self::strtolower($match, $encoding); |
|
7145 | + return '_'.self::strtolower($match, $encoding); |
|
7146 | 7146 | }, |
7147 | 7147 | $str |
7148 | 7148 | ); |
7149 | 7149 | |
7150 | - $str = (string) \preg_replace( |
|
7150 | + $str = (string)\preg_replace( |
|
7151 | 7151 | [ |
7152 | - '/\s+/u', // convert spaces to "_" |
|
7153 | - '/^\s+|\s+$/u', // trim leading & trailing spaces |
|
7154 | - '/_+/', // remove double "_" |
|
7152 | + '/\s+/u', // convert spaces to "_" |
|
7153 | + '/^\s+|\s+$/u', // trim leading & trailing spaces |
|
7154 | + '/_+/', // remove double "_" |
|
7155 | 7155 | ], |
7156 | 7156 | [ |
7157 | 7157 | '_', |
@@ -7227,7 +7227,7 @@ discard block |
||
7227 | 7227 | } |
7228 | 7228 | |
7229 | 7229 | // init |
7230 | - $str = (string) $str; |
|
7230 | + $str = (string)$str; |
|
7231 | 7231 | |
7232 | 7232 | if ($str === '') { |
7233 | 7233 | return []; |
@@ -7274,7 +7274,7 @@ discard block |
||
7274 | 7274 | ($str[$i] & "\xE0") === "\xC0" |
7275 | 7275 | ) { |
7276 | 7276 | if (($str[$i + 1] & "\xC0") === "\x80") { |
7277 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
7277 | + $ret[] = $str[$i].$str[$i + 1]; |
|
7278 | 7278 | |
7279 | 7279 | ++$i; |
7280 | 7280 | } |
@@ -7288,7 +7288,7 @@ discard block |
||
7288 | 7288 | && |
7289 | 7289 | ($str[$i + 2] & "\xC0") === "\x80" |
7290 | 7290 | ) { |
7291 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
7291 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
7292 | 7292 | |
7293 | 7293 | $i += 2; |
7294 | 7294 | } |
@@ -7304,7 +7304,7 @@ discard block |
||
7304 | 7304 | && |
7305 | 7305 | ($str[$i + 3] & "\xC0") === "\x80" |
7306 | 7306 | ) { |
7307 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
7307 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
7308 | 7308 | |
7309 | 7309 | $i += 3; |
7310 | 7310 | } |
@@ -7316,7 +7316,7 @@ discard block |
||
7316 | 7316 | $ret = \array_chunk($ret, $length); |
7317 | 7317 | |
7318 | 7318 | return \array_map( |
7319 | - static function (array &$item): string { |
|
7319 | + static function(array &$item): string { |
|
7320 | 7320 | return \implode('', $item); |
7321 | 7321 | }, |
7322 | 7322 | $ret |
@@ -7379,7 +7379,7 @@ discard block |
||
7379 | 7379 | $limit = -1; |
7380 | 7380 | } |
7381 | 7381 | |
7382 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7382 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7383 | 7383 | |
7384 | 7384 | if ($array === false) { |
7385 | 7385 | return []; |
@@ -7463,9 +7463,9 @@ discard block |
||
7463 | 7463 | return ''; |
7464 | 7464 | } |
7465 | 7465 | |
7466 | - return (string) \mb_substr( |
|
7466 | + return (string)\mb_substr( |
|
7467 | 7467 | $str, |
7468 | - $offset + (int) \mb_strlen($separator) |
|
7468 | + $offset + (int)\mb_strlen($separator) |
|
7469 | 7469 | ); |
7470 | 7470 | } |
7471 | 7471 | |
@@ -7474,9 +7474,9 @@ discard block |
||
7474 | 7474 | return ''; |
7475 | 7475 | } |
7476 | 7476 | |
7477 | - return (string) \mb_substr( |
|
7477 | + return (string)\mb_substr( |
|
7478 | 7478 | $str, |
7479 | - $offset + (int) self::strlen($separator, $encoding), |
|
7479 | + $offset + (int)self::strlen($separator, $encoding), |
|
7480 | 7480 | null, |
7481 | 7481 | $encoding |
7482 | 7482 | ); |
@@ -7503,9 +7503,9 @@ discard block |
||
7503 | 7503 | return ''; |
7504 | 7504 | } |
7505 | 7505 | |
7506 | - return (string) \mb_substr( |
|
7506 | + return (string)\mb_substr( |
|
7507 | 7507 | $str, |
7508 | - $offset + (int) \mb_strlen($separator) |
|
7508 | + $offset + (int)\mb_strlen($separator) |
|
7509 | 7509 | ); |
7510 | 7510 | } |
7511 | 7511 | |
@@ -7514,9 +7514,9 @@ discard block |
||
7514 | 7514 | return ''; |
7515 | 7515 | } |
7516 | 7516 | |
7517 | - return (string) self::substr( |
|
7517 | + return (string)self::substr( |
|
7518 | 7518 | $str, |
7519 | - $offset + (int) self::strlen($separator, $encoding), |
|
7519 | + $offset + (int)self::strlen($separator, $encoding), |
|
7520 | 7520 | null, |
7521 | 7521 | $encoding |
7522 | 7522 | ); |
@@ -7546,7 +7546,7 @@ discard block |
||
7546 | 7546 | return ''; |
7547 | 7547 | } |
7548 | 7548 | |
7549 | - return (string) \mb_substr( |
|
7549 | + return (string)\mb_substr( |
|
7550 | 7550 | $str, |
7551 | 7551 | 0, |
7552 | 7552 | $offset |
@@ -7558,7 +7558,7 @@ discard block |
||
7558 | 7558 | return ''; |
7559 | 7559 | } |
7560 | 7560 | |
7561 | - return (string) self::substr( |
|
7561 | + return (string)self::substr( |
|
7562 | 7562 | $str, |
7563 | 7563 | 0, |
7564 | 7564 | $offset, |
@@ -7587,7 +7587,7 @@ discard block |
||
7587 | 7587 | return ''; |
7588 | 7588 | } |
7589 | 7589 | |
7590 | - return (string) \mb_substr( |
|
7590 | + return (string)\mb_substr( |
|
7591 | 7591 | $str, |
7592 | 7592 | 0, |
7593 | 7593 | $offset |
@@ -7601,7 +7601,7 @@ discard block |
||
7601 | 7601 | |
7602 | 7602 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7603 | 7603 | |
7604 | - return (string) self::substr( |
|
7604 | + return (string)self::substr( |
|
7605 | 7605 | $str, |
7606 | 7606 | 0, |
7607 | 7607 | $offset, |
@@ -7709,7 +7709,7 @@ discard block |
||
7709 | 7709 | */ |
7710 | 7710 | public static function str_surround(string $str, string $substring): string |
7711 | 7711 | { |
7712 | - return $substring . $str . $substring; |
|
7712 | + return $substring.$str.$substring; |
|
7713 | 7713 | } |
7714 | 7714 | |
7715 | 7715 | /** |
@@ -7753,9 +7753,9 @@ discard block |
||
7753 | 7753 | |
7754 | 7754 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
7755 | 7755 | |
7756 | - return (string) \preg_replace_callback( |
|
7756 | + return (string)\preg_replace_callback( |
|
7757 | 7757 | '/([\S]+)/u', |
7758 | - static function (array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7758 | + static function(array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7759 | 7759 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
7760 | 7760 | return $match[0]; |
7761 | 7761 | } |
@@ -7841,16 +7841,16 @@ discard block |
||
7841 | 7841 | } |
7842 | 7842 | |
7843 | 7843 | // the main substitutions |
7844 | - $str = (string) \preg_replace_callback( |
|
7844 | + $str = (string)\preg_replace_callback( |
|
7845 | 7845 | '~\b (_*) (?: # 1. Leading underscore and |
7846 | 7846 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
7847 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) # URL, domain, or email |
|
7847 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) # URL, domain, or email |
|
7848 | 7848 | | |
7849 | - ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' ) # 3. or small word (case-insensitive) |
|
7849 | + ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' ) # 3. or small word (case-insensitive) |
|
7850 | 7850 | | |
7851 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 4. or word w/o internal caps |
|
7851 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 4. or word w/o internal caps |
|
7852 | 7852 | | |
7853 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 5. or some other word |
|
7853 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 5. or some other word |
|
7854 | 7854 | ) (_*) \b # 6. With trailing underscore |
7855 | 7855 | ~ux', |
7856 | 7856 | /** |
@@ -7858,7 +7858,7 @@ discard block |
||
7858 | 7858 | * |
7859 | 7859 | * @return string |
7860 | 7860 | */ |
7861 | - static function (array $matches) use ($encoding): string { |
|
7861 | + static function(array $matches) use ($encoding): string { |
|
7862 | 7862 | // preserve leading underscore |
7863 | 7863 | $str = $matches[1]; |
7864 | 7864 | if ($matches[2]) { |
@@ -7883,26 +7883,26 @@ discard block |
||
7883 | 7883 | ); |
7884 | 7884 | |
7885 | 7885 | // Exceptions for small words: capitalize at start of title... |
7886 | - $str = (string) \preg_replace_callback( |
|
7886 | + $str = (string)\preg_replace_callback( |
|
7887 | 7887 | '~( \A [[:punct:]]* # start of title... |
7888 | 7888 | | [:.;?!][ ]+ # or of subsentence... |
7889 | 7889 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
7890 | - ( ' . $smallWordsRx . ' ) \b # ...followed by small word |
|
7890 | + ( ' . $smallWordsRx.' ) \b # ...followed by small word |
|
7891 | 7891 | ~uxi', |
7892 | 7892 | /** |
7893 | 7893 | * @param string[] $matches |
7894 | 7894 | * |
7895 | 7895 | * @return string |
7896 | 7896 | */ |
7897 | - static function (array $matches) use ($encoding): string { |
|
7898 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7897 | + static function(array $matches) use ($encoding): string { |
|
7898 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7899 | 7899 | }, |
7900 | 7900 | $str |
7901 | 7901 | ); |
7902 | 7902 | |
7903 | 7903 | // ...and end of title |
7904 | - $str = (string) \preg_replace_callback( |
|
7905 | - '~\b ( ' . $smallWordsRx . ' ) # small word... |
|
7904 | + $str = (string)\preg_replace_callback( |
|
7905 | + '~\b ( '.$smallWordsRx.' ) # small word... |
|
7906 | 7906 | (?= [[:punct:]]* \Z # ...at the end of the title... |
7907 | 7907 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
7908 | 7908 | ~uxi', |
@@ -7911,7 +7911,7 @@ discard block |
||
7911 | 7911 | * |
7912 | 7912 | * @return string |
7913 | 7913 | */ |
7914 | - static function (array $matches) use ($encoding): string { |
|
7914 | + static function(array $matches) use ($encoding): string { |
|
7915 | 7915 | return static::str_upper_first($matches[1], $encoding); |
7916 | 7916 | }, |
7917 | 7917 | $str |
@@ -7919,10 +7919,10 @@ discard block |
||
7919 | 7919 | |
7920 | 7920 | // Exceptions for small words in hyphenated compound words. |
7921 | 7921 | // e.g. "in-flight" -> In-Flight |
7922 | - $str = (string) \preg_replace_callback( |
|
7922 | + $str = (string)\preg_replace_callback( |
|
7923 | 7923 | '~\b |
7924 | 7924 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
7925 | - ( ' . $smallWordsRx . ' ) |
|
7925 | + ( ' . $smallWordsRx.' ) |
|
7926 | 7926 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
7927 | 7927 | ~uxi', |
7928 | 7928 | /** |
@@ -7930,18 +7930,18 @@ discard block |
||
7930 | 7930 | * |
7931 | 7931 | * @return string |
7932 | 7932 | */ |
7933 | - static function (array $matches) use ($encoding): string { |
|
7933 | + static function(array $matches) use ($encoding): string { |
|
7934 | 7934 | return static::str_upper_first($matches[1], $encoding); |
7935 | 7935 | }, |
7936 | 7936 | $str |
7937 | 7937 | ); |
7938 | 7938 | |
7939 | 7939 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
7940 | - $str = (string) \preg_replace_callback( |
|
7940 | + $str = (string)\preg_replace_callback( |
|
7941 | 7941 | '~\b |
7942 | 7942 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
7943 | 7943 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
7944 | - ( ' . $smallWordsRx . ' ) # ...followed by small word |
|
7944 | + ( ' . $smallWordsRx.' ) # ...followed by small word |
|
7945 | 7945 | (?! - ) # Negative lookahead for another - |
7946 | 7946 | ~uxi', |
7947 | 7947 | /** |
@@ -7949,8 +7949,8 @@ discard block |
||
7949 | 7949 | * |
7950 | 7950 | * @return string |
7951 | 7951 | */ |
7952 | - static function (array $matches) use ($encoding): string { |
|
7953 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7952 | + static function(array $matches) use ($encoding): string { |
|
7953 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7954 | 7954 | }, |
7955 | 7955 | $str |
7956 | 7956 | ); |
@@ -8053,7 +8053,7 @@ discard block |
||
8053 | 8053 | ); |
8054 | 8054 | |
8055 | 8055 | foreach ($tmpReturn as &$item) { |
8056 | - $item = (string) $item; |
|
8056 | + $item = (string)$item; |
|
8057 | 8057 | } |
8058 | 8058 | |
8059 | 8059 | return $tmpReturn; |
@@ -8098,39 +8098,39 @@ discard block |
||
8098 | 8098 | } |
8099 | 8099 | |
8100 | 8100 | if ($encoding === 'UTF-8') { |
8101 | - if ($length >= (int) \mb_strlen($str)) { |
|
8101 | + if ($length >= (int)\mb_strlen($str)) { |
|
8102 | 8102 | return $str; |
8103 | 8103 | } |
8104 | 8104 | |
8105 | 8105 | if ($substring !== '') { |
8106 | - $length -= (int) \mb_strlen($substring); |
|
8106 | + $length -= (int)\mb_strlen($substring); |
|
8107 | 8107 | |
8108 | 8108 | /** @noinspection UnnecessaryCastingInspection */ |
8109 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
8109 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
8110 | 8110 | } |
8111 | 8111 | |
8112 | 8112 | /** @noinspection UnnecessaryCastingInspection */ |
8113 | - return (string) \mb_substr($str, 0, $length); |
|
8113 | + return (string)\mb_substr($str, 0, $length); |
|
8114 | 8114 | } |
8115 | 8115 | |
8116 | 8116 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8117 | 8117 | |
8118 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8118 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8119 | 8119 | return $str; |
8120 | 8120 | } |
8121 | 8121 | |
8122 | 8122 | if ($substring !== '') { |
8123 | - $length -= (int) self::strlen($substring, $encoding); |
|
8123 | + $length -= (int)self::strlen($substring, $encoding); |
|
8124 | 8124 | } |
8125 | 8125 | |
8126 | 8126 | return ( |
8127 | - (string) self::substr( |
|
8127 | + (string)self::substr( |
|
8128 | 8128 | $str, |
8129 | 8129 | 0, |
8130 | 8130 | $length, |
8131 | 8131 | $encoding |
8132 | 8132 | ) |
8133 | - ) . $substring; |
|
8133 | + ).$substring; |
|
8134 | 8134 | } |
8135 | 8135 | |
8136 | 8136 | /** |
@@ -8160,12 +8160,12 @@ discard block |
||
8160 | 8160 | } |
8161 | 8161 | |
8162 | 8162 | if ($encoding === 'UTF-8') { |
8163 | - if ($length >= (int) \mb_strlen($str)) { |
|
8163 | + if ($length >= (int)\mb_strlen($str)) { |
|
8164 | 8164 | return $str; |
8165 | 8165 | } |
8166 | 8166 | |
8167 | 8167 | // need to further trim the string so we can append the substring |
8168 | - $length -= (int) \mb_strlen($substring); |
|
8168 | + $length -= (int)\mb_strlen($substring); |
|
8169 | 8169 | if ($length <= 0) { |
8170 | 8170 | return $substring; |
8171 | 8171 | } |
@@ -8187,18 +8187,18 @@ discard block |
||
8187 | 8187 | || |
8188 | 8188 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8189 | 8189 | ) { |
8190 | - $truncated = (string) \mb_substr($truncated, 0, (int) $lastPos); |
|
8190 | + $truncated = (string)\mb_substr($truncated, 0, (int)$lastPos); |
|
8191 | 8191 | } |
8192 | 8192 | } |
8193 | 8193 | } else { |
8194 | 8194 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8195 | 8195 | |
8196 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8196 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8197 | 8197 | return $str; |
8198 | 8198 | } |
8199 | 8199 | |
8200 | 8200 | // need to further trim the string so we can append the substring |
8201 | - $length -= (int) self::strlen($substring, $encoding); |
|
8201 | + $length -= (int)self::strlen($substring, $encoding); |
|
8202 | 8202 | if ($length <= 0) { |
8203 | 8203 | return $substring; |
8204 | 8204 | } |
@@ -8220,12 +8220,12 @@ discard block |
||
8220 | 8220 | || |
8221 | 8221 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8222 | 8222 | ) { |
8223 | - $truncated = (string) self::substr($truncated, 0, (int) $lastPos, $encoding); |
|
8223 | + $truncated = (string)self::substr($truncated, 0, (int)$lastPos, $encoding); |
|
8224 | 8224 | } |
8225 | 8225 | } |
8226 | 8226 | } |
8227 | 8227 | |
8228 | - return $truncated . $substring; |
|
8228 | + return $truncated.$substring; |
|
8229 | 8229 | } |
8230 | 8230 | |
8231 | 8231 | /** |
@@ -8315,13 +8315,13 @@ discard block |
||
8315 | 8315 | } |
8316 | 8316 | } elseif ($format === 2) { |
8317 | 8317 | $numberOfWords = []; |
8318 | - $offset = (int) self::strlen($strParts[0]); |
|
8318 | + $offset = (int)self::strlen($strParts[0]); |
|
8319 | 8319 | for ($i = 1; $i < $len; $i += 2) { |
8320 | 8320 | $numberOfWords[$offset] = $strParts[$i]; |
8321 | - $offset += (int) self::strlen($strParts[$i]) + (int) self::strlen($strParts[$i + 1]); |
|
8321 | + $offset += (int)self::strlen($strParts[$i]) + (int)self::strlen($strParts[$i + 1]); |
|
8322 | 8322 | } |
8323 | 8323 | } else { |
8324 | - $numberOfWords = (int) (($len - 1) / 2); |
|
8324 | + $numberOfWords = (int)(($len - 1) / 2); |
|
8325 | 8325 | } |
8326 | 8326 | |
8327 | 8327 | return $numberOfWords; |
@@ -8418,21 +8418,21 @@ discard block |
||
8418 | 8418 | } |
8419 | 8419 | |
8420 | 8420 | if ($charList === '') { |
8421 | - return (int) self::strlen($str, $encoding); |
|
8421 | + return (int)self::strlen($str, $encoding); |
|
8422 | 8422 | } |
8423 | 8423 | |
8424 | 8424 | if ($offset !== null || $length !== null) { |
8425 | 8425 | if ($encoding === 'UTF-8') { |
8426 | 8426 | if ($length === null) { |
8427 | 8427 | /** @noinspection UnnecessaryCastingInspection */ |
8428 | - $strTmp = \mb_substr($str, (int) $offset); |
|
8428 | + $strTmp = \mb_substr($str, (int)$offset); |
|
8429 | 8429 | } else { |
8430 | 8430 | /** @noinspection UnnecessaryCastingInspection */ |
8431 | - $strTmp = \mb_substr($str, (int) $offset, $length); |
|
8431 | + $strTmp = \mb_substr($str, (int)$offset, $length); |
|
8432 | 8432 | } |
8433 | 8433 | } else { |
8434 | 8434 | /** @noinspection UnnecessaryCastingInspection */ |
8435 | - $strTmp = self::substr($str, (int) $offset, $length, $encoding); |
|
8435 | + $strTmp = self::substr($str, (int)$offset, $length, $encoding); |
|
8436 | 8436 | } |
8437 | 8437 | |
8438 | 8438 | if ($strTmp === false) { |
@@ -8447,7 +8447,7 @@ discard block |
||
8447 | 8447 | } |
8448 | 8448 | |
8449 | 8449 | $matches = []; |
8450 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $matches)) { |
|
8450 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $matches)) { |
|
8451 | 8451 | $return = self::strlen($matches[1], $encoding); |
8452 | 8452 | if ($return === false) { |
8453 | 8453 | return 0; |
@@ -8456,7 +8456,7 @@ discard block |
||
8456 | 8456 | return $return; |
8457 | 8457 | } |
8458 | 8458 | |
8459 | - return (int) self::strlen($str, $encoding); |
|
8459 | + return (int)self::strlen($str, $encoding); |
|
8460 | 8460 | } |
8461 | 8461 | |
8462 | 8462 | /** |
@@ -8578,7 +8578,7 @@ discard block |
||
8578 | 8578 | return ''; |
8579 | 8579 | } |
8580 | 8580 | |
8581 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
8581 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
8582 | 8582 | } |
8583 | 8583 | |
8584 | 8584 | /** |
@@ -8643,7 +8643,7 @@ discard block |
||
8643 | 8643 | // fallback for ascii only |
8644 | 8644 | // |
8645 | 8645 | |
8646 | - if (self::is_ascii($haystack . $needle)) { |
|
8646 | + if (self::is_ascii($haystack.$needle)) { |
|
8647 | 8647 | return \stripos($haystack, $needle, $offset); |
8648 | 8648 | } |
8649 | 8649 | |
@@ -8710,7 +8710,7 @@ discard block |
||
8710 | 8710 | && |
8711 | 8711 | self::$SUPPORT['mbstring'] === false |
8712 | 8712 | ) { |
8713 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8713 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8714 | 8714 | } |
8715 | 8715 | |
8716 | 8716 | if ( |
@@ -8724,11 +8724,11 @@ discard block |
||
8724 | 8724 | } |
8725 | 8725 | } |
8726 | 8726 | |
8727 | - if (self::is_ascii($needle . $haystack)) { |
|
8727 | + if (self::is_ascii($needle.$haystack)) { |
|
8728 | 8728 | return \stristr($haystack, $needle, $before_needle); |
8729 | 8729 | } |
8730 | 8730 | |
8731 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
8731 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
8732 | 8732 | |
8733 | 8733 | if (!isset($match[1])) { |
8734 | 8734 | return false; |
@@ -8738,7 +8738,7 @@ discard block |
||
8738 | 8738 | return $match[1]; |
8739 | 8739 | } |
8740 | 8740 | |
8741 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
8741 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
8742 | 8742 | } |
8743 | 8743 | |
8744 | 8744 | /** |
@@ -8805,7 +8805,7 @@ discard block |
||
8805 | 8805 | && |
8806 | 8806 | self::$SUPPORT['iconv'] === false |
8807 | 8807 | ) { |
8808 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8808 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8809 | 8809 | } |
8810 | 8810 | |
8811 | 8811 | // |
@@ -8980,11 +8980,11 @@ discard block |
||
8980 | 8980 | } |
8981 | 8981 | |
8982 | 8982 | if ($encoding === 'UTF-8') { |
8983 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
8984 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
8983 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
8984 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
8985 | 8985 | } else { |
8986 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
8987 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
8986 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
8987 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
8988 | 8988 | } |
8989 | 8989 | |
8990 | 8990 | return self::strcmp($str1, $str2); |
@@ -9006,8 +9006,8 @@ discard block |
||
9006 | 9006 | return false; |
9007 | 9007 | } |
9008 | 9008 | |
9009 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
9010 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
9009 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
9010 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
9011 | 9011 | } |
9012 | 9012 | |
9013 | 9013 | return false; |
@@ -9040,10 +9040,10 @@ discard block |
||
9040 | 9040 | } |
9041 | 9041 | |
9042 | 9042 | // iconv and mbstring do not support integer $needle |
9043 | - if ((int) $needle === $needle) { |
|
9044 | - $needle = (string) self::chr($needle); |
|
9043 | + if ((int)$needle === $needle) { |
|
9044 | + $needle = (string)self::chr($needle); |
|
9045 | 9045 | } |
9046 | - $needle = (string) $needle; |
|
9046 | + $needle = (string)$needle; |
|
9047 | 9047 | |
9048 | 9048 | if ($needle === '') { |
9049 | 9049 | return false; |
@@ -9090,7 +9090,7 @@ discard block |
||
9090 | 9090 | && |
9091 | 9091 | self::$SUPPORT['mbstring'] === false |
9092 | 9092 | ) { |
9093 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9093 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9094 | 9094 | } |
9095 | 9095 | |
9096 | 9096 | // |
@@ -9131,7 +9131,7 @@ discard block |
||
9131 | 9131 | // fallback for ascii only |
9132 | 9132 | // |
9133 | 9133 | |
9134 | - if (self::is_ascii($haystack . $needle)) { |
|
9134 | + if (self::is_ascii($haystack.$needle)) { |
|
9135 | 9135 | return \strpos($haystack, $needle, $offset); |
9136 | 9136 | } |
9137 | 9137 | |
@@ -9143,7 +9143,7 @@ discard block |
||
9143 | 9143 | if ($haystackTmp === false) { |
9144 | 9144 | $haystackTmp = ''; |
9145 | 9145 | } |
9146 | - $haystack = (string) $haystackTmp; |
|
9146 | + $haystack = (string)$haystackTmp; |
|
9147 | 9147 | |
9148 | 9148 | if ($offset < 0) { |
9149 | 9149 | $offset = 0; |
@@ -9155,7 +9155,7 @@ discard block |
||
9155 | 9155 | } |
9156 | 9156 | |
9157 | 9157 | if ($pos) { |
9158 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9158 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9159 | 9159 | } |
9160 | 9160 | |
9161 | 9161 | return $offset + 0; |
@@ -9266,7 +9266,7 @@ discard block |
||
9266 | 9266 | && |
9267 | 9267 | self::$SUPPORT['mbstring'] === false |
9268 | 9268 | ) { |
9269 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9269 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9270 | 9270 | } |
9271 | 9271 | |
9272 | 9272 | // |
@@ -9278,7 +9278,7 @@ discard block |
||
9278 | 9278 | if ($needleTmp === false) { |
9279 | 9279 | return false; |
9280 | 9280 | } |
9281 | - $needle = (string) $needleTmp; |
|
9281 | + $needle = (string)$needleTmp; |
|
9282 | 9282 | |
9283 | 9283 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
9284 | 9284 | if ($pos === false) { |
@@ -9300,7 +9300,7 @@ discard block |
||
9300 | 9300 | if ($needleTmp === false) { |
9301 | 9301 | return false; |
9302 | 9302 | } |
9303 | - $needle = (string) $needleTmp; |
|
9303 | + $needle = (string)$needleTmp; |
|
9304 | 9304 | |
9305 | 9305 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
9306 | 9306 | if ($pos === false) { |
@@ -9336,7 +9336,7 @@ discard block |
||
9336 | 9336 | if ($encoding === 'UTF-8') { |
9337 | 9337 | if (self::$SUPPORT['intl'] === true) { |
9338 | 9338 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
9339 | - $i = (int) \grapheme_strlen($str); |
|
9339 | + $i = (int)\grapheme_strlen($str); |
|
9340 | 9340 | while ($i--) { |
9341 | 9341 | $reversedTmp = \grapheme_substr($str, $i, 1); |
9342 | 9342 | if ($reversedTmp !== false) { |
@@ -9344,7 +9344,7 @@ discard block |
||
9344 | 9344 | } |
9345 | 9345 | } |
9346 | 9346 | } else { |
9347 | - $i = (int) \mb_strlen($str); |
|
9347 | + $i = (int)\mb_strlen($str); |
|
9348 | 9348 | while ($i--) { |
9349 | 9349 | $reversedTmp = \mb_substr($str, $i, 1); |
9350 | 9350 | if ($reversedTmp !== false) { |
@@ -9355,7 +9355,7 @@ discard block |
||
9355 | 9355 | } else { |
9356 | 9356 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9357 | 9357 | |
9358 | - $i = (int) self::strlen($str, $encoding); |
|
9358 | + $i = (int)self::strlen($str, $encoding); |
|
9359 | 9359 | while ($i--) { |
9360 | 9360 | $reversedTmp = self::substr($str, $i, 1, $encoding); |
9361 | 9361 | if ($reversedTmp !== false) { |
@@ -9429,7 +9429,7 @@ discard block |
||
9429 | 9429 | if ($needleTmp === false) { |
9430 | 9430 | return false; |
9431 | 9431 | } |
9432 | - $needle = (string) $needleTmp; |
|
9432 | + $needle = (string)$needleTmp; |
|
9433 | 9433 | |
9434 | 9434 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
9435 | 9435 | if ($pos === false) { |
@@ -9468,10 +9468,10 @@ discard block |
||
9468 | 9468 | } |
9469 | 9469 | |
9470 | 9470 | // iconv and mbstring do not support integer $needle |
9471 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9472 | - $needle = (string) self::chr($needle); |
|
9471 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9472 | + $needle = (string)self::chr($needle); |
|
9473 | 9473 | } |
9474 | - $needle = (string) $needle; |
|
9474 | + $needle = (string)$needle; |
|
9475 | 9475 | |
9476 | 9476 | if ($needle === '') { |
9477 | 9477 | return false; |
@@ -9516,7 +9516,7 @@ discard block |
||
9516 | 9516 | && |
9517 | 9517 | self::$SUPPORT['mbstring'] === false |
9518 | 9518 | ) { |
9519 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9519 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9520 | 9520 | } |
9521 | 9521 | |
9522 | 9522 | // |
@@ -9540,7 +9540,7 @@ discard block |
||
9540 | 9540 | // fallback for ascii only |
9541 | 9541 | // |
9542 | 9542 | |
9543 | - if (self::is_ascii($haystack . $needle)) { |
|
9543 | + if (self::is_ascii($haystack.$needle)) { |
|
9544 | 9544 | return \strripos($haystack, $needle, $offset); |
9545 | 9545 | } |
9546 | 9546 | |
@@ -9616,10 +9616,10 @@ discard block |
||
9616 | 9616 | } |
9617 | 9617 | |
9618 | 9618 | // iconv and mbstring do not support integer $needle |
9619 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9620 | - $needle = (string) self::chr($needle); |
|
9619 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9620 | + $needle = (string)self::chr($needle); |
|
9621 | 9621 | } |
9622 | - $needle = (string) $needle; |
|
9622 | + $needle = (string)$needle; |
|
9623 | 9623 | |
9624 | 9624 | if ($needle === '') { |
9625 | 9625 | return false; |
@@ -9664,7 +9664,7 @@ discard block |
||
9664 | 9664 | && |
9665 | 9665 | self::$SUPPORT['mbstring'] === false |
9666 | 9666 | ) { |
9667 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9667 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9668 | 9668 | } |
9669 | 9669 | |
9670 | 9670 | // |
@@ -9688,7 +9688,7 @@ discard block |
||
9688 | 9688 | // fallback for ascii only |
9689 | 9689 | // |
9690 | 9690 | |
9691 | - if (self::is_ascii($haystack . $needle)) { |
|
9691 | + if (self::is_ascii($haystack.$needle)) { |
|
9692 | 9692 | return \strrpos($haystack, $needle, $offset); |
9693 | 9693 | } |
9694 | 9694 | |
@@ -9708,7 +9708,7 @@ discard block |
||
9708 | 9708 | if ($haystackTmp === false) { |
9709 | 9709 | $haystackTmp = ''; |
9710 | 9710 | } |
9711 | - $haystack = (string) $haystackTmp; |
|
9711 | + $haystack = (string)$haystackTmp; |
|
9712 | 9712 | } |
9713 | 9713 | |
9714 | 9714 | $pos = \strrpos($haystack, $needle); |
@@ -9721,7 +9721,7 @@ discard block |
||
9721 | 9721 | return false; |
9722 | 9722 | } |
9723 | 9723 | |
9724 | - return $offset + (int) self::strlen($strTmp); |
|
9724 | + return $offset + (int)self::strlen($strTmp); |
|
9725 | 9725 | } |
9726 | 9726 | |
9727 | 9727 | /** |
@@ -9781,12 +9781,12 @@ discard block |
||
9781 | 9781 | if ($offset || $length !== null) { |
9782 | 9782 | if ($encoding === 'UTF-8') { |
9783 | 9783 | if ($length === null) { |
9784 | - $str = (string) \mb_substr($str, $offset); |
|
9784 | + $str = (string)\mb_substr($str, $offset); |
|
9785 | 9785 | } else { |
9786 | - $str = (string) \mb_substr($str, $offset, $length); |
|
9786 | + $str = (string)\mb_substr($str, $offset, $length); |
|
9787 | 9787 | } |
9788 | 9788 | } else { |
9789 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
9789 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
9790 | 9790 | } |
9791 | 9791 | } |
9792 | 9792 | |
@@ -9796,7 +9796,7 @@ discard block |
||
9796 | 9796 | |
9797 | 9797 | $matches = []; |
9798 | 9798 | |
9799 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
9799 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
9800 | 9800 | } |
9801 | 9801 | |
9802 | 9802 | /** |
@@ -9865,7 +9865,7 @@ discard block |
||
9865 | 9865 | && |
9866 | 9866 | self::$SUPPORT['mbstring'] === false |
9867 | 9867 | ) { |
9868 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9868 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9869 | 9869 | } |
9870 | 9870 | |
9871 | 9871 | // |
@@ -9887,7 +9887,7 @@ discard block |
||
9887 | 9887 | // fallback for ascii only |
9888 | 9888 | // |
9889 | 9889 | |
9890 | - if (self::is_ascii($haystack . $needle)) { |
|
9890 | + if (self::is_ascii($haystack.$needle)) { |
|
9891 | 9891 | return \strstr($haystack, $needle, $before_needle); |
9892 | 9892 | } |
9893 | 9893 | |
@@ -9895,7 +9895,7 @@ discard block |
||
9895 | 9895 | // fallback via vanilla php |
9896 | 9896 | // |
9897 | 9897 | |
9898 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
9898 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
9899 | 9899 | |
9900 | 9900 | if (!isset($match[1])) { |
9901 | 9901 | return false; |
@@ -9905,7 +9905,7 @@ discard block |
||
9905 | 9905 | return $match[1]; |
9906 | 9906 | } |
9907 | 9907 | |
9908 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
9908 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
9909 | 9909 | } |
9910 | 9910 | |
9911 | 9911 | /** |
@@ -10019,7 +10019,7 @@ discard block |
||
10019 | 10019 | bool $tryToKeepStringLength = false |
10020 | 10020 | ): string { |
10021 | 10021 | // init |
10022 | - $str = (string) $str; |
|
10022 | + $str = (string)$str; |
|
10023 | 10023 | |
10024 | 10024 | if ($str === '') { |
10025 | 10025 | return ''; |
@@ -10048,19 +10048,19 @@ discard block |
||
10048 | 10048 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10049 | 10049 | } |
10050 | 10050 | |
10051 | - $langCode = $lang . '-Lower'; |
|
10051 | + $langCode = $lang.'-Lower'; |
|
10052 | 10052 | if (!\in_array($langCode, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10053 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, \E_USER_WARNING); |
|
10053 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, \E_USER_WARNING); |
|
10054 | 10054 | |
10055 | 10055 | $langCode = 'Any-Lower'; |
10056 | 10056 | } |
10057 | 10057 | |
10058 | 10058 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10059 | 10059 | /** @noinspection UnnecessaryCastingInspection */ |
10060 | - return (string) \transliterator_transliterate($langCode, $str); |
|
10060 | + return (string)\transliterator_transliterate($langCode, $str); |
|
10061 | 10061 | } |
10062 | 10062 | |
10063 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
10063 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
10064 | 10064 | } |
10065 | 10065 | |
10066 | 10066 | // always fallback via symfony polyfill |
@@ -10089,7 +10089,7 @@ discard block |
||
10089 | 10089 | bool $tryToKeepStringLength = false |
10090 | 10090 | ): string { |
10091 | 10091 | // init |
10092 | - $str = (string) $str; |
|
10092 | + $str = (string)$str; |
|
10093 | 10093 | |
10094 | 10094 | if ($str === '') { |
10095 | 10095 | return ''; |
@@ -10118,19 +10118,19 @@ discard block |
||
10118 | 10118 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10119 | 10119 | } |
10120 | 10120 | |
10121 | - $langCode = $lang . '-Upper'; |
|
10121 | + $langCode = $lang.'-Upper'; |
|
10122 | 10122 | if (!\in_array($langCode, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10123 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
10123 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
10124 | 10124 | |
10125 | 10125 | $langCode = 'Any-Upper'; |
10126 | 10126 | } |
10127 | 10127 | |
10128 | 10128 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10129 | 10129 | /** @noinspection UnnecessaryCastingInspection */ |
10130 | - return (string) \transliterator_transliterate($langCode, $str); |
|
10130 | + return (string)\transliterator_transliterate($langCode, $str); |
|
10131 | 10131 | } |
10132 | 10132 | |
10133 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
10133 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
10134 | 10134 | } |
10135 | 10135 | |
10136 | 10136 | // always fallback via symfony polyfill |
@@ -10174,7 +10174,7 @@ discard block |
||
10174 | 10174 | |
10175 | 10175 | $from = \array_combine($from, $to); |
10176 | 10176 | if ($from === false) { |
10177 | - 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) . ')'); |
|
10177 | + 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).')'); |
|
10178 | 10178 | } |
10179 | 10179 | } |
10180 | 10180 | |
@@ -10231,9 +10231,9 @@ discard block |
||
10231 | 10231 | } |
10232 | 10232 | |
10233 | 10233 | $wide = 0; |
10234 | - $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); |
|
10234 | + $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); |
|
10235 | 10235 | |
10236 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
10236 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
10237 | 10237 | } |
10238 | 10238 | |
10239 | 10239 | /** |
@@ -10333,9 +10333,9 @@ discard block |
||
10333 | 10333 | } |
10334 | 10334 | |
10335 | 10335 | if ($length === null) { |
10336 | - $length = (int) $str_length; |
|
10336 | + $length = (int)$str_length; |
|
10337 | 10337 | } else { |
10338 | - $length = (int) $length; |
|
10338 | + $length = (int)$length; |
|
10339 | 10339 | } |
10340 | 10340 | |
10341 | 10341 | if ( |
@@ -10343,7 +10343,7 @@ discard block |
||
10343 | 10343 | && |
10344 | 10344 | self::$SUPPORT['mbstring'] === false |
10345 | 10345 | ) { |
10346 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10346 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10347 | 10347 | } |
10348 | 10348 | |
10349 | 10349 | // |
@@ -10431,16 +10431,16 @@ discard block |
||
10431 | 10431 | ) { |
10432 | 10432 | if ($encoding === 'UTF-8') { |
10433 | 10433 | if ($length === null) { |
10434 | - $str1 = (string) \mb_substr($str1, $offset); |
|
10434 | + $str1 = (string)\mb_substr($str1, $offset); |
|
10435 | 10435 | } else { |
10436 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
10436 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
10437 | 10437 | } |
10438 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
10438 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
10439 | 10439 | } else { |
10440 | 10440 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10441 | 10441 | |
10442 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
10443 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
10442 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
10443 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
10444 | 10444 | } |
10445 | 10445 | } |
10446 | 10446 | |
@@ -10502,13 +10502,13 @@ discard block |
||
10502 | 10502 | if ($lengthTmp === false) { |
10503 | 10503 | return false; |
10504 | 10504 | } |
10505 | - $length = (int) $lengthTmp; |
|
10505 | + $length = (int)$lengthTmp; |
|
10506 | 10506 | } |
10507 | 10507 | |
10508 | 10508 | if ($encoding === 'UTF-8') { |
10509 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
10509 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
10510 | 10510 | } else { |
10511 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
10511 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
10512 | 10512 | } |
10513 | 10513 | } |
10514 | 10514 | |
@@ -10517,7 +10517,7 @@ discard block |
||
10517 | 10517 | && |
10518 | 10518 | self::$SUPPORT['mbstring'] === false |
10519 | 10519 | ) { |
10520 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10520 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10521 | 10521 | } |
10522 | 10522 | |
10523 | 10523 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10528,7 +10528,7 @@ discard block |
||
10528 | 10528 | return \mb_substr_count($haystack, $needle, $encoding); |
10529 | 10529 | } |
10530 | 10530 | |
10531 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10531 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10532 | 10532 | |
10533 | 10533 | return \count($matches); |
10534 | 10534 | } |
@@ -10575,7 +10575,7 @@ discard block |
||
10575 | 10575 | if ($lengthTmp === false) { |
10576 | 10576 | return false; |
10577 | 10577 | } |
10578 | - $length = (int) $lengthTmp; |
|
10578 | + $length = (int)$lengthTmp; |
|
10579 | 10579 | } |
10580 | 10580 | |
10581 | 10581 | if ( |
@@ -10596,7 +10596,7 @@ discard block |
||
10596 | 10596 | if ($haystackTmp === false) { |
10597 | 10597 | $haystackTmp = ''; |
10598 | 10598 | } |
10599 | - $haystack = (string) $haystackTmp; |
|
10599 | + $haystack = (string)$haystackTmp; |
|
10600 | 10600 | } |
10601 | 10601 | |
10602 | 10602 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10635,10 +10635,10 @@ discard block |
||
10635 | 10635 | |
10636 | 10636 | if ($encoding === 'UTF-8') { |
10637 | 10637 | if ($caseSensitive) { |
10638 | - return (int) \mb_substr_count($str, $substring); |
|
10638 | + return (int)\mb_substr_count($str, $substring); |
|
10639 | 10639 | } |
10640 | 10640 | |
10641 | - return (int) \mb_substr_count( |
|
10641 | + return (int)\mb_substr_count( |
|
10642 | 10642 | \mb_strtoupper($str), |
10643 | 10643 | \mb_strtoupper($substring) |
10644 | 10644 | |
@@ -10648,10 +10648,10 @@ discard block |
||
10648 | 10648 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10649 | 10649 | |
10650 | 10650 | if ($caseSensitive) { |
10651 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
10651 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
10652 | 10652 | } |
10653 | 10653 | |
10654 | - return (int) \mb_substr_count( |
|
10654 | + return (int)\mb_substr_count( |
|
10655 | 10655 | self::strtocasefold($str, true, false, $encoding, null, false), |
10656 | 10656 | self::strtocasefold($substring, true, false, $encoding, null, false), |
10657 | 10657 | $encoding |
@@ -10677,7 +10677,7 @@ discard block |
||
10677 | 10677 | } |
10678 | 10678 | |
10679 | 10679 | if (self::str_istarts_with($haystack, $needle) === true) { |
10680 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10680 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10681 | 10681 | } |
10682 | 10682 | |
10683 | 10683 | return $haystack; |
@@ -10734,7 +10734,7 @@ discard block |
||
10734 | 10734 | } |
10735 | 10735 | |
10736 | 10736 | if (self::str_iends_with($haystack, $needle) === true) { |
10737 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
10737 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
10738 | 10738 | } |
10739 | 10739 | |
10740 | 10740 | return $haystack; |
@@ -10759,7 +10759,7 @@ discard block |
||
10759 | 10759 | } |
10760 | 10760 | |
10761 | 10761 | if (self::str_starts_with($haystack, $needle) === true) { |
10762 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10762 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10763 | 10763 | } |
10764 | 10764 | |
10765 | 10765 | return $haystack; |
@@ -10811,7 +10811,7 @@ discard block |
||
10811 | 10811 | if (\is_array($offset) === true) { |
10812 | 10812 | $offset = \array_slice($offset, 0, $num); |
10813 | 10813 | foreach ($offset as &$valueTmp) { |
10814 | - $valueTmp = (int) $valueTmp === $valueTmp ? $valueTmp : 0; |
|
10814 | + $valueTmp = (int)$valueTmp === $valueTmp ? $valueTmp : 0; |
|
10815 | 10815 | } |
10816 | 10816 | unset($valueTmp); |
10817 | 10817 | } else { |
@@ -10824,7 +10824,7 @@ discard block |
||
10824 | 10824 | } elseif (\is_array($length) === true) { |
10825 | 10825 | $length = \array_slice($length, 0, $num); |
10826 | 10826 | foreach ($length as &$valueTmpV2) { |
10827 | - $valueTmpV2 = (int) $valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10827 | + $valueTmpV2 = (int)$valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10828 | 10828 | } |
10829 | 10829 | unset($valueTmpV2); |
10830 | 10830 | } else { |
@@ -10844,8 +10844,8 @@ discard block |
||
10844 | 10844 | } |
10845 | 10845 | |
10846 | 10846 | // init |
10847 | - $str = (string) $str; |
|
10848 | - $replacement = (string) $replacement; |
|
10847 | + $str = (string)$str; |
|
10848 | + $replacement = (string)$replacement; |
|
10849 | 10849 | |
10850 | 10850 | if (\is_array($length) === true) { |
10851 | 10851 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -10860,16 +10860,16 @@ discard block |
||
10860 | 10860 | } |
10861 | 10861 | |
10862 | 10862 | if (self::$SUPPORT['mbstring'] === true) { |
10863 | - $string_length = (int) self::strlen($str, $encoding); |
|
10863 | + $string_length = (int)self::strlen($str, $encoding); |
|
10864 | 10864 | |
10865 | 10865 | if ($offset < 0) { |
10866 | - $offset = (int) \max(0, $string_length + $offset); |
|
10866 | + $offset = (int)\max(0, $string_length + $offset); |
|
10867 | 10867 | } elseif ($offset > $string_length) { |
10868 | 10868 | $offset = $string_length; |
10869 | 10869 | } |
10870 | 10870 | |
10871 | 10871 | if ($length !== null && $length < 0) { |
10872 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
10872 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
10873 | 10873 | } elseif ($length === null || $length > $string_length) { |
10874 | 10874 | $length = $string_length; |
10875 | 10875 | } |
@@ -10880,9 +10880,9 @@ discard block |
||
10880 | 10880 | } |
10881 | 10881 | |
10882 | 10882 | /** @noinspection AdditionOperationOnArraysInspection */ |
10883 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
10884 | - $replacement . |
|
10885 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10883 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
10884 | + $replacement. |
|
10885 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10886 | 10886 | } |
10887 | 10887 | |
10888 | 10888 | // |
@@ -10891,8 +10891,7 @@ discard block |
||
10891 | 10891 | |
10892 | 10892 | if (self::is_ascii($str)) { |
10893 | 10893 | return ($length === null) ? |
10894 | - \substr_replace($str, $replacement, $offset) : |
|
10895 | - \substr_replace($str, $replacement, $offset, $length); |
|
10894 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
10896 | 10895 | } |
10897 | 10896 | |
10898 | 10897 | // |
@@ -10908,7 +10907,7 @@ discard block |
||
10908 | 10907 | // e.g.: non mbstring support + invalid chars |
10909 | 10908 | return ''; |
10910 | 10909 | } |
10911 | - $length = (int) $lengthTmp; |
|
10910 | + $length = (int)$lengthTmp; |
|
10912 | 10911 | } |
10913 | 10912 | |
10914 | 10913 | \array_splice($smatches[0], $offset, $length, $rmatches[0]); |
@@ -10943,14 +10942,14 @@ discard block |
||
10943 | 10942 | && |
10944 | 10943 | \substr($haystack, -\strlen($needle)) === $needle |
10945 | 10944 | ) { |
10946 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
10945 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
10947 | 10946 | } |
10948 | 10947 | |
10949 | 10948 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
10950 | - return (string) self::substr( |
|
10949 | + return (string)self::substr( |
|
10951 | 10950 | $haystack, |
10952 | 10951 | 0, |
10953 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
10952 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
10954 | 10953 | $encoding |
10955 | 10954 | ); |
10956 | 10955 | } |
@@ -10980,10 +10979,10 @@ discard block |
||
10980 | 10979 | } |
10981 | 10980 | |
10982 | 10981 | if ($encoding === 'UTF-8') { |
10983 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10982 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10984 | 10983 | } |
10985 | 10984 | |
10986 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10985 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10987 | 10986 | } |
10988 | 10987 | |
10989 | 10988 | /** |
@@ -11175,7 +11174,7 @@ discard block |
||
11175 | 11174 | // INFO: https://unicode.org/cldr/utility/character.jsp?a=%E2%84%8C |
11176 | 11175 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11177 | 11176 | /** @noinspection UnnecessaryCastingInspection */ |
11178 | - $str = (string) \transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11177 | + $str = (string)\transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11179 | 11178 | |
11180 | 11179 | // check again, if we only have ASCII, now ... |
11181 | 11180 | if (self::is_ascii($str) === true) { |
@@ -11298,7 +11297,7 @@ discard block |
||
11298 | 11297 | public static function to_boolean($str): bool |
11299 | 11298 | { |
11300 | 11299 | // init |
11301 | - $str = (string) $str; |
|
11300 | + $str = (string)$str; |
|
11302 | 11301 | |
11303 | 11302 | if ($str === '') { |
11304 | 11303 | return false; |
@@ -11326,10 +11325,10 @@ discard block |
||
11326 | 11325 | } |
11327 | 11326 | |
11328 | 11327 | if (\is_numeric($str)) { |
11329 | - return ((float) $str + 0) > 0; |
|
11328 | + return ((float)$str + 0) > 0; |
|
11330 | 11329 | } |
11331 | 11330 | |
11332 | - return (bool) \trim($str); |
|
11331 | + return (bool)\trim($str); |
|
11333 | 11332 | } |
11334 | 11333 | |
11335 | 11334 | /** |
@@ -11350,11 +11349,11 @@ discard block |
||
11350 | 11349 | |
11351 | 11350 | $fallback_char_escaped = \preg_quote($fallback_char, '/'); |
11352 | 11351 | |
11353 | - $string = (string) \preg_replace( |
|
11352 | + $string = (string)\preg_replace( |
|
11354 | 11353 | [ |
11355 | - '/[^' . $fallback_char_escaped . '\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
11356 | - '/[\s]+/u', // 2) convert spaces to $fallback_char |
|
11357 | - '/[' . $fallback_char_escaped . ']+/u', // 3) remove double $fallback_char's |
|
11354 | + '/[^'.$fallback_char_escaped.'\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
11355 | + '/[\s]+/u', // 2) convert spaces to $fallback_char |
|
11356 | + '/['.$fallback_char_escaped.']+/u', // 3) remove double $fallback_char's |
|
11358 | 11357 | ], |
11359 | 11358 | [ |
11360 | 11359 | '', |
@@ -11385,7 +11384,7 @@ discard block |
||
11385 | 11384 | return $str; |
11386 | 11385 | } |
11387 | 11386 | |
11388 | - $str = (string) $str; |
|
11387 | + $str = (string)$str; |
|
11389 | 11388 | if ($str === '') { |
11390 | 11389 | return ''; |
11391 | 11390 | } |
@@ -11432,7 +11431,7 @@ discard block |
||
11432 | 11431 | return $str; |
11433 | 11432 | } |
11434 | 11433 | |
11435 | - $str = (string) $str; |
|
11434 | + $str = (string)$str; |
|
11436 | 11435 | if ($str === '') { |
11437 | 11436 | return $str; |
11438 | 11437 | } |
@@ -11450,7 +11449,7 @@ discard block |
||
11450 | 11449 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
11451 | 11450 | |
11452 | 11451 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11453 | - $buf .= $c1 . $c2; |
|
11452 | + $buf .= $c1.$c2; |
|
11454 | 11453 | ++$i; |
11455 | 11454 | } else { // not valid UTF8 - convert it |
11456 | 11455 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11461,7 +11460,7 @@ discard block |
||
11461 | 11460 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
11462 | 11461 | |
11463 | 11462 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11464 | - $buf .= $c1 . $c2 . $c3; |
|
11463 | + $buf .= $c1.$c2.$c3; |
|
11465 | 11464 | $i += 2; |
11466 | 11465 | } else { // not valid UTF8 - convert it |
11467 | 11466 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11473,7 +11472,7 @@ discard block |
||
11473 | 11472 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
11474 | 11473 | |
11475 | 11474 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11476 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
11475 | + $buf .= $c1.$c2.$c3.$c4; |
|
11477 | 11476 | $i += 3; |
11478 | 11477 | } else { // not valid UTF8 - convert it |
11479 | 11478 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11499,13 +11498,13 @@ discard block |
||
11499 | 11498 | * |
11500 | 11499 | * @return string |
11501 | 11500 | */ |
11502 | - static function (array $matches): string { |
|
11501 | + static function(array $matches): string { |
|
11503 | 11502 | if (isset($matches[3])) { |
11504 | - $cp = (int) \hexdec($matches[3]); |
|
11503 | + $cp = (int)\hexdec($matches[3]); |
|
11505 | 11504 | } else { |
11506 | 11505 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
11507 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
11508 | - + (int) \hexdec($matches[2]) |
|
11506 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
11507 | + + (int)\hexdec($matches[2]) |
|
11509 | 11508 | + 0x10000 |
11510 | 11509 | - (0xD800 << 10) |
11511 | 11510 | - 0xDC00; |
@@ -11516,12 +11515,12 @@ discard block |
||
11516 | 11515 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
11517 | 11516 | |
11518 | 11517 | if ($cp < 0x80) { |
11519 | - return (string) self::chr($cp); |
|
11518 | + return (string)self::chr($cp); |
|
11520 | 11519 | } |
11521 | 11520 | |
11522 | 11521 | if ($cp < 0xA0) { |
11523 | 11522 | /** @noinspection UnnecessaryCastingInspection */ |
11524 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
11523 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
11525 | 11524 | } |
11526 | 11525 | |
11527 | 11526 | return self::decimal_to_chr($cp); |
@@ -11569,7 +11568,7 @@ discard block |
||
11569 | 11568 | |
11570 | 11569 | if (self::$SUPPORT['mbstring'] === true) { |
11571 | 11570 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11572 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
11571 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
11573 | 11572 | } |
11574 | 11573 | |
11575 | 11574 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -11606,15 +11605,15 @@ discard block |
||
11606 | 11605 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
11607 | 11606 | |
11608 | 11607 | if ($encoding === 'UTF-8') { |
11609 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
11608 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
11610 | 11609 | |
11611 | 11610 | if ($useMbFunction === true) { |
11612 | 11611 | $strPartOne = \mb_strtoupper( |
11613 | - (string) \mb_substr($str, 0, 1) |
|
11612 | + (string)\mb_substr($str, 0, 1) |
|
11614 | 11613 | ); |
11615 | 11614 | } else { |
11616 | 11615 | $strPartOne = self::strtoupper( |
11617 | - (string) \mb_substr($str, 0, 1), |
|
11616 | + (string)\mb_substr($str, 0, 1), |
|
11618 | 11617 | $encoding, |
11619 | 11618 | false, |
11620 | 11619 | $lang, |
@@ -11624,16 +11623,16 @@ discard block |
||
11624 | 11623 | } else { |
11625 | 11624 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11626 | 11625 | |
11627 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
11626 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
11628 | 11627 | |
11629 | 11628 | if ($useMbFunction === true) { |
11630 | 11629 | $strPartOne = \mb_strtoupper( |
11631 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
11630 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
11632 | 11631 | $encoding |
11633 | 11632 | ); |
11634 | 11633 | } else { |
11635 | 11634 | $strPartOne = self::strtoupper( |
11636 | - (string) self::substr($str, 0, 1, $encoding), |
|
11635 | + (string)self::substr($str, 0, 1, $encoding), |
|
11637 | 11636 | $encoding, |
11638 | 11637 | false, |
11639 | 11638 | $lang, |
@@ -11642,7 +11641,7 @@ discard block |
||
11642 | 11641 | } |
11643 | 11642 | } |
11644 | 11643 | |
11645 | - return $strPartOne . $strPartTwo; |
|
11644 | + return $strPartOne.$strPartTwo; |
|
11646 | 11645 | } |
11647 | 11646 | |
11648 | 11647 | /** |
@@ -11693,7 +11692,7 @@ discard block |
||
11693 | 11692 | $str = self::clean($str); |
11694 | 11693 | } |
11695 | 11694 | |
11696 | - $usePhpDefaultFunctions = !(bool) ($charlist . \implode('', $exceptions)); |
|
11695 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
11697 | 11696 | |
11698 | 11697 | if ( |
11699 | 11698 | $usePhpDefaultFunctions === true |
@@ -12080,7 +12079,7 @@ discard block |
||
12080 | 12079 | if ( |
12081 | 12080 | $keepUtf8Chars === true |
12082 | 12081 | && |
12083 | - self::strlen($return) >= (int) self::strlen($str_backup) |
|
12082 | + self::strlen($return) >= (int)self::strlen($str_backup) |
|
12084 | 12083 | ) { |
12085 | 12084 | return $str_backup; |
12086 | 12085 | } |
@@ -12156,17 +12155,17 @@ discard block |
||
12156 | 12155 | return ''; |
12157 | 12156 | } |
12158 | 12157 | |
12159 | - \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches); |
|
12158 | + \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches); |
|
12160 | 12159 | |
12161 | 12160 | if ( |
12162 | 12161 | !isset($matches[0]) |
12163 | 12162 | || |
12164 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
12163 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
12165 | 12164 | ) { |
12166 | 12165 | return $str; |
12167 | 12166 | } |
12168 | 12167 | |
12169 | - return \rtrim($matches[0]) . $strAddOn; |
|
12168 | + return \rtrim($matches[0]).$strAddOn; |
|
12170 | 12169 | } |
12171 | 12170 | |
12172 | 12171 | /** |
@@ -12237,7 +12236,7 @@ discard block |
||
12237 | 12236 | $strReturn .= $break; |
12238 | 12237 | } |
12239 | 12238 | |
12240 | - return $strReturn . \implode('', $chars); |
|
12239 | + return $strReturn.\implode('', $chars); |
|
12241 | 12240 | } |
12242 | 12241 | |
12243 | 12242 | /** |
@@ -12250,7 +12249,7 @@ discard block |
||
12250 | 12249 | */ |
12251 | 12250 | public static function wordwrap_per_line(string $str, int $limit): string |
12252 | 12251 | { |
12253 | - $strings = (array) \preg_split('/\\r\\n|\\r|\\n/', $str); |
|
12252 | + $strings = (array)\preg_split('/\\r\\n|\\r|\\n/', $str); |
|
12254 | 12253 | |
12255 | 12254 | $string = ''; |
12256 | 12255 | foreach ($strings as &$value) { |
@@ -12329,7 +12328,7 @@ discard block |
||
12329 | 12328 | /** @noinspection PhpIncludeInspection */ |
12330 | 12329 | /** @noinspection UsingInclusionReturnValueInspection */ |
12331 | 12330 | /** @psalm-suppress UnresolvableInclude */ |
12332 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
12331 | + return include __DIR__.'/data/'.$file.'.php'; |
|
12333 | 12332 | } |
12334 | 12333 | |
12335 | 12334 | /** |
@@ -12341,7 +12340,7 @@ discard block |
||
12341 | 12340 | */ |
12342 | 12341 | private static function getDataIfExists(string $file) |
12343 | 12342 | { |
12344 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
12343 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
12345 | 12344 | if (\file_exists($file)) { |
12346 | 12345 | /** @noinspection PhpIncludeInspection */ |
12347 | 12346 | /** @noinspection UsingInclusionReturnValueInspection */ |
@@ -12363,7 +12362,7 @@ discard block |
||
12363 | 12362 | |
12364 | 12363 | \uksort( |
12365 | 12364 | self::$EMOJI, |
12366 | - static function (string $a, string $b): int { |
|
12365 | + static function(string $a, string $b): int { |
|
12367 | 12366 | return \strlen($b) <=> \strlen($a); |
12368 | 12367 | } |
12369 | 12368 | ); |
@@ -12373,7 +12372,7 @@ discard block |
||
12373 | 12372 | |
12374 | 12373 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
12375 | 12374 | $tmpKey = \crc32($key); |
12376 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmpKey . '_-_' . \strrev((string) $tmpKey) . '_-_8FTU_ELBATROP_-_'; |
|
12375 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmpKey.'_-_'.\strrev((string)$tmpKey).'_-_8FTU_ELBATROP_-_'; |
|
12377 | 12376 | } |
12378 | 12377 | |
12379 | 12378 | return true; |
@@ -12397,7 +12396,7 @@ discard block |
||
12397 | 12396 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
12398 | 12397 | return \defined('MB_OVERLOAD_STRING') |
12399 | 12398 | && |
12400 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12399 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12401 | 12400 | } |
12402 | 12401 | |
12403 | 12402 | /** |
@@ -12447,7 +12446,7 @@ discard block |
||
12447 | 12446 | { |
12448 | 12447 | static $RX_CLASS_CACHE = []; |
12449 | 12448 | |
12450 | - $cacheKey = $s . $class; |
|
12449 | + $cacheKey = $s.$class; |
|
12451 | 12450 | |
12452 | 12451 | if (isset($RX_CLASS_CACHE[$cacheKey])) { |
12453 | 12452 | return $RX_CLASS_CACHE[$cacheKey]; |
@@ -12459,7 +12458,7 @@ discard block |
||
12459 | 12458 | /** @noinspection AlterInForeachInspection */ |
12460 | 12459 | foreach (self::str_split($s) as &$s) { |
12461 | 12460 | if ($s === '-') { |
12462 | - $classArray[0] = '-' . $classArray[0]; |
|
12461 | + $classArray[0] = '-'.$classArray[0]; |
|
12463 | 12462 | } elseif (!isset($s[2])) { |
12464 | 12463 | $classArray[0] .= \preg_quote($s, '/'); |
12465 | 12464 | } elseif (self::strlen($s) === 1) { |
@@ -12470,13 +12469,13 @@ discard block |
||
12470 | 12469 | } |
12471 | 12470 | |
12472 | 12471 | if ($classArray[0]) { |
12473 | - $classArray[0] = '[' . $classArray[0] . ']'; |
|
12472 | + $classArray[0] = '['.$classArray[0].']'; |
|
12474 | 12473 | } |
12475 | 12474 | |
12476 | 12475 | if (\count($classArray) === 1) { |
12477 | 12476 | $return = $classArray[0]; |
12478 | 12477 | } else { |
12479 | - $return = '(?:' . \implode('|', $classArray) . ')'; |
|
12478 | + $return = '(?:'.\implode('|', $classArray).')'; |
|
12480 | 12479 | } |
12481 | 12480 | |
12482 | 12481 | $RX_CLASS_CACHE[$cacheKey] = $return; |
@@ -12550,7 +12549,7 @@ discard block |
||
12550 | 12549 | $continue = false; |
12551 | 12550 | |
12552 | 12551 | if ($delimiter === '-') { |
12553 | - foreach ((array) $specialCases['names'] as &$beginning) { |
|
12552 | + foreach ((array)$specialCases['names'] as &$beginning) { |
|
12554 | 12553 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12555 | 12554 | $continue = true; |
12556 | 12555 | } |
@@ -12558,7 +12557,7 @@ discard block |
||
12558 | 12557 | unset($beginning); |
12559 | 12558 | } |
12560 | 12559 | |
12561 | - foreach ((array) $specialCases['prefixes'] as &$beginning) { |
|
12560 | + foreach ((array)$specialCases['prefixes'] as &$beginning) { |
|
12562 | 12561 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12563 | 12562 | $continue = true; |
12564 | 12563 | } |
@@ -12618,8 +12617,8 @@ discard block |
||
12618 | 12617 | $buf .= self::$WIN1252_TO_UTF8[$ordC1]; |
12619 | 12618 | } else { |
12620 | 12619 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
12621 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
12622 | - $buf .= $cc1 . $cc2; |
|
12620 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
12621 | + $buf .= $cc1.$cc2; |
|
12623 | 12622 | } |
12624 | 12623 | |
12625 | 12624 | return $buf; |
@@ -12634,7 +12633,7 @@ discard block |
||
12634 | 12633 | { |
12635 | 12634 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
12636 | 12635 | if (\preg_match($pattern, $str)) { |
12637 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
12636 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
12638 | 12637 | } |
12639 | 12638 | |
12640 | 12639 | return $str; |
@@ -5260,19 +5260,26 @@ |
||
5260 | 5260 | array $needles, |
5261 | 5261 | bool $caseSensitive = true |
5262 | 5262 | ): bool { |
5263 | - if ($haystack === '' || $needles === []) |
|
5264 | - return false; |
|
5263 | + if ($haystack === '' || $needles === []) { |
|
5264 | + return false; |
|
5265 | + } |
|
5265 | 5266 | |
5266 | 5267 | /** @noinspection LoopWhichDoesNotLoopInspection */ |
5267 | 5268 | foreach ($needles as &$needle) { |
5268 | - if (!$needle) continue; |
|
5269 | + if (!$needle) { |
|
5270 | + continue; |
|
5271 | + } |
|
5269 | 5272 | |
5270 | 5273 | if ($caseSensitive) { |
5271 | - if (strpos($haystack, $needle) !== false) return true; |
|
5274 | + if (strpos($haystack, $needle) !== false) { |
|
5275 | + return true; |
|
5276 | + } |
|
5272 | 5277 | continue; |
5273 | 5278 | } |
5274 | 5279 | |
5275 | - if (mb_stripos($haystack, $needle) !== false) return true; |
|
5280 | + if (mb_stripos($haystack, $needle) !== false) { |
|
5281 | + return true; |
|
5282 | + } |
|
5276 | 5283 | } |
5277 | 5284 | |
5278 | 5285 | return false; |