@@ -3,17 +3,17 @@ discard block |
||
3 | 3 | return [ |
4 | 4 | 0x80 => "\xe2\x82\xac", // € |
5 | 5 | 0x82 => "\xe2\x80\x9a", // ‚ |
6 | - 0x83 => "\xc6\x92", // ƒ |
|
6 | + 0x83 => "\xc6\x92", // ƒ |
|
7 | 7 | 0x84 => "\xe2\x80\x9e", // „ |
8 | 8 | 0x85 => "\xe2\x80\xa6", // … |
9 | 9 | 0x86 => "\xe2\x80\xa0", // † |
10 | 10 | 0x87 => "\xe2\x80\xa1", // ‡ |
11 | - 0x88 => "\xcb\x86", // ˆ |
|
11 | + 0x88 => "\xcb\x86", // ˆ |
|
12 | 12 | 0x89 => "\xe2\x80\xb0", // ‰ |
13 | - 0x8a => "\xc5\xa0", // Š |
|
13 | + 0x8a => "\xc5\xa0", // Š |
|
14 | 14 | 0x8b => "\xe2\x80\xb9", // ‹ |
15 | - 0x8c => "\xc5\x92", // Œ |
|
16 | - 0x8e => "\xc5\xbd", // Ž |
|
15 | + 0x8c => "\xc5\x92", // Œ |
|
16 | + 0x8e => "\xc5\xbd", // Ž |
|
17 | 17 | 0x91 => "\xe2\x80\x98", // ‘ |
18 | 18 | 0x92 => "\xe2\x80\x99", // ’ |
19 | 19 | 0x93 => "\xe2\x80\x9c", // “ |
@@ -21,106 +21,106 @@ discard block |
||
21 | 21 | 0x95 => "\xe2\x80\xa2", // • |
22 | 22 | 0x96 => "\xe2\x80\x93", // – |
23 | 23 | 0x97 => "\xe2\x80\x94", // — |
24 | - 0x98 => "\xcb\x9c", // ˜ |
|
24 | + 0x98 => "\xcb\x9c", // ˜ |
|
25 | 25 | 0x99 => "\xe2\x84\xa2", // ™ |
26 | - 0x9a => "\xc5\xa1", // š |
|
26 | + 0x9a => "\xc5\xa1", // š |
|
27 | 27 | 0x9b => "\xe2\x80\xba", // › |
28 | - 0x9c => "\xc5\x93", // œ |
|
29 | - 0x9e => "\xc5\xbe", // ž |
|
30 | - 0x9f => "\xc5\xb8", // Ÿ |
|
28 | + 0x9c => "\xc5\x93", // œ |
|
29 | + 0x9e => "\xc5\xbe", // ž |
|
30 | + 0x9f => "\xc5\xb8", // Ÿ |
|
31 | 31 | 0xa0 => "\xc2\xa0", |
32 | - 0xa1 => "\xc2\xa1", // ¡ |
|
33 | - 0xa2 => "\xc2\xa2", // ¢ |
|
34 | - 0xa3 => "\xc2\xa3", // £ |
|
35 | - 0xa4 => "\xc2\xa4", // ¤ |
|
36 | - 0xa5 => "\xc2\xa5", // ¥ |
|
37 | - 0xa6 => "\xc2\xa6", // ¦ |
|
38 | - 0xa7 => "\xc2\xa7", // § |
|
39 | - 0xa8 => "\xc2\xa8", // ¨ |
|
40 | - 0xa9 => "\xc2\xa9", // © |
|
41 | - 0xaa => "\xc2\xaa", // ª |
|
42 | - 0xab => "\xc2\xab", // « |
|
43 | - 0xac => "\xc2\xac", // ¬ |
|
44 | - 0xad => "\xc2\xad", // |
|
45 | - 0xae => "\xc2\xae", // ® |
|
46 | - 0xaf => "\xc2\xaf", // ¯ |
|
47 | - 0xb0 => "\xc2\xb0", // ° |
|
48 | - 0xb1 => "\xc2\xb1", // ± |
|
49 | - 0xb2 => "\xc2\xb2", // ² |
|
50 | - 0xb3 => "\xc2\xb3", // ³ |
|
51 | - 0xb4 => "\xc2\xb4", // ´ |
|
52 | - 0xb5 => "\xc2\xb5", // µ |
|
53 | - 0xb6 => "\xc2\xb6", // ¶ |
|
54 | - 0xb7 => "\xc2\xb7", // · |
|
55 | - 0xb8 => "\xc2\xb8", // ¸ |
|
56 | - 0xb9 => "\xc2\xb9", // ¹ |
|
57 | - 0xba => "\xc2\xba", // º |
|
58 | - 0xbb => "\xc2\xbb", // » |
|
59 | - 0xbc => "\xc2\xbc", // ¼ |
|
60 | - 0xbd => "\xc2\xbd", // ½ |
|
61 | - 0xbe => "\xc2\xbe", // ¾ |
|
62 | - 0xbf => "\xc2\xbf", // ¿ |
|
63 | - 0xc0 => "\xc3\x80", // À |
|
64 | - 0xc1 => "\xc3\x81", // Á |
|
65 | - 0xc2 => "\xc3\x82", // Â |
|
66 | - 0xc3 => "\xc3\x83", // Ã |
|
67 | - 0xc4 => "\xc3\x84", // Ä |
|
68 | - 0xc5 => "\xc3\x85", // Å |
|
69 | - 0xc6 => "\xc3\x86", // Æ |
|
70 | - 0xc7 => "\xc3\x87", // Ç |
|
71 | - 0xc8 => "\xc3\x88", // È |
|
72 | - 0xc9 => "\xc3\x89", // É |
|
73 | - 0xca => "\xc3\x8a", // Ê |
|
74 | - 0xcb => "\xc3\x8b", // Ë |
|
75 | - 0xcc => "\xc3\x8c", // Ì |
|
76 | - 0xcd => "\xc3\x8d", // Í |
|
77 | - 0xce => "\xc3\x8e", // Î |
|
78 | - 0xcf => "\xc3\x8f", // Ï |
|
79 | - 0xd0 => "\xc3\x90", // Ð |
|
80 | - 0xd1 => "\xc3\x91", // Ñ |
|
81 | - 0xd2 => "\xc3\x92", // Ò |
|
82 | - 0xd3 => "\xc3\x93", // Ó |
|
83 | - 0xd4 => "\xc3\x94", // Ô |
|
84 | - 0xd5 => "\xc3\x95", // Õ |
|
85 | - 0xd6 => "\xc3\x96", // Ö |
|
86 | - 0xd7 => "\xc3\x97", // × |
|
87 | - 0xd8 => "\xc3\x98", // Ø |
|
88 | - 0xd9 => "\xc3\x99", // Ù |
|
89 | - 0xda => "\xc3\x9a", // Ú |
|
90 | - 0xdb => "\xc3\x9b", // Û |
|
91 | - 0xdc => "\xc3\x9c", // Ü |
|
92 | - 0xdd => "\xc3\x9d", // Ý |
|
93 | - 0xde => "\xc3\x9e", // Þ |
|
94 | - 0xdf => "\xc3\x9f", // ß |
|
95 | - 0xe0 => "\xc3\xa0", // à |
|
96 | - 0xe1 => "\xa1", // á |
|
97 | - 0xe2 => "\xc3\xa2", // â |
|
98 | - 0xe3 => "\xc3\xa3", // ã |
|
99 | - 0xe4 => "\xc3\xa4", // ä |
|
100 | - 0xe5 => "\xc3\xa5", // å |
|
101 | - 0xe6 => "\xc3\xa6", // æ |
|
102 | - 0xe7 => "\xc3\xa7", // ç |
|
103 | - 0xe8 => "\xc3\xa8", // è |
|
104 | - 0xe9 => "\xc3\xa9", // é |
|
105 | - 0xea => "\xc3\xaa", // ê |
|
106 | - 0xeb => "\xc3\xab", // ë |
|
107 | - 0xec => "\xc3\xac", // ì |
|
108 | - 0xed => "\xc3\xad", // í |
|
109 | - 0xee => "\xc3\xae", // î |
|
110 | - 0xef => "\xc3\xaf", // ï |
|
111 | - 0xf0 => "\xc3\xb0", // ð |
|
112 | - 0xf1 => "\xc3\xb1", // ñ |
|
113 | - 0xf2 => "\xc3\xb2", // ò |
|
114 | - 0xf3 => "\xc3\xb3", // ó |
|
115 | - 0xf4 => "\xc3\xb4", // ô |
|
116 | - 0xf5 => "\xc3\xb5", // õ |
|
117 | - 0xf6 => "\xc3\xb6", // ö |
|
118 | - 0xf7 => "\xc3\xb7", // ÷ |
|
119 | - 0xf8 => "\xc3\xb8", // ø |
|
120 | - 0xf9 => "\xc3\xb9", // ù |
|
121 | - 0xfa => "\xc3\xba", // ú |
|
122 | - 0xfb => "\xc3\xbb", // û |
|
123 | - 0xfc => "\xc3\xbc", // ü |
|
124 | - 0xfd => "\xc3\xbd", // ý |
|
125 | - 0xfe => "\xc3\xbe", // þ |
|
32 | + 0xa1 => "\xc2\xa1", // ¡ |
|
33 | + 0xa2 => "\xc2\xa2", // ¢ |
|
34 | + 0xa3 => "\xc2\xa3", // £ |
|
35 | + 0xa4 => "\xc2\xa4", // ¤ |
|
36 | + 0xa5 => "\xc2\xa5", // ¥ |
|
37 | + 0xa6 => "\xc2\xa6", // ¦ |
|
38 | + 0xa7 => "\xc2\xa7", // § |
|
39 | + 0xa8 => "\xc2\xa8", // ¨ |
|
40 | + 0xa9 => "\xc2\xa9", // © |
|
41 | + 0xaa => "\xc2\xaa", // ª |
|
42 | + 0xab => "\xc2\xab", // « |
|
43 | + 0xac => "\xc2\xac", // ¬ |
|
44 | + 0xad => "\xc2\xad", // |
|
45 | + 0xae => "\xc2\xae", // ® |
|
46 | + 0xaf => "\xc2\xaf", // ¯ |
|
47 | + 0xb0 => "\xc2\xb0", // ° |
|
48 | + 0xb1 => "\xc2\xb1", // ± |
|
49 | + 0xb2 => "\xc2\xb2", // ² |
|
50 | + 0xb3 => "\xc2\xb3", // ³ |
|
51 | + 0xb4 => "\xc2\xb4", // ´ |
|
52 | + 0xb5 => "\xc2\xb5", // µ |
|
53 | + 0xb6 => "\xc2\xb6", // ¶ |
|
54 | + 0xb7 => "\xc2\xb7", // · |
|
55 | + 0xb8 => "\xc2\xb8", // ¸ |
|
56 | + 0xb9 => "\xc2\xb9", // ¹ |
|
57 | + 0xba => "\xc2\xba", // º |
|
58 | + 0xbb => "\xc2\xbb", // » |
|
59 | + 0xbc => "\xc2\xbc", // ¼ |
|
60 | + 0xbd => "\xc2\xbd", // ½ |
|
61 | + 0xbe => "\xc2\xbe", // ¾ |
|
62 | + 0xbf => "\xc2\xbf", // ¿ |
|
63 | + 0xc0 => "\xc3\x80", // À |
|
64 | + 0xc1 => "\xc3\x81", // Á |
|
65 | + 0xc2 => "\xc3\x82", // Â |
|
66 | + 0xc3 => "\xc3\x83", // Ã |
|
67 | + 0xc4 => "\xc3\x84", // Ä |
|
68 | + 0xc5 => "\xc3\x85", // Å |
|
69 | + 0xc6 => "\xc3\x86", // Æ |
|
70 | + 0xc7 => "\xc3\x87", // Ç |
|
71 | + 0xc8 => "\xc3\x88", // È |
|
72 | + 0xc9 => "\xc3\x89", // É |
|
73 | + 0xca => "\xc3\x8a", // Ê |
|
74 | + 0xcb => "\xc3\x8b", // Ë |
|
75 | + 0xcc => "\xc3\x8c", // Ì |
|
76 | + 0xcd => "\xc3\x8d", // Í |
|
77 | + 0xce => "\xc3\x8e", // Î |
|
78 | + 0xcf => "\xc3\x8f", // Ï |
|
79 | + 0xd0 => "\xc3\x90", // Ð |
|
80 | + 0xd1 => "\xc3\x91", // Ñ |
|
81 | + 0xd2 => "\xc3\x92", // Ò |
|
82 | + 0xd3 => "\xc3\x93", // Ó |
|
83 | + 0xd4 => "\xc3\x94", // Ô |
|
84 | + 0xd5 => "\xc3\x95", // Õ |
|
85 | + 0xd6 => "\xc3\x96", // Ö |
|
86 | + 0xd7 => "\xc3\x97", // × |
|
87 | + 0xd8 => "\xc3\x98", // Ø |
|
88 | + 0xd9 => "\xc3\x99", // Ù |
|
89 | + 0xda => "\xc3\x9a", // Ú |
|
90 | + 0xdb => "\xc3\x9b", // Û |
|
91 | + 0xdc => "\xc3\x9c", // Ü |
|
92 | + 0xdd => "\xc3\x9d", // Ý |
|
93 | + 0xde => "\xc3\x9e", // Þ |
|
94 | + 0xdf => "\xc3\x9f", // ß |
|
95 | + 0xe0 => "\xc3\xa0", // à |
|
96 | + 0xe1 => "\xa1", // á |
|
97 | + 0xe2 => "\xc3\xa2", // â |
|
98 | + 0xe3 => "\xc3\xa3", // ã |
|
99 | + 0xe4 => "\xc3\xa4", // ä |
|
100 | + 0xe5 => "\xc3\xa5", // å |
|
101 | + 0xe6 => "\xc3\xa6", // æ |
|
102 | + 0xe7 => "\xc3\xa7", // ç |
|
103 | + 0xe8 => "\xc3\xa8", // è |
|
104 | + 0xe9 => "\xc3\xa9", // é |
|
105 | + 0xea => "\xc3\xaa", // ê |
|
106 | + 0xeb => "\xc3\xab", // ë |
|
107 | + 0xec => "\xc3\xac", // ì |
|
108 | + 0xed => "\xc3\xad", // í |
|
109 | + 0xee => "\xc3\xae", // î |
|
110 | + 0xef => "\xc3\xaf", // ï |
|
111 | + 0xf0 => "\xc3\xb0", // ð |
|
112 | + 0xf1 => "\xc3\xb1", // ñ |
|
113 | + 0xf2 => "\xc3\xb2", // ò |
|
114 | + 0xf3 => "\xc3\xb3", // ó |
|
115 | + 0xf4 => "\xc3\xb4", // ô |
|
116 | + 0xf5 => "\xc3\xb5", // õ |
|
117 | + 0xf6 => "\xc3\xb6", // ö |
|
118 | + 0xf7 => "\xc3\xb7", // ÷ |
|
119 | + 0xf8 => "\xc3\xb8", // ø |
|
120 | + 0xf9 => "\xc3\xb9", // ù |
|
121 | + 0xfa => "\xc3\xba", // ú |
|
122 | + 0xfb => "\xc3\xbb", // û |
|
123 | + 0xfc => "\xc3\xbc", // ü |
|
124 | + 0xfd => "\xc3\xbd", // ý |
|
125 | + 0xfe => "\xc3\xbe", // þ |
|
126 | 126 | ]; |
@@ -541,22 +541,22 @@ discard block |
||
541 | 541 | * @psalm-suppress PossiblyNullArrayAccess |
542 | 542 | */ |
543 | 543 | $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
544 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
544 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
545 | 545 | } elseif ($code_point <= 0xFFFF) { |
546 | 546 | /** |
547 | 547 | * @psalm-suppress PossiblyNullArrayAccess |
548 | 548 | */ |
549 | 549 | $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
550 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
551 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
550 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
551 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
552 | 552 | } else { |
553 | 553 | /** |
554 | 554 | * @psalm-suppress PossiblyNullArrayAccess |
555 | 555 | */ |
556 | 556 | $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
557 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
558 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
559 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
557 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
558 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
559 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
560 | 560 | } |
561 | 561 | |
562 | 562 | if ($encoding !== 'UTF-8') { |
@@ -3133,10 +3133,10 @@ discard block |
||
3133 | 3133 | |
3134 | 3134 | /** @noinspection PhpComposerExtensionStubsInspection */ |
3135 | 3135 | return ( |
3136 | - \is_object($json) === true |
|
3136 | + \is_object($json) === true |
|
3137 | 3137 | || |
3138 | 3138 | \is_array($json) === true |
3139 | - ) |
|
3139 | + ) |
|
3140 | 3140 | && |
3141 | 3141 | \json_last_error() === \JSON_ERROR_NONE; |
3142 | 3142 | } |
@@ -5419,8 +5419,8 @@ discard block |
||
5419 | 5419 | } |
5420 | 5420 | |
5421 | 5421 | return (string) self::substr($str, 0, $index, $encoding) . |
5422 | - $substring . |
|
5423 | - (string) self::substr($str, $index, $len, $encoding); |
|
5422 | + $substring . |
|
5423 | + (string) self::substr($str, $index, $len, $encoding); |
|
5424 | 5424 | } |
5425 | 5425 | |
5426 | 5426 | /** |
@@ -9653,8 +9653,8 @@ discard block |
||
9653 | 9653 | |
9654 | 9654 | /** @noinspection AdditionOperationOnArraysInspection */ |
9655 | 9655 | return (string) self::substr($str, 0, $offset, $encoding) . |
9656 | - $replacement . |
|
9657 | - (string) self::substr($str, $offset + $length, $string_length - $offset - $length, $encoding); |
|
9656 | + $replacement . |
|
9657 | + (string) self::substr($str, $offset + $length, $string_length - $offset - $length, $encoding); |
|
9658 | 9658 | } |
9659 | 9659 | |
9660 | 9660 | \preg_match_all('/./us', $str, $smatches); |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | return ''; |
244 | 244 | } |
245 | 245 | |
246 | - return (string) self::substr($str, $pos, 1); |
|
246 | + return (string)self::substr($str, $pos, 1); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | /** |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | public static function add_bom_to_string(string $str): string |
259 | 259 | { |
260 | 260 | if (self::string_has_bom($str) === false) { |
261 | - $str = self::bom() . $str; |
|
261 | + $str = self::bom().$str; |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | return $str; |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | return ''; |
316 | 316 | } |
317 | 317 | |
318 | - $substrIndex = $posStart + (int) self::strlen($start, $encoding); |
|
318 | + $substrIndex = $posStart + (int)self::strlen($start, $encoding); |
|
319 | 319 | $posEnd = self::strpos($str, $end, $substrIndex, $encoding); |
320 | 320 | if ( |
321 | 321 | $posEnd === false |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | return ''; |
326 | 326 | } |
327 | 327 | |
328 | - return (string) self::substr($str, $substrIndex, $posEnd - $substrIndex, $encoding); |
|
328 | + return (string)self::substr($str, $substrIndex, $posEnd - $substrIndex, $encoding); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | */ |
388 | 388 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
389 | 389 | { |
390 | - return (string) self::substr($str, $index, 1, $encoding); |
|
390 | + return (string)self::substr($str, $index, 1, $encoding); |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | /** |
@@ -483,10 +483,10 @@ discard block |
||
483 | 483 | && |
484 | 484 | self::$SUPPORT['mbstring'] === false |
485 | 485 | ) { |
486 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
486 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
487 | 487 | } |
488 | 488 | |
489 | - $cacheKey = $code_point . $encoding; |
|
489 | + $cacheKey = $code_point.$encoding; |
|
490 | 490 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
491 | 491 | return $CHAR_CACHE[$cacheKey]; |
492 | 492 | } |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | if (self::$CHR === null) { |
497 | 497 | $chrTmp = self::getData('chr'); |
498 | 498 | if ($chrTmp) { |
499 | - self::$CHR = (array) $chrTmp; |
|
499 | + self::$CHR = (array)$chrTmp; |
|
500 | 500 | } |
501 | 501 | } |
502 | 502 | |
@@ -526,11 +526,11 @@ discard block |
||
526 | 526 | if (self::$CHR === null) { |
527 | 527 | $chrTmp = self::getData('chr'); |
528 | 528 | if ($chrTmp) { |
529 | - self::$CHR = (array) $chrTmp; |
|
529 | + self::$CHR = (array)$chrTmp; |
|
530 | 530 | } |
531 | 531 | } |
532 | 532 | |
533 | - $code_point = (int) $code_point; |
|
533 | + $code_point = (int)$code_point; |
|
534 | 534 | if ($code_point <= 0x7F) { |
535 | 535 | /** |
536 | 536 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -540,22 +540,22 @@ discard block |
||
540 | 540 | /** |
541 | 541 | * @psalm-suppress PossiblyNullArrayAccess |
542 | 542 | */ |
543 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
543 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
544 | 544 | self::$CHR[($code_point & 0x3F) + 0x80]; |
545 | 545 | } elseif ($code_point <= 0xFFFF) { |
546 | 546 | /** |
547 | 547 | * @psalm-suppress PossiblyNullArrayAccess |
548 | 548 | */ |
549 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
550 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
549 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
550 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
551 | 551 | self::$CHR[($code_point & 0x3F) + 0x80]; |
552 | 552 | } else { |
553 | 553 | /** |
554 | 554 | * @psalm-suppress PossiblyNullArrayAccess |
555 | 555 | */ |
556 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
557 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
558 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
556 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
557 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
558 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
559 | 559 | self::$CHR[($code_point & 0x3F) + 0x80]; |
560 | 560 | } |
561 | 561 | |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | |
608 | 608 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
609 | 609 | return \array_map( |
610 | - static function (string $data): int { |
|
610 | + static function(string $data): int { |
|
611 | 611 | return self::strlen_in_byte($data); |
612 | 612 | }, |
613 | 613 | $strSplit |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | $char = ''; |
675 | 675 | } |
676 | 676 | |
677 | - return self::int_to_hex(self::ord((string) $char), $pfix); |
|
677 | + return self::int_to_hex(self::ord((string)$char), $pfix); |
|
678 | 678 | } |
679 | 679 | |
680 | 680 | /** |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | | ( [\x80-\xBF] ) # invalid byte in range 10000000 - 10111111 |
749 | 749 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
750 | 750 | /x'; |
751 | - $str = (string) \preg_replace($regx, '$1', $str); |
|
751 | + $str = (string)\preg_replace($regx, '$1', $str); |
|
752 | 752 | |
753 | 753 | if ($replace_diamond_question_mark === true) { |
754 | 754 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | public static function cleanup($str): string |
784 | 784 | { |
785 | 785 | // init |
786 | - $str = (string) $str; |
|
786 | + $str = (string)$str; |
|
787 | 787 | |
788 | 788 | if ($str === '') { |
789 | 789 | return ''; |
@@ -892,7 +892,7 @@ discard block |
||
892 | 892 | */ |
893 | 893 | public static function css_stripe_media_queries(string $str): string |
894 | 894 | { |
895 | - return (string) \preg_replace( |
|
895 | + return (string)\preg_replace( |
|
896 | 896 | '#@media\\s+(?:only\\s)?(?:[\\s{\\(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#misU', |
897 | 897 | '', |
898 | 898 | $str |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | */ |
920 | 920 | public static function decimal_to_chr($int): string |
921 | 921 | { |
922 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
922 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
923 | 923 | } |
924 | 924 | |
925 | 925 | /** |
@@ -996,7 +996,7 @@ discard block |
||
996 | 996 | if ($toEncoding === 'JSON') { |
997 | 997 | $return = self::json_encode($str); |
998 | 998 | if ($return === false) { |
999 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
999 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1000 | 1000 | } |
1001 | 1001 | |
1002 | 1002 | return $return; |
@@ -1082,7 +1082,7 @@ discard block |
||
1082 | 1082 | && |
1083 | 1083 | self::$SUPPORT['mbstring'] === false |
1084 | 1084 | ) { |
1085 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $toEncoding . '" encoding', \E_USER_WARNING); |
|
1085 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$toEncoding.'" encoding', \E_USER_WARNING); |
|
1086 | 1086 | } |
1087 | 1087 | |
1088 | 1088 | if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) { |
@@ -1171,18 +1171,18 @@ discard block |
||
1171 | 1171 | $trimChars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1172 | 1172 | |
1173 | 1173 | if ($length === null) { |
1174 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
1174 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
1175 | 1175 | } |
1176 | 1176 | |
1177 | 1177 | if (empty($search)) { |
1178 | 1178 | if ($length > 0) { |
1179 | - $stringLength = (int) self::strlen($str, $encoding); |
|
1179 | + $stringLength = (int)self::strlen($str, $encoding); |
|
1180 | 1180 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
1181 | 1181 | } else { |
1182 | 1182 | $end = 0; |
1183 | 1183 | } |
1184 | 1184 | |
1185 | - $pos = (int) \min( |
|
1185 | + $pos = (int)\min( |
|
1186 | 1186 | self::strpos($str, ' ', $end, $encoding), |
1187 | 1187 | self::strpos($str, '.', $end, $encoding) |
1188 | 1188 | ); |
@@ -1193,20 +1193,20 @@ discard block |
||
1193 | 1193 | return ''; |
1194 | 1194 | } |
1195 | 1195 | |
1196 | - return \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1196 | + return \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1197 | 1197 | } |
1198 | 1198 | |
1199 | 1199 | return $str; |
1200 | 1200 | } |
1201 | 1201 | |
1202 | - $wordPos = (int) self::stripos($str, $search, 0, $encoding); |
|
1203 | - $halfSide = (int) ($wordPos - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1202 | + $wordPos = (int)self::stripos($str, $search, 0, $encoding); |
|
1203 | + $halfSide = (int)($wordPos - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1204 | 1204 | |
1205 | 1205 | $pos_start = 0; |
1206 | 1206 | if ($halfSide > 0) { |
1207 | 1207 | $halfText = self::substr($str, 0, $halfSide, $encoding); |
1208 | 1208 | if ($halfText !== false) { |
1209 | - $pos_start = (int) \max( |
|
1209 | + $pos_start = (int)\max( |
|
1210 | 1210 | self::strrpos($halfText, ' ', 0, $encoding), |
1211 | 1211 | self::strrpos($halfText, '.', 0, $encoding) |
1212 | 1212 | ); |
@@ -1215,35 +1215,35 @@ discard block |
||
1215 | 1215 | |
1216 | 1216 | if ($wordPos && $halfSide > 0) { |
1217 | 1217 | $offset = $pos_start + $length - 1; |
1218 | - $realLength = (int) self::strlen($str, $encoding); |
|
1218 | + $realLength = (int)self::strlen($str, $encoding); |
|
1219 | 1219 | |
1220 | 1220 | if ($offset > $realLength) { |
1221 | 1221 | $offset = $realLength; |
1222 | 1222 | } |
1223 | 1223 | |
1224 | - $pos_end = (int) \min( |
|
1224 | + $pos_end = (int)\min( |
|
1225 | 1225 | self::strpos($str, ' ', $offset, $encoding), |
1226 | 1226 | self::strpos($str, '.', $offset, $encoding) |
1227 | 1227 | ) - $pos_start; |
1228 | 1228 | |
1229 | 1229 | if (!$pos_end || $pos_end <= 0) { |
1230 | - $strSub = self::substr($str, $pos_start, (int) self::strlen($str), $encoding); |
|
1230 | + $strSub = self::substr($str, $pos_start, (int)self::strlen($str), $encoding); |
|
1231 | 1231 | if ($strSub !== false) { |
1232 | - $extract = $replacerForSkippedText . \ltrim($strSub, $trimChars); |
|
1232 | + $extract = $replacerForSkippedText.\ltrim($strSub, $trimChars); |
|
1233 | 1233 | } else { |
1234 | 1234 | $extract = ''; |
1235 | 1235 | } |
1236 | 1236 | } else { |
1237 | 1237 | $strSub = self::substr($str, $pos_start, $pos_end, $encoding); |
1238 | 1238 | if ($strSub !== false) { |
1239 | - $extract = $replacerForSkippedText . \trim($strSub, $trimChars) . $replacerForSkippedText; |
|
1239 | + $extract = $replacerForSkippedText.\trim($strSub, $trimChars).$replacerForSkippedText; |
|
1240 | 1240 | } else { |
1241 | 1241 | $extract = ''; |
1242 | 1242 | } |
1243 | 1243 | } |
1244 | 1244 | } else { |
1245 | 1245 | $offset = $length - 1; |
1246 | - $trueLength = (int) self::strlen($str, $encoding); |
|
1246 | + $trueLength = (int)self::strlen($str, $encoding); |
|
1247 | 1247 | |
1248 | 1248 | if ($offset > $trueLength) { |
1249 | 1249 | $offset = $trueLength; |
@@ -1257,7 +1257,7 @@ discard block |
||
1257 | 1257 | if ($pos_end) { |
1258 | 1258 | $strSub = self::substr($str, 0, $pos_end, $encoding); |
1259 | 1259 | if ($strSub !== false) { |
1260 | - $extract = \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1260 | + $extract = \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1261 | 1261 | } else { |
1262 | 1262 | $extract = ''; |
1263 | 1263 | } |
@@ -1377,7 +1377,7 @@ discard block |
||
1377 | 1377 | { |
1378 | 1378 | $file_content = \file_get_contents($file_path); |
1379 | 1379 | if ($file_content === false) { |
1380 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1380 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1381 | 1381 | } |
1382 | 1382 | |
1383 | 1383 | return self::string_has_bom($file_content); |
@@ -1440,7 +1440,7 @@ discard block |
||
1440 | 1440 | ) { |
1441 | 1441 | // Prevent leading combining chars |
1442 | 1442 | // for NFC-safe concatenations. |
1443 | - $var = $leading_combining . $var; |
|
1443 | + $var = $leading_combining.$var; |
|
1444 | 1444 | } |
1445 | 1445 | } |
1446 | 1446 | |
@@ -1674,7 +1674,7 @@ discard block |
||
1674 | 1674 | return ''; |
1675 | 1675 | } |
1676 | 1676 | |
1677 | - return (string) self::substr($str, 0, $n, $encoding); |
|
1677 | + return (string)self::substr($str, 0, $n, $encoding); |
|
1678 | 1678 | } |
1679 | 1679 | |
1680 | 1680 | /** |
@@ -1749,7 +1749,7 @@ discard block |
||
1749 | 1749 | return $str; |
1750 | 1750 | } |
1751 | 1751 | |
1752 | - $str = (string) $str; |
|
1752 | + $str = (string)$str; |
|
1753 | 1753 | $last = ''; |
1754 | 1754 | while ($last !== $str) { |
1755 | 1755 | $last = $str; |
@@ -1940,7 +1940,7 @@ discard block |
||
1940 | 1940 | } |
1941 | 1941 | |
1942 | 1942 | $str_info = \unpack('C2chars', $str_info); |
1943 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
1943 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
1944 | 1944 | |
1945 | 1945 | // DEBUG |
1946 | 1946 | //var_dump($type_code); |
@@ -2023,7 +2023,7 @@ discard block |
||
2023 | 2023 | // init |
2024 | 2024 | $i = 0; |
2025 | 2025 | $str = ''; |
2026 | - $maxlength = (int) self::strlen($possibleChars, $encoding); |
|
2026 | + $maxlength = (int)self::strlen($possibleChars, $encoding); |
|
2027 | 2027 | |
2028 | 2028 | if ($maxlength === 0) { |
2029 | 2029 | return ''; |
@@ -2055,16 +2055,16 @@ discard block |
||
2055 | 2055 | */ |
2056 | 2056 | public static function get_unique_string($entropyExtra = '', bool $md5 = true): string |
2057 | 2057 | { |
2058 | - $uniqueHelper = \random_int(0, \mt_getrandmax()) . |
|
2059 | - \session_id() . |
|
2060 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2061 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2058 | + $uniqueHelper = \random_int(0, \mt_getrandmax()). |
|
2059 | + \session_id(). |
|
2060 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2061 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2062 | 2062 | $entropyExtra; |
2063 | 2063 | |
2064 | 2064 | $uniqueString = \uniqid($uniqueHelper, true); |
2065 | 2065 | |
2066 | 2066 | if ($md5) { |
2067 | - $uniqueString = \md5($uniqueString . $uniqueHelper); |
|
2067 | + $uniqueString = \md5($uniqueString.$uniqueHelper); |
|
2068 | 2068 | } |
2069 | 2069 | |
2070 | 2070 | return $uniqueString; |
@@ -2134,7 +2134,7 @@ discard block |
||
2134 | 2134 | public static function hex_to_int($hexDec) |
2135 | 2135 | { |
2136 | 2136 | // init |
2137 | - $hexDec = (string) $hexDec; |
|
2137 | + $hexDec = (string)$hexDec; |
|
2138 | 2138 | |
2139 | 2139 | if ($hexDec === '') { |
2140 | 2140 | return false; |
@@ -2209,7 +2209,7 @@ discard block |
||
2209 | 2209 | return \implode( |
2210 | 2210 | '', |
2211 | 2211 | \array_map( |
2212 | - static function (string $chr) use ($keepAsciiChars, $encoding): string { |
|
2212 | + static function(string $chr) use ($keepAsciiChars, $encoding): string { |
|
2213 | 2213 | return self::single_chr_html_encode($chr, $keepAsciiChars, $encoding); |
2214 | 2214 | }, |
2215 | 2215 | self::split($str) |
@@ -2325,7 +2325,7 @@ discard block |
||
2325 | 2325 | && |
2326 | 2326 | self::$SUPPORT['mbstring'] === false |
2327 | 2327 | ) { |
2328 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2328 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2329 | 2329 | } |
2330 | 2330 | |
2331 | 2331 | if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) { |
@@ -2343,14 +2343,14 @@ discard block |
||
2343 | 2343 | $encoding |
2344 | 2344 | ); |
2345 | 2345 | } else { |
2346 | - $str = (string) \preg_replace_callback( |
|
2346 | + $str = (string)\preg_replace_callback( |
|
2347 | 2347 | "/&#\d{2,6};/", |
2348 | 2348 | /** |
2349 | 2349 | * @param string[] $matches |
2350 | 2350 | * |
2351 | 2351 | * @return string |
2352 | 2352 | */ |
2353 | - static function (array $matches) use ($encoding): string { |
|
2353 | + static function(array $matches) use ($encoding): string { |
|
2354 | 2354 | // always fallback via symfony polyfill |
2355 | 2355 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
2356 | 2356 | |
@@ -2366,7 +2366,7 @@ discard block |
||
2366 | 2366 | |
2367 | 2367 | // decode numeric & UTF16 two byte entities |
2368 | 2368 | $str = \html_entity_decode( |
2369 | - (string) \preg_replace('/(&#(?:x0*[0-9a-f]{2,6}(?![0-9a-f;])|(?:0*\d{2,6}(?![0-9;]))))/iS', '$1;', $str), |
|
2369 | + (string)\preg_replace('/(&#(?:x0*[0-9a-f]{2,6}(?![0-9a-f;])|(?:0*\d{2,6}(?![0-9;]))))/iS', '$1;', $str), |
|
2370 | 2370 | $flags, |
2371 | 2371 | $encoding |
2372 | 2372 | ); |
@@ -2403,7 +2403,7 @@ discard block |
||
2403 | 2403 | */ |
2404 | 2404 | public static function html_stripe_empty_tags(string $str): string |
2405 | 2405 | { |
2406 | - return (string) \preg_replace( |
|
2406 | + return (string)\preg_replace( |
|
2407 | 2407 | "/<[^\/>]*>(([\s]?)*|)<\/[^>]*>/iu", |
2408 | 2408 | '', |
2409 | 2409 | $str |
@@ -2692,9 +2692,9 @@ discard block |
||
2692 | 2692 | { |
2693 | 2693 | $hex = \dechex($int); |
2694 | 2694 | |
2695 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
2695 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
2696 | 2696 | |
2697 | - return $pfix . $hex . ''; |
|
2697 | + return $pfix.$hex.''; |
|
2698 | 2698 | } |
2699 | 2699 | |
2700 | 2700 | /** |
@@ -2935,7 +2935,7 @@ discard block |
||
2935 | 2935 | return false; |
2936 | 2936 | } |
2937 | 2937 | |
2938 | - $base64String = (string) \base64_decode($str, true); |
|
2938 | + $base64String = (string)\base64_decode($str, true); |
|
2939 | 2939 | |
2940 | 2940 | return $base64String && \base64_encode($base64String) === $str; |
2941 | 2941 | } |
@@ -2950,7 +2950,7 @@ discard block |
||
2950 | 2950 | */ |
2951 | 2951 | public static function is_binary($input, bool $strict = false): bool |
2952 | 2952 | { |
2953 | - $input = (string) $input; |
|
2953 | + $input = (string)$input; |
|
2954 | 2954 | if ($input === '') { |
2955 | 2955 | return false; |
2956 | 2956 | } |
@@ -3199,7 +3199,7 @@ discard block |
||
3199 | 3199 | public static function is_utf16($str, $checkIfStringIsBinary = true) |
3200 | 3200 | { |
3201 | 3201 | // init |
3202 | - $str = (string) $str; |
|
3202 | + $str = (string)$str; |
|
3203 | 3203 | $strChars = []; |
3204 | 3204 | |
3205 | 3205 | if ( |
@@ -3277,7 +3277,7 @@ discard block |
||
3277 | 3277 | public static function is_utf32($str, $checkIfStringIsBinary = true) |
3278 | 3278 | { |
3279 | 3279 | // init |
3280 | - $str = (string) $str; |
|
3280 | + $str = (string)$str; |
|
3281 | 3281 | $strChars = []; |
3282 | 3282 | |
3283 | 3283 | if ( |
@@ -3401,7 +3401,7 @@ discard block |
||
3401 | 3401 | self::$ORD = self::getData('ord'); |
3402 | 3402 | } |
3403 | 3403 | |
3404 | - $len = self::strlen_in_byte((string) $str); |
|
3404 | + $len = self::strlen_in_byte((string)$str); |
|
3405 | 3405 | /** @noinspection ForeachInvariantsInspection */ |
3406 | 3406 | for ($i = 0; $i < $len; ++$i) { |
3407 | 3407 | $in = self::$ORD[$str[$i]]; |
@@ -3630,17 +3630,17 @@ discard block |
||
3630 | 3630 | */ |
3631 | 3631 | public static function lcfirst(string $str, string $encoding = 'UTF-8', bool $cleanUtf8 = false, string $lang = null, bool $tryToKeepStringLength = false): string |
3632 | 3632 | { |
3633 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding, $cleanUtf8); |
|
3633 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding, $cleanUtf8); |
|
3634 | 3634 | |
3635 | 3635 | $strPartOne = self::strtolower( |
3636 | - (string) self::substr($str, 0, 1, $encoding, $cleanUtf8), |
|
3636 | + (string)self::substr($str, 0, 1, $encoding, $cleanUtf8), |
|
3637 | 3637 | $encoding, |
3638 | 3638 | $cleanUtf8, |
3639 | 3639 | $lang, |
3640 | 3640 | $tryToKeepStringLength |
3641 | 3641 | ); |
3642 | 3642 | |
3643 | - return $strPartOne . $strPartTwo; |
|
3643 | + return $strPartOne.$strPartTwo; |
|
3644 | 3644 | } |
3645 | 3645 | |
3646 | 3646 | /** |
@@ -3796,7 +3796,7 @@ discard block |
||
3796 | 3796 | { |
3797 | 3797 | $bytes = self::chr_size_list($str); |
3798 | 3798 | if (\count($bytes) > 0) { |
3799 | - return (int) \max($bytes); |
|
3799 | + return (int)\max($bytes); |
|
3800 | 3800 | } |
3801 | 3801 | |
3802 | 3802 | return 0; |
@@ -3871,7 +3871,7 @@ discard block |
||
3871 | 3871 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
3872 | 3872 | |
3873 | 3873 | // init |
3874 | - $encoding = (string) $encoding; |
|
3874 | + $encoding = (string)$encoding; |
|
3875 | 3875 | |
3876 | 3876 | if ( |
3877 | 3877 | !$encoding |
@@ -3923,7 +3923,7 @@ discard block |
||
3923 | 3923 | |
3924 | 3924 | $encodingOrig = $encoding; |
3925 | 3925 | $encoding = \strtoupper($encoding); |
3926 | - $encodingUpperHelper = (string) \preg_replace('/[^a-zA-Z0-9\s]/', '', $encoding); |
|
3926 | + $encodingUpperHelper = (string)\preg_replace('/[^a-zA-Z0-9\s]/', '', $encoding); |
|
3927 | 3927 | |
3928 | 3928 | $equivalences = [ |
3929 | 3929 | 'ISO8859' => 'ISO-8859-1', |
@@ -4009,7 +4009,7 @@ discard block |
||
4009 | 4009 | */ |
4010 | 4010 | public static function normalize_line_ending(string $str): string |
4011 | 4011 | { |
4012 | - return (string) \str_replace(["\r\n", "\r"], "\n", $str); |
|
4012 | + return (string)\str_replace(["\r\n", "\r"], "\n", $str); |
|
4013 | 4013 | } |
4014 | 4014 | |
4015 | 4015 | /** |
@@ -4057,7 +4057,7 @@ discard block |
||
4057 | 4057 | } |
4058 | 4058 | |
4059 | 4059 | static $WHITESPACE_CACHE = []; |
4060 | - $cacheKey = (int) $keepNonBreakingSpace; |
|
4060 | + $cacheKey = (int)$keepNonBreakingSpace; |
|
4061 | 4061 | |
4062 | 4062 | if (!isset($WHITESPACE_CACHE[$cacheKey])) { |
4063 | 4063 | $WHITESPACE_CACHE[$cacheKey] = self::$WHITESPACE_TABLE; |
@@ -4097,7 +4097,7 @@ discard block |
||
4097 | 4097 | public static function ord($chr, string $encoding = 'UTF-8'): int |
4098 | 4098 | { |
4099 | 4099 | // init |
4100 | - $chr = (string) $chr; |
|
4100 | + $chr = (string)$chr; |
|
4101 | 4101 | |
4102 | 4102 | static $CHAR_CACHE = []; |
4103 | 4103 | |
@@ -4108,7 +4108,7 @@ discard block |
||
4108 | 4108 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4109 | 4109 | } |
4110 | 4110 | |
4111 | - $cacheKey = $chr_orig . $encoding; |
|
4111 | + $cacheKey = $chr_orig.$encoding; |
|
4112 | 4112 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
4113 | 4113 | return $CHAR_CACHE[$cacheKey]; |
4114 | 4114 | } |
@@ -4139,22 +4139,22 @@ discard block |
||
4139 | 4139 | } |
4140 | 4140 | |
4141 | 4141 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
4142 | - $chr = \unpack('C*', (string) self::substr($chr, 0, 4, 'CP850')); |
|
4142 | + $chr = \unpack('C*', (string)self::substr($chr, 0, 4, 'CP850')); |
|
4143 | 4143 | $code = $chr ? $chr[1] : 0; |
4144 | 4144 | |
4145 | 4145 | if ($code >= 0xF0 && isset($chr[4])) { |
4146 | 4146 | /** @noinspection UnnecessaryCastingInspection */ |
4147 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4147 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4148 | 4148 | } |
4149 | 4149 | |
4150 | 4150 | if ($code >= 0xE0 && isset($chr[3])) { |
4151 | 4151 | /** @noinspection UnnecessaryCastingInspection */ |
4152 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4152 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4153 | 4153 | } |
4154 | 4154 | |
4155 | 4155 | if ($code >= 0xC0 && isset($chr[2])) { |
4156 | 4156 | /** @noinspection UnnecessaryCastingInspection */ |
4157 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4157 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4158 | 4158 | } |
4159 | 4159 | |
4160 | 4160 | return $CHAR_CACHE[$cacheKey] = $code; |
@@ -4207,7 +4207,7 @@ discard block |
||
4207 | 4207 | public static function pcre_utf8_support(): bool |
4208 | 4208 | { |
4209 | 4209 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4210 | - return (bool) @\preg_match('//u', ''); |
|
4210 | + return (bool)@\preg_match('//u', ''); |
|
4211 | 4211 | } |
4212 | 4212 | |
4213 | 4213 | /** |
@@ -4233,10 +4233,10 @@ discard block |
||
4233 | 4233 | } |
4234 | 4234 | |
4235 | 4235 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4236 | - if (\ctype_digit((string) $var1)) { |
|
4237 | - $start = (int) $var1; |
|
4236 | + if (\ctype_digit((string)$var1)) { |
|
4237 | + $start = (int)$var1; |
|
4238 | 4238 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var1)) { |
4239 | - $start = (int) self::hex_to_int($var1); |
|
4239 | + $start = (int)self::hex_to_int($var1); |
|
4240 | 4240 | } else { |
4241 | 4241 | $start = self::ord($var1); |
4242 | 4242 | } |
@@ -4246,10 +4246,10 @@ discard block |
||
4246 | 4246 | } |
4247 | 4247 | |
4248 | 4248 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4249 | - if (\ctype_digit((string) $var2)) { |
|
4250 | - $end = (int) $var2; |
|
4249 | + if (\ctype_digit((string)$var2)) { |
|
4250 | + $end = (int)$var2; |
|
4251 | 4251 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var2)) { |
4252 | - $end = (int) self::hex_to_int($var2); |
|
4252 | + $end = (int)self::hex_to_int($var2); |
|
4253 | 4253 | } else { |
4254 | 4254 | $end = self::ord($var2); |
4255 | 4255 | } |
@@ -4259,8 +4259,8 @@ discard block |
||
4259 | 4259 | } |
4260 | 4260 | |
4261 | 4261 | return \array_map( |
4262 | - static function (int $i): string { |
|
4263 | - return (string) self::chr($i); |
|
4262 | + static function(int $i): string { |
|
4263 | + return (string)self::chr($i); |
|
4264 | 4264 | }, |
4265 | 4265 | \range($start, $end) |
4266 | 4266 | ); |
@@ -4293,7 +4293,7 @@ discard block |
||
4293 | 4293 | |
4294 | 4294 | $pattern = '/%u([0-9a-f]{3,4})/i'; |
4295 | 4295 | if (\preg_match($pattern, $str)) { |
4296 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \rawurldecode($str)); |
|
4296 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \rawurldecode($str)); |
|
4297 | 4297 | } |
4298 | 4298 | |
4299 | 4299 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -4341,8 +4341,8 @@ discard block |
||
4341 | 4341 | $delimiter = '/'; |
4342 | 4342 | } |
4343 | 4343 | |
4344 | - return (string) \preg_replace( |
|
4345 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4344 | + return (string)\preg_replace( |
|
4345 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4346 | 4346 | $replacement, |
4347 | 4347 | $str |
4348 | 4348 | ); |
@@ -4385,9 +4385,9 @@ discard block |
||
4385 | 4385 | return ''; |
4386 | 4386 | } |
4387 | 4387 | |
4388 | - $strLength -= (int) $bomByteLength; |
|
4388 | + $strLength -= (int)$bomByteLength; |
|
4389 | 4389 | |
4390 | - $str = (string) $strTmp; |
|
4390 | + $str = (string)$strTmp; |
|
4391 | 4391 | } |
4392 | 4392 | } |
4393 | 4393 | |
@@ -4411,7 +4411,7 @@ discard block |
||
4411 | 4411 | if (\is_array($what) === true) { |
4412 | 4412 | /** @noinspection ForeachSourceInspection */ |
4413 | 4413 | foreach ($what as $item) { |
4414 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/', $item, $str); |
|
4414 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/', $item, $str); |
|
4415 | 4415 | } |
4416 | 4416 | } |
4417 | 4417 | |
@@ -4443,7 +4443,7 @@ discard block |
||
4443 | 4443 | */ |
4444 | 4444 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
4445 | 4445 | { |
4446 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4446 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4447 | 4447 | } |
4448 | 4448 | |
4449 | 4449 | /** |
@@ -4474,7 +4474,7 @@ discard block |
||
4474 | 4474 | $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
4475 | 4475 | |
4476 | 4476 | do { |
4477 | - $str = (string) \preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4477 | + $str = (string)\preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4478 | 4478 | } while ($count !== 0); |
4479 | 4479 | |
4480 | 4480 | return $str; |
@@ -4492,9 +4492,9 @@ discard block |
||
4492 | 4492 | public static function remove_left(string $str, string $substring, string $encoding = 'UTF-8'): string |
4493 | 4493 | { |
4494 | 4494 | if (self::str_starts_with($str, $substring)) { |
4495 | - return (string) self::substr( |
|
4495 | + return (string)self::substr( |
|
4496 | 4496 | $str, |
4497 | - (int) self::strlen($substring, $encoding), |
|
4497 | + (int)self::strlen($substring, $encoding), |
|
4498 | 4498 | null, |
4499 | 4499 | $encoding |
4500 | 4500 | ); |
@@ -4515,10 +4515,10 @@ discard block |
||
4515 | 4515 | public static function remove_right(string $str, string $substring, string $encoding = 'UTF-8'): string |
4516 | 4516 | { |
4517 | 4517 | if (self::str_ends_with($str, $substring)) { |
4518 | - return (string) self::substr( |
|
4518 | + return (string)self::substr( |
|
4519 | 4519 | $str, |
4520 | 4520 | 0, |
4521 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding) |
|
4521 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding) |
|
4522 | 4522 | ); |
4523 | 4523 | } |
4524 | 4524 | |
@@ -4654,7 +4654,7 @@ discard block |
||
4654 | 4654 | |
4655 | 4655 | echo '<pre>'; |
4656 | 4656 | foreach (self::$SUPPORT as $key => &$value) { |
4657 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
4657 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
4658 | 4658 | } |
4659 | 4659 | unset($value); |
4660 | 4660 | echo '</pre>'; |
@@ -4687,7 +4687,7 @@ discard block |
||
4687 | 4687 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4688 | 4688 | } |
4689 | 4689 | |
4690 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
4690 | + return '&#'.self::ord($char, $encoding).';'; |
|
4691 | 4691 | } |
4692 | 4692 | |
4693 | 4693 | /** |
@@ -4726,7 +4726,7 @@ discard block |
||
4726 | 4726 | } |
4727 | 4727 | |
4728 | 4728 | // init |
4729 | - $str = (string) $str; |
|
4729 | + $str = (string)$str; |
|
4730 | 4730 | |
4731 | 4731 | if ($str === '') { |
4732 | 4732 | return []; |
@@ -4769,7 +4769,7 @@ discard block |
||
4769 | 4769 | ($str[$i] & "\xE0") === "\xC0" |
4770 | 4770 | ) { |
4771 | 4771 | if (($str[$i + 1] & "\xC0") === "\x80") { |
4772 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
4772 | + $ret[] = $str[$i].$str[$i + 1]; |
|
4773 | 4773 | |
4774 | 4774 | ++$i; |
4775 | 4775 | } |
@@ -4783,7 +4783,7 @@ discard block |
||
4783 | 4783 | && |
4784 | 4784 | ($str[$i + 2] & "\xC0") === "\x80" |
4785 | 4785 | ) { |
4786 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
4786 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
4787 | 4787 | |
4788 | 4788 | $i += 2; |
4789 | 4789 | } |
@@ -4799,7 +4799,7 @@ discard block |
||
4799 | 4799 | && |
4800 | 4800 | ($str[$i + 3] & "\xC0") === "\x80" |
4801 | 4801 | ) { |
4802 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
4802 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
4803 | 4803 | |
4804 | 4804 | $i += 3; |
4805 | 4805 | } |
@@ -4811,7 +4811,7 @@ discard block |
||
4811 | 4811 | $ret = \array_chunk($ret, $length); |
4812 | 4812 | |
4813 | 4813 | return \array_map( |
4814 | - static function (array $item): string { |
|
4814 | + static function(array $item): string { |
|
4815 | 4815 | return \implode('', $item); |
4816 | 4816 | }, |
4817 | 4817 | $ret |
@@ -4841,16 +4841,16 @@ discard block |
||
4841 | 4841 | public static function str_camelize(string $str, string $encoding = 'UTF-8', bool $cleanUtf8 = false, string $lang = null, bool $tryToKeepStringLength = false): string |
4842 | 4842 | { |
4843 | 4843 | $str = self::lcfirst(self::trim($str), $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
4844 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
4844 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
4845 | 4845 | |
4846 | - $str = (string) \preg_replace_callback( |
|
4846 | + $str = (string)\preg_replace_callback( |
|
4847 | 4847 | '/[-_\s]+(.)?/u', |
4848 | 4848 | /** |
4849 | 4849 | * @param array $match |
4850 | 4850 | * |
4851 | 4851 | * @return string |
4852 | 4852 | */ |
4853 | - static function (array $match) use ($encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
4853 | + static function(array $match) use ($encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
4854 | 4854 | if (isset($match[1])) { |
4855 | 4855 | return self::strtoupper($match[1], $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
4856 | 4856 | } |
@@ -4860,14 +4860,14 @@ discard block |
||
4860 | 4860 | $str |
4861 | 4861 | ); |
4862 | 4862 | |
4863 | - return (string) \preg_replace_callback( |
|
4863 | + return (string)\preg_replace_callback( |
|
4864 | 4864 | '/[\d]+(.)?/u', |
4865 | 4865 | /** |
4866 | 4866 | * @param array $match |
4867 | 4867 | * |
4868 | 4868 | * @return string |
4869 | 4869 | */ |
4870 | - static function (array $match) use ($encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
4870 | + static function(array $match) use ($encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
4871 | 4871 | return self::strtoupper($match[0], $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
4872 | 4872 | }, |
4873 | 4873 | $str |
@@ -4912,7 +4912,7 @@ discard block |
||
4912 | 4912 | // only a fallback to prevent BC in the api ... |
4913 | 4913 | /** @psalm-suppress RedundantConditionGivenDocblockType */ |
4914 | 4914 | if ($caseSensitive !== false && $caseSensitive !== true) { |
4915 | - $encoding = (string) $caseSensitive; |
|
4915 | + $encoding = (string)$caseSensitive; |
|
4916 | 4916 | } |
4917 | 4917 | |
4918 | 4918 | if ($caseSensitive) { |
@@ -4947,7 +4947,7 @@ discard block |
||
4947 | 4947 | // only a fallback to prevent BC in the api ... |
4948 | 4948 | /** @psalm-suppress RedundantConditionGivenDocblockType */ |
4949 | 4949 | if ($caseSensitive !== false && $caseSensitive !== true) { |
4950 | - $encoding = (string) $caseSensitive; |
|
4950 | + $encoding = (string)$caseSensitive; |
|
4951 | 4951 | } |
4952 | 4952 | |
4953 | 4953 | foreach ($needles as &$needle) { |
@@ -5029,11 +5029,11 @@ discard block |
||
5029 | 5029 | ): string { |
5030 | 5030 | $str = self::trim($str); |
5031 | 5031 | |
5032 | - $str = (string) \preg_replace('/\B([A-Z])/u', '-\1', $str); |
|
5032 | + $str = (string)\preg_replace('/\B([A-Z])/u', '-\1', $str); |
|
5033 | 5033 | |
5034 | 5034 | $str = self::strtolower($str, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
5035 | 5035 | |
5036 | - return (string) \preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
5036 | + return (string)\preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
5037 | 5037 | } |
5038 | 5038 | |
5039 | 5039 | /** |
@@ -5048,7 +5048,7 @@ discard block |
||
5048 | 5048 | public static function str_detect_encoding($str) |
5049 | 5049 | { |
5050 | 5050 | // init |
5051 | - $str = (string) $str; |
|
5051 | + $str = (string)$str; |
|
5052 | 5052 | |
5053 | 5053 | // |
5054 | 5054 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5154,7 +5154,7 @@ discard block |
||
5154 | 5154 | foreach (self::$ENCODINGS as $encodingTmp) { |
5155 | 5155 | // INFO: //IGNORE but still throw notice |
5156 | 5156 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5157 | - if ((string) @\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str) === $str) { |
|
5157 | + if ((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str) === $str) { |
|
5158 | 5158 | return $encodingTmp; |
5159 | 5159 | } |
5160 | 5160 | } |
@@ -5216,7 +5216,7 @@ discard block |
||
5216 | 5216 | public static function str_ensure_left(string $str, string $substring): string |
5217 | 5217 | { |
5218 | 5218 | if (!self::str_starts_with($str, $substring)) { |
5219 | - $str = $substring . $str; |
|
5219 | + $str = $substring.$str; |
|
5220 | 5220 | } |
5221 | 5221 | |
5222 | 5222 | return $str; |
@@ -5412,15 +5412,15 @@ discard block |
||
5412 | 5412 | */ |
5413 | 5413 | public static function str_insert(string $str, string $substring, int $index, string $encoding = 'UTF-8'): string |
5414 | 5414 | { |
5415 | - $len = (int) self::strlen($str, $encoding); |
|
5415 | + $len = (int)self::strlen($str, $encoding); |
|
5416 | 5416 | |
5417 | 5417 | if ($index > $len) { |
5418 | 5418 | return $str; |
5419 | 5419 | } |
5420 | 5420 | |
5421 | - return (string) self::substr($str, 0, $index, $encoding) . |
|
5422 | - $substring . |
|
5423 | - (string) self::substr($str, $index, $len, $encoding); |
|
5421 | + return (string)self::substr($str, 0, $index, $encoding). |
|
5422 | + $substring. |
|
5423 | + (string)self::substr($str, $index, $len, $encoding); |
|
5424 | 5424 | } |
5425 | 5425 | |
5426 | 5426 | /** |
@@ -5450,15 +5450,15 @@ discard block |
||
5450 | 5450 | */ |
5451 | 5451 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
5452 | 5452 | { |
5453 | - $search = (array) $search; |
|
5453 | + $search = (array)$search; |
|
5454 | 5454 | |
5455 | 5455 | /** @noinspection AlterInForeachInspection */ |
5456 | 5456 | foreach ($search as &$s) { |
5457 | - $s = (string) $s; |
|
5457 | + $s = (string)$s; |
|
5458 | 5458 | if ($s === '') { |
5459 | 5459 | $s = '/^(?<=.)$/'; |
5460 | 5460 | } else { |
5461 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5461 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5462 | 5462 | } |
5463 | 5463 | } |
5464 | 5464 | |
@@ -5490,11 +5490,11 @@ discard block |
||
5490 | 5490 | } |
5491 | 5491 | |
5492 | 5492 | if ($search === '') { |
5493 | - return $str . $replacement; |
|
5493 | + return $str.$replacement; |
|
5494 | 5494 | } |
5495 | 5495 | |
5496 | 5496 | if (\stripos($str, $search) === 0) { |
5497 | - return $replacement . \substr($str, \strlen($search)); |
|
5497 | + return $replacement.\substr($str, \strlen($search)); |
|
5498 | 5498 | } |
5499 | 5499 | |
5500 | 5500 | return $str; |
@@ -5522,11 +5522,11 @@ discard block |
||
5522 | 5522 | } |
5523 | 5523 | |
5524 | 5524 | if ($search === '') { |
5525 | - return $str . $replacement; |
|
5525 | + return $str.$replacement; |
|
5526 | 5526 | } |
5527 | 5527 | |
5528 | 5528 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
5529 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
5529 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
5530 | 5530 | } |
5531 | 5531 | |
5532 | 5532 | return $str; |
@@ -5602,9 +5602,9 @@ discard block |
||
5602 | 5602 | return ''; |
5603 | 5603 | } |
5604 | 5604 | |
5605 | - return (string) self::substr( |
|
5605 | + return (string)self::substr( |
|
5606 | 5606 | $str, |
5607 | - $offset + (int) self::strlen($separator, $encoding), |
|
5607 | + $offset + (int)self::strlen($separator, $encoding), |
|
5608 | 5608 | null, |
5609 | 5609 | $encoding |
5610 | 5610 | ); |
@@ -5634,9 +5634,9 @@ discard block |
||
5634 | 5634 | return ''; |
5635 | 5635 | } |
5636 | 5636 | |
5637 | - return (string) self::substr( |
|
5637 | + return (string)self::substr( |
|
5638 | 5638 | $str, |
5639 | - $offset + (int) self::strlen($separator, $encoding), |
|
5639 | + $offset + (int)self::strlen($separator, $encoding), |
|
5640 | 5640 | null, |
5641 | 5641 | $encoding |
5642 | 5642 | ); |
@@ -5666,7 +5666,7 @@ discard block |
||
5666 | 5666 | return ''; |
5667 | 5667 | } |
5668 | 5668 | |
5669 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
5669 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
5670 | 5670 | } |
5671 | 5671 | |
5672 | 5672 | /** |
@@ -5693,7 +5693,7 @@ discard block |
||
5693 | 5693 | return ''; |
5694 | 5694 | } |
5695 | 5695 | |
5696 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
5696 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
5697 | 5697 | } |
5698 | 5698 | |
5699 | 5699 | /** |
@@ -5772,7 +5772,7 @@ discard block |
||
5772 | 5772 | return ''; |
5773 | 5773 | } |
5774 | 5774 | |
5775 | - return (string) self::substr($str, -$n, null, $encoding); |
|
5775 | + return (string)self::substr($str, -$n, null, $encoding); |
|
5776 | 5776 | } |
5777 | 5777 | |
5778 | 5778 | /** |
@@ -5795,11 +5795,11 @@ discard block |
||
5795 | 5795 | return ''; |
5796 | 5796 | } |
5797 | 5797 | |
5798 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
5798 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
5799 | 5799 | return $str; |
5800 | 5800 | } |
5801 | 5801 | |
5802 | - return (string) self::substr($str, 0, $length - (int) self::strlen($strAddOn), $encoding) . $strAddOn; |
|
5802 | + return (string)self::substr($str, 0, $length - (int)self::strlen($strAddOn), $encoding).$strAddOn; |
|
5803 | 5803 | } |
5804 | 5804 | |
5805 | 5805 | /** |
@@ -5822,17 +5822,17 @@ discard block |
||
5822 | 5822 | return ''; |
5823 | 5823 | } |
5824 | 5824 | |
5825 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
5825 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
5826 | 5826 | return $str; |
5827 | 5827 | } |
5828 | 5828 | |
5829 | 5829 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
5830 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
5830 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
5831 | 5831 | } |
5832 | 5832 | |
5833 | 5833 | $str = self::substr($str, 0, $length, $encoding); |
5834 | 5834 | if ($str === false) { |
5835 | - return '' . $strAddOn; |
|
5835 | + return ''.$strAddOn; |
|
5836 | 5836 | } |
5837 | 5837 | |
5838 | 5838 | $array = \explode(' ', $str); |
@@ -5840,10 +5840,10 @@ discard block |
||
5840 | 5840 | $new_str = \implode(' ', $array); |
5841 | 5841 | |
5842 | 5842 | if ($new_str === '') { |
5843 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
5843 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
5844 | 5844 | } |
5845 | 5845 | |
5846 | - return $new_str . $strAddOn; |
|
5846 | + return $new_str.$strAddOn; |
|
5847 | 5847 | } |
5848 | 5848 | |
5849 | 5849 | /** |
@@ -5857,7 +5857,7 @@ discard block |
||
5857 | 5857 | */ |
5858 | 5858 | public static function str_longest_common_prefix(string $str, string $otherStr, string $encoding = 'UTF-8'): string |
5859 | 5859 | { |
5860 | - $maxLength = \min(self::strlen($str, $encoding), (int) self::strlen($otherStr, $encoding)); |
|
5860 | + $maxLength = \min(self::strlen($str, $encoding), (int)self::strlen($otherStr, $encoding)); |
|
5861 | 5861 | |
5862 | 5862 | $longestCommonPrefix = ''; |
5863 | 5863 | for ($i = 0; $i < $maxLength; ++$i) { |
@@ -5891,8 +5891,8 @@ discard block |
||
5891 | 5891 | { |
5892 | 5892 | // Uses dynamic programming to solve |
5893 | 5893 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
5894 | - $strLength = (int) self::strlen($str, $encoding); |
|
5895 | - $otherLength = (int) self::strlen($otherStr, $encoding); |
|
5894 | + $strLength = (int)self::strlen($str, $encoding); |
|
5895 | + $otherLength = (int)self::strlen($otherStr, $encoding); |
|
5896 | 5896 | |
5897 | 5897 | // Return if either string is empty |
5898 | 5898 | if ($strLength === 0 || $otherLength === 0) { |
@@ -5924,7 +5924,7 @@ discard block |
||
5924 | 5924 | } |
5925 | 5925 | } |
5926 | 5926 | |
5927 | - return (string) self::substr($str, $end - $len, $len, $encoding); |
|
5927 | + return (string)self::substr($str, $end - $len, $len, $encoding); |
|
5928 | 5928 | } |
5929 | 5929 | |
5930 | 5930 | /** |
@@ -5938,7 +5938,7 @@ discard block |
||
5938 | 5938 | */ |
5939 | 5939 | public static function str_longest_common_suffix(string $str, string $otherStr, string $encoding = 'UTF-8'): string |
5940 | 5940 | { |
5941 | - $maxLength = \min(self::strlen($str, $encoding), (int) self::strlen($otherStr, $encoding)); |
|
5941 | + $maxLength = \min(self::strlen($str, $encoding), (int)self::strlen($otherStr, $encoding)); |
|
5942 | 5942 | |
5943 | 5943 | $longestCommonSuffix = ''; |
5944 | 5944 | for ($i = 1; $i <= $maxLength; ++$i) { |
@@ -5949,7 +5949,7 @@ discard block |
||
5949 | 5949 | && |
5950 | 5950 | $char === self::substr($otherStr, -$i, 1, $encoding) |
5951 | 5951 | ) { |
5952 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
5952 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
5953 | 5953 | } else { |
5954 | 5954 | break; |
5955 | 5955 | } |
@@ -5968,7 +5968,7 @@ discard block |
||
5968 | 5968 | */ |
5969 | 5969 | public static function str_matches_pattern(string $str, string $pattern): bool |
5970 | 5970 | { |
5971 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
5971 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
5972 | 5972 | } |
5973 | 5973 | |
5974 | 5974 | /** |
@@ -5985,7 +5985,7 @@ discard block |
||
5985 | 5985 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
5986 | 5986 | { |
5987 | 5987 | // init |
5988 | - $length = (int) self::strlen($str, $encoding); |
|
5988 | + $length = (int)self::strlen($str, $encoding); |
|
5989 | 5989 | |
5990 | 5990 | if ($offset >= 0) { |
5991 | 5991 | return $length > $offset; |
@@ -6011,7 +6011,7 @@ discard block |
||
6011 | 6011 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
6012 | 6012 | { |
6013 | 6013 | // init |
6014 | - $length = (int) self::strlen($str); |
|
6014 | + $length = (int)self::strlen($str); |
|
6015 | 6015 | |
6016 | 6016 | if ( |
6017 | 6017 | ($index >= 0 && $length <= $index) |
@@ -6045,7 +6045,7 @@ discard block |
||
6045 | 6045 | return ''; |
6046 | 6046 | } |
6047 | 6047 | |
6048 | - if ($pad_type !== (int) $pad_type) { |
|
6048 | + if ($pad_type !== (int)$pad_type) { |
|
6049 | 6049 | if ($pad_type === 'left') { |
6050 | 6050 | $pad_type = \STR_PAD_LEFT; |
6051 | 6051 | } elseif ($pad_type === 'right') { |
@@ -6054,46 +6054,46 @@ discard block |
||
6054 | 6054 | $pad_type = \STR_PAD_BOTH; |
6055 | 6055 | } else { |
6056 | 6056 | throw new \InvalidArgumentException( |
6057 | - 'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
6057 | + 'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
6058 | 6058 | ); |
6059 | 6059 | } |
6060 | 6060 | } |
6061 | 6061 | |
6062 | - $str_length = (int) self::strlen($str, $encoding); |
|
6062 | + $str_length = (int)self::strlen($str, $encoding); |
|
6063 | 6063 | |
6064 | 6064 | if ( |
6065 | 6065 | $pad_length > 0 |
6066 | 6066 | && |
6067 | 6067 | $pad_length >= $str_length |
6068 | 6068 | ) { |
6069 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6069 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6070 | 6070 | |
6071 | 6071 | $diff = ($pad_length - $str_length); |
6072 | 6072 | |
6073 | 6073 | switch ($pad_type) { |
6074 | 6074 | case \STR_PAD_LEFT: |
6075 | - $pre = \str_repeat($pad_string, (int) \ceil($diff / $ps_length)); |
|
6076 | - $pre = (string) self::substr($pre, 0, $diff, $encoding); |
|
6075 | + $pre = \str_repeat($pad_string, (int)\ceil($diff / $ps_length)); |
|
6076 | + $pre = (string)self::substr($pre, 0, $diff, $encoding); |
|
6077 | 6077 | $post = ''; |
6078 | 6078 | |
6079 | 6079 | break; |
6080 | 6080 | |
6081 | 6081 | case \STR_PAD_BOTH: |
6082 | - $pre = \str_repeat($pad_string, (int) \ceil($diff / $ps_length / 2)); |
|
6083 | - $pre = (string) self::substr($pre, 0, (int) \floor($diff / 2), $encoding); |
|
6084 | - $post = \str_repeat($pad_string, (int) \ceil($diff / $ps_length / 2)); |
|
6085 | - $post = (string) self::substr($post, 0, (int) \ceil($diff / 2), $encoding); |
|
6082 | + $pre = \str_repeat($pad_string, (int)\ceil($diff / $ps_length / 2)); |
|
6083 | + $pre = (string)self::substr($pre, 0, (int)\floor($diff / 2), $encoding); |
|
6084 | + $post = \str_repeat($pad_string, (int)\ceil($diff / $ps_length / 2)); |
|
6085 | + $post = (string)self::substr($post, 0, (int)\ceil($diff / 2), $encoding); |
|
6086 | 6086 | |
6087 | 6087 | break; |
6088 | 6088 | |
6089 | 6089 | case \STR_PAD_RIGHT: |
6090 | 6090 | default: |
6091 | - $post = \str_repeat($pad_string, (int) \ceil($diff / $ps_length)); |
|
6092 | - $post = (string) self::substr($post, 0, $diff, $encoding); |
|
6091 | + $post = \str_repeat($pad_string, (int)\ceil($diff / $ps_length)); |
|
6092 | + $post = (string)self::substr($post, 0, $diff, $encoding); |
|
6093 | 6093 | $pre = ''; |
6094 | 6094 | } |
6095 | 6095 | |
6096 | - return $pre . $str . $post; |
|
6096 | + return $pre.$str.$post; |
|
6097 | 6097 | } |
6098 | 6098 | |
6099 | 6099 | return $str; |
@@ -6112,9 +6112,9 @@ discard block |
||
6112 | 6112 | */ |
6113 | 6113 | public static function str_pad_both(string $str, int $length, string $padStr = ' ', string $encoding = 'UTF-8'): string |
6114 | 6114 | { |
6115 | - $padding = $length - (int) self::strlen($str, $encoding); |
|
6115 | + $padding = $length - (int)self::strlen($str, $encoding); |
|
6116 | 6116 | |
6117 | - return self::apply_padding($str, (int) \floor($padding / 2), (int) \ceil($padding / 2), $padStr, $encoding); |
|
6117 | + return self::apply_padding($str, (int)\floor($padding / 2), (int)\ceil($padding / 2), $padStr, $encoding); |
|
6118 | 6118 | } |
6119 | 6119 | |
6120 | 6120 | /** |
@@ -6130,7 +6130,7 @@ discard block |
||
6130 | 6130 | */ |
6131 | 6131 | public static function str_pad_left(string $str, int $length, string $padStr = ' ', string $encoding = 'UTF-8'): string |
6132 | 6132 | { |
6133 | - return self::apply_padding($str, $length - (int) self::strlen($str), 0, $padStr, $encoding); |
|
6133 | + return self::apply_padding($str, $length - (int)self::strlen($str), 0, $padStr, $encoding); |
|
6134 | 6134 | } |
6135 | 6135 | |
6136 | 6136 | /** |
@@ -6146,7 +6146,7 @@ discard block |
||
6146 | 6146 | */ |
6147 | 6147 | public static function str_pad_right(string $str, int $length, string $padStr = ' ', string $encoding = 'UTF-8'): string |
6148 | 6148 | { |
6149 | - return self::apply_padding($str, 0, $length - (int) self::strlen($str), $padStr, $encoding); |
|
6149 | + return self::apply_padding($str, 0, $length - (int)self::strlen($str), $padStr, $encoding); |
|
6150 | 6150 | } |
6151 | 6151 | |
6152 | 6152 | /** |
@@ -6231,11 +6231,11 @@ discard block |
||
6231 | 6231 | } |
6232 | 6232 | |
6233 | 6233 | if ($search === '') { |
6234 | - return $str . $replacement; |
|
6234 | + return $str.$replacement; |
|
6235 | 6235 | } |
6236 | 6236 | |
6237 | 6237 | if (\strpos($str, $search) === 0) { |
6238 | - return $replacement . \substr($str, \strlen($search)); |
|
6238 | + return $replacement.\substr($str, \strlen($search)); |
|
6239 | 6239 | } |
6240 | 6240 | |
6241 | 6241 | return $str; |
@@ -6263,11 +6263,11 @@ discard block |
||
6263 | 6263 | } |
6264 | 6264 | |
6265 | 6265 | if ($search === '') { |
6266 | - return $str . $replacement; |
|
6266 | + return $str.$replacement; |
|
6267 | 6267 | } |
6268 | 6268 | |
6269 | 6269 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6270 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6270 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6271 | 6271 | } |
6272 | 6272 | |
6273 | 6273 | return $str; |
@@ -6289,7 +6289,7 @@ discard block |
||
6289 | 6289 | $pos = self::strpos($subject, $search); |
6290 | 6290 | if ($pos !== false) { |
6291 | 6291 | /** @psalm-suppress InvalidReturnStatement */ |
6292 | - return self::substr_replace($subject, $replace, $pos, (int) self::strlen($search)); |
|
6292 | + return self::substr_replace($subject, $replace, $pos, (int)self::strlen($search)); |
|
6293 | 6293 | } |
6294 | 6294 | |
6295 | 6295 | return $subject; |
@@ -6311,7 +6311,7 @@ discard block |
||
6311 | 6311 | $pos = self::strrpos($subject, $search); |
6312 | 6312 | if ($pos !== false) { |
6313 | 6313 | /** @psalm-suppress InvalidReturnStatement */ |
6314 | - return self::substr_replace($subject, $replace, $pos, (int) self::strlen($search)); |
|
6314 | + return self::substr_replace($subject, $replace, $pos, (int)self::strlen($search)); |
|
6315 | 6315 | } |
6316 | 6316 | |
6317 | 6317 | return $subject; |
@@ -6328,7 +6328,7 @@ discard block |
||
6328 | 6328 | */ |
6329 | 6329 | public static function str_shuffle(string $str): string |
6330 | 6330 | { |
6331 | - $indexes = \range(0, (int) self::strlen($str) - 1); |
|
6331 | + $indexes = \range(0, (int)self::strlen($str) - 1); |
|
6332 | 6332 | /** @noinspection NonSecureShuffleUsageInspection */ |
6333 | 6333 | \shuffle($indexes); |
6334 | 6334 | |
@@ -6361,11 +6361,11 @@ discard block |
||
6361 | 6361 | public static function str_slice(string $str, int $start, int $end = null, string $encoding = 'UTF-8') |
6362 | 6362 | { |
6363 | 6363 | if ($end === null) { |
6364 | - $length = (int) self::strlen($str); |
|
6364 | + $length = (int)self::strlen($str); |
|
6365 | 6365 | } elseif ($end >= 0 && $end <= $start) { |
6366 | 6366 | return ''; |
6367 | 6367 | } elseif ($end < 0) { |
6368 | - $length = (int) self::strlen($str) + $end - $start; |
|
6368 | + $length = (int)self::strlen($str) + $end - $start; |
|
6369 | 6369 | } else { |
6370 | 6370 | $length = $end - $start; |
6371 | 6371 | } |
@@ -6386,31 +6386,31 @@ discard block |
||
6386 | 6386 | $str = self::normalize_whitespace($str); |
6387 | 6387 | $str = \str_replace('-', '_', $str); |
6388 | 6388 | |
6389 | - $str = (string) \preg_replace_callback( |
|
6389 | + $str = (string)\preg_replace_callback( |
|
6390 | 6390 | '/([\d|A-Z])/u', |
6391 | 6391 | /** |
6392 | 6392 | * @param string[] $matches |
6393 | 6393 | * |
6394 | 6394 | * @return string |
6395 | 6395 | */ |
6396 | - static function (array $matches) use ($encoding): string { |
|
6396 | + static function(array $matches) use ($encoding): string { |
|
6397 | 6397 | $match = $matches[1]; |
6398 | - $matchInt = (int) $match; |
|
6398 | + $matchInt = (int)$match; |
|
6399 | 6399 | |
6400 | - if ((string) $matchInt === $match) { |
|
6401 | - return '_' . $match . '_'; |
|
6400 | + if ((string)$matchInt === $match) { |
|
6401 | + return '_'.$match.'_'; |
|
6402 | 6402 | } |
6403 | 6403 | |
6404 | - return '_' . self::strtolower($match, $encoding); |
|
6404 | + return '_'.self::strtolower($match, $encoding); |
|
6405 | 6405 | }, |
6406 | 6406 | $str |
6407 | 6407 | ); |
6408 | 6408 | |
6409 | - $str = (string) \preg_replace( |
|
6409 | + $str = (string)\preg_replace( |
|
6410 | 6410 | [ |
6411 | - '/\s+/', // convert spaces to "_" |
|
6412 | - '/^\s+|\s+$/', // trim leading & trailing spaces |
|
6413 | - '/_+/', // remove double "_" |
|
6411 | + '/\s+/', // convert spaces to "_" |
|
6412 | + '/^\s+|\s+$/', // trim leading & trailing spaces |
|
6413 | + '/_+/', // remove double "_" |
|
6414 | 6414 | ], |
6415 | 6415 | [ |
6416 | 6416 | '_', |
@@ -6497,7 +6497,7 @@ discard block |
||
6497 | 6497 | $limit = -1; |
6498 | 6498 | } |
6499 | 6499 | |
6500 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
6500 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
6501 | 6501 | |
6502 | 6502 | if ($array === false) { |
6503 | 6503 | return []; |
@@ -6580,9 +6580,9 @@ discard block |
||
6580 | 6580 | return ''; |
6581 | 6581 | } |
6582 | 6582 | |
6583 | - return (string) self::substr( |
|
6583 | + return (string)self::substr( |
|
6584 | 6584 | $str, |
6585 | - $offset + (int) self::strlen($separator, $encoding), |
|
6585 | + $offset + (int)self::strlen($separator, $encoding), |
|
6586 | 6586 | null, |
6587 | 6587 | $encoding |
6588 | 6588 | ); |
@@ -6612,9 +6612,9 @@ discard block |
||
6612 | 6612 | return ''; |
6613 | 6613 | } |
6614 | 6614 | |
6615 | - return (string) self::substr( |
|
6615 | + return (string)self::substr( |
|
6616 | 6616 | $str, |
6617 | - $offset + (int) self::strlen($separator, $encoding), |
|
6617 | + $offset + (int)self::strlen($separator, $encoding), |
|
6618 | 6618 | null, |
6619 | 6619 | $encoding |
6620 | 6620 | ); |
@@ -6644,7 +6644,7 @@ discard block |
||
6644 | 6644 | return ''; |
6645 | 6645 | } |
6646 | 6646 | |
6647 | - return (string) self::substr( |
|
6647 | + return (string)self::substr( |
|
6648 | 6648 | $str, |
6649 | 6649 | 0, |
6650 | 6650 | $offset, |
@@ -6676,7 +6676,7 @@ discard block |
||
6676 | 6676 | return ''; |
6677 | 6677 | } |
6678 | 6678 | |
6679 | - return (string) self::substr( |
|
6679 | + return (string)self::substr( |
|
6680 | 6680 | $str, |
6681 | 6681 | 0, |
6682 | 6682 | $offset, |
@@ -6867,16 +6867,16 @@ discard block |
||
6867 | 6867 | } |
6868 | 6868 | |
6869 | 6869 | // the main substitutions |
6870 | - $str = (string) \preg_replace_callback( |
|
6870 | + $str = (string)\preg_replace_callback( |
|
6871 | 6871 | '~\b (_*) (?: # 1. Leading underscore and |
6872 | 6872 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
6873 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) # URL, domain, or email |
|
6873 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) # URL, domain, or email |
|
6874 | 6874 | | |
6875 | - ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' ) # 3. or small word (case-insensitive) |
|
6875 | + ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' ) # 3. or small word (case-insensitive) |
|
6876 | 6876 | | |
6877 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 4. or word w/o internal caps |
|
6877 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 4. or word w/o internal caps |
|
6878 | 6878 | | |
6879 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 5. or some other word |
|
6879 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 5. or some other word |
|
6880 | 6880 | ) (_*) \b # 6. With trailing underscore |
6881 | 6881 | ~ux', |
6882 | 6882 | /** |
@@ -6884,7 +6884,7 @@ discard block |
||
6884 | 6884 | * |
6885 | 6885 | * @return string |
6886 | 6886 | */ |
6887 | - static function (array $matches) use ($encoding): string { |
|
6887 | + static function(array $matches) use ($encoding): string { |
|
6888 | 6888 | // preserve leading underscore |
6889 | 6889 | $str = $matches[1]; |
6890 | 6890 | if ($matches[2]) { |
@@ -6909,26 +6909,26 @@ discard block |
||
6909 | 6909 | ); |
6910 | 6910 | |
6911 | 6911 | // Exceptions for small words: capitalize at start of title... |
6912 | - $str = (string) \preg_replace_callback( |
|
6912 | + $str = (string)\preg_replace_callback( |
|
6913 | 6913 | '~( \A [[:punct:]]* # start of title... |
6914 | 6914 | | [:.;?!][ ]+ # or of subsentence... |
6915 | 6915 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
6916 | - ( ' . $smallWordsRx . ' ) \b # ...followed by small word |
|
6916 | + ( ' . $smallWordsRx.' ) \b # ...followed by small word |
|
6917 | 6917 | ~uxi', |
6918 | 6918 | /** |
6919 | 6919 | * @param string[] $matches |
6920 | 6920 | * |
6921 | 6921 | * @return string |
6922 | 6922 | */ |
6923 | - static function (array $matches) use ($encoding): string { |
|
6924 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
6923 | + static function(array $matches) use ($encoding): string { |
|
6924 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
6925 | 6925 | }, |
6926 | 6926 | $str |
6927 | 6927 | ); |
6928 | 6928 | |
6929 | 6929 | // ...and end of title |
6930 | - $str = (string) \preg_replace_callback( |
|
6931 | - '~\b ( ' . $smallWordsRx . ' ) # small word... |
|
6930 | + $str = (string)\preg_replace_callback( |
|
6931 | + '~\b ( '.$smallWordsRx.' ) # small word... |
|
6932 | 6932 | (?= [[:punct:]]* \Z # ...at the end of the title... |
6933 | 6933 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
6934 | 6934 | ~uxi', |
@@ -6937,7 +6937,7 @@ discard block |
||
6937 | 6937 | * |
6938 | 6938 | * @return string |
6939 | 6939 | */ |
6940 | - static function (array $matches) use ($encoding): string { |
|
6940 | + static function(array $matches) use ($encoding): string { |
|
6941 | 6941 | return static::str_upper_first($matches[1], $encoding); |
6942 | 6942 | }, |
6943 | 6943 | $str |
@@ -6945,10 +6945,10 @@ discard block |
||
6945 | 6945 | |
6946 | 6946 | // Exceptions for small words in hyphenated compound words. |
6947 | 6947 | // e.g. "in-flight" -> In-Flight |
6948 | - $str = (string) \preg_replace_callback( |
|
6948 | + $str = (string)\preg_replace_callback( |
|
6949 | 6949 | '~\b |
6950 | 6950 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
6951 | - ( ' . $smallWordsRx . ' ) |
|
6951 | + ( ' . $smallWordsRx.' ) |
|
6952 | 6952 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
6953 | 6953 | ~uxi', |
6954 | 6954 | /** |
@@ -6956,18 +6956,18 @@ discard block |
||
6956 | 6956 | * |
6957 | 6957 | * @return string |
6958 | 6958 | */ |
6959 | - static function (array $matches) use ($encoding): string { |
|
6959 | + static function(array $matches) use ($encoding): string { |
|
6960 | 6960 | return static::str_upper_first($matches[1], $encoding); |
6961 | 6961 | }, |
6962 | 6962 | $str |
6963 | 6963 | ); |
6964 | 6964 | |
6965 | 6965 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
6966 | - $str = (string) \preg_replace_callback( |
|
6966 | + $str = (string)\preg_replace_callback( |
|
6967 | 6967 | '~\b |
6968 | 6968 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
6969 | 6969 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
6970 | - ( ' . $smallWordsRx . ' ) # ...followed by small word |
|
6970 | + ( ' . $smallWordsRx.' ) # ...followed by small word |
|
6971 | 6971 | (?! - ) # Negative lookahead for another - |
6972 | 6972 | ~uxi', |
6973 | 6973 | /** |
@@ -6975,8 +6975,8 @@ discard block |
||
6975 | 6975 | * |
6976 | 6976 | * @return string |
6977 | 6977 | */ |
6978 | - static function (array $matches) use ($encoding): string { |
|
6979 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
6978 | + static function(array $matches) use ($encoding): string { |
|
6979 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
6980 | 6980 | }, |
6981 | 6981 | $str |
6982 | 6982 | ); |
@@ -7069,7 +7069,7 @@ discard block |
||
7069 | 7069 | ); |
7070 | 7070 | |
7071 | 7071 | foreach ($tmpReturn as &$item) { |
7072 | - $item = (string) $item; |
|
7072 | + $item = (string)$item; |
|
7073 | 7073 | } |
7074 | 7074 | |
7075 | 7075 | return $tmpReturn; |
@@ -7106,21 +7106,21 @@ discard block |
||
7106 | 7106 | public static function str_truncate($str, int $length, string $substring = '', string $encoding = 'UTF-8'): string |
7107 | 7107 | { |
7108 | 7108 | // init |
7109 | - $str = (string) $str; |
|
7109 | + $str = (string)$str; |
|
7110 | 7110 | |
7111 | 7111 | if ($str === '') { |
7112 | 7112 | return ''; |
7113 | 7113 | } |
7114 | 7114 | |
7115 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
7115 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
7116 | 7116 | return $str; |
7117 | 7117 | } |
7118 | 7118 | |
7119 | 7119 | // Need to further trim the string so we can append the substring |
7120 | - $substringLength = (int) self::strlen($substring, $encoding); |
|
7120 | + $substringLength = (int)self::strlen($substring, $encoding); |
|
7121 | 7121 | $length -= $substringLength; |
7122 | 7122 | |
7123 | - return ((string) self::substr($str, 0, $length, $encoding)) . $substring; |
|
7123 | + return ((string)self::substr($str, 0, $length, $encoding)).$substring; |
|
7124 | 7124 | } |
7125 | 7125 | |
7126 | 7126 | /** |
@@ -7138,12 +7138,12 @@ discard block |
||
7138 | 7138 | */ |
7139 | 7139 | public static function str_truncate_safe(string $str, int $length, string $substring = '', string $encoding = 'UTF-8'): string |
7140 | 7140 | { |
7141 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
7141 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
7142 | 7142 | return $str; |
7143 | 7143 | } |
7144 | 7144 | |
7145 | 7145 | // need to further trim the string so we can append the substring |
7146 | - $substringLength = (int) self::strlen($substring, $encoding); |
|
7146 | + $substringLength = (int)self::strlen($substring, $encoding); |
|
7147 | 7147 | $length -= $substringLength; |
7148 | 7148 | |
7149 | 7149 | $truncated = self::substr($str, 0, $length, $encoding); |
@@ -7158,11 +7158,11 @@ discard block |
||
7158 | 7158 | $lastPos = self::strrpos($truncated, ' ', 0, $encoding); |
7159 | 7159 | |
7160 | 7160 | if ($lastPos !== false || $strPosSpace !== false) { |
7161 | - $truncated = (string) self::substr($truncated, 0, (int) $lastPos, $encoding); |
|
7161 | + $truncated = (string)self::substr($truncated, 0, (int)$lastPos, $encoding); |
|
7162 | 7162 | } |
7163 | 7163 | } |
7164 | 7164 | |
7165 | - return $truncated . $substring; |
|
7165 | + return $truncated.$substring; |
|
7166 | 7166 | } |
7167 | 7167 | |
7168 | 7168 | /** |
@@ -7242,13 +7242,13 @@ discard block |
||
7242 | 7242 | } |
7243 | 7243 | } elseif ($format === 2) { |
7244 | 7244 | $numberOfWords = []; |
7245 | - $offset = (int) self::strlen($strParts[0]); |
|
7245 | + $offset = (int)self::strlen($strParts[0]); |
|
7246 | 7246 | for ($i = 1; $i < $len; $i += 2) { |
7247 | 7247 | $numberOfWords[$offset] = $strParts[$i]; |
7248 | - $offset += (int) self::strlen($strParts[$i]) + (int) self::strlen($strParts[$i + 1]); |
|
7248 | + $offset += (int)self::strlen($strParts[$i]) + (int)self::strlen($strParts[$i + 1]); |
|
7249 | 7249 | } |
7250 | 7250 | } else { |
7251 | - $numberOfWords = (int) (($len - 1) / 2); |
|
7251 | + $numberOfWords = (int)(($len - 1) / 2); |
|
7252 | 7252 | } |
7253 | 7253 | |
7254 | 7254 | return $numberOfWords; |
@@ -7308,7 +7308,7 @@ discard block |
||
7308 | 7308 | public static function strcmp(string $str1, string $str2): int |
7309 | 7309 | { |
7310 | 7310 | /** @noinspection PhpUndefinedClassInspection */ |
7311 | - return $str1 . '' === $str2 . '' ? 0 : \strcmp( |
|
7311 | + return $str1.'' === $str2.'' ? 0 : \strcmp( |
|
7312 | 7312 | \Normalizer::normalize($str1, \Normalizer::NFD), |
7313 | 7313 | \Normalizer::normalize($str2, \Normalizer::NFD) |
7314 | 7314 | ); |
@@ -7327,12 +7327,12 @@ discard block |
||
7327 | 7327 | public static function strcspn(string $str, string $charList, int $offset = null, int $length = null): int |
7328 | 7328 | { |
7329 | 7329 | if ($charList === '') { |
7330 | - return (int) self::strlen($str); |
|
7330 | + return (int)self::strlen($str); |
|
7331 | 7331 | } |
7332 | 7332 | |
7333 | 7333 | if ($offset !== null || $length !== null) { |
7334 | 7334 | /** @noinspection UnnecessaryCastingInspection */ |
7335 | - $strTmp = self::substr($str, (int) $offset, $length); |
|
7335 | + $strTmp = self::substr($str, (int)$offset, $length); |
|
7336 | 7336 | if ($strTmp === false) { |
7337 | 7337 | return 0; |
7338 | 7338 | } |
@@ -7344,7 +7344,7 @@ discard block |
||
7344 | 7344 | } |
7345 | 7345 | |
7346 | 7346 | $matches = []; |
7347 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $matches)) { |
|
7347 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $matches)) { |
|
7348 | 7348 | $return = self::strlen($matches[1]); |
7349 | 7349 | if ($return === false) { |
7350 | 7350 | return 0; |
@@ -7353,7 +7353,7 @@ discard block |
||
7353 | 7353 | return $return; |
7354 | 7354 | } |
7355 | 7355 | |
7356 | - return (int) self::strlen($str); |
|
7356 | + return (int)self::strlen($str); |
|
7357 | 7357 | } |
7358 | 7358 | |
7359 | 7359 | /** |
@@ -7449,7 +7449,7 @@ discard block |
||
7449 | 7449 | } |
7450 | 7450 | |
7451 | 7451 | /** @noinspection UnnecessaryCastingInspection */ |
7452 | - return \strip_tags($str, (string) $allowable_tags); |
|
7452 | + return \strip_tags($str, (string)$allowable_tags); |
|
7453 | 7453 | } |
7454 | 7454 | |
7455 | 7455 | /** |
@@ -7467,7 +7467,7 @@ discard block |
||
7467 | 7467 | return ''; |
7468 | 7468 | } |
7469 | 7469 | |
7470 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
7470 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
7471 | 7471 | } |
7472 | 7472 | |
7473 | 7473 | /** |
@@ -7588,7 +7588,7 @@ discard block |
||
7588 | 7588 | && |
7589 | 7589 | self::$SUPPORT['mbstring'] === false |
7590 | 7590 | ) { |
7591 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
7591 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
7592 | 7592 | } |
7593 | 7593 | |
7594 | 7594 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -7610,7 +7610,7 @@ discard block |
||
7610 | 7610 | return \stristr($haystack, $needle, $before_needle); |
7611 | 7611 | } |
7612 | 7612 | |
7613 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
7613 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
7614 | 7614 | |
7615 | 7615 | if (!isset($match[1])) { |
7616 | 7616 | return false; |
@@ -7620,7 +7620,7 @@ discard block |
||
7620 | 7620 | return $match[1]; |
7621 | 7621 | } |
7622 | 7622 | |
7623 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
7623 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
7624 | 7624 | } |
7625 | 7625 | |
7626 | 7626 | /** |
@@ -7679,7 +7679,7 @@ discard block |
||
7679 | 7679 | && |
7680 | 7680 | self::$SUPPORT['iconv'] === false |
7681 | 7681 | ) { |
7682 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
7682 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
7683 | 7683 | } |
7684 | 7684 | |
7685 | 7685 | // |
@@ -7805,7 +7805,7 @@ discard block |
||
7805 | 7805 | */ |
7806 | 7806 | public static function strnatcmp(string $str1, string $str2): int |
7807 | 7807 | { |
7808 | - return $str1 . '' === $str2 . '' ? 0 : \strnatcmp((string) self::strtonatfold($str1), (string) self::strtonatfold($str2)); |
|
7808 | + return $str1.'' === $str2.'' ? 0 : \strnatcmp((string)self::strtonatfold($str1), (string)self::strtonatfold($str2)); |
|
7809 | 7809 | } |
7810 | 7810 | |
7811 | 7811 | /** |
@@ -7848,8 +7848,8 @@ discard block |
||
7848 | 7848 | */ |
7849 | 7849 | public static function strncmp(string $str1, string $str2, int $len): int |
7850 | 7850 | { |
7851 | - $str1 = (string) self::substr($str1, 0, $len); |
|
7852 | - $str2 = (string) self::substr($str2, 0, $len); |
|
7851 | + $str1 = (string)self::substr($str1, 0, $len); |
|
7852 | + $str2 = (string)self::substr($str2, 0, $len); |
|
7853 | 7853 | |
7854 | 7854 | return self::strcmp($str1, $str2); |
7855 | 7855 | } |
@@ -7870,8 +7870,8 @@ discard block |
||
7870 | 7870 | return false; |
7871 | 7871 | } |
7872 | 7872 | |
7873 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
7874 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
7873 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
7874 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
7875 | 7875 | } |
7876 | 7876 | |
7877 | 7877 | return false; |
@@ -7899,10 +7899,10 @@ discard block |
||
7899 | 7899 | } |
7900 | 7900 | |
7901 | 7901 | // iconv and mbstring do not support integer $needle |
7902 | - if ((int) $needle === $needle && $needle >= 0) { |
|
7903 | - $needle = (string) self::chr($needle); |
|
7902 | + if ((int)$needle === $needle && $needle >= 0) { |
|
7903 | + $needle = (string)self::chr($needle); |
|
7904 | 7904 | } |
7905 | - $needle = (string) $needle; |
|
7905 | + $needle = (string)$needle; |
|
7906 | 7906 | |
7907 | 7907 | if ($needle === '') { |
7908 | 7908 | return false; |
@@ -7942,7 +7942,7 @@ discard block |
||
7942 | 7942 | && |
7943 | 7943 | self::$SUPPORT['mbstring'] === false |
7944 | 7944 | ) { |
7945 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
7945 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
7946 | 7946 | } |
7947 | 7947 | |
7948 | 7948 | // |
@@ -8010,7 +8010,7 @@ discard block |
||
8010 | 8010 | if ($haystackTmp === false) { |
8011 | 8011 | $haystackTmp = ''; |
8012 | 8012 | } |
8013 | - $haystack = (string) $haystackTmp; |
|
8013 | + $haystack = (string)$haystackTmp; |
|
8014 | 8014 | |
8015 | 8015 | if ($offset < 0) { |
8016 | 8016 | $offset = 0; |
@@ -8022,7 +8022,7 @@ discard block |
||
8022 | 8022 | } |
8023 | 8023 | |
8024 | 8024 | if ($pos) { |
8025 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
8025 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
8026 | 8026 | } |
8027 | 8027 | |
8028 | 8028 | return $offset + 0; |
@@ -8108,7 +8108,7 @@ discard block |
||
8108 | 8108 | && |
8109 | 8109 | self::$SUPPORT['mbstring'] === false |
8110 | 8110 | ) { |
8111 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8111 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8112 | 8112 | } |
8113 | 8113 | |
8114 | 8114 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -8140,7 +8140,7 @@ discard block |
||
8140 | 8140 | if ($needleTmp === false) { |
8141 | 8141 | return false; |
8142 | 8142 | } |
8143 | - $needle = (string) $needleTmp; |
|
8143 | + $needle = (string)$needleTmp; |
|
8144 | 8144 | |
8145 | 8145 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
8146 | 8146 | if ($pos === false) { |
@@ -8162,7 +8162,7 @@ discard block |
||
8162 | 8162 | if ($needleTmp === false) { |
8163 | 8163 | return false; |
8164 | 8164 | } |
8165 | - $needle = (string) $needleTmp; |
|
8165 | + $needle = (string)$needleTmp; |
|
8166 | 8166 | |
8167 | 8167 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
8168 | 8168 | if ($pos === false) { |
@@ -8190,7 +8190,7 @@ discard block |
||
8190 | 8190 | } |
8191 | 8191 | |
8192 | 8192 | $reversed = ''; |
8193 | - $i = (int) self::strlen($str); |
|
8193 | + $i = (int)self::strlen($str); |
|
8194 | 8194 | while ($i--) { |
8195 | 8195 | $reversedTmp = self::substr($str, $i, 1); |
8196 | 8196 | if ($reversedTmp !== false) { |
@@ -8258,7 +8258,7 @@ discard block |
||
8258 | 8258 | if ($needleTmp === false) { |
8259 | 8259 | return false; |
8260 | 8260 | } |
8261 | - $needle = (string) $needleTmp; |
|
8261 | + $needle = (string)$needleTmp; |
|
8262 | 8262 | |
8263 | 8263 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
8264 | 8264 | if ($pos === false) { |
@@ -8292,10 +8292,10 @@ discard block |
||
8292 | 8292 | } |
8293 | 8293 | |
8294 | 8294 | // iconv and mbstring do not support integer $needle |
8295 | - if ((int) $needle === $needle && $needle >= 0) { |
|
8296 | - $needle = (string) self::chr($needle); |
|
8295 | + if ((int)$needle === $needle && $needle >= 0) { |
|
8296 | + $needle = (string)self::chr($needle); |
|
8297 | 8297 | } |
8298 | - $needle = (string) $needle; |
|
8298 | + $needle = (string)$needle; |
|
8299 | 8299 | |
8300 | 8300 | if ($needle === '') { |
8301 | 8301 | return false; |
@@ -8332,7 +8332,7 @@ discard block |
||
8332 | 8332 | && |
8333 | 8333 | self::$SUPPORT['mbstring'] === false |
8334 | 8334 | ) { |
8335 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8335 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8336 | 8336 | } |
8337 | 8337 | |
8338 | 8338 | // |
@@ -8439,10 +8439,10 @@ discard block |
||
8439 | 8439 | } |
8440 | 8440 | |
8441 | 8441 | // iconv and mbstring do not support integer $needle |
8442 | - if ((int) $needle === $needle && $needle >= 0) { |
|
8443 | - $needle = (string) self::chr($needle); |
|
8442 | + if ((int)$needle === $needle && $needle >= 0) { |
|
8443 | + $needle = (string)self::chr($needle); |
|
8444 | 8444 | } |
8445 | - $needle = (string) $needle; |
|
8445 | + $needle = (string)$needle; |
|
8446 | 8446 | |
8447 | 8447 | if ($needle === '') { |
8448 | 8448 | return false; |
@@ -8479,7 +8479,7 @@ discard block |
||
8479 | 8479 | && |
8480 | 8480 | self::$SUPPORT['mbstring'] === false |
8481 | 8481 | ) { |
8482 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8482 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8483 | 8483 | } |
8484 | 8484 | |
8485 | 8485 | // |
@@ -8539,7 +8539,7 @@ discard block |
||
8539 | 8539 | if ($haystackTmp === false) { |
8540 | 8540 | $haystackTmp = ''; |
8541 | 8541 | } |
8542 | - $haystack = (string) $haystackTmp; |
|
8542 | + $haystack = (string)$haystackTmp; |
|
8543 | 8543 | } |
8544 | 8544 | |
8545 | 8545 | $pos = self::strrpos_in_byte($haystack, $needle); |
@@ -8552,7 +8552,7 @@ discard block |
||
8552 | 8552 | return false; |
8553 | 8553 | } |
8554 | 8554 | |
8555 | - return $offset + (int) self::strlen($strTmp); |
|
8555 | + return $offset + (int)self::strlen($strTmp); |
|
8556 | 8556 | } |
8557 | 8557 | |
8558 | 8558 | /** |
@@ -8604,7 +8604,7 @@ discard block |
||
8604 | 8604 | public static function strspn(string $str, string $mask, int $offset = 0, int $length = null) |
8605 | 8605 | { |
8606 | 8606 | if ($offset || $length !== null) { |
8607 | - $str = (string) self::substr($str, $offset, $length); |
|
8607 | + $str = (string)self::substr($str, $offset, $length); |
|
8608 | 8608 | } |
8609 | 8609 | |
8610 | 8610 | if ($str === '' || $mask === '') { |
@@ -8613,7 +8613,7 @@ discard block |
||
8613 | 8613 | |
8614 | 8614 | $matches = []; |
8615 | 8615 | |
8616 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0]) : 0; |
|
8616 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0]) : 0; |
|
8617 | 8617 | } |
8618 | 8618 | |
8619 | 8619 | /** |
@@ -8669,7 +8669,7 @@ discard block |
||
8669 | 8669 | && |
8670 | 8670 | self::$SUPPORT['mbstring'] === false |
8671 | 8671 | ) { |
8672 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8672 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8673 | 8673 | } |
8674 | 8674 | |
8675 | 8675 | // |
@@ -8707,7 +8707,7 @@ discard block |
||
8707 | 8707 | // fallback via vanilla php |
8708 | 8708 | // |
8709 | 8709 | |
8710 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
8710 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
8711 | 8711 | |
8712 | 8712 | if (!isset($match[1])) { |
8713 | 8713 | return false; |
@@ -8717,7 +8717,7 @@ discard block |
||
8717 | 8717 | return $match[1]; |
8718 | 8718 | } |
8719 | 8719 | |
8720 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
8720 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
8721 | 8721 | } |
8722 | 8722 | |
8723 | 8723 | /** |
@@ -8816,7 +8816,7 @@ discard block |
||
8816 | 8816 | public static function strtolower($str, string $encoding = 'UTF-8', bool $cleanUtf8 = false, string $lang = null, bool $tryToKeepStringLength = false): string |
8817 | 8817 | { |
8818 | 8818 | // init |
8819 | - $str = (string) $str; |
|
8819 | + $str = (string)$str; |
|
8820 | 8820 | |
8821 | 8821 | if ($str === '') { |
8822 | 8822 | return ''; |
@@ -8843,9 +8843,9 @@ discard block |
||
8843 | 8843 | } |
8844 | 8844 | |
8845 | 8845 | if (self::$SUPPORT['intl'] === true) { |
8846 | - $langCode = $lang . '-Lower'; |
|
8846 | + $langCode = $lang.'-Lower'; |
|
8847 | 8847 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
8848 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, \E_USER_WARNING); |
|
8848 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, \E_USER_WARNING); |
|
8849 | 8849 | |
8850 | 8850 | $langCode = 'Any-Lower'; |
8851 | 8851 | } |
@@ -8854,7 +8854,7 @@ discard block |
||
8854 | 8854 | return \transliterator_transliterate($langCode, $str); |
8855 | 8855 | } |
8856 | 8856 | |
8857 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
8857 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
8858 | 8858 | } |
8859 | 8859 | |
8860 | 8860 | // always fallback via symfony polyfill |
@@ -8878,7 +8878,7 @@ discard block |
||
8878 | 8878 | public static function strtoupper($str, string $encoding = 'UTF-8', bool $cleanUtf8 = false, string $lang = null, bool $tryToKeepStringLength = false): string |
8879 | 8879 | { |
8880 | 8880 | // init |
8881 | - $str = (string) $str; |
|
8881 | + $str = (string)$str; |
|
8882 | 8882 | |
8883 | 8883 | if ($str === '') { |
8884 | 8884 | return ''; |
@@ -8905,9 +8905,9 @@ discard block |
||
8905 | 8905 | } |
8906 | 8906 | |
8907 | 8907 | if (self::$SUPPORT['intl'] === true) { |
8908 | - $langCode = $lang . '-Upper'; |
|
8908 | + $langCode = $lang.'-Upper'; |
|
8909 | 8909 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
8910 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
8910 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
8911 | 8911 | |
8912 | 8912 | $langCode = 'Any-Upper'; |
8913 | 8913 | } |
@@ -8916,7 +8916,7 @@ discard block |
||
8916 | 8916 | return \transliterator_transliterate($langCode, $str); |
8917 | 8917 | } |
8918 | 8918 | |
8919 | - \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
8919 | + \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
8920 | 8920 | } |
8921 | 8921 | |
8922 | 8922 | // always fallback via symfony polyfill |
@@ -8960,7 +8960,7 @@ discard block |
||
8960 | 8960 | |
8961 | 8961 | $from = \array_combine($from, $to); |
8962 | 8962 | if ($from === false) { |
8963 | - 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) . ')'); |
|
8963 | + 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).')'); |
|
8964 | 8964 | } |
8965 | 8965 | } |
8966 | 8966 | |
@@ -9017,9 +9017,9 @@ discard block |
||
9017 | 9017 | } |
9018 | 9018 | |
9019 | 9019 | $wide = 0; |
9020 | - $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); |
|
9020 | + $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); |
|
9021 | 9021 | |
9022 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
9022 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
9023 | 9023 | } |
9024 | 9024 | |
9025 | 9025 | /** |
@@ -9115,9 +9115,9 @@ discard block |
||
9115 | 9115 | } |
9116 | 9116 | |
9117 | 9117 | if ($length === null) { |
9118 | - $length = (int) $str_length; |
|
9118 | + $length = (int)$str_length; |
|
9119 | 9119 | } else { |
9120 | - $length = (int) $length; |
|
9120 | + $length = (int)$length; |
|
9121 | 9121 | } |
9122 | 9122 | |
9123 | 9123 | if ( |
@@ -9125,7 +9125,7 @@ discard block |
||
9125 | 9125 | && |
9126 | 9126 | self::$SUPPORT['mbstring'] === false |
9127 | 9127 | ) { |
9128 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9128 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9129 | 9129 | } |
9130 | 9130 | |
9131 | 9131 | // |
@@ -9204,8 +9204,8 @@ discard block |
||
9204 | 9204 | || |
9205 | 9205 | $length !== null |
9206 | 9206 | ) { |
9207 | - $str1 = (string) self::substr($str1, $offset, $length); |
|
9208 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1)); |
|
9207 | + $str1 = (string)self::substr($str1, $offset, $length); |
|
9208 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1)); |
|
9209 | 9209 | } |
9210 | 9210 | |
9211 | 9211 | if ($case_insensitivity === true) { |
@@ -9251,7 +9251,7 @@ discard block |
||
9251 | 9251 | if ($lengthTmp === false) { |
9252 | 9252 | return false; |
9253 | 9253 | } |
9254 | - $length = (int) $lengthTmp; |
|
9254 | + $length = (int)$lengthTmp; |
|
9255 | 9255 | } |
9256 | 9256 | |
9257 | 9257 | if ( |
@@ -9268,7 +9268,7 @@ discard block |
||
9268 | 9268 | return false; |
9269 | 9269 | } |
9270 | 9270 | |
9271 | - $haystack = (string) self::substr($haystack, $offset, $length, $encoding); |
|
9271 | + $haystack = (string)self::substr($haystack, $offset, $length, $encoding); |
|
9272 | 9272 | } |
9273 | 9273 | |
9274 | 9274 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
@@ -9291,14 +9291,14 @@ discard block |
||
9291 | 9291 | && |
9292 | 9292 | self::$SUPPORT['mbstring'] === false |
9293 | 9293 | ) { |
9294 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9294 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9295 | 9295 | } |
9296 | 9296 | |
9297 | 9297 | if (self::$SUPPORT['mbstring'] === true) { |
9298 | 9298 | return \mb_substr_count($haystack, $needle, $encoding); |
9299 | 9299 | } |
9300 | 9300 | |
9301 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
9301 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
9302 | 9302 | |
9303 | 9303 | return \count($matches); |
9304 | 9304 | } |
@@ -9345,7 +9345,7 @@ discard block |
||
9345 | 9345 | if ($lengthTmp === false) { |
9346 | 9346 | return false; |
9347 | 9347 | } |
9348 | - $length = (int) $lengthTmp; |
|
9348 | + $length = (int)$lengthTmp; |
|
9349 | 9349 | } |
9350 | 9350 | |
9351 | 9351 | if ( |
@@ -9366,7 +9366,7 @@ discard block |
||
9366 | 9366 | if ($haystackTmp === false) { |
9367 | 9367 | $haystackTmp = ''; |
9368 | 9368 | } |
9369 | - $haystack = (string) $haystackTmp; |
|
9369 | + $haystack = (string)$haystackTmp; |
|
9370 | 9370 | } |
9371 | 9371 | |
9372 | 9372 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -9402,7 +9402,7 @@ discard block |
||
9402 | 9402 | // only a fallback to prevent BC in the api ... |
9403 | 9403 | /** @psalm-suppress RedundantConditionGivenDocblockType */ |
9404 | 9404 | if ($caseSensitive !== false && $caseSensitive !== true) { |
9405 | - $encoding = (string) $caseSensitive; |
|
9405 | + $encoding = (string)$caseSensitive; |
|
9406 | 9406 | } |
9407 | 9407 | |
9408 | 9408 | if (!$caseSensitive) { |
@@ -9410,7 +9410,7 @@ discard block |
||
9410 | 9410 | $substring = self::strtocasefold($substring, true, false, $encoding, null, false); |
9411 | 9411 | } |
9412 | 9412 | |
9413 | - return (int) self::substr_count($str, $substring, 0, null, $encoding); |
|
9413 | + return (int)self::substr_count($str, $substring, 0, null, $encoding); |
|
9414 | 9414 | } |
9415 | 9415 | |
9416 | 9416 | /** |
@@ -9432,7 +9432,7 @@ discard block |
||
9432 | 9432 | } |
9433 | 9433 | |
9434 | 9434 | if (self::str_istarts_with($haystack, $needle) === true) { |
9435 | - $haystack = (string) self::substr($haystack, (int) self::strlen($needle)); |
|
9435 | + $haystack = (string)self::substr($haystack, (int)self::strlen($needle)); |
|
9436 | 9436 | } |
9437 | 9437 | |
9438 | 9438 | return $haystack; |
@@ -9497,7 +9497,7 @@ discard block |
||
9497 | 9497 | } |
9498 | 9498 | |
9499 | 9499 | if (self::str_iends_with($haystack, $needle) === true) { |
9500 | - $haystack = (string) self::substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
9500 | + $haystack = (string)self::substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
9501 | 9501 | } |
9502 | 9502 | |
9503 | 9503 | return $haystack; |
@@ -9522,7 +9522,7 @@ discard block |
||
9522 | 9522 | } |
9523 | 9523 | |
9524 | 9524 | if (self::str_starts_with($haystack, $needle) === true) { |
9525 | - $haystack = (string) self::substr($haystack, (int) self::strlen($needle)); |
|
9525 | + $haystack = (string)self::substr($haystack, (int)self::strlen($needle)); |
|
9526 | 9526 | } |
9527 | 9527 | |
9528 | 9528 | return $haystack; |
@@ -9569,7 +9569,7 @@ discard block |
||
9569 | 9569 | if (\is_array($offset) === true) { |
9570 | 9570 | $offset = \array_slice($offset, 0, $num); |
9571 | 9571 | foreach ($offset as &$valueTmp) { |
9572 | - $valueTmp = (int) $valueTmp === $valueTmp ? $valueTmp : 0; |
|
9572 | + $valueTmp = (int)$valueTmp === $valueTmp ? $valueTmp : 0; |
|
9573 | 9573 | } |
9574 | 9574 | unset($valueTmp); |
9575 | 9575 | } else { |
@@ -9583,7 +9583,7 @@ discard block |
||
9583 | 9583 | $length = \array_slice($length, 0, $num); |
9584 | 9584 | foreach ($length as &$valueTmpV2) { |
9585 | 9585 | if ($valueTmpV2 !== null) { |
9586 | - $valueTmpV2 = (int) $valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
9586 | + $valueTmpV2 = (int)$valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
9587 | 9587 | } else { |
9588 | 9588 | $valueTmpV2 = 0; |
9589 | 9589 | } |
@@ -9606,8 +9606,8 @@ discard block |
||
9606 | 9606 | } |
9607 | 9607 | |
9608 | 9608 | // init |
9609 | - $str = (string) $str; |
|
9610 | - $replacement = (string) $replacement; |
|
9609 | + $str = (string)$str; |
|
9610 | + $replacement = (string)$replacement; |
|
9611 | 9611 | |
9612 | 9612 | if (\is_array($length) === true) { |
9613 | 9613 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -9623,8 +9623,7 @@ discard block |
||
9623 | 9623 | |
9624 | 9624 | if (self::is_ascii($str)) { |
9625 | 9625 | return ($length === null) ? |
9626 | - \substr_replace($str, $replacement, $offset) : |
|
9627 | - \substr_replace($str, $replacement, $offset, $length); |
|
9626 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
9628 | 9627 | } |
9629 | 9628 | |
9630 | 9629 | if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) { |
@@ -9632,16 +9631,16 @@ discard block |
||
9632 | 9631 | } |
9633 | 9632 | |
9634 | 9633 | if (self::$SUPPORT['mbstring'] === true) { |
9635 | - $string_length = (int) self::strlen($str, $encoding); |
|
9634 | + $string_length = (int)self::strlen($str, $encoding); |
|
9636 | 9635 | |
9637 | 9636 | if ($offset < 0) { |
9638 | - $offset = (int) \max(0, $string_length + $offset); |
|
9637 | + $offset = (int)\max(0, $string_length + $offset); |
|
9639 | 9638 | } elseif ($offset > $string_length) { |
9640 | 9639 | $offset = $string_length; |
9641 | 9640 | } |
9642 | 9641 | |
9643 | 9642 | if ($length !== null && $length < 0) { |
9644 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
9643 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
9645 | 9644 | } elseif ($length === null || $length > $string_length) { |
9646 | 9645 | $length = $string_length; |
9647 | 9646 | } |
@@ -9652,9 +9651,9 @@ discard block |
||
9652 | 9651 | } |
9653 | 9652 | |
9654 | 9653 | /** @noinspection AdditionOperationOnArraysInspection */ |
9655 | - return (string) self::substr($str, 0, $offset, $encoding) . |
|
9656 | - $replacement . |
|
9657 | - (string) self::substr($str, $offset + $length, $string_length - $offset - $length, $encoding); |
|
9654 | + return (string)self::substr($str, 0, $offset, $encoding). |
|
9655 | + $replacement. |
|
9656 | + (string)self::substr($str, $offset + $length, $string_length - $offset - $length, $encoding); |
|
9658 | 9657 | } |
9659 | 9658 | |
9660 | 9659 | \preg_match_all('/./us', $str, $smatches); |
@@ -9666,7 +9665,7 @@ discard block |
||
9666 | 9665 | // e.g.: non mbstring support + invalid chars |
9667 | 9666 | return ''; |
9668 | 9667 | } |
9669 | - $length = (int) $lengthTmp; |
|
9668 | + $length = (int)$lengthTmp; |
|
9670 | 9669 | } |
9671 | 9670 | |
9672 | 9671 | \array_splice($smatches[0], $offset, $length, $rmatches[0]); |
@@ -9693,7 +9692,7 @@ discard block |
||
9693 | 9692 | } |
9694 | 9693 | |
9695 | 9694 | if (self::str_ends_with($haystack, $needle) === true) { |
9696 | - $haystack = (string) self::substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
9695 | + $haystack = (string)self::substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
9697 | 9696 | } |
9698 | 9697 | |
9699 | 9698 | return $haystack; |
@@ -9724,7 +9723,7 @@ discard block |
||
9724 | 9723 | $str = self::clean($str); |
9725 | 9724 | } |
9726 | 9725 | |
9727 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
9726 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
9728 | 9727 | } |
9729 | 9728 | |
9730 | 9729 | /** |
@@ -10019,7 +10018,7 @@ discard block |
||
10019 | 10018 | public static function to_boolean($str): bool |
10020 | 10019 | { |
10021 | 10020 | // init |
10022 | - $str = (string) $str; |
|
10021 | + $str = (string)$str; |
|
10023 | 10022 | |
10024 | 10023 | if ($str === '') { |
10025 | 10024 | return false; |
@@ -10045,10 +10044,10 @@ discard block |
||
10045 | 10044 | |
10046 | 10045 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
10047 | 10046 | if (\is_numeric($str)) { |
10048 | - return ((float) $str + 0) > 0; |
|
10047 | + return ((float)$str + 0) > 0; |
|
10049 | 10048 | } |
10050 | 10049 | |
10051 | - return (bool) self::trim($str); |
|
10050 | + return (bool)self::trim($str); |
|
10052 | 10051 | } |
10053 | 10052 | |
10054 | 10053 | /** |
@@ -10069,11 +10068,11 @@ discard block |
||
10069 | 10068 | |
10070 | 10069 | $fallback_char_escaped = \preg_quote($fallback_char, '/'); |
10071 | 10070 | |
10072 | - $string = (string) \preg_replace( |
|
10071 | + $string = (string)\preg_replace( |
|
10073 | 10072 | [ |
10074 | - '/[^' . $fallback_char_escaped . '\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
10075 | - '/[\s]+/', // 2) convert spaces to $fallback_char |
|
10076 | - '/[' . $fallback_char_escaped . ']+/', // 3) remove double $fallback_char's |
|
10073 | + '/[^'.$fallback_char_escaped.'\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
10074 | + '/[\s]+/', // 2) convert spaces to $fallback_char |
|
10075 | + '/['.$fallback_char_escaped.']+/', // 3) remove double $fallback_char's |
|
10077 | 10076 | ], |
10078 | 10077 | [ |
10079 | 10078 | '', |
@@ -10104,7 +10103,7 @@ discard block |
||
10104 | 10103 | return $str; |
10105 | 10104 | } |
10106 | 10105 | |
10107 | - $str = (string) $str; |
|
10106 | + $str = (string)$str; |
|
10108 | 10107 | if ($str === '') { |
10109 | 10108 | return ''; |
10110 | 10109 | } |
@@ -10151,7 +10150,7 @@ discard block |
||
10151 | 10150 | return $str; |
10152 | 10151 | } |
10153 | 10152 | |
10154 | - $str = (string) $str; |
|
10153 | + $str = (string)$str; |
|
10155 | 10154 | if ($str === '') { |
10156 | 10155 | return $str; |
10157 | 10156 | } |
@@ -10173,7 +10172,7 @@ discard block |
||
10173 | 10172 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
10174 | 10173 | |
10175 | 10174 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
10176 | - $buf .= $c1 . $c2; |
|
10175 | + $buf .= $c1.$c2; |
|
10177 | 10176 | ++$i; |
10178 | 10177 | } else { // not valid UTF8 - convert it |
10179 | 10178 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -10184,7 +10183,7 @@ discard block |
||
10184 | 10183 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
10185 | 10184 | |
10186 | 10185 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
10187 | - $buf .= $c1 . $c2 . $c3; |
|
10186 | + $buf .= $c1.$c2.$c3; |
|
10188 | 10187 | $i += 2; |
10189 | 10188 | } else { // not valid UTF8 - convert it |
10190 | 10189 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -10196,7 +10195,7 @@ discard block |
||
10196 | 10195 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
10197 | 10196 | |
10198 | 10197 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
10199 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
10198 | + $buf .= $c1.$c2.$c3.$c4; |
|
10200 | 10199 | $i += 3; |
10201 | 10200 | } else { // not valid UTF8 - convert it |
10202 | 10201 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -10220,7 +10219,7 @@ discard block |
||
10220 | 10219 | * |
10221 | 10220 | * @return string |
10222 | 10221 | */ |
10223 | - static function (array $match): string { |
|
10222 | + static function(array $match): string { |
|
10224 | 10223 | // always fallback via symfony polyfill |
10225 | 10224 | return \mb_convert_encoding(\pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); |
10226 | 10225 | }, |
@@ -10288,17 +10287,17 @@ discard block |
||
10288 | 10287 | $str = self::clean($str); |
10289 | 10288 | } |
10290 | 10289 | |
10291 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
10290 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
10292 | 10291 | |
10293 | 10292 | $strPartOne = self::strtoupper( |
10294 | - (string) self::substr($str, 0, 1, $encoding), |
|
10293 | + (string)self::substr($str, 0, 1, $encoding), |
|
10295 | 10294 | $encoding, |
10296 | 10295 | $cleanUtf8, |
10297 | 10296 | $lang, |
10298 | 10297 | $tryToKeepStringLength |
10299 | 10298 | ); |
10300 | 10299 | |
10301 | - return $strPartOne . $strPartTwo; |
|
10300 | + return $strPartOne.$strPartTwo; |
|
10302 | 10301 | } |
10303 | 10302 | |
10304 | 10303 | /** |
@@ -10344,7 +10343,7 @@ discard block |
||
10344 | 10343 | $str = self::clean($str); |
10345 | 10344 | } |
10346 | 10345 | |
10347 | - $usePhpDefaultFunctions = !(bool) ($charlist . \implode('', $exceptions)); |
|
10346 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
10348 | 10347 | |
10349 | 10348 | if ( |
10350 | 10349 | $usePhpDefaultFunctions === true |
@@ -10401,7 +10400,7 @@ discard block |
||
10401 | 10400 | |
10402 | 10401 | $pattern = '/%u([0-9a-f]{3,4})/i'; |
10403 | 10402 | if (\preg_match($pattern, $str)) { |
10404 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
10403 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
10405 | 10404 | } |
10406 | 10405 | |
10407 | 10406 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -10745,7 +10744,7 @@ discard block |
||
10745 | 10744 | if ( |
10746 | 10745 | $keepUtf8Chars === true |
10747 | 10746 | && |
10748 | - self::strlen($return) >= (int) self::strlen($str_backup) |
|
10747 | + self::strlen($return) >= (int)self::strlen($str_backup) |
|
10749 | 10748 | ) { |
10750 | 10749 | return $str_backup; |
10751 | 10750 | } |
@@ -10843,17 +10842,17 @@ discard block |
||
10843 | 10842 | return ''; |
10844 | 10843 | } |
10845 | 10844 | |
10846 | - \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches); |
|
10845 | + \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches); |
|
10847 | 10846 | |
10848 | 10847 | if ( |
10849 | 10848 | !isset($matches[0]) |
10850 | 10849 | || |
10851 | - self::strlen($str) === (int) self::strlen($matches[0]) |
|
10850 | + self::strlen($str) === (int)self::strlen($matches[0]) |
|
10852 | 10851 | ) { |
10853 | 10852 | return $str; |
10854 | 10853 | } |
10855 | 10854 | |
10856 | - return self::rtrim($matches[0]) . $strAddOn; |
|
10855 | + return self::rtrim($matches[0]).$strAddOn; |
|
10857 | 10856 | } |
10858 | 10857 | |
10859 | 10858 | /** |
@@ -10919,7 +10918,7 @@ discard block |
||
10919 | 10918 | $strReturn .= $break; |
10920 | 10919 | } |
10921 | 10920 | |
10922 | - return $strReturn . \implode('', $chars); |
|
10921 | + return $strReturn.\implode('', $chars); |
|
10923 | 10922 | } |
10924 | 10923 | |
10925 | 10924 | /** |
@@ -10932,7 +10931,7 @@ discard block |
||
10932 | 10931 | */ |
10933 | 10932 | public static function wordwrap_per_line(string $str, int $limit): string |
10934 | 10933 | { |
10935 | - $strings = (array) \preg_split('/\\r\\n|\\r|\\n/', $str); |
|
10934 | + $strings = (array)\preg_split('/\\r\\n|\\r|\\n/', $str); |
|
10936 | 10935 | |
10937 | 10936 | $string = ''; |
10938 | 10937 | foreach ($strings as &$value) { |
@@ -10971,7 +10970,7 @@ discard block |
||
10971 | 10970 | */ |
10972 | 10971 | private static function apply_padding(string $str, int $left = 0, int $right = 0, string $padStr = ' ', string $encoding = 'UTF-8'): string |
10973 | 10972 | { |
10974 | - $strlen = (int) self::strlen($str, $encoding); |
|
10973 | + $strlen = (int)self::strlen($str, $encoding); |
|
10975 | 10974 | |
10976 | 10975 | if ($left && $right) { |
10977 | 10976 | $length = ($left + $right) + $strlen; |
@@ -11003,13 +11002,13 @@ discard block |
||
11003 | 11002 | $lower = self::$COMMON_CASE_FOLD['lower']; |
11004 | 11003 | |
11005 | 11004 | if ($useLower === true) { |
11006 | - $str = (string) \str_replace( |
|
11005 | + $str = (string)\str_replace( |
|
11007 | 11006 | $upper, |
11008 | 11007 | $lower, |
11009 | 11008 | $str |
11010 | 11009 | ); |
11011 | 11010 | } else { |
11012 | - $str = (string) \str_replace( |
|
11011 | + $str = (string)\str_replace( |
|
11013 | 11012 | $lower, |
11014 | 11013 | $upper, |
11015 | 11014 | $str |
@@ -11023,9 +11022,9 @@ discard block |
||
11023 | 11022 | } |
11024 | 11023 | |
11025 | 11024 | if ($useLower === true) { |
11026 | - $str = (string) \str_replace($FULL_CASE_FOLD[0], $FULL_CASE_FOLD[1], $str); |
|
11025 | + $str = (string)\str_replace($FULL_CASE_FOLD[0], $FULL_CASE_FOLD[1], $str); |
|
11027 | 11026 | } else { |
11028 | - $str = (string) \str_replace($FULL_CASE_FOLD[1], $FULL_CASE_FOLD[0], $str); |
|
11027 | + $str = (string)\str_replace($FULL_CASE_FOLD[1], $FULL_CASE_FOLD[0], $str); |
|
11029 | 11028 | } |
11030 | 11029 | } |
11031 | 11030 | |
@@ -11043,7 +11042,7 @@ discard block |
||
11043 | 11042 | { |
11044 | 11043 | /** @noinspection PhpIncludeInspection */ |
11045 | 11044 | /** @psalm-suppress UnresolvableInclude */ |
11046 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
11045 | + return include __DIR__.'/data/'.$file.'.php'; |
|
11047 | 11046 | } |
11048 | 11047 | |
11049 | 11048 | /** |
@@ -11055,7 +11054,7 @@ discard block |
||
11055 | 11054 | */ |
11056 | 11055 | private static function getDataIfExists(string $file) |
11057 | 11056 | { |
11058 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
11057 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
11059 | 11058 | if (\file_exists($file)) { |
11060 | 11059 | /** @noinspection PhpIncludeInspection */ |
11061 | 11060 | return include $file; |
@@ -11079,7 +11078,7 @@ discard block |
||
11079 | 11078 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
11080 | 11079 | return \defined('MB_OVERLOAD_STRING') |
11081 | 11080 | && |
11082 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
11081 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
11083 | 11082 | } |
11084 | 11083 | |
11085 | 11084 | /** |
@@ -11129,7 +11128,7 @@ discard block |
||
11129 | 11128 | { |
11130 | 11129 | static $RX_CLASSS_CACHE = []; |
11131 | 11130 | |
11132 | - $cacheKey = $s . $class; |
|
11131 | + $cacheKey = $s.$class; |
|
11133 | 11132 | |
11134 | 11133 | if (isset($RX_CLASSS_CACHE[$cacheKey])) { |
11135 | 11134 | return $RX_CLASSS_CACHE[$cacheKey]; |
@@ -11140,7 +11139,7 @@ discard block |
||
11140 | 11139 | /** @noinspection SuspiciousLoopInspection */ |
11141 | 11140 | foreach (self::str_split($s) as &$s) { |
11142 | 11141 | if ($s === '-') { |
11143 | - $class[0] = '-' . $class[0]; |
|
11142 | + $class[0] = '-'.$class[0]; |
|
11144 | 11143 | } elseif (!isset($s[2])) { |
11145 | 11144 | $class[0] .= \preg_quote($s, '/'); |
11146 | 11145 | } elseif (self::strlen($s) === 1) { |
@@ -11152,13 +11151,13 @@ discard block |
||
11152 | 11151 | unset($s); |
11153 | 11152 | |
11154 | 11153 | if ($class[0]) { |
11155 | - $class[0] = '[' . $class[0] . ']'; |
|
11154 | + $class[0] = '['.$class[0].']'; |
|
11156 | 11155 | } |
11157 | 11156 | |
11158 | 11157 | if (\count($class) === 1) { |
11159 | 11158 | $return = $class[0]; |
11160 | 11159 | } else { |
11161 | - $return = '(?:' . \implode('|', $class) . ')'; |
|
11160 | + $return = '(?:'.\implode('|', $class).')'; |
|
11162 | 11161 | } |
11163 | 11162 | |
11164 | 11163 | $RX_CLASSS_CACHE[$cacheKey] = $return; |
@@ -11297,8 +11296,8 @@ discard block |
||
11297 | 11296 | $buf .= self::$WIN1252_TO_UTF8[$ordC1]; |
11298 | 11297 | } else { |
11299 | 11298 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
11300 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
11301 | - $buf .= $cc1 . $cc2; |
|
11299 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
11300 | + $buf .= $cc1.$cc2; |
|
11302 | 11301 | } |
11303 | 11302 | |
11304 | 11303 | return $buf; |
@@ -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, '>='); |