@@ -3,17 +3,17 @@ discard block |
||
3 | 3 | return [ |
4 | 4 | 0x80 => "\xe2\x82\xac", // € |
5 | 5 | 0x82 => "\xe2\x80\x9a", // ‚ |
6 | - 0x83 => "\xc6\x92", // ƒ |
|
6 | + 0x83 => "\xc6\x92", // ƒ |
|
7 | 7 | 0x84 => "\xe2\x80\x9e", // „ |
8 | 8 | 0x85 => "\xe2\x80\xa6", // … |
9 | 9 | 0x86 => "\xe2\x80\xa0", // † |
10 | 10 | 0x87 => "\xe2\x80\xa1", // ‡ |
11 | - 0x88 => "\xcb\x86", // ˆ |
|
11 | + 0x88 => "\xcb\x86", // ˆ |
|
12 | 12 | 0x89 => "\xe2\x80\xb0", // ‰ |
13 | - 0x8a => "\xc5\xa0", // Š |
|
13 | + 0x8a => "\xc5\xa0", // Š |
|
14 | 14 | 0x8b => "\xe2\x80\xb9", // ‹ |
15 | - 0x8c => "\xc5\x92", // Œ |
|
16 | - 0x8e => "\xc5\xbd", // Ž |
|
15 | + 0x8c => "\xc5\x92", // Œ |
|
16 | + 0x8e => "\xc5\xbd", // Ž |
|
17 | 17 | 0x91 => "\xe2\x80\x98", // ‘ |
18 | 18 | 0x92 => "\xe2\x80\x99", // ’ |
19 | 19 | 0x93 => "\xe2\x80\x9c", // “ |
@@ -21,106 +21,106 @@ discard block |
||
21 | 21 | 0x95 => "\xe2\x80\xa2", // • |
22 | 22 | 0x96 => "\xe2\x80\x93", // – |
23 | 23 | 0x97 => "\xe2\x80\x94", // — |
24 | - 0x98 => "\xcb\x9c", // ˜ |
|
24 | + 0x98 => "\xcb\x9c", // ˜ |
|
25 | 25 | 0x99 => "\xe2\x84\xa2", // ™ |
26 | - 0x9a => "\xc5\xa1", // š |
|
26 | + 0x9a => "\xc5\xa1", // š |
|
27 | 27 | 0x9b => "\xe2\x80\xba", // › |
28 | - 0x9c => "\xc5\x93", // œ |
|
29 | - 0x9e => "\xc5\xbe", // ž |
|
30 | - 0x9f => "\xc5\xb8", // Ÿ |
|
28 | + 0x9c => "\xc5\x93", // œ |
|
29 | + 0x9e => "\xc5\xbe", // ž |
|
30 | + 0x9f => "\xc5\xb8", // Ÿ |
|
31 | 31 | 0xa0 => "\xc2\xa0", |
32 | - 0xa1 => "\xc2\xa1", // ¡ |
|
33 | - 0xa2 => "\xc2\xa2", // ¢ |
|
34 | - 0xa3 => "\xc2\xa3", // £ |
|
35 | - 0xa4 => "\xc2\xa4", // ¤ |
|
36 | - 0xa5 => "\xc2\xa5", // ¥ |
|
37 | - 0xa6 => "\xc2\xa6", // ¦ |
|
38 | - 0xa7 => "\xc2\xa7", // § |
|
39 | - 0xa8 => "\xc2\xa8", // ¨ |
|
40 | - 0xa9 => "\xc2\xa9", // © |
|
41 | - 0xaa => "\xc2\xaa", // ª |
|
42 | - 0xab => "\xc2\xab", // « |
|
43 | - 0xac => "\xc2\xac", // ¬ |
|
44 | - 0xad => "\xc2\xad", // |
|
45 | - 0xae => "\xc2\xae", // ® |
|
46 | - 0xaf => "\xc2\xaf", // ¯ |
|
47 | - 0xb0 => "\xc2\xb0", // ° |
|
48 | - 0xb1 => "\xc2\xb1", // ± |
|
49 | - 0xb2 => "\xc2\xb2", // ² |
|
50 | - 0xb3 => "\xc2\xb3", // ³ |
|
51 | - 0xb4 => "\xc2\xb4", // ´ |
|
52 | - 0xb5 => "\xc2\xb5", // µ |
|
53 | - 0xb6 => "\xc2\xb6", // ¶ |
|
54 | - 0xb7 => "\xc2\xb7", // · |
|
55 | - 0xb8 => "\xc2\xb8", // ¸ |
|
56 | - 0xb9 => "\xc2\xb9", // ¹ |
|
57 | - 0xba => "\xc2\xba", // º |
|
58 | - 0xbb => "\xc2\xbb", // » |
|
59 | - 0xbc => "\xc2\xbc", // ¼ |
|
60 | - 0xbd => "\xc2\xbd", // ½ |
|
61 | - 0xbe => "\xc2\xbe", // ¾ |
|
62 | - 0xbf => "\xc2\xbf", // ¿ |
|
63 | - 0xc0 => "\xc3\x80", // À |
|
64 | - 0xc1 => "\xc3\x81", // Á |
|
65 | - 0xc2 => "\xc3\x82", // Â |
|
66 | - 0xc3 => "\xc3\x83", // Ã |
|
67 | - 0xc4 => "\xc3\x84", // Ä |
|
68 | - 0xc5 => "\xc3\x85", // Å |
|
69 | - 0xc6 => "\xc3\x86", // Æ |
|
70 | - 0xc7 => "\xc3\x87", // Ç |
|
71 | - 0xc8 => "\xc3\x88", // È |
|
72 | - 0xc9 => "\xc3\x89", // É |
|
73 | - 0xca => "\xc3\x8a", // Ê |
|
74 | - 0xcb => "\xc3\x8b", // Ë |
|
75 | - 0xcc => "\xc3\x8c", // Ì |
|
76 | - 0xcd => "\xc3\x8d", // Í |
|
77 | - 0xce => "\xc3\x8e", // Î |
|
78 | - 0xcf => "\xc3\x8f", // Ï |
|
79 | - 0xd0 => "\xc3\x90", // Ð |
|
80 | - 0xd1 => "\xc3\x91", // Ñ |
|
81 | - 0xd2 => "\xc3\x92", // Ò |
|
82 | - 0xd3 => "\xc3\x93", // Ó |
|
83 | - 0xd4 => "\xc3\x94", // Ô |
|
84 | - 0xd5 => "\xc3\x95", // Õ |
|
85 | - 0xd6 => "\xc3\x96", // Ö |
|
86 | - 0xd7 => "\xc3\x97", // × |
|
87 | - 0xd8 => "\xc3\x98", // Ø |
|
88 | - 0xd9 => "\xc3\x99", // Ù |
|
89 | - 0xda => "\xc3\x9a", // Ú |
|
90 | - 0xdb => "\xc3\x9b", // Û |
|
91 | - 0xdc => "\xc3\x9c", // Ü |
|
92 | - 0xdd => "\xc3\x9d", // Ý |
|
93 | - 0xde => "\xc3\x9e", // Þ |
|
94 | - 0xdf => "\xc3\x9f", // ß |
|
95 | - 0xe0 => "\xc3\xa0", // à |
|
96 | - 0xe1 => "\xc3\xa1", // á |
|
97 | - 0xe2 => "\xc3\xa2", // â |
|
98 | - 0xe3 => "\xc3\xa3", // ã |
|
99 | - 0xe4 => "\xc3\xa4", // ä |
|
100 | - 0xe5 => "\xc3\xa5", // å |
|
101 | - 0xe6 => "\xc3\xa6", // æ |
|
102 | - 0xe7 => "\xc3\xa7", // ç |
|
103 | - 0xe8 => "\xc3\xa8", // è |
|
104 | - 0xe9 => "\xc3\xa9", // é |
|
105 | - 0xea => "\xc3\xaa", // ê |
|
106 | - 0xeb => "\xc3\xab", // ë |
|
107 | - 0xec => "\xc3\xac", // ì |
|
108 | - 0xed => "\xc3\xad", // í |
|
109 | - 0xee => "\xc3\xae", // î |
|
110 | - 0xef => "\xc3\xaf", // ï |
|
111 | - 0xf0 => "\xc3\xb0", // ð |
|
112 | - 0xf1 => "\xc3\xb1", // ñ |
|
113 | - 0xf2 => "\xc3\xb2", // ò |
|
114 | - 0xf3 => "\xc3\xb3", // ó |
|
115 | - 0xf4 => "\xc3\xb4", // ô |
|
116 | - 0xf5 => "\xc3\xb5", // õ |
|
117 | - 0xf6 => "\xc3\xb6", // ö |
|
118 | - 0xf7 => "\xc3\xb7", // ÷ |
|
119 | - 0xf8 => "\xc3\xb8", // ø |
|
120 | - 0xf9 => "\xc3\xb9", // ù |
|
121 | - 0xfa => "\xc3\xba", // ú |
|
122 | - 0xfb => "\xc3\xbb", // û |
|
123 | - 0xfc => "\xc3\xbc", // ü |
|
124 | - 0xfd => "\xc3\xbd", // ý |
|
125 | - 0xfe => "\xc3\xbe", // þ |
|
32 | + 0xa1 => "\xc2\xa1", // ¡ |
|
33 | + 0xa2 => "\xc2\xa2", // ¢ |
|
34 | + 0xa3 => "\xc2\xa3", // £ |
|
35 | + 0xa4 => "\xc2\xa4", // ¤ |
|
36 | + 0xa5 => "\xc2\xa5", // ¥ |
|
37 | + 0xa6 => "\xc2\xa6", // ¦ |
|
38 | + 0xa7 => "\xc2\xa7", // § |
|
39 | + 0xa8 => "\xc2\xa8", // ¨ |
|
40 | + 0xa9 => "\xc2\xa9", // © |
|
41 | + 0xaa => "\xc2\xaa", // ª |
|
42 | + 0xab => "\xc2\xab", // « |
|
43 | + 0xac => "\xc2\xac", // ¬ |
|
44 | + 0xad => "\xc2\xad", // |
|
45 | + 0xae => "\xc2\xae", // ® |
|
46 | + 0xaf => "\xc2\xaf", // ¯ |
|
47 | + 0xb0 => "\xc2\xb0", // ° |
|
48 | + 0xb1 => "\xc2\xb1", // ± |
|
49 | + 0xb2 => "\xc2\xb2", // ² |
|
50 | + 0xb3 => "\xc2\xb3", // ³ |
|
51 | + 0xb4 => "\xc2\xb4", // ´ |
|
52 | + 0xb5 => "\xc2\xb5", // µ |
|
53 | + 0xb6 => "\xc2\xb6", // ¶ |
|
54 | + 0xb7 => "\xc2\xb7", // · |
|
55 | + 0xb8 => "\xc2\xb8", // ¸ |
|
56 | + 0xb9 => "\xc2\xb9", // ¹ |
|
57 | + 0xba => "\xc2\xba", // º |
|
58 | + 0xbb => "\xc2\xbb", // » |
|
59 | + 0xbc => "\xc2\xbc", // ¼ |
|
60 | + 0xbd => "\xc2\xbd", // ½ |
|
61 | + 0xbe => "\xc2\xbe", // ¾ |
|
62 | + 0xbf => "\xc2\xbf", // ¿ |
|
63 | + 0xc0 => "\xc3\x80", // À |
|
64 | + 0xc1 => "\xc3\x81", // Á |
|
65 | + 0xc2 => "\xc3\x82", // Â |
|
66 | + 0xc3 => "\xc3\x83", // Ã |
|
67 | + 0xc4 => "\xc3\x84", // Ä |
|
68 | + 0xc5 => "\xc3\x85", // Å |
|
69 | + 0xc6 => "\xc3\x86", // Æ |
|
70 | + 0xc7 => "\xc3\x87", // Ç |
|
71 | + 0xc8 => "\xc3\x88", // È |
|
72 | + 0xc9 => "\xc3\x89", // É |
|
73 | + 0xca => "\xc3\x8a", // Ê |
|
74 | + 0xcb => "\xc3\x8b", // Ë |
|
75 | + 0xcc => "\xc3\x8c", // Ì |
|
76 | + 0xcd => "\xc3\x8d", // Í |
|
77 | + 0xce => "\xc3\x8e", // Î |
|
78 | + 0xcf => "\xc3\x8f", // Ï |
|
79 | + 0xd0 => "\xc3\x90", // Ð |
|
80 | + 0xd1 => "\xc3\x91", // Ñ |
|
81 | + 0xd2 => "\xc3\x92", // Ò |
|
82 | + 0xd3 => "\xc3\x93", // Ó |
|
83 | + 0xd4 => "\xc3\x94", // Ô |
|
84 | + 0xd5 => "\xc3\x95", // Õ |
|
85 | + 0xd6 => "\xc3\x96", // Ö |
|
86 | + 0xd7 => "\xc3\x97", // × |
|
87 | + 0xd8 => "\xc3\x98", // Ø |
|
88 | + 0xd9 => "\xc3\x99", // Ù |
|
89 | + 0xda => "\xc3\x9a", // Ú |
|
90 | + 0xdb => "\xc3\x9b", // Û |
|
91 | + 0xdc => "\xc3\x9c", // Ü |
|
92 | + 0xdd => "\xc3\x9d", // Ý |
|
93 | + 0xde => "\xc3\x9e", // Þ |
|
94 | + 0xdf => "\xc3\x9f", // ß |
|
95 | + 0xe0 => "\xc3\xa0", // à |
|
96 | + 0xe1 => "\xc3\xa1", // á |
|
97 | + 0xe2 => "\xc3\xa2", // â |
|
98 | + 0xe3 => "\xc3\xa3", // ã |
|
99 | + 0xe4 => "\xc3\xa4", // ä |
|
100 | + 0xe5 => "\xc3\xa5", // å |
|
101 | + 0xe6 => "\xc3\xa6", // æ |
|
102 | + 0xe7 => "\xc3\xa7", // ç |
|
103 | + 0xe8 => "\xc3\xa8", // è |
|
104 | + 0xe9 => "\xc3\xa9", // é |
|
105 | + 0xea => "\xc3\xaa", // ê |
|
106 | + 0xeb => "\xc3\xab", // ë |
|
107 | + 0xec => "\xc3\xac", // ì |
|
108 | + 0xed => "\xc3\xad", // í |
|
109 | + 0xee => "\xc3\xae", // î |
|
110 | + 0xef => "\xc3\xaf", // ï |
|
111 | + 0xf0 => "\xc3\xb0", // ð |
|
112 | + 0xf1 => "\xc3\xb1", // ñ |
|
113 | + 0xf2 => "\xc3\xb2", // ò |
|
114 | + 0xf3 => "\xc3\xb3", // ó |
|
115 | + 0xf4 => "\xc3\xb4", // ô |
|
116 | + 0xf5 => "\xc3\xb5", // õ |
|
117 | + 0xf6 => "\xc3\xb6", // ö |
|
118 | + 0xf7 => "\xc3\xb7", // ÷ |
|
119 | + 0xf8 => "\xc3\xb8", // ø |
|
120 | + 0xf9 => "\xc3\xb9", // ù |
|
121 | + 0xfa => "\xc3\xba", // ú |
|
122 | + 0xfb => "\xc3\xbb", // û |
|
123 | + 0xfc => "\xc3\xbc", // ü |
|
124 | + 0xfd => "\xc3\xbd", // ý |
|
125 | + 0xfe => "\xc3\xbe", // þ |
|
126 | 126 | ]; |
@@ -237,10 +237,10 @@ discard block |
||
237 | 237 | } |
238 | 238 | |
239 | 239 | if ($encoding === 'UTF-8') { |
240 | - return (string) \mb_substr($str, $pos, 1); |
|
240 | + return (string)\mb_substr($str, $pos, 1); |
|
241 | 241 | } |
242 | 242 | |
243 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
243 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | public static function add_bom_to_string(string $str): string |
256 | 256 | { |
257 | 257 | if (self::string_has_bom($str) === false) { |
258 | - $str = self::bom() . $str; |
|
258 | + $str = self::bom().$str; |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | return $str; |
@@ -288,8 +288,8 @@ discard block |
||
288 | 288 | $return = []; |
289 | 289 | foreach ($array as $key => &$value) { |
290 | 290 | $key = $case === \CASE_LOWER |
291 | - ? self::strtolower((string) $key, $encoding) |
|
292 | - : self::strtoupper((string) $key, $encoding); |
|
291 | + ? self::strtolower((string)$key, $encoding) |
|
292 | + : self::strtoupper((string)$key, $encoding); |
|
293 | 293 | |
294 | 294 | $return[$key] = $value; |
295 | 295 | } |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | return ''; |
324 | 324 | } |
325 | 325 | |
326 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
326 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
327 | 327 | $end_position = \mb_strpos($str, $end, $substr_index); |
328 | 328 | if ( |
329 | 329 | $end_position === false |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | return ''; |
334 | 334 | } |
335 | 335 | |
336 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
336 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | return ''; |
344 | 344 | } |
345 | 345 | |
346 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
346 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
347 | 347 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
348 | 348 | if ( |
349 | 349 | $end_position === false |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | return ''; |
354 | 354 | } |
355 | 355 | |
356 | - return (string) self::substr( |
|
356 | + return (string)self::substr( |
|
357 | 357 | $str, |
358 | 358 | $substr_index, |
359 | 359 | $end_position - $substr_index, |
@@ -421,10 +421,10 @@ discard block |
||
421 | 421 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
422 | 422 | { |
423 | 423 | if ($encoding === 'UTF-8') { |
424 | - return (string) \mb_substr($str, $index, 1); |
|
424 | + return (string)\mb_substr($str, $index, 1); |
|
425 | 425 | } |
426 | 426 | |
427 | - return (string) self::substr($str, $index, 1, $encoding); |
|
427 | + return (string)self::substr($str, $index, 1, $encoding); |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | /** |
@@ -523,10 +523,10 @@ discard block |
||
523 | 523 | && |
524 | 524 | self::$SUPPORT['mbstring'] === false |
525 | 525 | ) { |
526 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
526 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
527 | 527 | } |
528 | 528 | |
529 | - $cache_key = $code_point . $encoding; |
|
529 | + $cache_key = $code_point.$encoding; |
|
530 | 530 | if (isset($CHAR_CACHE[$cache_key]) === true) { |
531 | 531 | return $CHAR_CACHE[$cache_key]; |
532 | 532 | } |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | self::$CHR = self::getData('chr'); |
573 | 573 | } |
574 | 574 | |
575 | - $code_point = (int) $code_point; |
|
575 | + $code_point = (int)$code_point; |
|
576 | 576 | if ($code_point <= 0x7F) { |
577 | 577 | /** |
578 | 578 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -582,22 +582,22 @@ discard block |
||
582 | 582 | /** |
583 | 583 | * @psalm-suppress PossiblyNullArrayAccess |
584 | 584 | */ |
585 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
585 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
586 | 586 | self::$CHR[($code_point & 0x3F) + 0x80]; |
587 | 587 | } elseif ($code_point <= 0xFFFF) { |
588 | 588 | /** |
589 | 589 | * @psalm-suppress PossiblyNullArrayAccess |
590 | 590 | */ |
591 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
592 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
591 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
592 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
593 | 593 | self::$CHR[($code_point & 0x3F) + 0x80]; |
594 | 594 | } else { |
595 | 595 | /** |
596 | 596 | * @psalm-suppress PossiblyNullArrayAccess |
597 | 597 | */ |
598 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
599 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
600 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
598 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
599 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
600 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
601 | 601 | self::$CHR[($code_point & 0x3F) + 0x80]; |
602 | 602 | } |
603 | 603 | |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | |
646 | 646 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
647 | 647 | return \array_map( |
648 | - static function (string $data): int { |
|
648 | + static function(string $data): int { |
|
649 | 649 | // "mb_" is available if overload is used, so use it ... |
650 | 650 | return \mb_strlen($data, 'CP850'); // 8-BIT |
651 | 651 | }, |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | $char = ''; |
722 | 722 | } |
723 | 723 | |
724 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
724 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
725 | 725 | } |
726 | 726 | |
727 | 727 | /** |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
798 | 798 | /x'; |
799 | 799 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
800 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
800 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
801 | 801 | |
802 | 802 | if ($replace_diamond_question_mark === true) { |
803 | 803 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | public static function cleanup($str): string |
833 | 833 | { |
834 | 834 | // init |
835 | - $str = (string) $str; |
|
835 | + $str = (string)$str; |
|
836 | 836 | |
837 | 837 | if ($str === '') { |
838 | 838 | return ''; |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | { |
920 | 920 | if (self::$SUPPORT['mbstring'] === true) { |
921 | 921 | /** @noinspection PhpComposerExtensionStubsInspection */ |
922 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
922 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
923 | 923 | } |
924 | 924 | |
925 | 925 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | */ |
960 | 960 | public static function css_stripe_media_queries(string $str): string |
961 | 961 | { |
962 | - return (string) \preg_replace( |
|
962 | + return (string)\preg_replace( |
|
963 | 963 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
964 | 964 | '', |
965 | 965 | $str |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | */ |
987 | 987 | public static function decimal_to_chr($int): string |
988 | 988 | { |
989 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
989 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
990 | 990 | } |
991 | 991 | |
992 | 992 | /** |
@@ -1033,16 +1033,16 @@ discard block |
||
1033 | 1033 | self::initEmojiData(); |
1034 | 1034 | |
1035 | 1035 | if ($use_reversible_string_mappings === true) { |
1036 | - return (string) \str_replace( |
|
1037 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1038 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1036 | + return (string)\str_replace( |
|
1037 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1038 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1039 | 1039 | $str |
1040 | 1040 | ); |
1041 | 1041 | } |
1042 | 1042 | |
1043 | - return (string) \str_replace( |
|
1044 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1045 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1043 | + return (string)\str_replace( |
|
1044 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1045 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1046 | 1046 | $str |
1047 | 1047 | ); |
1048 | 1048 | } |
@@ -1064,16 +1064,16 @@ discard block |
||
1064 | 1064 | self::initEmojiData(); |
1065 | 1065 | |
1066 | 1066 | if ($use_reversible_string_mappings === true) { |
1067 | - return (string) \str_replace( |
|
1068 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1069 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1067 | + return (string)\str_replace( |
|
1068 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1069 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1070 | 1070 | $str |
1071 | 1071 | ); |
1072 | 1072 | } |
1073 | 1073 | |
1074 | - return (string) \str_replace( |
|
1075 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1076 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1074 | + return (string)\str_replace( |
|
1075 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1076 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1077 | 1077 | $str |
1078 | 1078 | ); |
1079 | 1079 | } |
@@ -1127,7 +1127,7 @@ discard block |
||
1127 | 1127 | if ($to_encoding === 'JSON') { |
1128 | 1128 | $return = self::json_encode($str); |
1129 | 1129 | if ($return === false) { |
1130 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1130 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1131 | 1131 | } |
1132 | 1132 | |
1133 | 1133 | return $return; |
@@ -1214,7 +1214,7 @@ discard block |
||
1214 | 1214 | && |
1215 | 1215 | self::$SUPPORT['mbstring'] === false |
1216 | 1216 | ) { |
1217 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
1217 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
1218 | 1218 | } |
1219 | 1219 | |
1220 | 1220 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1308,31 +1308,31 @@ discard block |
||
1308 | 1308 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1309 | 1309 | |
1310 | 1310 | if ($length === null) { |
1311 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
1311 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
1312 | 1312 | } |
1313 | 1313 | |
1314 | 1314 | if ($search === '') { |
1315 | 1315 | if ($encoding === 'UTF-8') { |
1316 | 1316 | if ($length > 0) { |
1317 | - $string_length = (int) \mb_strlen($str); |
|
1317 | + $string_length = (int)\mb_strlen($str); |
|
1318 | 1318 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1319 | 1319 | } else { |
1320 | 1320 | $end = 0; |
1321 | 1321 | } |
1322 | 1322 | |
1323 | - $pos = (int) \min( |
|
1323 | + $pos = (int)\min( |
|
1324 | 1324 | \mb_strpos($str, ' ', $end), |
1325 | 1325 | \mb_strpos($str, '.', $end) |
1326 | 1326 | ); |
1327 | 1327 | } else { |
1328 | 1328 | if ($length > 0) { |
1329 | - $string_length = (int) self::strlen($str, $encoding); |
|
1329 | + $string_length = (int)self::strlen($str, $encoding); |
|
1330 | 1330 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1331 | 1331 | } else { |
1332 | 1332 | $end = 0; |
1333 | 1333 | } |
1334 | 1334 | |
1335 | - $pos = (int) \min( |
|
1335 | + $pos = (int)\min( |
|
1336 | 1336 | self::strpos($str, ' ', $end, $encoding), |
1337 | 1337 | self::strpos($str, '.', $end, $encoding) |
1338 | 1338 | ); |
@@ -1349,18 +1349,18 @@ discard block |
||
1349 | 1349 | return ''; |
1350 | 1350 | } |
1351 | 1351 | |
1352 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1352 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1353 | 1353 | } |
1354 | 1354 | |
1355 | 1355 | return $str; |
1356 | 1356 | } |
1357 | 1357 | |
1358 | 1358 | if ($encoding === 'UTF-8') { |
1359 | - $word_position = (int) \mb_stripos($str, $search); |
|
1360 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1359 | + $word_position = (int)\mb_stripos($str, $search); |
|
1360 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1361 | 1361 | } else { |
1362 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
1363 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1362 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
1363 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1364 | 1364 | } |
1365 | 1365 | |
1366 | 1366 | $pos_start = 0; |
@@ -1372,12 +1372,12 @@ discard block |
||
1372 | 1372 | } |
1373 | 1373 | if ($half_text !== false) { |
1374 | 1374 | if ($encoding === 'UTF-8') { |
1375 | - $pos_start = (int) \max( |
|
1375 | + $pos_start = (int)\max( |
|
1376 | 1376 | \mb_strrpos($half_text, ' '), |
1377 | 1377 | \mb_strrpos($half_text, '.') |
1378 | 1378 | ); |
1379 | 1379 | } else { |
1380 | - $pos_start = (int) \max( |
|
1380 | + $pos_start = (int)\max( |
|
1381 | 1381 | self::strrpos($half_text, ' ', 0, $encoding), |
1382 | 1382 | self::strrpos($half_text, '.', 0, $encoding) |
1383 | 1383 | ); |
@@ -1387,19 +1387,19 @@ discard block |
||
1387 | 1387 | |
1388 | 1388 | if ($word_position && $half_side > 0) { |
1389 | 1389 | $offset = $pos_start + $length - 1; |
1390 | - $real_length = (int) self::strlen($str, $encoding); |
|
1390 | + $real_length = (int)self::strlen($str, $encoding); |
|
1391 | 1391 | |
1392 | 1392 | if ($offset > $real_length) { |
1393 | 1393 | $offset = $real_length; |
1394 | 1394 | } |
1395 | 1395 | |
1396 | 1396 | if ($encoding === 'UTF-8') { |
1397 | - $pos_end = (int) \min( |
|
1397 | + $pos_end = (int)\min( |
|
1398 | 1398 | \mb_strpos($str, ' ', $offset), |
1399 | 1399 | \mb_strpos($str, '.', $offset) |
1400 | 1400 | ) - $pos_start; |
1401 | 1401 | } else { |
1402 | - $pos_end = (int) \min( |
|
1402 | + $pos_end = (int)\min( |
|
1403 | 1403 | self::strpos($str, ' ', $offset, $encoding), |
1404 | 1404 | self::strpos($str, '.', $offset, $encoding) |
1405 | 1405 | ) - $pos_start; |
@@ -1407,12 +1407,12 @@ discard block |
||
1407 | 1407 | |
1408 | 1408 | if (!$pos_end || $pos_end <= 0) { |
1409 | 1409 | if ($encoding === 'UTF-8') { |
1410 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1410 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1411 | 1411 | } else { |
1412 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1412 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1413 | 1413 | } |
1414 | 1414 | if ($str_sub !== false) { |
1415 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
1415 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
1416 | 1416 | } else { |
1417 | 1417 | $extract = ''; |
1418 | 1418 | } |
@@ -1423,26 +1423,26 @@ discard block |
||
1423 | 1423 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
1424 | 1424 | } |
1425 | 1425 | if ($str_sub !== false) { |
1426 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1426 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1427 | 1427 | } else { |
1428 | 1428 | $extract = ''; |
1429 | 1429 | } |
1430 | 1430 | } |
1431 | 1431 | } else { |
1432 | 1432 | $offset = $length - 1; |
1433 | - $true_length = (int) self::strlen($str, $encoding); |
|
1433 | + $true_length = (int)self::strlen($str, $encoding); |
|
1434 | 1434 | |
1435 | 1435 | if ($offset > $true_length) { |
1436 | 1436 | $offset = $true_length; |
1437 | 1437 | } |
1438 | 1438 | |
1439 | 1439 | if ($encoding === 'UTF-8') { |
1440 | - $pos_end = (int) \min( |
|
1440 | + $pos_end = (int)\min( |
|
1441 | 1441 | \mb_strpos($str, ' ', $offset), |
1442 | 1442 | \mb_strpos($str, '.', $offset) |
1443 | 1443 | ); |
1444 | 1444 | } else { |
1445 | - $pos_end = (int) \min( |
|
1445 | + $pos_end = (int)\min( |
|
1446 | 1446 | self::strpos($str, ' ', $offset, $encoding), |
1447 | 1447 | self::strpos($str, '.', $offset, $encoding) |
1448 | 1448 | ); |
@@ -1455,7 +1455,7 @@ discard block |
||
1455 | 1455 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
1456 | 1456 | } |
1457 | 1457 | if ($str_sub !== false) { |
1458 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1458 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1459 | 1459 | } else { |
1460 | 1460 | $extract = ''; |
1461 | 1461 | } |
@@ -1578,7 +1578,7 @@ discard block |
||
1578 | 1578 | { |
1579 | 1579 | $file_content = \file_get_contents($file_path); |
1580 | 1580 | if ($file_content === false) { |
1581 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1581 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1582 | 1582 | } |
1583 | 1583 | |
1584 | 1584 | return self::string_has_bom($file_content); |
@@ -1644,7 +1644,7 @@ discard block |
||
1644 | 1644 | ) { |
1645 | 1645 | // Prevent leading combining chars |
1646 | 1646 | // for NFC-safe concatenations. |
1647 | - $var = $leading_combining . $var; |
|
1647 | + $var = $leading_combining.$var; |
|
1648 | 1648 | } |
1649 | 1649 | } |
1650 | 1650 | |
@@ -1895,10 +1895,10 @@ discard block |
||
1895 | 1895 | } |
1896 | 1896 | |
1897 | 1897 | if ($encoding === 'UTF-8') { |
1898 | - return (string) \mb_substr($str, 0, $n); |
|
1898 | + return (string)\mb_substr($str, 0, $n); |
|
1899 | 1899 | } |
1900 | 1900 | |
1901 | - return (string) self::substr($str, 0, $n, $encoding); |
|
1901 | + return (string)self::substr($str, 0, $n, $encoding); |
|
1902 | 1902 | } |
1903 | 1903 | |
1904 | 1904 | /** |
@@ -1911,7 +1911,7 @@ discard block |
||
1911 | 1911 | */ |
1912 | 1912 | public static function fits_inside(string $str, int $box_size): bool |
1913 | 1913 | { |
1914 | - return (int) self::strlen($str) <= $box_size; |
|
1914 | + return (int)self::strlen($str) <= $box_size; |
|
1915 | 1915 | } |
1916 | 1916 | |
1917 | 1917 | /** |
@@ -1973,7 +1973,7 @@ discard block |
||
1973 | 1973 | return $str; |
1974 | 1974 | } |
1975 | 1975 | |
1976 | - $str = (string) $str; |
|
1976 | + $str = (string)$str; |
|
1977 | 1977 | $last = ''; |
1978 | 1978 | while ($last !== $str) { |
1979 | 1979 | $last = $str; |
@@ -2167,7 +2167,7 @@ discard block |
||
2167 | 2167 | return $fallback; |
2168 | 2168 | } |
2169 | 2169 | /** @noinspection OffsetOperationsInspection */ |
2170 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2170 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2171 | 2171 | |
2172 | 2172 | // DEBUG |
2173 | 2173 | //var_dump($type_code); |
@@ -2225,7 +2225,7 @@ discard block |
||
2225 | 2225 | // |
2226 | 2226 | |
2227 | 2227 | if ($encoding === 'UTF-8') { |
2228 | - $max_length = (int) \mb_strlen($possible_chars); |
|
2228 | + $max_length = (int)\mb_strlen($possible_chars); |
|
2229 | 2229 | if ($max_length === 0) { |
2230 | 2230 | return ''; |
2231 | 2231 | } |
@@ -2246,7 +2246,7 @@ discard block |
||
2246 | 2246 | } else { |
2247 | 2247 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2248 | 2248 | |
2249 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
2249 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
2250 | 2250 | if ($max_length === 0) { |
2251 | 2251 | return ''; |
2252 | 2252 | } |
@@ -2277,16 +2277,16 @@ discard block |
||
2277 | 2277 | */ |
2278 | 2278 | public static function get_unique_string($entropy_extra = '', bool $use_md5 = true): string |
2279 | 2279 | { |
2280 | - $unique_helper = \random_int(0, \mt_getrandmax()) . |
|
2281 | - \session_id() . |
|
2282 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2283 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2280 | + $unique_helper = \random_int(0, \mt_getrandmax()). |
|
2281 | + \session_id(). |
|
2282 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2283 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2284 | 2284 | $entropy_extra; |
2285 | 2285 | |
2286 | 2286 | $unique_string = \uniqid($unique_helper, true); |
2287 | 2287 | |
2288 | 2288 | if ($use_md5) { |
2289 | - $unique_string = \md5($unique_string . $unique_helper); |
|
2289 | + $unique_string = \md5($unique_string.$unique_helper); |
|
2290 | 2290 | } |
2291 | 2291 | |
2292 | 2292 | return $unique_string; |
@@ -2365,7 +2365,7 @@ discard block |
||
2365 | 2365 | public static function hex_to_int($hexdec) |
2366 | 2366 | { |
2367 | 2367 | // init |
2368 | - $hexdec = (string) $hexdec; |
|
2368 | + $hexdec = (string)$hexdec; |
|
2369 | 2369 | |
2370 | 2370 | if ($hexdec === '') { |
2371 | 2371 | return false; |
@@ -2458,7 +2458,7 @@ discard block |
||
2458 | 2458 | return \implode( |
2459 | 2459 | '', |
2460 | 2460 | \array_map( |
2461 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2461 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2462 | 2462 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
2463 | 2463 | }, |
2464 | 2464 | self::str_split($str) |
@@ -2565,7 +2565,7 @@ discard block |
||
2565 | 2565 | && |
2566 | 2566 | self::$SUPPORT['mbstring'] === false |
2567 | 2567 | ) { |
2568 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2568 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2569 | 2569 | } |
2570 | 2570 | |
2571 | 2571 | do { |
@@ -2574,7 +2574,7 @@ discard block |
||
2574 | 2574 | if (\strpos($str, '&') !== false) { |
2575 | 2575 | if (\strpos($str, '&#') !== false) { |
2576 | 2576 | // decode also numeric & UTF16 two byte entities |
2577 | - $str = (string) \preg_replace( |
|
2577 | + $str = (string)\preg_replace( |
|
2578 | 2578 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
2579 | 2579 | '$1;', |
2580 | 2580 | $str |
@@ -2620,7 +2620,7 @@ discard block |
||
2620 | 2620 | */ |
2621 | 2621 | public static function html_stripe_empty_tags(string $str): string |
2622 | 2622 | { |
2623 | - return (string) \preg_replace( |
|
2623 | + return (string)\preg_replace( |
|
2624 | 2624 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
2625 | 2625 | '', |
2626 | 2626 | $str |
@@ -2930,9 +2930,9 @@ discard block |
||
2930 | 2930 | { |
2931 | 2931 | $hex = \dechex($int); |
2932 | 2932 | |
2933 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
2933 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
2934 | 2934 | |
2935 | - return $prefix . $hex . ''; |
|
2935 | + return $prefix.$hex.''; |
|
2936 | 2936 | } |
2937 | 2937 | |
2938 | 2938 | /** |
@@ -3190,7 +3190,7 @@ discard block |
||
3190 | 3190 | */ |
3191 | 3191 | public static function is_binary($input, bool $strict = false): bool |
3192 | 3192 | { |
3193 | - $input = (string) $input; |
|
3193 | + $input = (string)$input; |
|
3194 | 3194 | if ($input === '') { |
3195 | 3195 | return false; |
3196 | 3196 | } |
@@ -3453,7 +3453,7 @@ discard block |
||
3453 | 3453 | public static function is_utf16($str, $check_if_string_is_binary = true) |
3454 | 3454 | { |
3455 | 3455 | // init |
3456 | - $str = (string) $str; |
|
3456 | + $str = (string)$str; |
|
3457 | 3457 | $str_chars = []; |
3458 | 3458 | |
3459 | 3459 | if ( |
@@ -3531,7 +3531,7 @@ discard block |
||
3531 | 3531 | public static function is_utf32($str, $check_if_string_is_binary = true) |
3532 | 3532 | { |
3533 | 3533 | // init |
3534 | - $str = (string) $str; |
|
3534 | + $str = (string)$str; |
|
3535 | 3535 | $str_chars = []; |
3536 | 3536 | |
3537 | 3537 | if ( |
@@ -3615,7 +3615,7 @@ discard block |
||
3615 | 3615 | return true; |
3616 | 3616 | } |
3617 | 3617 | |
3618 | - return self::is_utf8_string((string) $str, $strict); |
|
3618 | + return self::is_utf8_string((string)$str, $strict); |
|
3619 | 3619 | } |
3620 | 3620 | |
3621 | 3621 | /** |
@@ -3755,15 +3755,15 @@ discard block |
||
3755 | 3755 | $use_mb_functions = ($lang === null && $try_to_keep_the_string_length === false); |
3756 | 3756 | |
3757 | 3757 | if ($encoding === 'UTF-8') { |
3758 | - $str_part_two = (string) \mb_substr($str, 1); |
|
3758 | + $str_part_two = (string)\mb_substr($str, 1); |
|
3759 | 3759 | |
3760 | 3760 | if ($use_mb_functions === true) { |
3761 | 3761 | $str_part_one = \mb_strtolower( |
3762 | - (string) \mb_substr($str, 0, 1) |
|
3762 | + (string)\mb_substr($str, 0, 1) |
|
3763 | 3763 | ); |
3764 | 3764 | } else { |
3765 | 3765 | $str_part_one = self::strtolower( |
3766 | - (string) \mb_substr($str, 0, 1), |
|
3766 | + (string)\mb_substr($str, 0, 1), |
|
3767 | 3767 | $encoding, |
3768 | 3768 | false, |
3769 | 3769 | $lang, |
@@ -3773,10 +3773,10 @@ discard block |
||
3773 | 3773 | } else { |
3774 | 3774 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
3775 | 3775 | |
3776 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
3776 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
3777 | 3777 | |
3778 | 3778 | $str_part_one = self::strtolower( |
3779 | - (string) self::substr($str, 0, 1, $encoding), |
|
3779 | + (string)self::substr($str, 0, 1, $encoding), |
|
3780 | 3780 | $encoding, |
3781 | 3781 | false, |
3782 | 3782 | $lang, |
@@ -3784,7 +3784,7 @@ discard block |
||
3784 | 3784 | ); |
3785 | 3785 | } |
3786 | 3786 | |
3787 | - return $str_part_one . $str_part_two; |
|
3787 | + return $str_part_one.$str_part_two; |
|
3788 | 3788 | } |
3789 | 3789 | |
3790 | 3790 | /** |
@@ -3921,7 +3921,7 @@ discard block |
||
3921 | 3921 | } |
3922 | 3922 | |
3923 | 3923 | /** @noinspection PhpComposerExtensionStubsInspection */ |
3924 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
3924 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
3925 | 3925 | } |
3926 | 3926 | |
3927 | 3927 | if ($chars) { |
@@ -3969,7 +3969,7 @@ discard block |
||
3969 | 3969 | { |
3970 | 3970 | $bytes = self::chr_size_list($str); |
3971 | 3971 | if ($bytes !== []) { |
3972 | - return (int) \max($bytes); |
|
3972 | + return (int)\max($bytes); |
|
3973 | 3973 | } |
3974 | 3974 | |
3975 | 3975 | return 0; |
@@ -4038,7 +4038,7 @@ discard block |
||
4038 | 4038 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4039 | 4039 | |
4040 | 4040 | // init |
4041 | - $encoding = (string) $encoding; |
|
4041 | + $encoding = (string)$encoding; |
|
4042 | 4042 | |
4043 | 4043 | if (!$encoding) { |
4044 | 4044 | return $fallback; |
@@ -4100,7 +4100,7 @@ discard block |
||
4100 | 4100 | |
4101 | 4101 | $encoding_original = $encoding; |
4102 | 4102 | $encoding = \strtoupper($encoding); |
4103 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4103 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4104 | 4104 | |
4105 | 4105 | $equivalences = [ |
4106 | 4106 | 'ISO8859' => 'ISO-8859-1', |
@@ -4240,13 +4240,13 @@ discard block |
||
4240 | 4240 | static $CHAR_CACHE = []; |
4241 | 4241 | |
4242 | 4242 | // init |
4243 | - $chr = (string) $chr; |
|
4243 | + $chr = (string)$chr; |
|
4244 | 4244 | |
4245 | 4245 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
4246 | 4246 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4247 | 4247 | } |
4248 | 4248 | |
4249 | - $cache_key = $chr . $encoding; |
|
4249 | + $cache_key = $chr.$encoding; |
|
4250 | 4250 | if (isset($CHAR_CACHE[$cache_key]) === true) { |
4251 | 4251 | return $CHAR_CACHE[$cache_key]; |
4252 | 4252 | } |
@@ -4281,7 +4281,7 @@ discard block |
||
4281 | 4281 | // |
4282 | 4282 | |
4283 | 4283 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
4284 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
4284 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
4285 | 4285 | /** @noinspection OffsetOperationsInspection */ |
4286 | 4286 | $code = $chr ? $chr[1] : 0; |
4287 | 4287 | |
@@ -4289,21 +4289,21 @@ discard block |
||
4289 | 4289 | if ($code >= 0xF0 && isset($chr[4])) { |
4290 | 4290 | /** @noinspection UnnecessaryCastingInspection */ |
4291 | 4291 | /** @noinspection OffsetOperationsInspection */ |
4292 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4292 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4293 | 4293 | } |
4294 | 4294 | |
4295 | 4295 | /** @noinspection OffsetOperationsInspection */ |
4296 | 4296 | if ($code >= 0xE0 && isset($chr[3])) { |
4297 | 4297 | /** @noinspection UnnecessaryCastingInspection */ |
4298 | 4298 | /** @noinspection OffsetOperationsInspection */ |
4299 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4299 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4300 | 4300 | } |
4301 | 4301 | |
4302 | 4302 | /** @noinspection OffsetOperationsInspection */ |
4303 | 4303 | if ($code >= 0xC0 && isset($chr[2])) { |
4304 | 4304 | /** @noinspection UnnecessaryCastingInspection */ |
4305 | 4305 | /** @noinspection OffsetOperationsInspection */ |
4306 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4306 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4307 | 4307 | } |
4308 | 4308 | |
4309 | 4309 | return $CHAR_CACHE[$cache_key] = $code; |
@@ -4352,7 +4352,7 @@ discard block |
||
4352 | 4352 | public static function pcre_utf8_support(): bool |
4353 | 4353 | { |
4354 | 4354 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4355 | - return (bool) @\preg_match('//u', ''); |
|
4355 | + return (bool)@\preg_match('//u', ''); |
|
4356 | 4356 | } |
4357 | 4357 | |
4358 | 4358 | /** |
@@ -4384,11 +4384,11 @@ discard block |
||
4384 | 4384 | |
4385 | 4385 | if ($step !== 1) { |
4386 | 4386 | if (!\is_numeric($step)) { |
4387 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
4387 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
4388 | 4388 | } |
4389 | 4389 | |
4390 | 4390 | if ($step <= 0) { |
4391 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
4391 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
4392 | 4392 | } |
4393 | 4393 | } |
4394 | 4394 | |
@@ -4400,14 +4400,14 @@ discard block |
||
4400 | 4400 | $is_xdigit = false; |
4401 | 4401 | |
4402 | 4402 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4403 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
4403 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
4404 | 4404 | $is_digit = true; |
4405 | - $start = (int) $var1; |
|
4405 | + $start = (int)$var1; |
|
4406 | 4406 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
4407 | 4407 | $is_xdigit = true; |
4408 | - $start = (int) self::hex_to_int($var1); |
|
4408 | + $start = (int)self::hex_to_int($var1); |
|
4409 | 4409 | } elseif (!$use_ctype && \is_numeric($var1)) { |
4410 | - $start = (int) $var1; |
|
4410 | + $start = (int)$var1; |
|
4411 | 4411 | } else { |
4412 | 4412 | $start = self::ord($var1); |
4413 | 4413 | } |
@@ -4417,11 +4417,11 @@ discard block |
||
4417 | 4417 | } |
4418 | 4418 | |
4419 | 4419 | if ($is_digit) { |
4420 | - $end = (int) $var2; |
|
4420 | + $end = (int)$var2; |
|
4421 | 4421 | } elseif ($is_xdigit) { |
4422 | - $end = (int) self::hex_to_int($var2); |
|
4422 | + $end = (int)self::hex_to_int($var2); |
|
4423 | 4423 | } elseif (!$use_ctype && \is_numeric($var2)) { |
4424 | - $end = (int) $var2; |
|
4424 | + $end = (int)$var2; |
|
4425 | 4425 | } else { |
4426 | 4426 | $end = self::ord($var2); |
4427 | 4427 | } |
@@ -4432,7 +4432,7 @@ discard block |
||
4432 | 4432 | |
4433 | 4433 | $array = []; |
4434 | 4434 | foreach (\range($start, $end, $step) as $i) { |
4435 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
4435 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
4436 | 4436 | } |
4437 | 4437 | |
4438 | 4438 | return $array; |
@@ -4523,8 +4523,8 @@ discard block |
||
4523 | 4523 | $delimiter = '/'; |
4524 | 4524 | } |
4525 | 4525 | |
4526 | - return (string) \preg_replace( |
|
4527 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4526 | + return (string)\preg_replace( |
|
4527 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4528 | 4528 | $replacement, |
4529 | 4529 | $str |
4530 | 4530 | ); |
@@ -4567,9 +4567,9 @@ discard block |
||
4567 | 4567 | return ''; |
4568 | 4568 | } |
4569 | 4569 | |
4570 | - $str_length -= (int) $bom_byte_length; |
|
4570 | + $str_length -= (int)$bom_byte_length; |
|
4571 | 4571 | |
4572 | - $str = (string) $str_tmp; |
|
4572 | + $str = (string)$str_tmp; |
|
4573 | 4573 | } |
4574 | 4574 | } |
4575 | 4575 | |
@@ -4593,7 +4593,7 @@ discard block |
||
4593 | 4593 | if (\is_array($what) === true) { |
4594 | 4594 | /** @noinspection ForeachSourceInspection */ |
4595 | 4595 | foreach ($what as $item) { |
4596 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
4596 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
4597 | 4597 | } |
4598 | 4598 | } |
4599 | 4599 | |
@@ -4625,7 +4625,7 @@ discard block |
||
4625 | 4625 | */ |
4626 | 4626 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
4627 | 4627 | { |
4628 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4628 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4629 | 4629 | } |
4630 | 4630 | |
4631 | 4631 | /** |
@@ -4669,17 +4669,17 @@ discard block |
||
4669 | 4669 | ): string { |
4670 | 4670 | if ($substring && \strpos($str, $substring) === 0) { |
4671 | 4671 | if ($encoding === 'UTF-8') { |
4672 | - return (string) \mb_substr( |
|
4672 | + return (string)\mb_substr( |
|
4673 | 4673 | $str, |
4674 | - (int) \mb_strlen($substring) |
|
4674 | + (int)\mb_strlen($substring) |
|
4675 | 4675 | ); |
4676 | 4676 | } |
4677 | 4677 | |
4678 | 4678 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4679 | 4679 | |
4680 | - return (string) self::substr( |
|
4680 | + return (string)self::substr( |
|
4681 | 4681 | $str, |
4682 | - (int) self::strlen($substring, $encoding), |
|
4682 | + (int)self::strlen($substring, $encoding), |
|
4683 | 4683 | null, |
4684 | 4684 | $encoding |
4685 | 4685 | ); |
@@ -4704,19 +4704,19 @@ discard block |
||
4704 | 4704 | ): string { |
4705 | 4705 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
4706 | 4706 | if ($encoding === 'UTF-8') { |
4707 | - return (string) \mb_substr( |
|
4707 | + return (string)\mb_substr( |
|
4708 | 4708 | $str, |
4709 | 4709 | 0, |
4710 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
4710 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
4711 | 4711 | ); |
4712 | 4712 | } |
4713 | 4713 | |
4714 | 4714 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4715 | 4715 | |
4716 | - return (string) self::substr( |
|
4716 | + return (string)self::substr( |
|
4717 | 4717 | $str, |
4718 | 4718 | 0, |
4719 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
4719 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
4720 | 4720 | $encoding |
4721 | 4721 | ); |
4722 | 4722 | } |
@@ -4803,7 +4803,7 @@ discard block |
||
4803 | 4803 | $save = \mb_substitute_character(); |
4804 | 4804 | \mb_substitute_character($replacement_char_helper); |
4805 | 4805 | // the polyfill maybe return false, so cast to string |
4806 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4806 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4807 | 4807 | \mb_substitute_character($save); |
4808 | 4808 | } |
4809 | 4809 | |
@@ -4844,7 +4844,7 @@ discard block |
||
4844 | 4844 | } |
4845 | 4845 | |
4846 | 4846 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4847 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4847 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4848 | 4848 | } |
4849 | 4849 | |
4850 | 4850 | if ($chars) { |
@@ -4866,7 +4866,7 @@ discard block |
||
4866 | 4866 | { |
4867 | 4867 | echo '<pre>'; |
4868 | 4868 | foreach (self::$SUPPORT as $key => &$value) { |
4869 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
4869 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
4870 | 4870 | } |
4871 | 4871 | unset($value); |
4872 | 4872 | echo '</pre>'; |
@@ -4898,7 +4898,7 @@ discard block |
||
4898 | 4898 | return $char; |
4899 | 4899 | } |
4900 | 4900 | |
4901 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
4901 | + return '&#'.self::ord($char, $encoding).';'; |
|
4902 | 4902 | } |
4903 | 4903 | |
4904 | 4904 | /** |
@@ -4991,18 +4991,18 @@ discard block |
||
4991 | 4991 | $lang, |
4992 | 4992 | $try_to_keep_the_string_length |
4993 | 4993 | ); |
4994 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
4994 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
4995 | 4995 | |
4996 | 4996 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
4997 | 4997 | |
4998 | - $str = (string) \preg_replace_callback( |
|
4998 | + $str = (string)\preg_replace_callback( |
|
4999 | 4999 | '/[-_\\s]+(.)?/u', |
5000 | 5000 | /** |
5001 | 5001 | * @param array $match |
5002 | 5002 | * |
5003 | 5003 | * @return string |
5004 | 5004 | */ |
5005 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5005 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5006 | 5006 | if (isset($match[1])) { |
5007 | 5007 | if ($use_mb_functions === true) { |
5008 | 5008 | if ($encoding === 'UTF-8') { |
@@ -5020,14 +5020,14 @@ discard block |
||
5020 | 5020 | $str |
5021 | 5021 | ); |
5022 | 5022 | |
5023 | - return (string) \preg_replace_callback( |
|
5023 | + return (string)\preg_replace_callback( |
|
5024 | 5024 | '/[\\p{N}]+(.)?/u', |
5025 | 5025 | /** |
5026 | 5026 | * @param array $match |
5027 | 5027 | * |
5028 | 5028 | * @return string |
5029 | 5029 | */ |
5030 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5030 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5031 | 5031 | if ($use_mb_functions === true) { |
5032 | 5032 | if ($encoding === 'UTF-8') { |
5033 | 5033 | return \mb_strtoupper($match[0]); |
@@ -5205,7 +5205,7 @@ discard block |
||
5205 | 5205 | ): string { |
5206 | 5206 | if (self::$SUPPORT['mbstring'] === true) { |
5207 | 5207 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5208 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5208 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5209 | 5209 | |
5210 | 5210 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
5211 | 5211 | if ($use_mb_functions === true && $encoding === 'UTF-8') { |
@@ -5215,10 +5215,10 @@ discard block |
||
5215 | 5215 | } |
5216 | 5216 | |
5217 | 5217 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5218 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5218 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5219 | 5219 | } |
5220 | 5220 | |
5221 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5221 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5222 | 5222 | |
5223 | 5223 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
5224 | 5224 | if ($use_mb_functions === true && $encoding === 'UTF-8') { |
@@ -5227,7 +5227,7 @@ discard block |
||
5227 | 5227 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
5228 | 5228 | } |
5229 | 5229 | |
5230 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5230 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5231 | 5231 | } |
5232 | 5232 | |
5233 | 5233 | /** |
@@ -5242,7 +5242,7 @@ discard block |
||
5242 | 5242 | public static function str_detect_encoding($str) |
5243 | 5243 | { |
5244 | 5244 | // init |
5245 | - $str = (string) $str; |
|
5245 | + $str = (string)$str; |
|
5246 | 5246 | |
5247 | 5247 | // |
5248 | 5248 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5344,7 +5344,7 @@ discard block |
||
5344 | 5344 | foreach (self::$ENCODINGS as $encoding_tmp) { |
5345 | 5345 | // INFO: //IGNORE but still throw notice |
5346 | 5346 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5347 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
5347 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
5348 | 5348 | return $encoding_tmp; |
5349 | 5349 | } |
5350 | 5350 | } |
@@ -5433,7 +5433,7 @@ discard block |
||
5433 | 5433 | return $str; |
5434 | 5434 | } |
5435 | 5435 | |
5436 | - return $substring . $str; |
|
5436 | + return $substring.$str; |
|
5437 | 5437 | } |
5438 | 5438 | |
5439 | 5439 | /** |
@@ -5702,27 +5702,27 @@ discard block |
||
5702 | 5702 | string $encoding = 'UTF-8' |
5703 | 5703 | ): string { |
5704 | 5704 | if ($encoding === 'UTF-8') { |
5705 | - $len = (int) \mb_strlen($str); |
|
5705 | + $len = (int)\mb_strlen($str); |
|
5706 | 5706 | if ($index > $len) { |
5707 | 5707 | return $str; |
5708 | 5708 | } |
5709 | 5709 | |
5710 | 5710 | /** @noinspection UnnecessaryCastingInspection */ |
5711 | - return (string) \mb_substr($str, 0, $index) . |
|
5712 | - $substring . |
|
5713 | - (string) \mb_substr($str, $index, $len); |
|
5711 | + return (string)\mb_substr($str, 0, $index). |
|
5712 | + $substring. |
|
5713 | + (string)\mb_substr($str, $index, $len); |
|
5714 | 5714 | } |
5715 | 5715 | |
5716 | 5716 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5717 | 5717 | |
5718 | - $len = (int) self::strlen($str, $encoding); |
|
5718 | + $len = (int)self::strlen($str, $encoding); |
|
5719 | 5719 | if ($index > $len) { |
5720 | 5720 | return $str; |
5721 | 5721 | } |
5722 | 5722 | |
5723 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
5724 | - $substring . |
|
5725 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5723 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
5724 | + $substring. |
|
5725 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
5726 | 5726 | } |
5727 | 5727 | |
5728 | 5728 | /** |
@@ -5752,15 +5752,15 @@ discard block |
||
5752 | 5752 | */ |
5753 | 5753 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
5754 | 5754 | { |
5755 | - $search = (array) $search; |
|
5755 | + $search = (array)$search; |
|
5756 | 5756 | |
5757 | 5757 | /** @noinspection AlterInForeachInspection */ |
5758 | 5758 | foreach ($search as &$s) { |
5759 | - $s = (string) $s; |
|
5759 | + $s = (string)$s; |
|
5760 | 5760 | if ($s === '') { |
5761 | 5761 | $s = '/^(?<=.)$/'; |
5762 | 5762 | } else { |
5763 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5763 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5764 | 5764 | } |
5765 | 5765 | } |
5766 | 5766 | |
@@ -5792,11 +5792,11 @@ discard block |
||
5792 | 5792 | } |
5793 | 5793 | |
5794 | 5794 | if ($search === '') { |
5795 | - return $str . $replacement; |
|
5795 | + return $str.$replacement; |
|
5796 | 5796 | } |
5797 | 5797 | |
5798 | 5798 | if (\stripos($str, $search) === 0) { |
5799 | - return $replacement . \substr($str, \strlen($search)); |
|
5799 | + return $replacement.\substr($str, \strlen($search)); |
|
5800 | 5800 | } |
5801 | 5801 | |
5802 | 5802 | return $str; |
@@ -5824,11 +5824,11 @@ discard block |
||
5824 | 5824 | } |
5825 | 5825 | |
5826 | 5826 | if ($search === '') { |
5827 | - return $str . $replacement; |
|
5827 | + return $str.$replacement; |
|
5828 | 5828 | } |
5829 | 5829 | |
5830 | 5830 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
5831 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
5831 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
5832 | 5832 | } |
5833 | 5833 | |
5834 | 5834 | return $str; |
@@ -5908,15 +5908,15 @@ discard block |
||
5908 | 5908 | } |
5909 | 5909 | |
5910 | 5910 | if ($encoding === 'UTF-8') { |
5911 | - return (string) \mb_substr( |
|
5911 | + return (string)\mb_substr( |
|
5912 | 5912 | $str, |
5913 | - $offset + (int) \mb_strlen($separator) |
|
5913 | + $offset + (int)\mb_strlen($separator) |
|
5914 | 5914 | ); |
5915 | 5915 | } |
5916 | 5916 | |
5917 | - return (string) self::substr( |
|
5917 | + return (string)self::substr( |
|
5918 | 5918 | $str, |
5919 | - $offset + (int) self::strlen($separator, $encoding), |
|
5919 | + $offset + (int)self::strlen($separator, $encoding), |
|
5920 | 5920 | null, |
5921 | 5921 | $encoding |
5922 | 5922 | ); |
@@ -5946,15 +5946,15 @@ discard block |
||
5946 | 5946 | } |
5947 | 5947 | |
5948 | 5948 | if ($encoding === 'UTF-8') { |
5949 | - return (string) \mb_substr( |
|
5949 | + return (string)\mb_substr( |
|
5950 | 5950 | $str, |
5951 | - $offset + (int) self::strlen($separator) |
|
5951 | + $offset + (int)self::strlen($separator) |
|
5952 | 5952 | ); |
5953 | 5953 | } |
5954 | 5954 | |
5955 | - return (string) self::substr( |
|
5955 | + return (string)self::substr( |
|
5956 | 5956 | $str, |
5957 | - $offset + (int) self::strlen($separator, $encoding), |
|
5957 | + $offset + (int)self::strlen($separator, $encoding), |
|
5958 | 5958 | null, |
5959 | 5959 | $encoding |
5960 | 5960 | ); |
@@ -5984,10 +5984,10 @@ discard block |
||
5984 | 5984 | } |
5985 | 5985 | |
5986 | 5986 | if ($encoding === 'UTF-8') { |
5987 | - return (string) \mb_substr($str, 0, $offset); |
|
5987 | + return (string)\mb_substr($str, 0, $offset); |
|
5988 | 5988 | } |
5989 | 5989 | |
5990 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
5990 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
5991 | 5991 | } |
5992 | 5992 | |
5993 | 5993 | /** |
@@ -6014,7 +6014,7 @@ discard block |
||
6014 | 6014 | return ''; |
6015 | 6015 | } |
6016 | 6016 | |
6017 | - return (string) \mb_substr($str, 0, $offset); |
|
6017 | + return (string)\mb_substr($str, 0, $offset); |
|
6018 | 6018 | } |
6019 | 6019 | |
6020 | 6020 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6022,7 +6022,7 @@ discard block |
||
6022 | 6022 | return ''; |
6023 | 6023 | } |
6024 | 6024 | |
6025 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6025 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6026 | 6026 | } |
6027 | 6027 | |
6028 | 6028 | /** |
@@ -6118,12 +6118,12 @@ discard block |
||
6118 | 6118 | } |
6119 | 6119 | |
6120 | 6120 | if ($encoding === 'UTF-8') { |
6121 | - return (string) \mb_substr($str, -$n); |
|
6121 | + return (string)\mb_substr($str, -$n); |
|
6122 | 6122 | } |
6123 | 6123 | |
6124 | 6124 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6125 | 6125 | |
6126 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6126 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6127 | 6127 | } |
6128 | 6128 | |
6129 | 6129 | /** |
@@ -6147,21 +6147,21 @@ discard block |
||
6147 | 6147 | } |
6148 | 6148 | |
6149 | 6149 | if ($encoding === 'UTF-8') { |
6150 | - if ((int) \mb_strlen($str) <= $length) { |
|
6150 | + if ((int)\mb_strlen($str) <= $length) { |
|
6151 | 6151 | return $str; |
6152 | 6152 | } |
6153 | 6153 | |
6154 | 6154 | /** @noinspection UnnecessaryCastingInspection */ |
6155 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
6155 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
6156 | 6156 | } |
6157 | 6157 | |
6158 | 6158 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6159 | 6159 | |
6160 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6160 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6161 | 6161 | return $str; |
6162 | 6162 | } |
6163 | 6163 | |
6164 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
6164 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
6165 | 6165 | } |
6166 | 6166 | |
6167 | 6167 | /** |
@@ -6186,12 +6186,12 @@ discard block |
||
6186 | 6186 | |
6187 | 6187 | if ($encoding === 'UTF-8') { |
6188 | 6188 | /** @noinspection UnnecessaryCastingInspection */ |
6189 | - if ((int) \mb_strlen($str) <= $length) { |
|
6189 | + if ((int)\mb_strlen($str) <= $length) { |
|
6190 | 6190 | return $str; |
6191 | 6191 | } |
6192 | 6192 | |
6193 | 6193 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6194 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6194 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6195 | 6195 | } |
6196 | 6196 | |
6197 | 6197 | $str = \mb_substr($str, 0, $length); |
@@ -6201,22 +6201,22 @@ discard block |
||
6201 | 6201 | $new_str = \implode(' ', $array); |
6202 | 6202 | |
6203 | 6203 | if ($new_str === '') { |
6204 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6204 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6205 | 6205 | } |
6206 | 6206 | } else { |
6207 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6207 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6208 | 6208 | return $str; |
6209 | 6209 | } |
6210 | 6210 | |
6211 | 6211 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6212 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6212 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6213 | 6213 | } |
6214 | 6214 | |
6215 | 6215 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6216 | 6216 | $str = self::substr($str, 0, $length, $encoding); |
6217 | 6217 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6218 | 6218 | if ($str === false) { |
6219 | - return '' . $str_add_on; |
|
6219 | + return ''.$str_add_on; |
|
6220 | 6220 | } |
6221 | 6221 | |
6222 | 6222 | $array = \explode(' ', $str); |
@@ -6224,11 +6224,11 @@ discard block |
||
6224 | 6224 | $new_str = \implode(' ', $array); |
6225 | 6225 | |
6226 | 6226 | if ($new_str === '') { |
6227 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6227 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6228 | 6228 | } |
6229 | 6229 | } |
6230 | 6230 | |
6231 | - return $new_str . $str_add_on; |
|
6231 | + return $new_str.$str_add_on; |
|
6232 | 6232 | } |
6233 | 6233 | |
6234 | 6234 | /** |
@@ -6249,7 +6249,7 @@ discard block |
||
6249 | 6249 | $longest_common_prefix = ''; |
6250 | 6250 | |
6251 | 6251 | if ($encoding === 'UTF-8') { |
6252 | - $max_length = (int) \min( |
|
6252 | + $max_length = (int)\min( |
|
6253 | 6253 | \mb_strlen($str1), |
6254 | 6254 | \mb_strlen($str2) |
6255 | 6255 | ); |
@@ -6270,7 +6270,7 @@ discard block |
||
6270 | 6270 | } else { |
6271 | 6271 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6272 | 6272 | |
6273 | - $max_length = (int) \min( |
|
6273 | + $max_length = (int)\min( |
|
6274 | 6274 | self::strlen($str1, $encoding), |
6275 | 6275 | self::strlen($str2, $encoding) |
6276 | 6276 | ); |
@@ -6316,13 +6316,13 @@ discard block |
||
6316 | 6316 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6317 | 6317 | |
6318 | 6318 | if ($encoding === 'UTF-8') { |
6319 | - $str_length = (int) \mb_strlen($str1); |
|
6320 | - $other_length = (int) \mb_strlen($str2); |
|
6319 | + $str_length = (int)\mb_strlen($str1); |
|
6320 | + $other_length = (int)\mb_strlen($str2); |
|
6321 | 6321 | } else { |
6322 | 6322 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6323 | 6323 | |
6324 | - $str_length = (int) self::strlen($str1, $encoding); |
|
6325 | - $other_length = (int) self::strlen($str2, $encoding); |
|
6324 | + $str_length = (int)self::strlen($str1, $encoding); |
|
6325 | + $other_length = (int)self::strlen($str2, $encoding); |
|
6326 | 6326 | } |
6327 | 6327 | |
6328 | 6328 | // Return if either string is empty |
@@ -6375,10 +6375,10 @@ discard block |
||
6375 | 6375 | } |
6376 | 6376 | |
6377 | 6377 | if ($encoding === 'UTF-8') { |
6378 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
6378 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
6379 | 6379 | } |
6380 | 6380 | |
6381 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
6381 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
6382 | 6382 | } |
6383 | 6383 | |
6384 | 6384 | /** |
@@ -6400,7 +6400,7 @@ discard block |
||
6400 | 6400 | } |
6401 | 6401 | |
6402 | 6402 | if ($encoding === 'UTF-8') { |
6403 | - $max_length = (int) \min( |
|
6403 | + $max_length = (int)\min( |
|
6404 | 6404 | \mb_strlen($str1, $encoding), |
6405 | 6405 | \mb_strlen($str2, $encoding) |
6406 | 6406 | ); |
@@ -6414,7 +6414,7 @@ discard block |
||
6414 | 6414 | && |
6415 | 6415 | $char === \mb_substr($str2, -$i, 1) |
6416 | 6416 | ) { |
6417 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
6417 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
6418 | 6418 | } else { |
6419 | 6419 | break; |
6420 | 6420 | } |
@@ -6422,7 +6422,7 @@ discard block |
||
6422 | 6422 | } else { |
6423 | 6423 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6424 | 6424 | |
6425 | - $max_length = (int) \min( |
|
6425 | + $max_length = (int)\min( |
|
6426 | 6426 | self::strlen($str1, $encoding), |
6427 | 6427 | self::strlen($str2, $encoding) |
6428 | 6428 | ); |
@@ -6436,7 +6436,7 @@ discard block |
||
6436 | 6436 | && |
6437 | 6437 | $char === self::substr($str2, -$i, 1, $encoding) |
6438 | 6438 | ) { |
6439 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
6439 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
6440 | 6440 | } else { |
6441 | 6441 | break; |
6442 | 6442 | } |
@@ -6456,7 +6456,7 @@ discard block |
||
6456 | 6456 | */ |
6457 | 6457 | public static function str_matches_pattern(string $str, string $pattern): bool |
6458 | 6458 | { |
6459 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
6459 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
6460 | 6460 | } |
6461 | 6461 | |
6462 | 6462 | /** |
@@ -6473,7 +6473,7 @@ discard block |
||
6473 | 6473 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
6474 | 6474 | { |
6475 | 6475 | // init |
6476 | - $length = (int) self::strlen($str, $encoding); |
|
6476 | + $length = (int)self::strlen($str, $encoding); |
|
6477 | 6477 | |
6478 | 6478 | if ($offset >= 0) { |
6479 | 6479 | return $length > $offset; |
@@ -6499,7 +6499,7 @@ discard block |
||
6499 | 6499 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
6500 | 6500 | { |
6501 | 6501 | // init |
6502 | - $length = (int) self::strlen($str); |
|
6502 | + $length = (int)self::strlen($str); |
|
6503 | 6503 | |
6504 | 6504 | if ( |
6505 | 6505 | ($index >= 0 && $length <= $index) |
@@ -6538,7 +6538,7 @@ discard block |
||
6538 | 6538 | return $str; |
6539 | 6539 | } |
6540 | 6540 | |
6541 | - if ($pad_type !== (int) $pad_type) { |
|
6541 | + if ($pad_type !== (int)$pad_type) { |
|
6542 | 6542 | if ($pad_type === 'left') { |
6543 | 6543 | $pad_type = \STR_PAD_LEFT; |
6544 | 6544 | } elseif ($pad_type === 'right') { |
@@ -6547,23 +6547,23 @@ discard block |
||
6547 | 6547 | $pad_type = \STR_PAD_BOTH; |
6548 | 6548 | } else { |
6549 | 6549 | throw new \InvalidArgumentException( |
6550 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
6550 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
6551 | 6551 | ); |
6552 | 6552 | } |
6553 | 6553 | } |
6554 | 6554 | |
6555 | 6555 | if ($encoding === 'UTF-8') { |
6556 | - $str_length = (int) \mb_strlen($str); |
|
6556 | + $str_length = (int)\mb_strlen($str); |
|
6557 | 6557 | |
6558 | 6558 | if ($pad_length >= $str_length) { |
6559 | 6559 | switch ($pad_type) { |
6560 | 6560 | case \STR_PAD_LEFT: |
6561 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6561 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6562 | 6562 | |
6563 | 6563 | $diff = ($pad_length - $str_length); |
6564 | 6564 | |
6565 | - $pre = (string) \mb_substr( |
|
6566 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6565 | + $pre = (string)\mb_substr( |
|
6566 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6567 | 6567 | 0, |
6568 | 6568 | $diff |
6569 | 6569 | ); |
@@ -6574,16 +6574,16 @@ discard block |
||
6574 | 6574 | case \STR_PAD_BOTH: |
6575 | 6575 | $diff = ($pad_length - $str_length); |
6576 | 6576 | |
6577 | - $ps_length_left = (int) \floor($diff / 2); |
|
6577 | + $ps_length_left = (int)\floor($diff / 2); |
|
6578 | 6578 | |
6579 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6579 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6580 | 6580 | |
6581 | - $pre = (string) \mb_substr( |
|
6581 | + $pre = (string)\mb_substr( |
|
6582 | 6582 | \str_repeat($pad_string, $ps_length_left), |
6583 | 6583 | 0, |
6584 | 6584 | $ps_length_left |
6585 | 6585 | ); |
6586 | - $post = (string) \mb_substr( |
|
6586 | + $post = (string)\mb_substr( |
|
6587 | 6587 | \str_repeat($pad_string, $ps_length_right), |
6588 | 6588 | 0, |
6589 | 6589 | $ps_length_right |
@@ -6593,19 +6593,19 @@ discard block |
||
6593 | 6593 | |
6594 | 6594 | case \STR_PAD_RIGHT: |
6595 | 6595 | default: |
6596 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6596 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6597 | 6597 | |
6598 | 6598 | $diff = ($pad_length - $str_length); |
6599 | 6599 | |
6600 | - $post = (string) \mb_substr( |
|
6601 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6600 | + $post = (string)\mb_substr( |
|
6601 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6602 | 6602 | 0, |
6603 | 6603 | $diff |
6604 | 6604 | ); |
6605 | 6605 | $pre = ''; |
6606 | 6606 | } |
6607 | 6607 | |
6608 | - return $pre . $str . $post; |
|
6608 | + return $pre.$str.$post; |
|
6609 | 6609 | } |
6610 | 6610 | |
6611 | 6611 | return $str; |
@@ -6613,17 +6613,17 @@ discard block |
||
6613 | 6613 | |
6614 | 6614 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6615 | 6615 | |
6616 | - $str_length = (int) self::strlen($str, $encoding); |
|
6616 | + $str_length = (int)self::strlen($str, $encoding); |
|
6617 | 6617 | |
6618 | 6618 | if ($pad_length >= $str_length) { |
6619 | 6619 | switch ($pad_type) { |
6620 | 6620 | case \STR_PAD_LEFT: |
6621 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6621 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6622 | 6622 | |
6623 | 6623 | $diff = ($pad_length - $str_length); |
6624 | 6624 | |
6625 | - $pre = (string) self::substr( |
|
6626 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6625 | + $pre = (string)self::substr( |
|
6626 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6627 | 6627 | 0, |
6628 | 6628 | $diff, |
6629 | 6629 | $encoding |
@@ -6635,17 +6635,17 @@ discard block |
||
6635 | 6635 | case \STR_PAD_BOTH: |
6636 | 6636 | $diff = ($pad_length - $str_length); |
6637 | 6637 | |
6638 | - $ps_length_left = (int) \floor($diff / 2); |
|
6638 | + $ps_length_left = (int)\floor($diff / 2); |
|
6639 | 6639 | |
6640 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6640 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6641 | 6641 | |
6642 | - $pre = (string) self::substr( |
|
6642 | + $pre = (string)self::substr( |
|
6643 | 6643 | \str_repeat($pad_string, $ps_length_left), |
6644 | 6644 | 0, |
6645 | 6645 | $ps_length_left, |
6646 | 6646 | $encoding |
6647 | 6647 | ); |
6648 | - $post = (string) self::substr( |
|
6648 | + $post = (string)self::substr( |
|
6649 | 6649 | \str_repeat($pad_string, $ps_length_right), |
6650 | 6650 | 0, |
6651 | 6651 | $ps_length_right, |
@@ -6656,12 +6656,12 @@ discard block |
||
6656 | 6656 | |
6657 | 6657 | case \STR_PAD_RIGHT: |
6658 | 6658 | default: |
6659 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6659 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6660 | 6660 | |
6661 | 6661 | $diff = ($pad_length - $str_length); |
6662 | 6662 | |
6663 | - $post = (string) self::substr( |
|
6664 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6663 | + $post = (string)self::substr( |
|
6664 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6665 | 6665 | 0, |
6666 | 6666 | $diff, |
6667 | 6667 | $encoding |
@@ -6669,7 +6669,7 @@ discard block |
||
6669 | 6669 | $pre = ''; |
6670 | 6670 | } |
6671 | 6671 | |
6672 | - return $pre . $str . $post; |
|
6672 | + return $pre.$str.$post; |
|
6673 | 6673 | } |
6674 | 6674 | |
6675 | 6675 | return $str; |
@@ -6853,11 +6853,11 @@ discard block |
||
6853 | 6853 | } |
6854 | 6854 | |
6855 | 6855 | if ($search === '') { |
6856 | - return $str . $replacement; |
|
6856 | + return $str.$replacement; |
|
6857 | 6857 | } |
6858 | 6858 | |
6859 | 6859 | if (\strpos($str, $search) === 0) { |
6860 | - return $replacement . \substr($str, \strlen($search)); |
|
6860 | + return $replacement.\substr($str, \strlen($search)); |
|
6861 | 6861 | } |
6862 | 6862 | |
6863 | 6863 | return $str; |
@@ -6888,11 +6888,11 @@ discard block |
||
6888 | 6888 | } |
6889 | 6889 | |
6890 | 6890 | if ($search === '') { |
6891 | - return $str . $replacement; |
|
6891 | + return $str.$replacement; |
|
6892 | 6892 | } |
6893 | 6893 | |
6894 | 6894 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6895 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6895 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6896 | 6896 | } |
6897 | 6897 | |
6898 | 6898 | return $str; |
@@ -6924,7 +6924,7 @@ discard block |
||
6924 | 6924 | $subject, |
6925 | 6925 | $replace, |
6926 | 6926 | $pos, |
6927 | - (int) self::strlen($search) |
|
6927 | + (int)self::strlen($search) |
|
6928 | 6928 | ); |
6929 | 6929 | } |
6930 | 6930 | |
@@ -6956,7 +6956,7 @@ discard block |
||
6956 | 6956 | $subject, |
6957 | 6957 | $replace, |
6958 | 6958 | $pos, |
6959 | - (int) self::strlen($search) |
|
6959 | + (int)self::strlen($search) |
|
6960 | 6960 | ); |
6961 | 6961 | } |
6962 | 6962 | |
@@ -6976,7 +6976,7 @@ discard block |
||
6976 | 6976 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
6977 | 6977 | { |
6978 | 6978 | if ($encoding === 'UTF-8') { |
6979 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
6979 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
6980 | 6980 | /** @noinspection NonSecureShuffleUsageInspection */ |
6981 | 6981 | \shuffle($indexes); |
6982 | 6982 | |
@@ -6992,7 +6992,7 @@ discard block |
||
6992 | 6992 | } else { |
6993 | 6993 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6994 | 6994 | |
6995 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
6995 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
6996 | 6996 | /** @noinspection NonSecureShuffleUsageInspection */ |
6997 | 6997 | \shuffle($indexes); |
6998 | 6998 | |
@@ -7033,11 +7033,11 @@ discard block |
||
7033 | 7033 | ) { |
7034 | 7034 | if ($encoding === 'UTF-8') { |
7035 | 7035 | if ($end === null) { |
7036 | - $length = (int) \mb_strlen($str); |
|
7036 | + $length = (int)\mb_strlen($str); |
|
7037 | 7037 | } elseif ($end >= 0 && $end <= $start) { |
7038 | 7038 | return ''; |
7039 | 7039 | } elseif ($end < 0) { |
7040 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7040 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7041 | 7041 | } else { |
7042 | 7042 | $length = $end - $start; |
7043 | 7043 | } |
@@ -7048,11 +7048,11 @@ discard block |
||
7048 | 7048 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7049 | 7049 | |
7050 | 7050 | if ($end === null) { |
7051 | - $length = (int) self::strlen($str, $encoding); |
|
7051 | + $length = (int)self::strlen($str, $encoding); |
|
7052 | 7052 | } elseif ($end >= 0 && $end <= $start) { |
7053 | 7053 | return ''; |
7054 | 7054 | } elseif ($end < 0) { |
7055 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7055 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7056 | 7056 | } else { |
7057 | 7057 | $length = $end - $start; |
7058 | 7058 | } |
@@ -7084,35 +7084,35 @@ discard block |
||
7084 | 7084 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7085 | 7085 | } |
7086 | 7086 | |
7087 | - $str = (string) \preg_replace_callback( |
|
7087 | + $str = (string)\preg_replace_callback( |
|
7088 | 7088 | '/([\\p{N}|\\p{Lu}])/u', |
7089 | 7089 | /** |
7090 | 7090 | * @param string[] $matches |
7091 | 7091 | * |
7092 | 7092 | * @return string |
7093 | 7093 | */ |
7094 | - static function (array $matches) use ($encoding): string { |
|
7094 | + static function(array $matches) use ($encoding): string { |
|
7095 | 7095 | $match = $matches[1]; |
7096 | - $match_int = (int) $match; |
|
7096 | + $match_int = (int)$match; |
|
7097 | 7097 | |
7098 | - if ((string) $match_int === $match) { |
|
7099 | - return '_' . $match . '_'; |
|
7098 | + if ((string)$match_int === $match) { |
|
7099 | + return '_'.$match.'_'; |
|
7100 | 7100 | } |
7101 | 7101 | |
7102 | 7102 | if ($encoding === 'UTF-8') { |
7103 | - return '_' . \mb_strtolower($match); |
|
7103 | + return '_'.\mb_strtolower($match); |
|
7104 | 7104 | } |
7105 | 7105 | |
7106 | - return '_' . self::strtolower($match, $encoding); |
|
7106 | + return '_'.self::strtolower($match, $encoding); |
|
7107 | 7107 | }, |
7108 | 7108 | $str |
7109 | 7109 | ); |
7110 | 7110 | |
7111 | - $str = (string) \preg_replace( |
|
7111 | + $str = (string)\preg_replace( |
|
7112 | 7112 | [ |
7113 | - '/\\s+/u', // convert spaces to "_" |
|
7113 | + '/\\s+/u', // convert spaces to "_" |
|
7114 | 7114 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
7115 | - '/_+/', // remove double "_" |
|
7115 | + '/_+/', // remove double "_" |
|
7116 | 7116 | ], |
7117 | 7117 | [ |
7118 | 7118 | '_', |
@@ -7188,7 +7188,7 @@ discard block |
||
7188 | 7188 | } |
7189 | 7189 | |
7190 | 7190 | // init |
7191 | - $str = (string) $str; |
|
7191 | + $str = (string)$str; |
|
7192 | 7192 | |
7193 | 7193 | if ($str === '') { |
7194 | 7194 | return []; |
@@ -7235,7 +7235,7 @@ discard block |
||
7235 | 7235 | ($str[$i] & "\xE0") === "\xC0" |
7236 | 7236 | ) { |
7237 | 7237 | if (($str[$i + 1] & "\xC0") === "\x80") { |
7238 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
7238 | + $ret[] = $str[$i].$str[$i + 1]; |
|
7239 | 7239 | |
7240 | 7240 | ++$i; |
7241 | 7241 | } |
@@ -7249,7 +7249,7 @@ discard block |
||
7249 | 7249 | && |
7250 | 7250 | ($str[$i + 2] & "\xC0") === "\x80" |
7251 | 7251 | ) { |
7252 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
7252 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
7253 | 7253 | |
7254 | 7254 | $i += 2; |
7255 | 7255 | } |
@@ -7265,7 +7265,7 @@ discard block |
||
7265 | 7265 | && |
7266 | 7266 | ($str[$i + 3] & "\xC0") === "\x80" |
7267 | 7267 | ) { |
7268 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
7268 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
7269 | 7269 | |
7270 | 7270 | $i += 3; |
7271 | 7271 | } |
@@ -7277,7 +7277,7 @@ discard block |
||
7277 | 7277 | $ret = \array_chunk($ret, $length); |
7278 | 7278 | |
7279 | 7279 | return \array_map( |
7280 | - static function (array &$item): string { |
|
7280 | + static function(array &$item): string { |
|
7281 | 7281 | return \implode('', $item); |
7282 | 7282 | }, |
7283 | 7283 | $ret |
@@ -7340,7 +7340,7 @@ discard block |
||
7340 | 7340 | $limit = -1; |
7341 | 7341 | } |
7342 | 7342 | |
7343 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7343 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7344 | 7344 | |
7345 | 7345 | if ($array === false) { |
7346 | 7346 | return []; |
@@ -7424,9 +7424,9 @@ discard block |
||
7424 | 7424 | return ''; |
7425 | 7425 | } |
7426 | 7426 | |
7427 | - return (string) \mb_substr( |
|
7427 | + return (string)\mb_substr( |
|
7428 | 7428 | $str, |
7429 | - $offset + (int) \mb_strlen($separator) |
|
7429 | + $offset + (int)\mb_strlen($separator) |
|
7430 | 7430 | ); |
7431 | 7431 | } |
7432 | 7432 | |
@@ -7435,9 +7435,9 @@ discard block |
||
7435 | 7435 | return ''; |
7436 | 7436 | } |
7437 | 7437 | |
7438 | - return (string) \mb_substr( |
|
7438 | + return (string)\mb_substr( |
|
7439 | 7439 | $str, |
7440 | - $offset + (int) self::strlen($separator, $encoding), |
|
7440 | + $offset + (int)self::strlen($separator, $encoding), |
|
7441 | 7441 | null, |
7442 | 7442 | $encoding |
7443 | 7443 | ); |
@@ -7464,9 +7464,9 @@ discard block |
||
7464 | 7464 | return ''; |
7465 | 7465 | } |
7466 | 7466 | |
7467 | - return (string) \mb_substr( |
|
7467 | + return (string)\mb_substr( |
|
7468 | 7468 | $str, |
7469 | - $offset + (int) \mb_strlen($separator) |
|
7469 | + $offset + (int)\mb_strlen($separator) |
|
7470 | 7470 | ); |
7471 | 7471 | } |
7472 | 7472 | |
@@ -7475,9 +7475,9 @@ discard block |
||
7475 | 7475 | return ''; |
7476 | 7476 | } |
7477 | 7477 | |
7478 | - return (string) self::substr( |
|
7478 | + return (string)self::substr( |
|
7479 | 7479 | $str, |
7480 | - $offset + (int) self::strlen($separator, $encoding), |
|
7480 | + $offset + (int)self::strlen($separator, $encoding), |
|
7481 | 7481 | null, |
7482 | 7482 | $encoding |
7483 | 7483 | ); |
@@ -7507,7 +7507,7 @@ discard block |
||
7507 | 7507 | return ''; |
7508 | 7508 | } |
7509 | 7509 | |
7510 | - return (string) \mb_substr( |
|
7510 | + return (string)\mb_substr( |
|
7511 | 7511 | $str, |
7512 | 7512 | 0, |
7513 | 7513 | $offset |
@@ -7519,7 +7519,7 @@ discard block |
||
7519 | 7519 | return ''; |
7520 | 7520 | } |
7521 | 7521 | |
7522 | - return (string) self::substr( |
|
7522 | + return (string)self::substr( |
|
7523 | 7523 | $str, |
7524 | 7524 | 0, |
7525 | 7525 | $offset, |
@@ -7548,7 +7548,7 @@ discard block |
||
7548 | 7548 | return ''; |
7549 | 7549 | } |
7550 | 7550 | |
7551 | - return (string) \mb_substr( |
|
7551 | + return (string)\mb_substr( |
|
7552 | 7552 | $str, |
7553 | 7553 | 0, |
7554 | 7554 | $offset |
@@ -7562,7 +7562,7 @@ discard block |
||
7562 | 7562 | |
7563 | 7563 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7564 | 7564 | |
7565 | - return (string) self::substr( |
|
7565 | + return (string)self::substr( |
|
7566 | 7566 | $str, |
7567 | 7567 | 0, |
7568 | 7568 | $offset, |
@@ -7670,7 +7670,7 @@ discard block |
||
7670 | 7670 | */ |
7671 | 7671 | public static function str_surround(string $str, string $substring): string |
7672 | 7672 | { |
7673 | - return $substring . $str . $substring; |
|
7673 | + return $substring.$str.$substring; |
|
7674 | 7674 | } |
7675 | 7675 | |
7676 | 7676 | /** |
@@ -7727,9 +7727,9 @@ discard block |
||
7727 | 7727 | $word_define_chars = ''; |
7728 | 7728 | } |
7729 | 7729 | |
7730 | - $str = (string) \preg_replace_callback( |
|
7731 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
7732 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
7730 | + $str = (string)\preg_replace_callback( |
|
7731 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
7732 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
7733 | 7733 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
7734 | 7734 | return $match[0]; |
7735 | 7735 | } |
@@ -7820,16 +7820,16 @@ discard block |
||
7820 | 7820 | } |
7821 | 7821 | |
7822 | 7822 | // the main substitutions |
7823 | - $str = (string) \preg_replace_callback( |
|
7823 | + $str = (string)\preg_replace_callback( |
|
7824 | 7824 | '~\\b (_*) (?: # 1. Leading underscore and |
7825 | 7825 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
7826 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
7826 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
7827 | 7827 | | |
7828 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
7828 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
7829 | 7829 | | |
7830 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
7830 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
7831 | 7831 | | |
7832 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
7832 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
7833 | 7833 | ) (_*) \\b # 6. With trailing underscore |
7834 | 7834 | ~ux', |
7835 | 7835 | /** |
@@ -7837,7 +7837,7 @@ discard block |
||
7837 | 7837 | * |
7838 | 7838 | * @return string |
7839 | 7839 | */ |
7840 | - static function (array $matches) use ($encoding): string { |
|
7840 | + static function(array $matches) use ($encoding): string { |
|
7841 | 7841 | // preserve leading underscore |
7842 | 7842 | $str = $matches[1]; |
7843 | 7843 | if ($matches[2]) { |
@@ -7862,26 +7862,26 @@ discard block |
||
7862 | 7862 | ); |
7863 | 7863 | |
7864 | 7864 | // Exceptions for small words: capitalize at start of title... |
7865 | - $str = (string) \preg_replace_callback( |
|
7865 | + $str = (string)\preg_replace_callback( |
|
7866 | 7866 | '~( \\A [[:punct:]]* # start of title... |
7867 | 7867 | | [:.;?!][ ]+ # or of subsentence... |
7868 | 7868 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
7869 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
7869 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
7870 | 7870 | ~uxi', |
7871 | 7871 | /** |
7872 | 7872 | * @param string[] $matches |
7873 | 7873 | * |
7874 | 7874 | * @return string |
7875 | 7875 | */ |
7876 | - static function (array $matches) use ($encoding): string { |
|
7877 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
7876 | + static function(array $matches) use ($encoding): string { |
|
7877 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
7878 | 7878 | }, |
7879 | 7879 | $str |
7880 | 7880 | ); |
7881 | 7881 | |
7882 | 7882 | // ...and end of title |
7883 | - $str = (string) \preg_replace_callback( |
|
7884 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
7883 | + $str = (string)\preg_replace_callback( |
|
7884 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
7885 | 7885 | (?= [[:punct:]]* \Z # ...at the end of the title... |
7886 | 7886 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
7887 | 7887 | ~uxi', |
@@ -7890,7 +7890,7 @@ discard block |
||
7890 | 7890 | * |
7891 | 7891 | * @return string |
7892 | 7892 | */ |
7893 | - static function (array $matches) use ($encoding): string { |
|
7893 | + static function(array $matches) use ($encoding): string { |
|
7894 | 7894 | return static::ucfirst($matches[1], $encoding); |
7895 | 7895 | }, |
7896 | 7896 | $str |
@@ -7898,10 +7898,10 @@ discard block |
||
7898 | 7898 | |
7899 | 7899 | // Exceptions for small words in hyphenated compound words. |
7900 | 7900 | // e.g. "in-flight" -> In-Flight |
7901 | - $str = (string) \preg_replace_callback( |
|
7901 | + $str = (string)\preg_replace_callback( |
|
7902 | 7902 | '~\\b |
7903 | 7903 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
7904 | - ( ' . $small_words_rx . ' ) |
|
7904 | + ( ' . $small_words_rx.' ) |
|
7905 | 7905 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
7906 | 7906 | ~uxi', |
7907 | 7907 | /** |
@@ -7909,18 +7909,18 @@ discard block |
||
7909 | 7909 | * |
7910 | 7910 | * @return string |
7911 | 7911 | */ |
7912 | - static function (array $matches) use ($encoding): string { |
|
7912 | + static function(array $matches) use ($encoding): string { |
|
7913 | 7913 | return static::ucfirst($matches[1], $encoding); |
7914 | 7914 | }, |
7915 | 7915 | $str |
7916 | 7916 | ); |
7917 | 7917 | |
7918 | 7918 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
7919 | - $str = (string) \preg_replace_callback( |
|
7919 | + $str = (string)\preg_replace_callback( |
|
7920 | 7920 | '~\\b |
7921 | 7921 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
7922 | 7922 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
7923 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
7923 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
7924 | 7924 | (?! - ) # Negative lookahead for another - |
7925 | 7925 | ~uxi', |
7926 | 7926 | /** |
@@ -7928,8 +7928,8 @@ discard block |
||
7928 | 7928 | * |
7929 | 7929 | * @return string |
7930 | 7930 | */ |
7931 | - static function (array $matches) use ($encoding): string { |
|
7932 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
7931 | + static function(array $matches) use ($encoding): string { |
|
7932 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
7933 | 7933 | }, |
7934 | 7934 | $str |
7935 | 7935 | ); |
@@ -8038,7 +8038,7 @@ discard block |
||
8038 | 8038 | ); |
8039 | 8039 | |
8040 | 8040 | foreach ($tmp_return as &$item) { |
8041 | - $item = (string) $item; |
|
8041 | + $item = (string)$item; |
|
8042 | 8042 | } |
8043 | 8043 | |
8044 | 8044 | return $tmp_return; |
@@ -8087,39 +8087,39 @@ discard block |
||
8087 | 8087 | } |
8088 | 8088 | |
8089 | 8089 | if ($encoding === 'UTF-8') { |
8090 | - if ($length >= (int) \mb_strlen($str)) { |
|
8090 | + if ($length >= (int)\mb_strlen($str)) { |
|
8091 | 8091 | return $str; |
8092 | 8092 | } |
8093 | 8093 | |
8094 | 8094 | if ($substring !== '') { |
8095 | - $length -= (int) \mb_strlen($substring); |
|
8095 | + $length -= (int)\mb_strlen($substring); |
|
8096 | 8096 | |
8097 | 8097 | /** @noinspection UnnecessaryCastingInspection */ |
8098 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
8098 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
8099 | 8099 | } |
8100 | 8100 | |
8101 | 8101 | /** @noinspection UnnecessaryCastingInspection */ |
8102 | - return (string) \mb_substr($str, 0, $length); |
|
8102 | + return (string)\mb_substr($str, 0, $length); |
|
8103 | 8103 | } |
8104 | 8104 | |
8105 | 8105 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8106 | 8106 | |
8107 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8107 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8108 | 8108 | return $str; |
8109 | 8109 | } |
8110 | 8110 | |
8111 | 8111 | if ($substring !== '') { |
8112 | - $length -= (int) self::strlen($substring, $encoding); |
|
8112 | + $length -= (int)self::strlen($substring, $encoding); |
|
8113 | 8113 | } |
8114 | 8114 | |
8115 | 8115 | return ( |
8116 | - (string) self::substr( |
|
8116 | + (string)self::substr( |
|
8117 | 8117 | $str, |
8118 | 8118 | 0, |
8119 | 8119 | $length, |
8120 | 8120 | $encoding |
8121 | 8121 | ) |
8122 | - ) . $substring; |
|
8122 | + ).$substring; |
|
8123 | 8123 | } |
8124 | 8124 | |
8125 | 8125 | /** |
@@ -8149,12 +8149,12 @@ discard block |
||
8149 | 8149 | } |
8150 | 8150 | |
8151 | 8151 | if ($encoding === 'UTF-8') { |
8152 | - if ($length >= (int) \mb_strlen($str)) { |
|
8152 | + if ($length >= (int)\mb_strlen($str)) { |
|
8153 | 8153 | return $str; |
8154 | 8154 | } |
8155 | 8155 | |
8156 | 8156 | // need to further trim the string so we can append the substring |
8157 | - $length -= (int) \mb_strlen($substring); |
|
8157 | + $length -= (int)\mb_strlen($substring); |
|
8158 | 8158 | if ($length <= 0) { |
8159 | 8159 | return $substring; |
8160 | 8160 | } |
@@ -8176,18 +8176,18 @@ discard block |
||
8176 | 8176 | || |
8177 | 8177 | ($space_position !== false && $ignore_do_not_split_words_for_one_word === false) |
8178 | 8178 | ) { |
8179 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
8179 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
8180 | 8180 | } |
8181 | 8181 | } |
8182 | 8182 | } else { |
8183 | 8183 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8184 | 8184 | |
8185 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8185 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8186 | 8186 | return $str; |
8187 | 8187 | } |
8188 | 8188 | |
8189 | 8189 | // need to further trim the string so we can append the substring |
8190 | - $length -= (int) self::strlen($substring, $encoding); |
|
8190 | + $length -= (int)self::strlen($substring, $encoding); |
|
8191 | 8191 | if ($length <= 0) { |
8192 | 8192 | return $substring; |
8193 | 8193 | } |
@@ -8209,12 +8209,12 @@ discard block |
||
8209 | 8209 | || |
8210 | 8210 | ($space_position !== false && $ignore_do_not_split_words_for_one_word === false) |
8211 | 8211 | ) { |
8212 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
8212 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
8213 | 8213 | } |
8214 | 8214 | } |
8215 | 8215 | } |
8216 | 8216 | |
8217 | - return $truncated . $substring; |
|
8217 | + return $truncated.$substring; |
|
8218 | 8218 | } |
8219 | 8219 | |
8220 | 8220 | /** |
@@ -8311,13 +8311,13 @@ discard block |
||
8311 | 8311 | } |
8312 | 8312 | } elseif ($format === 2) { |
8313 | 8313 | $number_of_words = []; |
8314 | - $offset = (int) self::strlen($str_parts[0]); |
|
8314 | + $offset = (int)self::strlen($str_parts[0]); |
|
8315 | 8315 | for ($i = 1; $i < $len; $i += 2) { |
8316 | 8316 | $number_of_words[$offset] = $str_parts[$i]; |
8317 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
8317 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
8318 | 8318 | } |
8319 | 8319 | } else { |
8320 | - $number_of_words = (int) (($len - 1) / 2); |
|
8320 | + $number_of_words = (int)(($len - 1) / 2); |
|
8321 | 8321 | } |
8322 | 8322 | |
8323 | 8323 | return $number_of_words; |
@@ -8438,21 +8438,21 @@ discard block |
||
8438 | 8438 | } |
8439 | 8439 | |
8440 | 8440 | if ($char_list === '') { |
8441 | - return (int) self::strlen($str, $encoding); |
|
8441 | + return (int)self::strlen($str, $encoding); |
|
8442 | 8442 | } |
8443 | 8443 | |
8444 | 8444 | if ($offset !== null || $length !== null) { |
8445 | 8445 | if ($encoding === 'UTF-8') { |
8446 | 8446 | if ($length === null) { |
8447 | 8447 | /** @noinspection UnnecessaryCastingInspection */ |
8448 | - $str_tmp = \mb_substr($str, (int) $offset); |
|
8448 | + $str_tmp = \mb_substr($str, (int)$offset); |
|
8449 | 8449 | } else { |
8450 | 8450 | /** @noinspection UnnecessaryCastingInspection */ |
8451 | - $str_tmp = \mb_substr($str, (int) $offset, $length); |
|
8451 | + $str_tmp = \mb_substr($str, (int)$offset, $length); |
|
8452 | 8452 | } |
8453 | 8453 | } else { |
8454 | 8454 | /** @noinspection UnnecessaryCastingInspection */ |
8455 | - $str_tmp = self::substr($str, (int) $offset, $length, $encoding); |
|
8455 | + $str_tmp = self::substr($str, (int)$offset, $length, $encoding); |
|
8456 | 8456 | } |
8457 | 8457 | |
8458 | 8458 | if ($str_tmp === false) { |
@@ -8468,7 +8468,7 @@ discard block |
||
8468 | 8468 | } |
8469 | 8469 | |
8470 | 8470 | $matches = []; |
8471 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
8471 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
8472 | 8472 | $return = self::strlen($matches[1], $encoding); |
8473 | 8473 | if ($return === false) { |
8474 | 8474 | return 0; |
@@ -8477,7 +8477,7 @@ discard block |
||
8477 | 8477 | return $return; |
8478 | 8478 | } |
8479 | 8479 | |
8480 | - return (int) self::strlen($str, $encoding); |
|
8480 | + return (int)self::strlen($str, $encoding); |
|
8481 | 8481 | } |
8482 | 8482 | |
8483 | 8483 | /** |
@@ -8610,7 +8610,7 @@ discard block |
||
8610 | 8610 | return ''; |
8611 | 8611 | } |
8612 | 8612 | |
8613 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
8613 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
8614 | 8614 | } |
8615 | 8615 | |
8616 | 8616 | /** |
@@ -8675,7 +8675,7 @@ discard block |
||
8675 | 8675 | // fallback for ascii only |
8676 | 8676 | // |
8677 | 8677 | |
8678 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
8678 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
8679 | 8679 | return \stripos($haystack, $needle, $offset); |
8680 | 8680 | } |
8681 | 8681 | |
@@ -8743,7 +8743,7 @@ discard block |
||
8743 | 8743 | && |
8744 | 8744 | self::$SUPPORT['mbstring'] === false |
8745 | 8745 | ) { |
8746 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8746 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8747 | 8747 | } |
8748 | 8748 | |
8749 | 8749 | if ( |
@@ -8757,11 +8757,11 @@ discard block |
||
8757 | 8757 | } |
8758 | 8758 | } |
8759 | 8759 | |
8760 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
8760 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
8761 | 8761 | return \stristr($haystack, $needle, $before_needle); |
8762 | 8762 | } |
8763 | 8763 | |
8764 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
8764 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
8765 | 8765 | |
8766 | 8766 | if (!isset($match[1])) { |
8767 | 8767 | return false; |
@@ -8771,7 +8771,7 @@ discard block |
||
8771 | 8771 | return $match[1]; |
8772 | 8772 | } |
8773 | 8773 | |
8774 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
8774 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
8775 | 8775 | } |
8776 | 8776 | |
8777 | 8777 | /** |
@@ -8843,7 +8843,7 @@ discard block |
||
8843 | 8843 | && |
8844 | 8844 | self::$SUPPORT['iconv'] === false |
8845 | 8845 | ) { |
8846 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8846 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8847 | 8847 | } |
8848 | 8848 | |
8849 | 8849 | // |
@@ -8959,8 +8959,8 @@ discard block |
||
8959 | 8959 | } |
8960 | 8960 | |
8961 | 8961 | return \strnatcmp( |
8962 | - (string) self::strtonatfold($str1), |
|
8963 | - (string) self::strtonatfold($str2) |
|
8962 | + (string)self::strtonatfold($str1), |
|
8963 | + (string)self::strtonatfold($str2) |
|
8964 | 8964 | ); |
8965 | 8965 | } |
8966 | 8966 | |
@@ -9018,11 +9018,11 @@ discard block |
||
9018 | 9018 | } |
9019 | 9019 | |
9020 | 9020 | if ($encoding === 'UTF-8') { |
9021 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
9022 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
9021 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
9022 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
9023 | 9023 | } else { |
9024 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
9025 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
9024 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
9025 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
9026 | 9026 | } |
9027 | 9027 | |
9028 | 9028 | return self::strcmp($str1, $str2); |
@@ -9044,8 +9044,8 @@ discard block |
||
9044 | 9044 | return false; |
9045 | 9045 | } |
9046 | 9046 | |
9047 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
9048 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
9047 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
9048 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
9049 | 9049 | } |
9050 | 9050 | |
9051 | 9051 | return false; |
@@ -9078,10 +9078,10 @@ discard block |
||
9078 | 9078 | } |
9079 | 9079 | |
9080 | 9080 | // iconv and mbstring do not support integer $needle |
9081 | - if ((int) $needle === $needle) { |
|
9082 | - $needle = (string) self::chr($needle); |
|
9081 | + if ((int)$needle === $needle) { |
|
9082 | + $needle = (string)self::chr($needle); |
|
9083 | 9083 | } |
9084 | - $needle = (string) $needle; |
|
9084 | + $needle = (string)$needle; |
|
9085 | 9085 | |
9086 | 9086 | if ($needle === '') { |
9087 | 9087 | return false; |
@@ -9128,7 +9128,7 @@ discard block |
||
9128 | 9128 | && |
9129 | 9129 | self::$SUPPORT['mbstring'] === false |
9130 | 9130 | ) { |
9131 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9131 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9132 | 9132 | } |
9133 | 9133 | |
9134 | 9134 | // |
@@ -9169,7 +9169,7 @@ discard block |
||
9169 | 9169 | // fallback for ascii only |
9170 | 9170 | // |
9171 | 9171 | |
9172 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9172 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9173 | 9173 | return \strpos($haystack, $needle, $offset); |
9174 | 9174 | } |
9175 | 9175 | |
@@ -9181,7 +9181,7 @@ discard block |
||
9181 | 9181 | if ($haystack_tmp === false) { |
9182 | 9182 | $haystack_tmp = ''; |
9183 | 9183 | } |
9184 | - $haystack = (string) $haystack_tmp; |
|
9184 | + $haystack = (string)$haystack_tmp; |
|
9185 | 9185 | |
9186 | 9186 | if ($offset < 0) { |
9187 | 9187 | $offset = 0; |
@@ -9193,7 +9193,7 @@ discard block |
||
9193 | 9193 | } |
9194 | 9194 | |
9195 | 9195 | if ($pos) { |
9196 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9196 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9197 | 9197 | } |
9198 | 9198 | |
9199 | 9199 | return $offset + 0; |
@@ -9304,7 +9304,7 @@ discard block |
||
9304 | 9304 | && |
9305 | 9305 | self::$SUPPORT['mbstring'] === false |
9306 | 9306 | ) { |
9307 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9307 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9308 | 9308 | } |
9309 | 9309 | |
9310 | 9310 | // |
@@ -9316,7 +9316,7 @@ discard block |
||
9316 | 9316 | if ($needle_tmp === false) { |
9317 | 9317 | return false; |
9318 | 9318 | } |
9319 | - $needle = (string) $needle_tmp; |
|
9319 | + $needle = (string)$needle_tmp; |
|
9320 | 9320 | |
9321 | 9321 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
9322 | 9322 | if ($pos === false) { |
@@ -9338,7 +9338,7 @@ discard block |
||
9338 | 9338 | if ($needle_tmp === false) { |
9339 | 9339 | return false; |
9340 | 9340 | } |
9341 | - $needle = (string) $needle_tmp; |
|
9341 | + $needle = (string)$needle_tmp; |
|
9342 | 9342 | |
9343 | 9343 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
9344 | 9344 | if ($pos === false) { |
@@ -9374,7 +9374,7 @@ discard block |
||
9374 | 9374 | if ($encoding === 'UTF-8') { |
9375 | 9375 | if (self::$SUPPORT['intl'] === true) { |
9376 | 9376 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
9377 | - $i = (int) \grapheme_strlen($str); |
|
9377 | + $i = (int)\grapheme_strlen($str); |
|
9378 | 9378 | while ($i--) { |
9379 | 9379 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
9380 | 9380 | if ($reversed_tmp !== false) { |
@@ -9382,7 +9382,7 @@ discard block |
||
9382 | 9382 | } |
9383 | 9383 | } |
9384 | 9384 | } else { |
9385 | - $i = (int) \mb_strlen($str); |
|
9385 | + $i = (int)\mb_strlen($str); |
|
9386 | 9386 | while ($i--) { |
9387 | 9387 | $reversed_tmp = \mb_substr($str, $i, 1); |
9388 | 9388 | if ($reversed_tmp !== false) { |
@@ -9393,7 +9393,7 @@ discard block |
||
9393 | 9393 | } else { |
9394 | 9394 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9395 | 9395 | |
9396 | - $i = (int) self::strlen($str, $encoding); |
|
9396 | + $i = (int)self::strlen($str, $encoding); |
|
9397 | 9397 | while ($i--) { |
9398 | 9398 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
9399 | 9399 | if ($reversed_tmp !== false) { |
@@ -9467,7 +9467,7 @@ discard block |
||
9467 | 9467 | if ($needle_tmp === false) { |
9468 | 9468 | return false; |
9469 | 9469 | } |
9470 | - $needle = (string) $needle_tmp; |
|
9470 | + $needle = (string)$needle_tmp; |
|
9471 | 9471 | |
9472 | 9472 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
9473 | 9473 | if ($pos === false) { |
@@ -9506,10 +9506,10 @@ discard block |
||
9506 | 9506 | } |
9507 | 9507 | |
9508 | 9508 | // iconv and mbstring do not support integer $needle |
9509 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9510 | - $needle = (string) self::chr($needle); |
|
9509 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9510 | + $needle = (string)self::chr($needle); |
|
9511 | 9511 | } |
9512 | - $needle = (string) $needle; |
|
9512 | + $needle = (string)$needle; |
|
9513 | 9513 | |
9514 | 9514 | if ($needle === '') { |
9515 | 9515 | return false; |
@@ -9554,7 +9554,7 @@ discard block |
||
9554 | 9554 | && |
9555 | 9555 | self::$SUPPORT['mbstring'] === false |
9556 | 9556 | ) { |
9557 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9557 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9558 | 9558 | } |
9559 | 9559 | |
9560 | 9560 | // |
@@ -9578,7 +9578,7 @@ discard block |
||
9578 | 9578 | // fallback for ascii only |
9579 | 9579 | // |
9580 | 9580 | |
9581 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9581 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9582 | 9582 | return \strripos($haystack, $needle, $offset); |
9583 | 9583 | } |
9584 | 9584 | |
@@ -9655,10 +9655,10 @@ discard block |
||
9655 | 9655 | } |
9656 | 9656 | |
9657 | 9657 | // iconv and mbstring do not support integer $needle |
9658 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9659 | - $needle = (string) self::chr($needle); |
|
9658 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9659 | + $needle = (string)self::chr($needle); |
|
9660 | 9660 | } |
9661 | - $needle = (string) $needle; |
|
9661 | + $needle = (string)$needle; |
|
9662 | 9662 | |
9663 | 9663 | if ($needle === '') { |
9664 | 9664 | return false; |
@@ -9703,7 +9703,7 @@ discard block |
||
9703 | 9703 | && |
9704 | 9704 | self::$SUPPORT['mbstring'] === false |
9705 | 9705 | ) { |
9706 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9706 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9707 | 9707 | } |
9708 | 9708 | |
9709 | 9709 | // |
@@ -9727,7 +9727,7 @@ discard block |
||
9727 | 9727 | // fallback for ascii only |
9728 | 9728 | // |
9729 | 9729 | |
9730 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9730 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9731 | 9731 | return \strrpos($haystack, $needle, $offset); |
9732 | 9732 | } |
9733 | 9733 | |
@@ -9747,7 +9747,7 @@ discard block |
||
9747 | 9747 | if ($haystack_tmp === false) { |
9748 | 9748 | $haystack_tmp = ''; |
9749 | 9749 | } |
9750 | - $haystack = (string) $haystack_tmp; |
|
9750 | + $haystack = (string)$haystack_tmp; |
|
9751 | 9751 | } |
9752 | 9752 | |
9753 | 9753 | $pos = \strrpos($haystack, $needle); |
@@ -9761,7 +9761,7 @@ discard block |
||
9761 | 9761 | return false; |
9762 | 9762 | } |
9763 | 9763 | |
9764 | - return $offset + (int) self::strlen($str_tmp); |
|
9764 | + return $offset + (int)self::strlen($str_tmp); |
|
9765 | 9765 | } |
9766 | 9766 | |
9767 | 9767 | /** |
@@ -9823,12 +9823,12 @@ discard block |
||
9823 | 9823 | if ($offset || $length !== null) { |
9824 | 9824 | if ($encoding === 'UTF-8') { |
9825 | 9825 | if ($length === null) { |
9826 | - $str = (string) \mb_substr($str, $offset); |
|
9826 | + $str = (string)\mb_substr($str, $offset); |
|
9827 | 9827 | } else { |
9828 | - $str = (string) \mb_substr($str, $offset, $length); |
|
9828 | + $str = (string)\mb_substr($str, $offset, $length); |
|
9829 | 9829 | } |
9830 | 9830 | } else { |
9831 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
9831 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
9832 | 9832 | } |
9833 | 9833 | } |
9834 | 9834 | |
@@ -9838,7 +9838,7 @@ discard block |
||
9838 | 9838 | |
9839 | 9839 | $matches = []; |
9840 | 9840 | |
9841 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
9841 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
9842 | 9842 | } |
9843 | 9843 | |
9844 | 9844 | /** |
@@ -9907,7 +9907,7 @@ discard block |
||
9907 | 9907 | && |
9908 | 9908 | self::$SUPPORT['mbstring'] === false |
9909 | 9909 | ) { |
9910 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9910 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9911 | 9911 | } |
9912 | 9912 | |
9913 | 9913 | // |
@@ -9929,7 +9929,7 @@ discard block |
||
9929 | 9929 | // fallback for ascii only |
9930 | 9930 | // |
9931 | 9931 | |
9932 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9932 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9933 | 9933 | return \strstr($haystack, $needle, $before_needle); |
9934 | 9934 | } |
9935 | 9935 | |
@@ -9937,7 +9937,7 @@ discard block |
||
9937 | 9937 | // fallback via vanilla php |
9938 | 9938 | // |
9939 | 9939 | |
9940 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
9940 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
9941 | 9941 | |
9942 | 9942 | if (!isset($match[1])) { |
9943 | 9943 | return false; |
@@ -9947,7 +9947,7 @@ discard block |
||
9947 | 9947 | return $match[1]; |
9948 | 9948 | } |
9949 | 9949 | |
9950 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
9950 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
9951 | 9951 | } |
9952 | 9952 | |
9953 | 9953 | /** |
@@ -10065,7 +10065,7 @@ discard block |
||
10065 | 10065 | bool $try_to_keep_the_string_length = false |
10066 | 10066 | ): string { |
10067 | 10067 | // init |
10068 | - $str = (string) $str; |
|
10068 | + $str = (string)$str; |
|
10069 | 10069 | |
10070 | 10070 | if ($str === '') { |
10071 | 10071 | return ''; |
@@ -10094,19 +10094,19 @@ discard block |
||
10094 | 10094 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10095 | 10095 | } |
10096 | 10096 | |
10097 | - $language_code = $lang . '-Lower'; |
|
10097 | + $language_code = $lang.'-Lower'; |
|
10098 | 10098 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10099 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
10099 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
10100 | 10100 | |
10101 | 10101 | $language_code = 'Any-Lower'; |
10102 | 10102 | } |
10103 | 10103 | |
10104 | 10104 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10105 | 10105 | /** @noinspection UnnecessaryCastingInspection */ |
10106 | - return (string) \transliterator_transliterate($language_code, $str); |
|
10106 | + return (string)\transliterator_transliterate($language_code, $str); |
|
10107 | 10107 | } |
10108 | 10108 | |
10109 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
10109 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
10110 | 10110 | } |
10111 | 10111 | |
10112 | 10112 | // always fallback via symfony polyfill |
@@ -10135,7 +10135,7 @@ discard block |
||
10135 | 10135 | bool $try_to_keep_the_string_length = false |
10136 | 10136 | ): string { |
10137 | 10137 | // init |
10138 | - $str = (string) $str; |
|
10138 | + $str = (string)$str; |
|
10139 | 10139 | |
10140 | 10140 | if ($str === '') { |
10141 | 10141 | return ''; |
@@ -10164,19 +10164,19 @@ discard block |
||
10164 | 10164 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10165 | 10165 | } |
10166 | 10166 | |
10167 | - $language_code = $lang . '-Upper'; |
|
10167 | + $language_code = $lang.'-Upper'; |
|
10168 | 10168 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10169 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
10169 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
10170 | 10170 | |
10171 | 10171 | $language_code = 'Any-Upper'; |
10172 | 10172 | } |
10173 | 10173 | |
10174 | 10174 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10175 | 10175 | /** @noinspection UnnecessaryCastingInspection */ |
10176 | - return (string) \transliterator_transliterate($language_code, $str); |
|
10176 | + return (string)\transliterator_transliterate($language_code, $str); |
|
10177 | 10177 | } |
10178 | 10178 | |
10179 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
10179 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
10180 | 10180 | } |
10181 | 10181 | |
10182 | 10182 | // always fallback via symfony polyfill |
@@ -10221,7 +10221,7 @@ discard block |
||
10221 | 10221 | $from = \array_combine($from, $to); |
10222 | 10222 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
10223 | 10223 | if ($from === false) { |
10224 | - 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) . ')'); |
|
10224 | + 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).')'); |
|
10225 | 10225 | } |
10226 | 10226 | } |
10227 | 10227 | |
@@ -10281,9 +10281,9 @@ discard block |
||
10281 | 10281 | } |
10282 | 10282 | |
10283 | 10283 | $wide = 0; |
10284 | - $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); |
|
10284 | + $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); |
|
10285 | 10285 | |
10286 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
10286 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
10287 | 10287 | } |
10288 | 10288 | |
10289 | 10289 | /** |
@@ -10383,9 +10383,9 @@ discard block |
||
10383 | 10383 | } |
10384 | 10384 | |
10385 | 10385 | if ($length === null) { |
10386 | - $length = (int) $str_length; |
|
10386 | + $length = (int)$str_length; |
|
10387 | 10387 | } else { |
10388 | - $length = (int) $length; |
|
10388 | + $length = (int)$length; |
|
10389 | 10389 | } |
10390 | 10390 | |
10391 | 10391 | if ( |
@@ -10393,7 +10393,7 @@ discard block |
||
10393 | 10393 | && |
10394 | 10394 | self::$SUPPORT['mbstring'] === false |
10395 | 10395 | ) { |
10396 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10396 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10397 | 10397 | } |
10398 | 10398 | |
10399 | 10399 | // |
@@ -10481,16 +10481,16 @@ discard block |
||
10481 | 10481 | ) { |
10482 | 10482 | if ($encoding === 'UTF-8') { |
10483 | 10483 | if ($length === null) { |
10484 | - $str1 = (string) \mb_substr($str1, $offset); |
|
10484 | + $str1 = (string)\mb_substr($str1, $offset); |
|
10485 | 10485 | } else { |
10486 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
10486 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
10487 | 10487 | } |
10488 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
10488 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
10489 | 10489 | } else { |
10490 | 10490 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10491 | 10491 | |
10492 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
10493 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
10492 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
10493 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
10494 | 10494 | } |
10495 | 10495 | } |
10496 | 10496 | |
@@ -10552,13 +10552,13 @@ discard block |
||
10552 | 10552 | if ($length_tmp === false) { |
10553 | 10553 | return false; |
10554 | 10554 | } |
10555 | - $length = (int) $length_tmp; |
|
10555 | + $length = (int)$length_tmp; |
|
10556 | 10556 | } |
10557 | 10557 | |
10558 | 10558 | if ($encoding === 'UTF-8') { |
10559 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
10559 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
10560 | 10560 | } else { |
10561 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
10561 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
10562 | 10562 | } |
10563 | 10563 | } |
10564 | 10564 | |
@@ -10567,7 +10567,7 @@ discard block |
||
10567 | 10567 | && |
10568 | 10568 | self::$SUPPORT['mbstring'] === false |
10569 | 10569 | ) { |
10570 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10570 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10571 | 10571 | } |
10572 | 10572 | |
10573 | 10573 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10578,7 +10578,7 @@ discard block |
||
10578 | 10578 | return \mb_substr_count($haystack, $needle, $encoding); |
10579 | 10579 | } |
10580 | 10580 | |
10581 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10581 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10582 | 10582 | |
10583 | 10583 | return \count($matches); |
10584 | 10584 | } |
@@ -10625,7 +10625,7 @@ discard block |
||
10625 | 10625 | if ($length_tmp === false) { |
10626 | 10626 | return false; |
10627 | 10627 | } |
10628 | - $length = (int) $length_tmp; |
|
10628 | + $length = (int)$length_tmp; |
|
10629 | 10629 | } |
10630 | 10630 | |
10631 | 10631 | if ( |
@@ -10647,7 +10647,7 @@ discard block |
||
10647 | 10647 | if ($haystack_tmp === false) { |
10648 | 10648 | $haystack_tmp = ''; |
10649 | 10649 | } |
10650 | - $haystack = (string) $haystack_tmp; |
|
10650 | + $haystack = (string)$haystack_tmp; |
|
10651 | 10651 | } |
10652 | 10652 | |
10653 | 10653 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10686,10 +10686,10 @@ discard block |
||
10686 | 10686 | |
10687 | 10687 | if ($encoding === 'UTF-8') { |
10688 | 10688 | if ($case_sensitive) { |
10689 | - return (int) \mb_substr_count($str, $substring); |
|
10689 | + return (int)\mb_substr_count($str, $substring); |
|
10690 | 10690 | } |
10691 | 10691 | |
10692 | - return (int) \mb_substr_count( |
|
10692 | + return (int)\mb_substr_count( |
|
10693 | 10693 | \mb_strtoupper($str), |
10694 | 10694 | \mb_strtoupper($substring) |
10695 | 10695 | ); |
@@ -10698,10 +10698,10 @@ discard block |
||
10698 | 10698 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10699 | 10699 | |
10700 | 10700 | if ($case_sensitive) { |
10701 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
10701 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
10702 | 10702 | } |
10703 | 10703 | |
10704 | - return (int) \mb_substr_count( |
|
10704 | + return (int)\mb_substr_count( |
|
10705 | 10705 | self::strtocasefold($str, true, false, $encoding, null, false), |
10706 | 10706 | self::strtocasefold($substring, true, false, $encoding, null, false), |
10707 | 10707 | $encoding |
@@ -10727,7 +10727,7 @@ discard block |
||
10727 | 10727 | } |
10728 | 10728 | |
10729 | 10729 | if (self::str_istarts_with($haystack, $needle) === true) { |
10730 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10730 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10731 | 10731 | } |
10732 | 10732 | |
10733 | 10733 | return $haystack; |
@@ -10784,7 +10784,7 @@ discard block |
||
10784 | 10784 | } |
10785 | 10785 | |
10786 | 10786 | if (self::str_iends_with($haystack, $needle) === true) { |
10787 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
10787 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
10788 | 10788 | } |
10789 | 10789 | |
10790 | 10790 | return $haystack; |
@@ -10809,7 +10809,7 @@ discard block |
||
10809 | 10809 | } |
10810 | 10810 | |
10811 | 10811 | if (self::str_starts_with($haystack, $needle) === true) { |
10812 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10812 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10813 | 10813 | } |
10814 | 10814 | |
10815 | 10815 | return $haystack; |
@@ -10861,7 +10861,7 @@ discard block |
||
10861 | 10861 | if (\is_array($offset) === true) { |
10862 | 10862 | $offset = \array_slice($offset, 0, $num); |
10863 | 10863 | foreach ($offset as &$value_tmp) { |
10864 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
10864 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
10865 | 10865 | } |
10866 | 10866 | unset($value_tmp); |
10867 | 10867 | } else { |
@@ -10874,7 +10874,7 @@ discard block |
||
10874 | 10874 | } elseif (\is_array($length) === true) { |
10875 | 10875 | $length = \array_slice($length, 0, $num); |
10876 | 10876 | foreach ($length as &$value_tmp_V2) { |
10877 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
10877 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
10878 | 10878 | } |
10879 | 10879 | unset($value_tmp_V2); |
10880 | 10880 | } else { |
@@ -10894,8 +10894,8 @@ discard block |
||
10894 | 10894 | } |
10895 | 10895 | |
10896 | 10896 | // init |
10897 | - $str = (string) $str; |
|
10898 | - $replacement = (string) $replacement; |
|
10897 | + $str = (string)$str; |
|
10898 | + $replacement = (string)$replacement; |
|
10899 | 10899 | |
10900 | 10900 | if (\is_array($length) === true) { |
10901 | 10901 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -10910,16 +10910,16 @@ discard block |
||
10910 | 10910 | } |
10911 | 10911 | |
10912 | 10912 | if (self::$SUPPORT['mbstring'] === true) { |
10913 | - $string_length = (int) self::strlen($str, $encoding); |
|
10913 | + $string_length = (int)self::strlen($str, $encoding); |
|
10914 | 10914 | |
10915 | 10915 | if ($offset < 0) { |
10916 | - $offset = (int) \max(0, $string_length + $offset); |
|
10916 | + $offset = (int)\max(0, $string_length + $offset); |
|
10917 | 10917 | } elseif ($offset > $string_length) { |
10918 | 10918 | $offset = $string_length; |
10919 | 10919 | } |
10920 | 10920 | |
10921 | 10921 | if ($length !== null && $length < 0) { |
10922 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
10922 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
10923 | 10923 | } elseif ($length === null || $length > $string_length) { |
10924 | 10924 | $length = $string_length; |
10925 | 10925 | } |
@@ -10930,9 +10930,9 @@ discard block |
||
10930 | 10930 | } |
10931 | 10931 | |
10932 | 10932 | /** @noinspection AdditionOperationOnArraysInspection */ |
10933 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
10934 | - $replacement . |
|
10935 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10933 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
10934 | + $replacement. |
|
10935 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10936 | 10936 | } |
10937 | 10937 | |
10938 | 10938 | // |
@@ -10941,8 +10941,7 @@ discard block |
||
10941 | 10941 | |
10942 | 10942 | if (ASCII::is_ascii($str)) { |
10943 | 10943 | return ($length === null) ? |
10944 | - \substr_replace($str, $replacement, $offset) : |
|
10945 | - \substr_replace($str, $replacement, $offset, $length); |
|
10944 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
10946 | 10945 | } |
10947 | 10946 | |
10948 | 10947 | // |
@@ -10958,7 +10957,7 @@ discard block |
||
10958 | 10957 | // e.g.: non mbstring support + invalid chars |
10959 | 10958 | return ''; |
10960 | 10959 | } |
10961 | - $length = (int) $length_tmp; |
|
10960 | + $length = (int)$length_tmp; |
|
10962 | 10961 | } |
10963 | 10962 | |
10964 | 10963 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -10993,14 +10992,14 @@ discard block |
||
10993 | 10992 | && |
10994 | 10993 | \substr($haystack, -\strlen($needle)) === $needle |
10995 | 10994 | ) { |
10996 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
10995 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
10997 | 10996 | } |
10998 | 10997 | |
10999 | 10998 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
11000 | - return (string) self::substr( |
|
10999 | + return (string)self::substr( |
|
11001 | 11000 | $haystack, |
11002 | 11001 | 0, |
11003 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
11002 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
11004 | 11003 | $encoding |
11005 | 11004 | ); |
11006 | 11005 | } |
@@ -11030,10 +11029,10 @@ discard block |
||
11030 | 11029 | } |
11031 | 11030 | |
11032 | 11031 | if ($encoding === 'UTF-8') { |
11033 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
11032 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
11034 | 11033 | } |
11035 | 11034 | |
11036 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
11035 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
11037 | 11036 | } |
11038 | 11037 | |
11039 | 11038 | /** |
@@ -11217,7 +11216,7 @@ discard block |
||
11217 | 11216 | public static function to_boolean($str): bool |
11218 | 11217 | { |
11219 | 11218 | // init |
11220 | - $str = (string) $str; |
|
11219 | + $str = (string)$str; |
|
11221 | 11220 | |
11222 | 11221 | if ($str === '') { |
11223 | 11222 | return false; |
@@ -11245,10 +11244,10 @@ discard block |
||
11245 | 11244 | } |
11246 | 11245 | |
11247 | 11246 | if (\is_numeric($str)) { |
11248 | - return ((float) $str + 0) > 0; |
|
11247 | + return ((float)$str + 0) > 0; |
|
11249 | 11248 | } |
11250 | 11249 | |
11251 | - return (bool) \trim($str); |
|
11250 | + return (bool)\trim($str); |
|
11252 | 11251 | } |
11253 | 11252 | |
11254 | 11253 | /** |
@@ -11290,7 +11289,7 @@ discard block |
||
11290 | 11289 | return $str; |
11291 | 11290 | } |
11292 | 11291 | |
11293 | - $str = (string) $str; |
|
11292 | + $str = (string)$str; |
|
11294 | 11293 | if ($str === '') { |
11295 | 11294 | return ''; |
11296 | 11295 | } |
@@ -11338,7 +11337,7 @@ discard block |
||
11338 | 11337 | return $str; |
11339 | 11338 | } |
11340 | 11339 | |
11341 | - $str = (string) $str; |
|
11340 | + $str = (string)$str; |
|
11342 | 11341 | if ($str === '') { |
11343 | 11342 | return $str; |
11344 | 11343 | } |
@@ -11356,7 +11355,7 @@ discard block |
||
11356 | 11355 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
11357 | 11356 | |
11358 | 11357 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11359 | - $buf .= $c1 . $c2; |
|
11358 | + $buf .= $c1.$c2; |
|
11360 | 11359 | ++$i; |
11361 | 11360 | } else { // not valid UTF8 - convert it |
11362 | 11361 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11367,7 +11366,7 @@ discard block |
||
11367 | 11366 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
11368 | 11367 | |
11369 | 11368 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11370 | - $buf .= $c1 . $c2 . $c3; |
|
11369 | + $buf .= $c1.$c2.$c3; |
|
11371 | 11370 | $i += 2; |
11372 | 11371 | } else { // not valid UTF8 - convert it |
11373 | 11372 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11379,7 +11378,7 @@ discard block |
||
11379 | 11378 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
11380 | 11379 | |
11381 | 11380 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11382 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
11381 | + $buf .= $c1.$c2.$c3.$c4; |
|
11383 | 11382 | $i += 3; |
11384 | 11383 | } else { // not valid UTF8 - convert it |
11385 | 11384 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11405,13 +11404,13 @@ discard block |
||
11405 | 11404 | * |
11406 | 11405 | * @return string |
11407 | 11406 | */ |
11408 | - static function (array $matches): string { |
|
11407 | + static function(array $matches): string { |
|
11409 | 11408 | if (isset($matches[3])) { |
11410 | - $cp = (int) \hexdec($matches[3]); |
|
11409 | + $cp = (int)\hexdec($matches[3]); |
|
11411 | 11410 | } else { |
11412 | 11411 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
11413 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
11414 | - + (int) \hexdec($matches[2]) |
|
11412 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
11413 | + + (int)\hexdec($matches[2]) |
|
11415 | 11414 | + 0x10000 |
11416 | 11415 | - (0xD800 << 10) |
11417 | 11416 | - 0xDC00; |
@@ -11422,12 +11421,12 @@ discard block |
||
11422 | 11421 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
11423 | 11422 | |
11424 | 11423 | if ($cp < 0x80) { |
11425 | - return (string) self::chr($cp); |
|
11424 | + return (string)self::chr($cp); |
|
11426 | 11425 | } |
11427 | 11426 | |
11428 | 11427 | if ($cp < 0xA0) { |
11429 | 11428 | /** @noinspection UnnecessaryCastingInspection */ |
11430 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
11429 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
11431 | 11430 | } |
11432 | 11431 | |
11433 | 11432 | return self::decimal_to_chr($cp); |
@@ -11476,7 +11475,7 @@ discard block |
||
11476 | 11475 | } |
11477 | 11476 | |
11478 | 11477 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11479 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
11478 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
11480 | 11479 | } |
11481 | 11480 | |
11482 | 11481 | if ($chars) { |
@@ -11520,15 +11519,15 @@ discard block |
||
11520 | 11519 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
11521 | 11520 | |
11522 | 11521 | if ($encoding === 'UTF-8') { |
11523 | - $str_part_two = (string) \mb_substr($str, 1); |
|
11522 | + $str_part_two = (string)\mb_substr($str, 1); |
|
11524 | 11523 | |
11525 | 11524 | if ($use_mb_functions === true) { |
11526 | 11525 | $str_part_one = \mb_strtoupper( |
11527 | - (string) \mb_substr($str, 0, 1) |
|
11526 | + (string)\mb_substr($str, 0, 1) |
|
11528 | 11527 | ); |
11529 | 11528 | } else { |
11530 | 11529 | $str_part_one = self::strtoupper( |
11531 | - (string) \mb_substr($str, 0, 1), |
|
11530 | + (string)\mb_substr($str, 0, 1), |
|
11532 | 11531 | $encoding, |
11533 | 11532 | false, |
11534 | 11533 | $lang, |
@@ -11538,16 +11537,16 @@ discard block |
||
11538 | 11537 | } else { |
11539 | 11538 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11540 | 11539 | |
11541 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
11540 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
11542 | 11541 | |
11543 | 11542 | if ($use_mb_functions === true) { |
11544 | 11543 | $str_part_one = \mb_strtoupper( |
11545 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
11544 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
11546 | 11545 | $encoding |
11547 | 11546 | ); |
11548 | 11547 | } else { |
11549 | 11548 | $str_part_one = self::strtoupper( |
11550 | - (string) self::substr($str, 0, 1, $encoding), |
|
11549 | + (string)self::substr($str, 0, 1, $encoding), |
|
11551 | 11550 | $encoding, |
11552 | 11551 | false, |
11553 | 11552 | $lang, |
@@ -11556,7 +11555,7 @@ discard block |
||
11556 | 11555 | } |
11557 | 11556 | } |
11558 | 11557 | |
11559 | - return $str_part_one . $str_part_two; |
|
11558 | + return $str_part_one.$str_part_two; |
|
11560 | 11559 | } |
11561 | 11560 | |
11562 | 11561 | /** |
@@ -11611,7 +11610,7 @@ discard block |
||
11611 | 11610 | $str = self::clean($str); |
11612 | 11611 | } |
11613 | 11612 | |
11614 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
11613 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
11615 | 11614 | |
11616 | 11615 | if ( |
11617 | 11616 | $use_php_default_functions === true |
@@ -12002,7 +12001,7 @@ discard block |
||
12002 | 12001 | if ( |
12003 | 12002 | $keep_utf8_chars === true |
12004 | 12003 | && |
12005 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
12004 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
12006 | 12005 | ) { |
12007 | 12006 | return $str_backup; |
12008 | 12007 | } |
@@ -12081,17 +12080,17 @@ discard block |
||
12081 | 12080 | return ''; |
12082 | 12081 | } |
12083 | 12082 | |
12084 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
12083 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
12085 | 12084 | |
12086 | 12085 | if ( |
12087 | 12086 | !isset($matches[0]) |
12088 | 12087 | || |
12089 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
12088 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
12090 | 12089 | ) { |
12091 | 12090 | return $str; |
12092 | 12091 | } |
12093 | 12092 | |
12094 | - return \rtrim($matches[0]) . $str_add_on; |
|
12093 | + return \rtrim($matches[0]).$str_add_on; |
|
12095 | 12094 | } |
12096 | 12095 | |
12097 | 12096 | /** |
@@ -12178,7 +12177,7 @@ discard block |
||
12178 | 12177 | } |
12179 | 12178 | } |
12180 | 12179 | |
12181 | - return $str_return . \implode('', $chars); |
|
12180 | + return $str_return.\implode('', $chars); |
|
12182 | 12181 | } |
12183 | 12182 | |
12184 | 12183 | /** |
@@ -12230,7 +12229,7 @@ discard block |
||
12230 | 12229 | $final_break = ''; |
12231 | 12230 | } |
12232 | 12231 | |
12233 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
12232 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
12234 | 12233 | } |
12235 | 12234 | |
12236 | 12235 | /** |
@@ -12452,7 +12451,7 @@ discard block |
||
12452 | 12451 | /** @noinspection PhpIncludeInspection */ |
12453 | 12452 | /** @noinspection UsingInclusionReturnValueInspection */ |
12454 | 12453 | /** @psalm-suppress UnresolvableInclude */ |
12455 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
12454 | + return include __DIR__.'/data/'.$file.'.php'; |
|
12456 | 12455 | } |
12457 | 12456 | |
12458 | 12457 | /** |
@@ -12467,7 +12466,7 @@ discard block |
||
12467 | 12466 | |
12468 | 12467 | \uksort( |
12469 | 12468 | self::$EMOJI, |
12470 | - static function (string $a, string $b): int { |
|
12469 | + static function(string $a, string $b): int { |
|
12471 | 12470 | return \strlen($b) <=> \strlen($a); |
12472 | 12471 | } |
12473 | 12472 | ); |
@@ -12477,7 +12476,7 @@ discard block |
||
12477 | 12476 | |
12478 | 12477 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
12479 | 12478 | $tmp_key = \crc32($key); |
12480 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
12479 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
12481 | 12480 | } |
12482 | 12481 | |
12483 | 12482 | return true; |
@@ -12503,7 +12502,7 @@ discard block |
||
12503 | 12502 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
12504 | 12503 | return \defined('MB_OVERLOAD_STRING') |
12505 | 12504 | && |
12506 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12505 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12507 | 12506 | } |
12508 | 12507 | |
12509 | 12508 | /** |
@@ -12560,7 +12559,7 @@ discard block |
||
12560 | 12559 | { |
12561 | 12560 | static $RX_CLASS_CACHE = []; |
12562 | 12561 | |
12563 | - $cache_key = $s . $class; |
|
12562 | + $cache_key = $s.$class; |
|
12564 | 12563 | |
12565 | 12564 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
12566 | 12565 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -12572,7 +12571,7 @@ discard block |
||
12572 | 12571 | /** @noinspection AlterInForeachInspection */ |
12573 | 12572 | foreach (self::str_split($s) as &$s) { |
12574 | 12573 | if ($s === '-') { |
12575 | - $class_array[0] = '-' . $class_array[0]; |
|
12574 | + $class_array[0] = '-'.$class_array[0]; |
|
12576 | 12575 | } elseif (!isset($s[2])) { |
12577 | 12576 | $class_array[0] .= \preg_quote($s, '/'); |
12578 | 12577 | } elseif (self::strlen($s) === 1) { |
@@ -12583,13 +12582,13 @@ discard block |
||
12583 | 12582 | } |
12584 | 12583 | |
12585 | 12584 | if ($class_array[0]) { |
12586 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
12585 | + $class_array[0] = '['.$class_array[0].']'; |
|
12587 | 12586 | } |
12588 | 12587 | |
12589 | 12588 | if (\count($class_array) === 1) { |
12590 | 12589 | $return = $class_array[0]; |
12591 | 12590 | } else { |
12592 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
12591 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
12593 | 12592 | } |
12594 | 12593 | |
12595 | 12594 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -12668,7 +12667,7 @@ discard block |
||
12668 | 12667 | |
12669 | 12668 | if ($delimiter === '-') { |
12670 | 12669 | /** @noinspection AlterInForeachInspection */ |
12671 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
12670 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
12672 | 12671 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12673 | 12672 | $continue = true; |
12674 | 12673 | } |
@@ -12676,7 +12675,7 @@ discard block |
||
12676 | 12675 | } |
12677 | 12676 | |
12678 | 12677 | /** @noinspection AlterInForeachInspection */ |
12679 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
12678 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
12680 | 12679 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12681 | 12680 | $continue = true; |
12682 | 12681 | } |
@@ -12739,8 +12738,8 @@ discard block |
||
12739 | 12738 | } else { |
12740 | 12739 | /** @noinspection OffsetOperationsInspection */ |
12741 | 12740 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
12742 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
12743 | - $buf .= $cc1 . $cc2; |
|
12741 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
12742 | + $buf .= $cc1.$cc2; |
|
12744 | 12743 | } |
12745 | 12744 | |
12746 | 12745 | return $buf; |
@@ -12757,7 +12756,7 @@ discard block |
||
12757 | 12756 | { |
12758 | 12757 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
12759 | 12758 | if (\preg_match($pattern, $str)) { |
12760 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
12759 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
12761 | 12760 | } |
12762 | 12761 | |
12763 | 12762 | return $str; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | return false; |
81 | 81 | } |
82 | 82 | |
83 | - $uri = (string) $_SERVER['REQUEST_URI']; |
|
83 | + $uri = (string)$_SERVER['REQUEST_URI']; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | $uriOrig = $uri; |
@@ -97,27 +97,27 @@ discard block |
||
97 | 97 | // When not, assumes Windows-1252 and redirects to the corresponding UTF-8 encoded URL |
98 | 98 | // |
99 | 99 | |
100 | - $uri = (string) \preg_replace_callback( |
|
100 | + $uri = (string)\preg_replace_callback( |
|
101 | 101 | '/[\x80-\xFF]+/', |
102 | 102 | /** |
103 | 103 | * @param array $m |
104 | 104 | * |
105 | 105 | * @return string |
106 | 106 | */ |
107 | - static function (array $m): string { |
|
107 | + static function(array $m): string { |
|
108 | 108 | return \rawurlencode($m[0]); |
109 | 109 | }, |
110 | 110 | $uri |
111 | 111 | ); |
112 | 112 | |
113 | - $uri = (string) \preg_replace_callback( |
|
113 | + $uri = (string)\preg_replace_callback( |
|
114 | 114 | '/(?:%[89A-F][0-9A-F])+/i', |
115 | 115 | /** |
116 | 116 | * @param array $m |
117 | 117 | * |
118 | 118 | * @return string |
119 | 119 | */ |
120 | - static function (array $m): string { |
|
120 | + static function(array $m): string { |
|
121 | 121 | return \rawurlencode(UTF8::rawurldecode($m[0])); |
122 | 122 | }, |
123 | 123 | $uri |
@@ -131,19 +131,19 @@ discard block |
||
131 | 131 | \headers_sent() === false |
132 | 132 | ) { |
133 | 133 | $severProtocol = ($_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'); |
134 | - \header($severProtocol . ' 301 Moved Permanently'); |
|
134 | + \header($severProtocol.' 301 Moved Permanently'); |
|
135 | 135 | |
136 | 136 | if (\strncmp($uri, '/', 1) === 0) { |
137 | - \header('Location: /' . \ltrim($uri, '/')); |
|
137 | + \header('Location: /'.\ltrim($uri, '/')); |
|
138 | 138 | } else { |
139 | - \header('Location: ' . $uri); |
|
139 | + \header('Location: '.$uri); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | exit(); |
143 | 143 | } |
144 | 144 | |
145 | 145 | if (\strncmp($uri, '/', 1) === 0) { |
146 | - $uri = '/' . \ltrim($uri, '/'); |
|
146 | + $uri = '/'.\ltrim($uri, '/'); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | return $uri; |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $input, |
163 | 163 | int $normalization_form = \Normalizer::NFC, |
164 | 164 | string $leading_combining = '◌' |
165 | - ){ |
|
165 | + ) { |
|
166 | 166 | return UTF8::filter( |
167 | 167 | $input, |
168 | 168 | $normalization_form, |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | return false; |
187 | 187 | } |
188 | 188 | |
189 | - $length = (int) $length; |
|
189 | + $length = (int)$length; |
|
190 | 190 | |
191 | 191 | if ($length <= 0) { |
192 | 192 | return false; |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | { |
220 | 220 | static $_IS_PHP; |
221 | 221 | |
222 | - $version = (string) $version; |
|
222 | + $version = (string)$version; |
|
223 | 223 | |
224 | 224 | if (!isset($_IS_PHP[$version])) { |
225 | 225 | $_IS_PHP[$version] = \version_compare(\PHP_VERSION, $version, '>='); |