@@ -235,10 +235,10 @@ discard block |
||
235 | 235 | } |
236 | 236 | |
237 | 237 | if ($encoding === 'UTF-8') { |
238 | - return (string) \mb_substr($str, $pos, 1); |
|
238 | + return (string)\mb_substr($str, $pos, 1); |
|
239 | 239 | } |
240 | 240 | |
241 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
241 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | public static function add_bom_to_string(string $str): string |
254 | 254 | { |
255 | 255 | if (self::string_has_bom($str) === false) { |
256 | - $str = self::bom() . $str; |
|
256 | + $str = self::bom().$str; |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | return $str; |
@@ -286,8 +286,8 @@ discard block |
||
286 | 286 | $return = []; |
287 | 287 | foreach ($array as $key => &$value) { |
288 | 288 | $key = $case === \CASE_LOWER |
289 | - ? self::strtolower((string) $key, $encoding) |
|
290 | - : self::strtoupper((string) $key, $encoding); |
|
289 | + ? self::strtolower((string)$key, $encoding) |
|
290 | + : self::strtoupper((string)$key, $encoding); |
|
291 | 291 | |
292 | 292 | $return[$key] = $value; |
293 | 293 | } |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | return ''; |
322 | 322 | } |
323 | 323 | |
324 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
324 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
325 | 325 | $end_position = \mb_strpos($str, $end, $substr_index); |
326 | 326 | if ( |
327 | 327 | $end_position === false |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | return ''; |
332 | 332 | } |
333 | 333 | |
334 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
334 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | return ''; |
342 | 342 | } |
343 | 343 | |
344 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
344 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
345 | 345 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
346 | 346 | if ( |
347 | 347 | $end_position === false |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | return ''; |
352 | 352 | } |
353 | 353 | |
354 | - return (string) self::substr( |
|
354 | + return (string)self::substr( |
|
355 | 355 | $str, |
356 | 356 | $substr_index, |
357 | 357 | $end_position - $substr_index, |
@@ -419,10 +419,10 @@ discard block |
||
419 | 419 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
420 | 420 | { |
421 | 421 | if ($encoding === 'UTF-8') { |
422 | - return (string) \mb_substr($str, $index, 1); |
|
422 | + return (string)\mb_substr($str, $index, 1); |
|
423 | 423 | } |
424 | 424 | |
425 | - return (string) self::substr($str, $index, 1, $encoding); |
|
425 | + return (string)self::substr($str, $index, 1, $encoding); |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | /** |
@@ -521,10 +521,10 @@ discard block |
||
521 | 521 | && |
522 | 522 | self::$SUPPORT['mbstring'] === false |
523 | 523 | ) { |
524 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
524 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
525 | 525 | } |
526 | 526 | |
527 | - $cache_key = $code_point . $encoding; |
|
527 | + $cache_key = $code_point.$encoding; |
|
528 | 528 | if (isset($CHAR_CACHE[$cache_key]) === true) { |
529 | 529 | return $CHAR_CACHE[$cache_key]; |
530 | 530 | } |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | self::$CHR = self::getData('chr'); |
571 | 571 | } |
572 | 572 | |
573 | - $code_point = (int) $code_point; |
|
573 | + $code_point = (int)$code_point; |
|
574 | 574 | if ($code_point <= 0x7F) { |
575 | 575 | /** |
576 | 576 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -580,22 +580,22 @@ discard block |
||
580 | 580 | /** |
581 | 581 | * @psalm-suppress PossiblyNullArrayAccess |
582 | 582 | */ |
583 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
583 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
584 | 584 | self::$CHR[($code_point & 0x3F) + 0x80]; |
585 | 585 | } elseif ($code_point <= 0xFFFF) { |
586 | 586 | /** |
587 | 587 | * @psalm-suppress PossiblyNullArrayAccess |
588 | 588 | */ |
589 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
590 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
589 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
590 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
591 | 591 | self::$CHR[($code_point & 0x3F) + 0x80]; |
592 | 592 | } else { |
593 | 593 | /** |
594 | 594 | * @psalm-suppress PossiblyNullArrayAccess |
595 | 595 | */ |
596 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
597 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
598 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
596 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
597 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
598 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
599 | 599 | self::$CHR[($code_point & 0x3F) + 0x80]; |
600 | 600 | } |
601 | 601 | |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | |
644 | 644 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
645 | 645 | return \array_map( |
646 | - static function (string $data): int { |
|
646 | + static function(string $data): int { |
|
647 | 647 | // "mb_" is available if overload is used, so use it ... |
648 | 648 | return \mb_strlen($data, 'CP850'); // 8-BIT |
649 | 649 | }, |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | $char = ''; |
712 | 712 | } |
713 | 713 | |
714 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
714 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
715 | 715 | } |
716 | 716 | |
717 | 717 | /** |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
788 | 788 | /x'; |
789 | 789 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
790 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
790 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
791 | 791 | |
792 | 792 | if ($replace_diamond_question_mark === true) { |
793 | 793 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -822,7 +822,7 @@ discard block |
||
822 | 822 | public static function cleanup($str): string |
823 | 823 | { |
824 | 824 | // init |
825 | - $str = (string) $str; |
|
825 | + $str = (string)$str; |
|
826 | 826 | |
827 | 827 | if ($str === '') { |
828 | 828 | return ''; |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | { |
910 | 910 | if (self::$SUPPORT['mbstring'] === true) { |
911 | 911 | /** @noinspection PhpComposerExtensionStubsInspection */ |
912 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
912 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
913 | 913 | } |
914 | 914 | |
915 | 915 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -949,7 +949,7 @@ discard block |
||
949 | 949 | */ |
950 | 950 | public static function css_stripe_media_queries(string $str): string |
951 | 951 | { |
952 | - return (string) \preg_replace( |
|
952 | + return (string)\preg_replace( |
|
953 | 953 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
954 | 954 | '', |
955 | 955 | $str |
@@ -976,7 +976,7 @@ discard block |
||
976 | 976 | */ |
977 | 977 | public static function decimal_to_chr($int): string |
978 | 978 | { |
979 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
979 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
980 | 980 | } |
981 | 981 | |
982 | 982 | /** |
@@ -1023,16 +1023,16 @@ discard block |
||
1023 | 1023 | self::initEmojiData(); |
1024 | 1024 | |
1025 | 1025 | if ($use_reversible_string_mappings === true) { |
1026 | - return (string) \str_replace( |
|
1027 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1028 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1026 | + return (string)\str_replace( |
|
1027 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1028 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1029 | 1029 | $str |
1030 | 1030 | ); |
1031 | 1031 | } |
1032 | 1032 | |
1033 | - return (string) \str_replace( |
|
1034 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1035 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1033 | + return (string)\str_replace( |
|
1034 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1035 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1036 | 1036 | $str |
1037 | 1037 | ); |
1038 | 1038 | } |
@@ -1054,16 +1054,16 @@ discard block |
||
1054 | 1054 | self::initEmojiData(); |
1055 | 1055 | |
1056 | 1056 | if ($use_reversible_string_mappings === true) { |
1057 | - return (string) \str_replace( |
|
1058 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1059 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1057 | + return (string)\str_replace( |
|
1058 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1059 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1060 | 1060 | $str |
1061 | 1061 | ); |
1062 | 1062 | } |
1063 | 1063 | |
1064 | - return (string) \str_replace( |
|
1065 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1066 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1064 | + return (string)\str_replace( |
|
1065 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1066 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1067 | 1067 | $str |
1068 | 1068 | ); |
1069 | 1069 | } |
@@ -1117,7 +1117,7 @@ discard block |
||
1117 | 1117 | if ($to_encoding === 'JSON') { |
1118 | 1118 | $return = self::json_encode($str); |
1119 | 1119 | if ($return === false) { |
1120 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1120 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1121 | 1121 | } |
1122 | 1122 | |
1123 | 1123 | return $return; |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | && |
1205 | 1205 | self::$SUPPORT['mbstring'] === false |
1206 | 1206 | ) { |
1207 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
1207 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
1208 | 1208 | } |
1209 | 1209 | |
1210 | 1210 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1298,31 +1298,31 @@ discard block |
||
1298 | 1298 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1299 | 1299 | |
1300 | 1300 | if ($length === null) { |
1301 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
1301 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
1302 | 1302 | } |
1303 | 1303 | |
1304 | 1304 | if ($search === '') { |
1305 | 1305 | if ($encoding === 'UTF-8') { |
1306 | 1306 | if ($length > 0) { |
1307 | - $string_length = (int) \mb_strlen($str); |
|
1307 | + $string_length = (int)\mb_strlen($str); |
|
1308 | 1308 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1309 | 1309 | } else { |
1310 | 1310 | $end = 0; |
1311 | 1311 | } |
1312 | 1312 | |
1313 | - $pos = (int) \min( |
|
1313 | + $pos = (int)\min( |
|
1314 | 1314 | \mb_strpos($str, ' ', $end), |
1315 | 1315 | \mb_strpos($str, '.', $end) |
1316 | 1316 | ); |
1317 | 1317 | } else { |
1318 | 1318 | if ($length > 0) { |
1319 | - $string_length = (int) self::strlen($str, $encoding); |
|
1319 | + $string_length = (int)self::strlen($str, $encoding); |
|
1320 | 1320 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1321 | 1321 | } else { |
1322 | 1322 | $end = 0; |
1323 | 1323 | } |
1324 | 1324 | |
1325 | - $pos = (int) \min( |
|
1325 | + $pos = (int)\min( |
|
1326 | 1326 | self::strpos($str, ' ', $end, $encoding), |
1327 | 1327 | self::strpos($str, '.', $end, $encoding) |
1328 | 1328 | ); |
@@ -1339,18 +1339,18 @@ discard block |
||
1339 | 1339 | return ''; |
1340 | 1340 | } |
1341 | 1341 | |
1342 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1342 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1343 | 1343 | } |
1344 | 1344 | |
1345 | 1345 | return $str; |
1346 | 1346 | } |
1347 | 1347 | |
1348 | 1348 | if ($encoding === 'UTF-8') { |
1349 | - $word_position = (int) \mb_stripos($str, $search); |
|
1350 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1349 | + $word_position = (int)\mb_stripos($str, $search); |
|
1350 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1351 | 1351 | } else { |
1352 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
1353 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1352 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
1353 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1354 | 1354 | } |
1355 | 1355 | |
1356 | 1356 | $pos_start = 0; |
@@ -1362,12 +1362,12 @@ discard block |
||
1362 | 1362 | } |
1363 | 1363 | if ($half_text !== false) { |
1364 | 1364 | if ($encoding === 'UTF-8') { |
1365 | - $pos_start = (int) \max( |
|
1365 | + $pos_start = (int)\max( |
|
1366 | 1366 | \mb_strrpos($half_text, ' '), |
1367 | 1367 | \mb_strrpos($half_text, '.') |
1368 | 1368 | ); |
1369 | 1369 | } else { |
1370 | - $pos_start = (int) \max( |
|
1370 | + $pos_start = (int)\max( |
|
1371 | 1371 | self::strrpos($half_text, ' ', 0, $encoding), |
1372 | 1372 | self::strrpos($half_text, '.', 0, $encoding) |
1373 | 1373 | ); |
@@ -1377,19 +1377,19 @@ discard block |
||
1377 | 1377 | |
1378 | 1378 | if ($word_position && $half_side > 0) { |
1379 | 1379 | $offset = $pos_start + $length - 1; |
1380 | - $real_length = (int) self::strlen($str, $encoding); |
|
1380 | + $real_length = (int)self::strlen($str, $encoding); |
|
1381 | 1381 | |
1382 | 1382 | if ($offset > $real_length) { |
1383 | 1383 | $offset = $real_length; |
1384 | 1384 | } |
1385 | 1385 | |
1386 | 1386 | if ($encoding === 'UTF-8') { |
1387 | - $pos_end = (int) \min( |
|
1387 | + $pos_end = (int)\min( |
|
1388 | 1388 | \mb_strpos($str, ' ', $offset), |
1389 | 1389 | \mb_strpos($str, '.', $offset) |
1390 | 1390 | ) - $pos_start; |
1391 | 1391 | } else { |
1392 | - $pos_end = (int) \min( |
|
1392 | + $pos_end = (int)\min( |
|
1393 | 1393 | self::strpos($str, ' ', $offset, $encoding), |
1394 | 1394 | self::strpos($str, '.', $offset, $encoding) |
1395 | 1395 | ) - $pos_start; |
@@ -1397,12 +1397,12 @@ discard block |
||
1397 | 1397 | |
1398 | 1398 | if (!$pos_end || $pos_end <= 0) { |
1399 | 1399 | if ($encoding === 'UTF-8') { |
1400 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1400 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1401 | 1401 | } else { |
1402 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1402 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1403 | 1403 | } |
1404 | 1404 | if ($str_sub !== false) { |
1405 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
1405 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
1406 | 1406 | } else { |
1407 | 1407 | $extract = ''; |
1408 | 1408 | } |
@@ -1413,26 +1413,26 @@ discard block |
||
1413 | 1413 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
1414 | 1414 | } |
1415 | 1415 | if ($str_sub !== false) { |
1416 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1416 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1417 | 1417 | } else { |
1418 | 1418 | $extract = ''; |
1419 | 1419 | } |
1420 | 1420 | } |
1421 | 1421 | } else { |
1422 | 1422 | $offset = $length - 1; |
1423 | - $true_length = (int) self::strlen($str, $encoding); |
|
1423 | + $true_length = (int)self::strlen($str, $encoding); |
|
1424 | 1424 | |
1425 | 1425 | if ($offset > $true_length) { |
1426 | 1426 | $offset = $true_length; |
1427 | 1427 | } |
1428 | 1428 | |
1429 | 1429 | if ($encoding === 'UTF-8') { |
1430 | - $pos_end = (int) \min( |
|
1430 | + $pos_end = (int)\min( |
|
1431 | 1431 | \mb_strpos($str, ' ', $offset), |
1432 | 1432 | \mb_strpos($str, '.', $offset) |
1433 | 1433 | ); |
1434 | 1434 | } else { |
1435 | - $pos_end = (int) \min( |
|
1435 | + $pos_end = (int)\min( |
|
1436 | 1436 | self::strpos($str, ' ', $offset, $encoding), |
1437 | 1437 | self::strpos($str, '.', $offset, $encoding) |
1438 | 1438 | ); |
@@ -1445,7 +1445,7 @@ discard block |
||
1445 | 1445 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
1446 | 1446 | } |
1447 | 1447 | if ($str_sub !== false) { |
1448 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1448 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1449 | 1449 | } else { |
1450 | 1450 | $extract = ''; |
1451 | 1451 | } |
@@ -1568,7 +1568,7 @@ discard block |
||
1568 | 1568 | { |
1569 | 1569 | $file_content = \file_get_contents($file_path); |
1570 | 1570 | if ($file_content === false) { |
1571 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1571 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1572 | 1572 | } |
1573 | 1573 | |
1574 | 1574 | return self::string_has_bom($file_content); |
@@ -1634,7 +1634,7 @@ discard block |
||
1634 | 1634 | ) { |
1635 | 1635 | // Prevent leading combining chars |
1636 | 1636 | // for NFC-safe concatenations. |
1637 | - $var = $leading_combining . $var; |
|
1637 | + $var = $leading_combining.$var; |
|
1638 | 1638 | } |
1639 | 1639 | } |
1640 | 1640 | |
@@ -1885,10 +1885,10 @@ discard block |
||
1885 | 1885 | } |
1886 | 1886 | |
1887 | 1887 | if ($encoding === 'UTF-8') { |
1888 | - return (string) \mb_substr($str, 0, $n); |
|
1888 | + return (string)\mb_substr($str, 0, $n); |
|
1889 | 1889 | } |
1890 | 1890 | |
1891 | - return (string) self::substr($str, 0, $n, $encoding); |
|
1891 | + return (string)self::substr($str, 0, $n, $encoding); |
|
1892 | 1892 | } |
1893 | 1893 | |
1894 | 1894 | /** |
@@ -1901,7 +1901,7 @@ discard block |
||
1901 | 1901 | */ |
1902 | 1902 | public static function fits_inside(string $str, int $box_size): bool |
1903 | 1903 | { |
1904 | - return (int) self::strlen($str) <= $box_size; |
|
1904 | + return (int)self::strlen($str) <= $box_size; |
|
1905 | 1905 | } |
1906 | 1906 | |
1907 | 1907 | /** |
@@ -1963,7 +1963,7 @@ discard block |
||
1963 | 1963 | return $str; |
1964 | 1964 | } |
1965 | 1965 | |
1966 | - $str = (string) $str; |
|
1966 | + $str = (string)$str; |
|
1967 | 1967 | $last = ''; |
1968 | 1968 | while ($last !== $str) { |
1969 | 1969 | $last = $str; |
@@ -2157,7 +2157,7 @@ discard block |
||
2157 | 2157 | return $fallback; |
2158 | 2158 | } |
2159 | 2159 | /** @noinspection OffsetOperationsInspection */ |
2160 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2160 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2161 | 2161 | |
2162 | 2162 | // DEBUG |
2163 | 2163 | //var_dump($type_code); |
@@ -2215,7 +2215,7 @@ discard block |
||
2215 | 2215 | // |
2216 | 2216 | |
2217 | 2217 | if ($encoding === 'UTF-8') { |
2218 | - $max_length = (int) \mb_strlen($possible_chars); |
|
2218 | + $max_length = (int)\mb_strlen($possible_chars); |
|
2219 | 2219 | if ($max_length === 0) { |
2220 | 2220 | return ''; |
2221 | 2221 | } |
@@ -2236,7 +2236,7 @@ discard block |
||
2236 | 2236 | } else { |
2237 | 2237 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2238 | 2238 | |
2239 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
2239 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
2240 | 2240 | if ($max_length === 0) { |
2241 | 2241 | return ''; |
2242 | 2242 | } |
@@ -2267,16 +2267,16 @@ discard block |
||
2267 | 2267 | */ |
2268 | 2268 | public static function get_unique_string($entropy_extra = '', bool $use_md5 = true): string |
2269 | 2269 | { |
2270 | - $unique_helper = \random_int(0, \mt_getrandmax()) . |
|
2271 | - \session_id() . |
|
2272 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2273 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2270 | + $unique_helper = \random_int(0, \mt_getrandmax()). |
|
2271 | + \session_id(). |
|
2272 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2273 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2274 | 2274 | $entropy_extra; |
2275 | 2275 | |
2276 | 2276 | $unique_string = \uniqid($unique_helper, true); |
2277 | 2277 | |
2278 | 2278 | if ($use_md5) { |
2279 | - $unique_string = \md5($unique_string . $unique_helper); |
|
2279 | + $unique_string = \md5($unique_string.$unique_helper); |
|
2280 | 2280 | } |
2281 | 2281 | |
2282 | 2282 | return $unique_string; |
@@ -2355,7 +2355,7 @@ discard block |
||
2355 | 2355 | public static function hex_to_int($hexdec) |
2356 | 2356 | { |
2357 | 2357 | // init |
2358 | - $hexdec = (string) $hexdec; |
|
2358 | + $hexdec = (string)$hexdec; |
|
2359 | 2359 | |
2360 | 2360 | if ($hexdec === '') { |
2361 | 2361 | return false; |
@@ -2448,7 +2448,7 @@ discard block |
||
2448 | 2448 | return \implode( |
2449 | 2449 | '', |
2450 | 2450 | \array_map( |
2451 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2451 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2452 | 2452 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
2453 | 2453 | }, |
2454 | 2454 | self::str_split($str) |
@@ -2555,7 +2555,7 @@ discard block |
||
2555 | 2555 | && |
2556 | 2556 | self::$SUPPORT['mbstring'] === false |
2557 | 2557 | ) { |
2558 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2558 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2559 | 2559 | } |
2560 | 2560 | |
2561 | 2561 | do { |
@@ -2587,7 +2587,7 @@ discard block |
||
2587 | 2587 | if (\strpos($str, '&') !== false) { |
2588 | 2588 | if (\strpos($str, '&#') !== false) { |
2589 | 2589 | // decode also numeric & UTF16 two byte entities |
2590 | - $str = (string) \preg_replace( |
|
2590 | + $str = (string)\preg_replace( |
|
2591 | 2591 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
2592 | 2592 | '$1;', |
2593 | 2593 | $str |
@@ -2633,7 +2633,7 @@ discard block |
||
2633 | 2633 | */ |
2634 | 2634 | public static function html_stripe_empty_tags(string $str): string |
2635 | 2635 | { |
2636 | - return (string) \preg_replace( |
|
2636 | + return (string)\preg_replace( |
|
2637 | 2637 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
2638 | 2638 | '', |
2639 | 2639 | $str |
@@ -2943,9 +2943,9 @@ discard block |
||
2943 | 2943 | { |
2944 | 2944 | $hex = \dechex($int); |
2945 | 2945 | |
2946 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
2946 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
2947 | 2947 | |
2948 | - return $prefix . $hex . ''; |
|
2948 | + return $prefix.$hex.''; |
|
2949 | 2949 | } |
2950 | 2950 | |
2951 | 2951 | /** |
@@ -3203,7 +3203,7 @@ discard block |
||
3203 | 3203 | */ |
3204 | 3204 | public static function is_binary($input, bool $strict = false): bool |
3205 | 3205 | { |
3206 | - $input = (string) $input; |
|
3206 | + $input = (string)$input; |
|
3207 | 3207 | if ($input === '') { |
3208 | 3208 | return false; |
3209 | 3209 | } |
@@ -3466,7 +3466,7 @@ discard block |
||
3466 | 3466 | public static function is_utf16($str, $check_if_string_is_binary = true) |
3467 | 3467 | { |
3468 | 3468 | // init |
3469 | - $str = (string) $str; |
|
3469 | + $str = (string)$str; |
|
3470 | 3470 | $str_chars = []; |
3471 | 3471 | |
3472 | 3472 | if ( |
@@ -3544,7 +3544,7 @@ discard block |
||
3544 | 3544 | public static function is_utf32($str, $check_if_string_is_binary = true) |
3545 | 3545 | { |
3546 | 3546 | // init |
3547 | - $str = (string) $str; |
|
3547 | + $str = (string)$str; |
|
3548 | 3548 | $str_chars = []; |
3549 | 3549 | |
3550 | 3550 | if ( |
@@ -3628,7 +3628,7 @@ discard block |
||
3628 | 3628 | return true; |
3629 | 3629 | } |
3630 | 3630 | |
3631 | - return self::is_utf8_string((string) $str, $strict); |
|
3631 | + return self::is_utf8_string((string)$str, $strict); |
|
3632 | 3632 | } |
3633 | 3633 | |
3634 | 3634 | /** |
@@ -3768,15 +3768,15 @@ discard block |
||
3768 | 3768 | $use_mb_functions = ($lang === null && $try_to_keep_the_string_length === false); |
3769 | 3769 | |
3770 | 3770 | if ($encoding === 'UTF-8') { |
3771 | - $str_part_two = (string) \mb_substr($str, 1); |
|
3771 | + $str_part_two = (string)\mb_substr($str, 1); |
|
3772 | 3772 | |
3773 | 3773 | if ($use_mb_functions === true) { |
3774 | 3774 | $str_part_one = \mb_strtolower( |
3775 | - (string) \mb_substr($str, 0, 1) |
|
3775 | + (string)\mb_substr($str, 0, 1) |
|
3776 | 3776 | ); |
3777 | 3777 | } else { |
3778 | 3778 | $str_part_one = self::strtolower( |
3779 | - (string) \mb_substr($str, 0, 1), |
|
3779 | + (string)\mb_substr($str, 0, 1), |
|
3780 | 3780 | $encoding, |
3781 | 3781 | false, |
3782 | 3782 | $lang, |
@@ -3786,10 +3786,10 @@ discard block |
||
3786 | 3786 | } else { |
3787 | 3787 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
3788 | 3788 | |
3789 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
3789 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
3790 | 3790 | |
3791 | 3791 | $str_part_one = self::strtolower( |
3792 | - (string) self::substr($str, 0, 1, $encoding), |
|
3792 | + (string)self::substr($str, 0, 1, $encoding), |
|
3793 | 3793 | $encoding, |
3794 | 3794 | false, |
3795 | 3795 | $lang, |
@@ -3797,7 +3797,7 @@ discard block |
||
3797 | 3797 | ); |
3798 | 3798 | } |
3799 | 3799 | |
3800 | - return $str_part_one . $str_part_two; |
|
3800 | + return $str_part_one.$str_part_two; |
|
3801 | 3801 | } |
3802 | 3802 | |
3803 | 3803 | /** |
@@ -3931,7 +3931,7 @@ discard block |
||
3931 | 3931 | } |
3932 | 3932 | |
3933 | 3933 | /** @noinspection PhpComposerExtensionStubsInspection */ |
3934 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
3934 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
3935 | 3935 | } |
3936 | 3936 | |
3937 | 3937 | if ($chars) { |
@@ -3979,7 +3979,7 @@ discard block |
||
3979 | 3979 | { |
3980 | 3980 | $bytes = self::chr_size_list($str); |
3981 | 3981 | if ($bytes !== []) { |
3982 | - return (int) \max($bytes); |
|
3982 | + return (int)\max($bytes); |
|
3983 | 3983 | } |
3984 | 3984 | |
3985 | 3985 | return 0; |
@@ -4048,7 +4048,7 @@ discard block |
||
4048 | 4048 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4049 | 4049 | |
4050 | 4050 | // init |
4051 | - $encoding = (string) $encoding; |
|
4051 | + $encoding = (string)$encoding; |
|
4052 | 4052 | |
4053 | 4053 | if (!$encoding) { |
4054 | 4054 | return $fallback; |
@@ -4102,7 +4102,7 @@ discard block |
||
4102 | 4102 | |
4103 | 4103 | $encoding_original = $encoding; |
4104 | 4104 | $encoding = \strtoupper($encoding); |
4105 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4105 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4106 | 4106 | |
4107 | 4107 | $equivalences = [ |
4108 | 4108 | 'ISO8859' => 'ISO-8859-1', |
@@ -4242,13 +4242,13 @@ discard block |
||
4242 | 4242 | static $CHAR_CACHE = []; |
4243 | 4243 | |
4244 | 4244 | // init |
4245 | - $chr = (string) $chr; |
|
4245 | + $chr = (string)$chr; |
|
4246 | 4246 | |
4247 | 4247 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
4248 | 4248 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4249 | 4249 | } |
4250 | 4250 | |
4251 | - $cache_key = $chr . $encoding; |
|
4251 | + $cache_key = $chr.$encoding; |
|
4252 | 4252 | if (isset($CHAR_CACHE[$cache_key]) === true) { |
4253 | 4253 | return $CHAR_CACHE[$cache_key]; |
4254 | 4254 | } |
@@ -4283,7 +4283,7 @@ discard block |
||
4283 | 4283 | // |
4284 | 4284 | |
4285 | 4285 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
4286 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
4286 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
4287 | 4287 | /** @noinspection OffsetOperationsInspection */ |
4288 | 4288 | $code = $chr ? $chr[1] : 0; |
4289 | 4289 | |
@@ -4291,21 +4291,21 @@ discard block |
||
4291 | 4291 | if ($code >= 0xF0 && isset($chr[4])) { |
4292 | 4292 | /** @noinspection UnnecessaryCastingInspection */ |
4293 | 4293 | /** @noinspection OffsetOperationsInspection */ |
4294 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4294 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4295 | 4295 | } |
4296 | 4296 | |
4297 | 4297 | /** @noinspection OffsetOperationsInspection */ |
4298 | 4298 | if ($code >= 0xE0 && isset($chr[3])) { |
4299 | 4299 | /** @noinspection UnnecessaryCastingInspection */ |
4300 | 4300 | /** @noinspection OffsetOperationsInspection */ |
4301 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4301 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4302 | 4302 | } |
4303 | 4303 | |
4304 | 4304 | /** @noinspection OffsetOperationsInspection */ |
4305 | 4305 | if ($code >= 0xC0 && isset($chr[2])) { |
4306 | 4306 | /** @noinspection UnnecessaryCastingInspection */ |
4307 | 4307 | /** @noinspection OffsetOperationsInspection */ |
4308 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4308 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4309 | 4309 | } |
4310 | 4310 | |
4311 | 4311 | return $CHAR_CACHE[$cache_key] = $code; |
@@ -4354,7 +4354,7 @@ discard block |
||
4354 | 4354 | public static function pcre_utf8_support(): bool |
4355 | 4355 | { |
4356 | 4356 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4357 | - return (bool) @\preg_match('//u', ''); |
|
4357 | + return (bool)@\preg_match('//u', ''); |
|
4358 | 4358 | } |
4359 | 4359 | |
4360 | 4360 | /** |
@@ -4386,11 +4386,11 @@ discard block |
||
4386 | 4386 | |
4387 | 4387 | if ($step !== 1) { |
4388 | 4388 | if (!\is_numeric($step)) { |
4389 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
4389 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
4390 | 4390 | } |
4391 | 4391 | |
4392 | 4392 | if ($step <= 0) { |
4393 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
4393 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
4394 | 4394 | } |
4395 | 4395 | } |
4396 | 4396 | |
@@ -4402,14 +4402,14 @@ discard block |
||
4402 | 4402 | $is_xdigit = false; |
4403 | 4403 | |
4404 | 4404 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4405 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
4405 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
4406 | 4406 | $is_digit = true; |
4407 | - $start = (int) $var1; |
|
4407 | + $start = (int)$var1; |
|
4408 | 4408 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
4409 | 4409 | $is_xdigit = true; |
4410 | - $start = (int) self::hex_to_int($var1); |
|
4410 | + $start = (int)self::hex_to_int($var1); |
|
4411 | 4411 | } elseif (!$use_ctype && \is_numeric($var1)) { |
4412 | - $start = (int) $var1; |
|
4412 | + $start = (int)$var1; |
|
4413 | 4413 | } else { |
4414 | 4414 | $start = self::ord($var1); |
4415 | 4415 | } |
@@ -4419,11 +4419,11 @@ discard block |
||
4419 | 4419 | } |
4420 | 4420 | |
4421 | 4421 | if ($is_digit) { |
4422 | - $end = (int) $var2; |
|
4422 | + $end = (int)$var2; |
|
4423 | 4423 | } elseif ($is_xdigit) { |
4424 | - $end = (int) self::hex_to_int($var2); |
|
4424 | + $end = (int)self::hex_to_int($var2); |
|
4425 | 4425 | } elseif (!$use_ctype && \is_numeric($var2)) { |
4426 | - $end = (int) $var2; |
|
4426 | + $end = (int)$var2; |
|
4427 | 4427 | } else { |
4428 | 4428 | $end = self::ord($var2); |
4429 | 4429 | } |
@@ -4434,7 +4434,7 @@ discard block |
||
4434 | 4434 | |
4435 | 4435 | $array = []; |
4436 | 4436 | foreach (\range($start, $end, $step) as $i) { |
4437 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
4437 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
4438 | 4438 | } |
4439 | 4439 | |
4440 | 4440 | return $array; |
@@ -4525,8 +4525,8 @@ discard block |
||
4525 | 4525 | $delimiter = '/'; |
4526 | 4526 | } |
4527 | 4527 | |
4528 | - return (string) \preg_replace( |
|
4529 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4528 | + return (string)\preg_replace( |
|
4529 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4530 | 4530 | $replacement, |
4531 | 4531 | $str |
4532 | 4532 | ); |
@@ -4569,9 +4569,9 @@ discard block |
||
4569 | 4569 | return ''; |
4570 | 4570 | } |
4571 | 4571 | |
4572 | - $str_length -= (int) $bom_byte_length; |
|
4572 | + $str_length -= (int)$bom_byte_length; |
|
4573 | 4573 | |
4574 | - $str = (string) $str_tmp; |
|
4574 | + $str = (string)$str_tmp; |
|
4575 | 4575 | } |
4576 | 4576 | } |
4577 | 4577 | |
@@ -4595,7 +4595,7 @@ discard block |
||
4595 | 4595 | if (\is_array($what) === true) { |
4596 | 4596 | /** @noinspection ForeachSourceInspection */ |
4597 | 4597 | foreach ($what as $item) { |
4598 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
4598 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
4599 | 4599 | } |
4600 | 4600 | } |
4601 | 4601 | |
@@ -4627,7 +4627,7 @@ discard block |
||
4627 | 4627 | */ |
4628 | 4628 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
4629 | 4629 | { |
4630 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4630 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4631 | 4631 | } |
4632 | 4632 | |
4633 | 4633 | /** |
@@ -4671,17 +4671,17 @@ discard block |
||
4671 | 4671 | ): string { |
4672 | 4672 | if ($substring && \strpos($str, $substring) === 0) { |
4673 | 4673 | if ($encoding === 'UTF-8') { |
4674 | - return (string) \mb_substr( |
|
4674 | + return (string)\mb_substr( |
|
4675 | 4675 | $str, |
4676 | - (int) \mb_strlen($substring) |
|
4676 | + (int)\mb_strlen($substring) |
|
4677 | 4677 | ); |
4678 | 4678 | } |
4679 | 4679 | |
4680 | 4680 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4681 | 4681 | |
4682 | - return (string) self::substr( |
|
4682 | + return (string)self::substr( |
|
4683 | 4683 | $str, |
4684 | - (int) self::strlen($substring, $encoding), |
|
4684 | + (int)self::strlen($substring, $encoding), |
|
4685 | 4685 | null, |
4686 | 4686 | $encoding |
4687 | 4687 | ); |
@@ -4706,19 +4706,19 @@ discard block |
||
4706 | 4706 | ): string { |
4707 | 4707 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
4708 | 4708 | if ($encoding === 'UTF-8') { |
4709 | - return (string) \mb_substr( |
|
4709 | + return (string)\mb_substr( |
|
4710 | 4710 | $str, |
4711 | 4711 | 0, |
4712 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
4712 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
4713 | 4713 | ); |
4714 | 4714 | } |
4715 | 4715 | |
4716 | 4716 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4717 | 4717 | |
4718 | - return (string) self::substr( |
|
4718 | + return (string)self::substr( |
|
4719 | 4719 | $str, |
4720 | 4720 | 0, |
4721 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
4721 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
4722 | 4722 | $encoding |
4723 | 4723 | ); |
4724 | 4724 | } |
@@ -4805,7 +4805,7 @@ discard block |
||
4805 | 4805 | $save = \mb_substitute_character(); |
4806 | 4806 | \mb_substitute_character($replacement_char_helper); |
4807 | 4807 | // the polyfill maybe return false, so cast to string |
4808 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4808 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4809 | 4809 | \mb_substitute_character($save); |
4810 | 4810 | } |
4811 | 4811 | |
@@ -4846,7 +4846,7 @@ discard block |
||
4846 | 4846 | } |
4847 | 4847 | |
4848 | 4848 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4849 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4849 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4850 | 4850 | } |
4851 | 4851 | |
4852 | 4852 | if ($chars) { |
@@ -4868,7 +4868,7 @@ discard block |
||
4868 | 4868 | { |
4869 | 4869 | echo '<pre>'; |
4870 | 4870 | foreach (self::$SUPPORT as $key => &$value) { |
4871 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
4871 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
4872 | 4872 | } |
4873 | 4873 | unset($value); |
4874 | 4874 | echo '</pre>'; |
@@ -4900,7 +4900,7 @@ discard block |
||
4900 | 4900 | return $char; |
4901 | 4901 | } |
4902 | 4902 | |
4903 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
4903 | + return '&#'.self::ord($char, $encoding).';'; |
|
4904 | 4904 | } |
4905 | 4905 | |
4906 | 4906 | /** |
@@ -4993,18 +4993,18 @@ discard block |
||
4993 | 4993 | $lang, |
4994 | 4994 | $try_to_keep_the_string_length |
4995 | 4995 | ); |
4996 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
4996 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
4997 | 4997 | |
4998 | 4998 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
4999 | 4999 | |
5000 | - $str = (string) \preg_replace_callback( |
|
5000 | + $str = (string)\preg_replace_callback( |
|
5001 | 5001 | '/[-_\\s]+(.)?/u', |
5002 | 5002 | /** |
5003 | 5003 | * @param array $match |
5004 | 5004 | * |
5005 | 5005 | * @return string |
5006 | 5006 | */ |
5007 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5007 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5008 | 5008 | if (isset($match[1])) { |
5009 | 5009 | if ($use_mb_functions === true) { |
5010 | 5010 | if ($encoding === 'UTF-8') { |
@@ -5022,14 +5022,14 @@ discard block |
||
5022 | 5022 | $str |
5023 | 5023 | ); |
5024 | 5024 | |
5025 | - return (string) \preg_replace_callback( |
|
5025 | + return (string)\preg_replace_callback( |
|
5026 | 5026 | '/[\\p{N}]+(.)?/u', |
5027 | 5027 | /** |
5028 | 5028 | * @param array $match |
5029 | 5029 | * |
5030 | 5030 | * @return string |
5031 | 5031 | */ |
5032 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5032 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5033 | 5033 | if ($use_mb_functions === true) { |
5034 | 5034 | if ($encoding === 'UTF-8') { |
5035 | 5035 | return \mb_strtoupper($match[0]); |
@@ -5207,7 +5207,7 @@ discard block |
||
5207 | 5207 | ): string { |
5208 | 5208 | if (self::$SUPPORT['mbstring'] === true) { |
5209 | 5209 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5210 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5210 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5211 | 5211 | |
5212 | 5212 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
5213 | 5213 | if ($use_mb_functions === true && $encoding === 'UTF-8') { |
@@ -5217,10 +5217,10 @@ discard block |
||
5217 | 5217 | } |
5218 | 5218 | |
5219 | 5219 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5220 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5220 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5221 | 5221 | } |
5222 | 5222 | |
5223 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5223 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5224 | 5224 | |
5225 | 5225 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
5226 | 5226 | if ($use_mb_functions === true && $encoding === 'UTF-8') { |
@@ -5229,7 +5229,7 @@ discard block |
||
5229 | 5229 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
5230 | 5230 | } |
5231 | 5231 | |
5232 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5232 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5233 | 5233 | } |
5234 | 5234 | |
5235 | 5235 | /** |
@@ -5244,7 +5244,7 @@ discard block |
||
5244 | 5244 | public static function str_detect_encoding($str) |
5245 | 5245 | { |
5246 | 5246 | // init |
5247 | - $str = (string) $str; |
|
5247 | + $str = (string)$str; |
|
5248 | 5248 | |
5249 | 5249 | // |
5250 | 5250 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5346,7 +5346,7 @@ discard block |
||
5346 | 5346 | foreach (self::$ENCODINGS as $encoding_tmp) { |
5347 | 5347 | // INFO: //IGNORE but still throw notice |
5348 | 5348 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5349 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
5349 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
5350 | 5350 | return $encoding_tmp; |
5351 | 5351 | } |
5352 | 5352 | } |
@@ -5435,7 +5435,7 @@ discard block |
||
5435 | 5435 | return $str; |
5436 | 5436 | } |
5437 | 5437 | |
5438 | - return $substring . $str; |
|
5438 | + return $substring.$str; |
|
5439 | 5439 | } |
5440 | 5440 | |
5441 | 5441 | /** |
@@ -5704,27 +5704,27 @@ discard block |
||
5704 | 5704 | string $encoding = 'UTF-8' |
5705 | 5705 | ): string { |
5706 | 5706 | if ($encoding === 'UTF-8') { |
5707 | - $len = (int) \mb_strlen($str); |
|
5707 | + $len = (int)\mb_strlen($str); |
|
5708 | 5708 | if ($index > $len) { |
5709 | 5709 | return $str; |
5710 | 5710 | } |
5711 | 5711 | |
5712 | 5712 | /** @noinspection UnnecessaryCastingInspection */ |
5713 | - return (string) \mb_substr($str, 0, $index) . |
|
5714 | - $substring . |
|
5715 | - (string) \mb_substr($str, $index, $len); |
|
5713 | + return (string)\mb_substr($str, 0, $index). |
|
5714 | + $substring. |
|
5715 | + (string)\mb_substr($str, $index, $len); |
|
5716 | 5716 | } |
5717 | 5717 | |
5718 | 5718 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5719 | 5719 | |
5720 | - $len = (int) self::strlen($str, $encoding); |
|
5720 | + $len = (int)self::strlen($str, $encoding); |
|
5721 | 5721 | if ($index > $len) { |
5722 | 5722 | return $str; |
5723 | 5723 | } |
5724 | 5724 | |
5725 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
5726 | - $substring . |
|
5727 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5725 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
5726 | + $substring. |
|
5727 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
5728 | 5728 | } |
5729 | 5729 | |
5730 | 5730 | /** |
@@ -5754,15 +5754,15 @@ discard block |
||
5754 | 5754 | */ |
5755 | 5755 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
5756 | 5756 | { |
5757 | - $search = (array) $search; |
|
5757 | + $search = (array)$search; |
|
5758 | 5758 | |
5759 | 5759 | /** @noinspection AlterInForeachInspection */ |
5760 | 5760 | foreach ($search as &$s) { |
5761 | - $s = (string) $s; |
|
5761 | + $s = (string)$s; |
|
5762 | 5762 | if ($s === '') { |
5763 | 5763 | $s = '/^(?<=.)$/'; |
5764 | 5764 | } else { |
5765 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5765 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5766 | 5766 | } |
5767 | 5767 | } |
5768 | 5768 | |
@@ -5794,11 +5794,11 @@ discard block |
||
5794 | 5794 | } |
5795 | 5795 | |
5796 | 5796 | if ($search === '') { |
5797 | - return $str . $replacement; |
|
5797 | + return $str.$replacement; |
|
5798 | 5798 | } |
5799 | 5799 | |
5800 | 5800 | if (\stripos($str, $search) === 0) { |
5801 | - return $replacement . \substr($str, \strlen($search)); |
|
5801 | + return $replacement.\substr($str, \strlen($search)); |
|
5802 | 5802 | } |
5803 | 5803 | |
5804 | 5804 | return $str; |
@@ -5826,11 +5826,11 @@ discard block |
||
5826 | 5826 | } |
5827 | 5827 | |
5828 | 5828 | if ($search === '') { |
5829 | - return $str . $replacement; |
|
5829 | + return $str.$replacement; |
|
5830 | 5830 | } |
5831 | 5831 | |
5832 | 5832 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
5833 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
5833 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
5834 | 5834 | } |
5835 | 5835 | |
5836 | 5836 | return $str; |
@@ -5910,15 +5910,15 @@ discard block |
||
5910 | 5910 | } |
5911 | 5911 | |
5912 | 5912 | if ($encoding === 'UTF-8') { |
5913 | - return (string) \mb_substr( |
|
5913 | + return (string)\mb_substr( |
|
5914 | 5914 | $str, |
5915 | - $offset + (int) \mb_strlen($separator) |
|
5915 | + $offset + (int)\mb_strlen($separator) |
|
5916 | 5916 | ); |
5917 | 5917 | } |
5918 | 5918 | |
5919 | - return (string) self::substr( |
|
5919 | + return (string)self::substr( |
|
5920 | 5920 | $str, |
5921 | - $offset + (int) self::strlen($separator, $encoding), |
|
5921 | + $offset + (int)self::strlen($separator, $encoding), |
|
5922 | 5922 | null, |
5923 | 5923 | $encoding |
5924 | 5924 | ); |
@@ -5948,15 +5948,15 @@ discard block |
||
5948 | 5948 | } |
5949 | 5949 | |
5950 | 5950 | if ($encoding === 'UTF-8') { |
5951 | - return (string) \mb_substr( |
|
5951 | + return (string)\mb_substr( |
|
5952 | 5952 | $str, |
5953 | - $offset + (int) self::strlen($separator) |
|
5953 | + $offset + (int)self::strlen($separator) |
|
5954 | 5954 | ); |
5955 | 5955 | } |
5956 | 5956 | |
5957 | - return (string) self::substr( |
|
5957 | + return (string)self::substr( |
|
5958 | 5958 | $str, |
5959 | - $offset + (int) self::strlen($separator, $encoding), |
|
5959 | + $offset + (int)self::strlen($separator, $encoding), |
|
5960 | 5960 | null, |
5961 | 5961 | $encoding |
5962 | 5962 | ); |
@@ -5986,10 +5986,10 @@ discard block |
||
5986 | 5986 | } |
5987 | 5987 | |
5988 | 5988 | if ($encoding === 'UTF-8') { |
5989 | - return (string) \mb_substr($str, 0, $offset); |
|
5989 | + return (string)\mb_substr($str, 0, $offset); |
|
5990 | 5990 | } |
5991 | 5991 | |
5992 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
5992 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
5993 | 5993 | } |
5994 | 5994 | |
5995 | 5995 | /** |
@@ -6016,7 +6016,7 @@ discard block |
||
6016 | 6016 | return ''; |
6017 | 6017 | } |
6018 | 6018 | |
6019 | - return (string) \mb_substr($str, 0, $offset); |
|
6019 | + return (string)\mb_substr($str, 0, $offset); |
|
6020 | 6020 | } |
6021 | 6021 | |
6022 | 6022 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6024,7 +6024,7 @@ discard block |
||
6024 | 6024 | return ''; |
6025 | 6025 | } |
6026 | 6026 | |
6027 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6027 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6028 | 6028 | } |
6029 | 6029 | |
6030 | 6030 | /** |
@@ -6120,12 +6120,12 @@ discard block |
||
6120 | 6120 | } |
6121 | 6121 | |
6122 | 6122 | if ($encoding === 'UTF-8') { |
6123 | - return (string) \mb_substr($str, -$n); |
|
6123 | + return (string)\mb_substr($str, -$n); |
|
6124 | 6124 | } |
6125 | 6125 | |
6126 | 6126 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6127 | 6127 | |
6128 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6128 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6129 | 6129 | } |
6130 | 6130 | |
6131 | 6131 | /** |
@@ -6149,21 +6149,21 @@ discard block |
||
6149 | 6149 | } |
6150 | 6150 | |
6151 | 6151 | if ($encoding === 'UTF-8') { |
6152 | - if ((int) \mb_strlen($str) <= $length) { |
|
6152 | + if ((int)\mb_strlen($str) <= $length) { |
|
6153 | 6153 | return $str; |
6154 | 6154 | } |
6155 | 6155 | |
6156 | 6156 | /** @noinspection UnnecessaryCastingInspection */ |
6157 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
6157 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
6158 | 6158 | } |
6159 | 6159 | |
6160 | 6160 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6161 | 6161 | |
6162 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6162 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6163 | 6163 | return $str; |
6164 | 6164 | } |
6165 | 6165 | |
6166 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
6166 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
6167 | 6167 | } |
6168 | 6168 | |
6169 | 6169 | /** |
@@ -6188,12 +6188,12 @@ discard block |
||
6188 | 6188 | |
6189 | 6189 | if ($encoding === 'UTF-8') { |
6190 | 6190 | /** @noinspection UnnecessaryCastingInspection */ |
6191 | - if ((int) \mb_strlen($str) <= $length) { |
|
6191 | + if ((int)\mb_strlen($str) <= $length) { |
|
6192 | 6192 | return $str; |
6193 | 6193 | } |
6194 | 6194 | |
6195 | 6195 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6196 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6196 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6197 | 6197 | } |
6198 | 6198 | |
6199 | 6199 | $str = \mb_substr($str, 0, $length); |
@@ -6203,22 +6203,22 @@ discard block |
||
6203 | 6203 | $new_str = \implode(' ', $array); |
6204 | 6204 | |
6205 | 6205 | if ($new_str === '') { |
6206 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6206 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6207 | 6207 | } |
6208 | 6208 | } else { |
6209 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6209 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6210 | 6210 | return $str; |
6211 | 6211 | } |
6212 | 6212 | |
6213 | 6213 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6214 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6214 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6215 | 6215 | } |
6216 | 6216 | |
6217 | 6217 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6218 | 6218 | $str = self::substr($str, 0, $length, $encoding); |
6219 | 6219 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6220 | 6220 | if ($str === false) { |
6221 | - return '' . $str_add_on; |
|
6221 | + return ''.$str_add_on; |
|
6222 | 6222 | } |
6223 | 6223 | |
6224 | 6224 | $array = \explode(' ', $str); |
@@ -6226,11 +6226,11 @@ discard block |
||
6226 | 6226 | $new_str = \implode(' ', $array); |
6227 | 6227 | |
6228 | 6228 | if ($new_str === '') { |
6229 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6229 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6230 | 6230 | } |
6231 | 6231 | } |
6232 | 6232 | |
6233 | - return $new_str . $str_add_on; |
|
6233 | + return $new_str.$str_add_on; |
|
6234 | 6234 | } |
6235 | 6235 | |
6236 | 6236 | /** |
@@ -6251,7 +6251,7 @@ discard block |
||
6251 | 6251 | $longest_common_prefix = ''; |
6252 | 6252 | |
6253 | 6253 | if ($encoding === 'UTF-8') { |
6254 | - $max_length = (int) \min( |
|
6254 | + $max_length = (int)\min( |
|
6255 | 6255 | \mb_strlen($str1), |
6256 | 6256 | \mb_strlen($str2) |
6257 | 6257 | ); |
@@ -6272,7 +6272,7 @@ discard block |
||
6272 | 6272 | } else { |
6273 | 6273 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6274 | 6274 | |
6275 | - $max_length = (int) \min( |
|
6275 | + $max_length = (int)\min( |
|
6276 | 6276 | self::strlen($str1, $encoding), |
6277 | 6277 | self::strlen($str2, $encoding) |
6278 | 6278 | ); |
@@ -6318,13 +6318,13 @@ discard block |
||
6318 | 6318 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6319 | 6319 | |
6320 | 6320 | if ($encoding === 'UTF-8') { |
6321 | - $str_length = (int) \mb_strlen($str1); |
|
6322 | - $other_length = (int) \mb_strlen($str2); |
|
6321 | + $str_length = (int)\mb_strlen($str1); |
|
6322 | + $other_length = (int)\mb_strlen($str2); |
|
6323 | 6323 | } else { |
6324 | 6324 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6325 | 6325 | |
6326 | - $str_length = (int) self::strlen($str1, $encoding); |
|
6327 | - $other_length = (int) self::strlen($str2, $encoding); |
|
6326 | + $str_length = (int)self::strlen($str1, $encoding); |
|
6327 | + $other_length = (int)self::strlen($str2, $encoding); |
|
6328 | 6328 | } |
6329 | 6329 | |
6330 | 6330 | // Return if either string is empty |
@@ -6377,10 +6377,10 @@ discard block |
||
6377 | 6377 | } |
6378 | 6378 | |
6379 | 6379 | if ($encoding === 'UTF-8') { |
6380 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
6380 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
6381 | 6381 | } |
6382 | 6382 | |
6383 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
6383 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
6384 | 6384 | } |
6385 | 6385 | |
6386 | 6386 | /** |
@@ -6402,7 +6402,7 @@ discard block |
||
6402 | 6402 | } |
6403 | 6403 | |
6404 | 6404 | if ($encoding === 'UTF-8') { |
6405 | - $max_length = (int) \min( |
|
6405 | + $max_length = (int)\min( |
|
6406 | 6406 | \mb_strlen($str1, $encoding), |
6407 | 6407 | \mb_strlen($str2, $encoding) |
6408 | 6408 | ); |
@@ -6416,7 +6416,7 @@ discard block |
||
6416 | 6416 | && |
6417 | 6417 | $char === \mb_substr($str2, -$i, 1) |
6418 | 6418 | ) { |
6419 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
6419 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
6420 | 6420 | } else { |
6421 | 6421 | break; |
6422 | 6422 | } |
@@ -6424,7 +6424,7 @@ discard block |
||
6424 | 6424 | } else { |
6425 | 6425 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6426 | 6426 | |
6427 | - $max_length = (int) \min( |
|
6427 | + $max_length = (int)\min( |
|
6428 | 6428 | self::strlen($str1, $encoding), |
6429 | 6429 | self::strlen($str2, $encoding) |
6430 | 6430 | ); |
@@ -6438,7 +6438,7 @@ discard block |
||
6438 | 6438 | && |
6439 | 6439 | $char === self::substr($str2, -$i, 1, $encoding) |
6440 | 6440 | ) { |
6441 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
6441 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
6442 | 6442 | } else { |
6443 | 6443 | break; |
6444 | 6444 | } |
@@ -6458,7 +6458,7 @@ discard block |
||
6458 | 6458 | */ |
6459 | 6459 | public static function str_matches_pattern(string $str, string $pattern): bool |
6460 | 6460 | { |
6461 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
6461 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
6462 | 6462 | } |
6463 | 6463 | |
6464 | 6464 | /** |
@@ -6475,7 +6475,7 @@ discard block |
||
6475 | 6475 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
6476 | 6476 | { |
6477 | 6477 | // init |
6478 | - $length = (int) self::strlen($str, $encoding); |
|
6478 | + $length = (int)self::strlen($str, $encoding); |
|
6479 | 6479 | |
6480 | 6480 | if ($offset >= 0) { |
6481 | 6481 | return $length > $offset; |
@@ -6501,7 +6501,7 @@ discard block |
||
6501 | 6501 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
6502 | 6502 | { |
6503 | 6503 | // init |
6504 | - $length = (int) self::strlen($str); |
|
6504 | + $length = (int)self::strlen($str); |
|
6505 | 6505 | |
6506 | 6506 | if ( |
6507 | 6507 | ($index >= 0 && $length <= $index) |
@@ -6540,7 +6540,7 @@ discard block |
||
6540 | 6540 | return $str; |
6541 | 6541 | } |
6542 | 6542 | |
6543 | - if ($pad_type !== (int) $pad_type) { |
|
6543 | + if ($pad_type !== (int)$pad_type) { |
|
6544 | 6544 | if ($pad_type === 'left') { |
6545 | 6545 | $pad_type = \STR_PAD_LEFT; |
6546 | 6546 | } elseif ($pad_type === 'right') { |
@@ -6549,23 +6549,23 @@ discard block |
||
6549 | 6549 | $pad_type = \STR_PAD_BOTH; |
6550 | 6550 | } else { |
6551 | 6551 | throw new \InvalidArgumentException( |
6552 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
6552 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
6553 | 6553 | ); |
6554 | 6554 | } |
6555 | 6555 | } |
6556 | 6556 | |
6557 | 6557 | if ($encoding === 'UTF-8') { |
6558 | - $str_length = (int) \mb_strlen($str); |
|
6558 | + $str_length = (int)\mb_strlen($str); |
|
6559 | 6559 | |
6560 | 6560 | if ($pad_length >= $str_length) { |
6561 | 6561 | switch ($pad_type) { |
6562 | 6562 | case \STR_PAD_LEFT: |
6563 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6563 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6564 | 6564 | |
6565 | 6565 | $diff = ($pad_length - $str_length); |
6566 | 6566 | |
6567 | - $pre = (string) \mb_substr( |
|
6568 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6567 | + $pre = (string)\mb_substr( |
|
6568 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6569 | 6569 | 0, |
6570 | 6570 | $diff |
6571 | 6571 | ); |
@@ -6576,16 +6576,16 @@ discard block |
||
6576 | 6576 | case \STR_PAD_BOTH: |
6577 | 6577 | $diff = ($pad_length - $str_length); |
6578 | 6578 | |
6579 | - $ps_length_left = (int) \floor($diff / 2); |
|
6579 | + $ps_length_left = (int)\floor($diff / 2); |
|
6580 | 6580 | |
6581 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6581 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6582 | 6582 | |
6583 | - $pre = (string) \mb_substr( |
|
6583 | + $pre = (string)\mb_substr( |
|
6584 | 6584 | \str_repeat($pad_string, $ps_length_left), |
6585 | 6585 | 0, |
6586 | 6586 | $ps_length_left |
6587 | 6587 | ); |
6588 | - $post = (string) \mb_substr( |
|
6588 | + $post = (string)\mb_substr( |
|
6589 | 6589 | \str_repeat($pad_string, $ps_length_right), |
6590 | 6590 | 0, |
6591 | 6591 | $ps_length_right |
@@ -6595,19 +6595,19 @@ discard block |
||
6595 | 6595 | |
6596 | 6596 | case \STR_PAD_RIGHT: |
6597 | 6597 | default: |
6598 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6598 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6599 | 6599 | |
6600 | 6600 | $diff = ($pad_length - $str_length); |
6601 | 6601 | |
6602 | - $post = (string) \mb_substr( |
|
6603 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6602 | + $post = (string)\mb_substr( |
|
6603 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6604 | 6604 | 0, |
6605 | 6605 | $diff |
6606 | 6606 | ); |
6607 | 6607 | $pre = ''; |
6608 | 6608 | } |
6609 | 6609 | |
6610 | - return $pre . $str . $post; |
|
6610 | + return $pre.$str.$post; |
|
6611 | 6611 | } |
6612 | 6612 | |
6613 | 6613 | return $str; |
@@ -6615,17 +6615,17 @@ discard block |
||
6615 | 6615 | |
6616 | 6616 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6617 | 6617 | |
6618 | - $str_length = (int) self::strlen($str, $encoding); |
|
6618 | + $str_length = (int)self::strlen($str, $encoding); |
|
6619 | 6619 | |
6620 | 6620 | if ($pad_length >= $str_length) { |
6621 | 6621 | switch ($pad_type) { |
6622 | 6622 | case \STR_PAD_LEFT: |
6623 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6623 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6624 | 6624 | |
6625 | 6625 | $diff = ($pad_length - $str_length); |
6626 | 6626 | |
6627 | - $pre = (string) self::substr( |
|
6628 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6627 | + $pre = (string)self::substr( |
|
6628 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6629 | 6629 | 0, |
6630 | 6630 | $diff, |
6631 | 6631 | $encoding |
@@ -6637,17 +6637,17 @@ discard block |
||
6637 | 6637 | case \STR_PAD_BOTH: |
6638 | 6638 | $diff = ($pad_length - $str_length); |
6639 | 6639 | |
6640 | - $ps_length_left = (int) \floor($diff / 2); |
|
6640 | + $ps_length_left = (int)\floor($diff / 2); |
|
6641 | 6641 | |
6642 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6642 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6643 | 6643 | |
6644 | - $pre = (string) self::substr( |
|
6644 | + $pre = (string)self::substr( |
|
6645 | 6645 | \str_repeat($pad_string, $ps_length_left), |
6646 | 6646 | 0, |
6647 | 6647 | $ps_length_left, |
6648 | 6648 | $encoding |
6649 | 6649 | ); |
6650 | - $post = (string) self::substr( |
|
6650 | + $post = (string)self::substr( |
|
6651 | 6651 | \str_repeat($pad_string, $ps_length_right), |
6652 | 6652 | 0, |
6653 | 6653 | $ps_length_right, |
@@ -6658,12 +6658,12 @@ discard block |
||
6658 | 6658 | |
6659 | 6659 | case \STR_PAD_RIGHT: |
6660 | 6660 | default: |
6661 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6661 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6662 | 6662 | |
6663 | 6663 | $diff = ($pad_length - $str_length); |
6664 | 6664 | |
6665 | - $post = (string) self::substr( |
|
6666 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6665 | + $post = (string)self::substr( |
|
6666 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6667 | 6667 | 0, |
6668 | 6668 | $diff, |
6669 | 6669 | $encoding |
@@ -6671,7 +6671,7 @@ discard block |
||
6671 | 6671 | $pre = ''; |
6672 | 6672 | } |
6673 | 6673 | |
6674 | - return $pre . $str . $post; |
|
6674 | + return $pre.$str.$post; |
|
6675 | 6675 | } |
6676 | 6676 | |
6677 | 6677 | return $str; |
@@ -6855,11 +6855,11 @@ discard block |
||
6855 | 6855 | } |
6856 | 6856 | |
6857 | 6857 | if ($search === '') { |
6858 | - return $str . $replacement; |
|
6858 | + return $str.$replacement; |
|
6859 | 6859 | } |
6860 | 6860 | |
6861 | 6861 | if (\strpos($str, $search) === 0) { |
6862 | - return $replacement . \substr($str, \strlen($search)); |
|
6862 | + return $replacement.\substr($str, \strlen($search)); |
|
6863 | 6863 | } |
6864 | 6864 | |
6865 | 6865 | return $str; |
@@ -6890,11 +6890,11 @@ discard block |
||
6890 | 6890 | } |
6891 | 6891 | |
6892 | 6892 | if ($search === '') { |
6893 | - return $str . $replacement; |
|
6893 | + return $str.$replacement; |
|
6894 | 6894 | } |
6895 | 6895 | |
6896 | 6896 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6897 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6897 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6898 | 6898 | } |
6899 | 6899 | |
6900 | 6900 | return $str; |
@@ -6926,7 +6926,7 @@ discard block |
||
6926 | 6926 | $subject, |
6927 | 6927 | $replace, |
6928 | 6928 | $pos, |
6929 | - (int) self::strlen($search) |
|
6929 | + (int)self::strlen($search) |
|
6930 | 6930 | ); |
6931 | 6931 | } |
6932 | 6932 | |
@@ -6958,7 +6958,7 @@ discard block |
||
6958 | 6958 | $subject, |
6959 | 6959 | $replace, |
6960 | 6960 | $pos, |
6961 | - (int) self::strlen($search) |
|
6961 | + (int)self::strlen($search) |
|
6962 | 6962 | ); |
6963 | 6963 | } |
6964 | 6964 | |
@@ -6978,7 +6978,7 @@ discard block |
||
6978 | 6978 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
6979 | 6979 | { |
6980 | 6980 | if ($encoding === 'UTF-8') { |
6981 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
6981 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
6982 | 6982 | /** @noinspection NonSecureShuffleUsageInspection */ |
6983 | 6983 | \shuffle($indexes); |
6984 | 6984 | |
@@ -6994,7 +6994,7 @@ discard block |
||
6994 | 6994 | } else { |
6995 | 6995 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6996 | 6996 | |
6997 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
6997 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
6998 | 6998 | /** @noinspection NonSecureShuffleUsageInspection */ |
6999 | 6999 | \shuffle($indexes); |
7000 | 7000 | |
@@ -7035,11 +7035,11 @@ discard block |
||
7035 | 7035 | ) { |
7036 | 7036 | if ($encoding === 'UTF-8') { |
7037 | 7037 | if ($end === null) { |
7038 | - $length = (int) \mb_strlen($str); |
|
7038 | + $length = (int)\mb_strlen($str); |
|
7039 | 7039 | } elseif ($end >= 0 && $end <= $start) { |
7040 | 7040 | return ''; |
7041 | 7041 | } elseif ($end < 0) { |
7042 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7042 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7043 | 7043 | } else { |
7044 | 7044 | $length = $end - $start; |
7045 | 7045 | } |
@@ -7050,11 +7050,11 @@ discard block |
||
7050 | 7050 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7051 | 7051 | |
7052 | 7052 | if ($end === null) { |
7053 | - $length = (int) self::strlen($str, $encoding); |
|
7053 | + $length = (int)self::strlen($str, $encoding); |
|
7054 | 7054 | } elseif ($end >= 0 && $end <= $start) { |
7055 | 7055 | return ''; |
7056 | 7056 | } elseif ($end < 0) { |
7057 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7057 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7058 | 7058 | } else { |
7059 | 7059 | $length = $end - $start; |
7060 | 7060 | } |
@@ -7086,35 +7086,35 @@ discard block |
||
7086 | 7086 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7087 | 7087 | } |
7088 | 7088 | |
7089 | - $str = (string) \preg_replace_callback( |
|
7089 | + $str = (string)\preg_replace_callback( |
|
7090 | 7090 | '/([\\p{N}|\\p{Lu}])/u', |
7091 | 7091 | /** |
7092 | 7092 | * @param string[] $matches |
7093 | 7093 | * |
7094 | 7094 | * @return string |
7095 | 7095 | */ |
7096 | - static function (array $matches) use ($encoding): string { |
|
7096 | + static function(array $matches) use ($encoding): string { |
|
7097 | 7097 | $match = $matches[1]; |
7098 | - $match_int = (int) $match; |
|
7098 | + $match_int = (int)$match; |
|
7099 | 7099 | |
7100 | - if ((string) $match_int === $match) { |
|
7101 | - return '_' . $match . '_'; |
|
7100 | + if ((string)$match_int === $match) { |
|
7101 | + return '_'.$match.'_'; |
|
7102 | 7102 | } |
7103 | 7103 | |
7104 | 7104 | if ($encoding === 'UTF-8') { |
7105 | - return '_' . \mb_strtolower($match); |
|
7105 | + return '_'.\mb_strtolower($match); |
|
7106 | 7106 | } |
7107 | 7107 | |
7108 | - return '_' . self::strtolower($match, $encoding); |
|
7108 | + return '_'.self::strtolower($match, $encoding); |
|
7109 | 7109 | }, |
7110 | 7110 | $str |
7111 | 7111 | ); |
7112 | 7112 | |
7113 | - $str = (string) \preg_replace( |
|
7113 | + $str = (string)\preg_replace( |
|
7114 | 7114 | [ |
7115 | - '/\\s+/u', // convert spaces to "_" |
|
7115 | + '/\\s+/u', // convert spaces to "_" |
|
7116 | 7116 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
7117 | - '/_+/', // remove double "_" |
|
7117 | + '/_+/', // remove double "_" |
|
7118 | 7118 | ], |
7119 | 7119 | [ |
7120 | 7120 | '_', |
@@ -7190,7 +7190,7 @@ discard block |
||
7190 | 7190 | } |
7191 | 7191 | |
7192 | 7192 | // init |
7193 | - $str = (string) $str; |
|
7193 | + $str = (string)$str; |
|
7194 | 7194 | |
7195 | 7195 | if ($str === '') { |
7196 | 7196 | return []; |
@@ -7237,7 +7237,7 @@ discard block |
||
7237 | 7237 | ($str[$i] & "\xE0") === "\xC0" |
7238 | 7238 | ) { |
7239 | 7239 | if (($str[$i + 1] & "\xC0") === "\x80") { |
7240 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
7240 | + $ret[] = $str[$i].$str[$i + 1]; |
|
7241 | 7241 | |
7242 | 7242 | ++$i; |
7243 | 7243 | } |
@@ -7251,7 +7251,7 @@ discard block |
||
7251 | 7251 | && |
7252 | 7252 | ($str[$i + 2] & "\xC0") === "\x80" |
7253 | 7253 | ) { |
7254 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
7254 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
7255 | 7255 | |
7256 | 7256 | $i += 2; |
7257 | 7257 | } |
@@ -7267,7 +7267,7 @@ discard block |
||
7267 | 7267 | && |
7268 | 7268 | ($str[$i + 3] & "\xC0") === "\x80" |
7269 | 7269 | ) { |
7270 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
7270 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
7271 | 7271 | |
7272 | 7272 | $i += 3; |
7273 | 7273 | } |
@@ -7279,7 +7279,7 @@ discard block |
||
7279 | 7279 | $ret = \array_chunk($ret, $length); |
7280 | 7280 | |
7281 | 7281 | return \array_map( |
7282 | - static function (array &$item): string { |
|
7282 | + static function(array &$item): string { |
|
7283 | 7283 | return \implode('', $item); |
7284 | 7284 | }, |
7285 | 7285 | $ret |
@@ -7342,7 +7342,7 @@ discard block |
||
7342 | 7342 | $limit = -1; |
7343 | 7343 | } |
7344 | 7344 | |
7345 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7345 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7346 | 7346 | |
7347 | 7347 | if ($array === false) { |
7348 | 7348 | return []; |
@@ -7426,9 +7426,9 @@ discard block |
||
7426 | 7426 | return ''; |
7427 | 7427 | } |
7428 | 7428 | |
7429 | - return (string) \mb_substr( |
|
7429 | + return (string)\mb_substr( |
|
7430 | 7430 | $str, |
7431 | - $offset + (int) \mb_strlen($separator) |
|
7431 | + $offset + (int)\mb_strlen($separator) |
|
7432 | 7432 | ); |
7433 | 7433 | } |
7434 | 7434 | |
@@ -7437,9 +7437,9 @@ discard block |
||
7437 | 7437 | return ''; |
7438 | 7438 | } |
7439 | 7439 | |
7440 | - return (string) \mb_substr( |
|
7440 | + return (string)\mb_substr( |
|
7441 | 7441 | $str, |
7442 | - $offset + (int) self::strlen($separator, $encoding), |
|
7442 | + $offset + (int)self::strlen($separator, $encoding), |
|
7443 | 7443 | null, |
7444 | 7444 | $encoding |
7445 | 7445 | ); |
@@ -7466,9 +7466,9 @@ discard block |
||
7466 | 7466 | return ''; |
7467 | 7467 | } |
7468 | 7468 | |
7469 | - return (string) \mb_substr( |
|
7469 | + return (string)\mb_substr( |
|
7470 | 7470 | $str, |
7471 | - $offset + (int) \mb_strlen($separator) |
|
7471 | + $offset + (int)\mb_strlen($separator) |
|
7472 | 7472 | ); |
7473 | 7473 | } |
7474 | 7474 | |
@@ -7477,9 +7477,9 @@ discard block |
||
7477 | 7477 | return ''; |
7478 | 7478 | } |
7479 | 7479 | |
7480 | - return (string) self::substr( |
|
7480 | + return (string)self::substr( |
|
7481 | 7481 | $str, |
7482 | - $offset + (int) self::strlen($separator, $encoding), |
|
7482 | + $offset + (int)self::strlen($separator, $encoding), |
|
7483 | 7483 | null, |
7484 | 7484 | $encoding |
7485 | 7485 | ); |
@@ -7509,7 +7509,7 @@ discard block |
||
7509 | 7509 | return ''; |
7510 | 7510 | } |
7511 | 7511 | |
7512 | - return (string) \mb_substr( |
|
7512 | + return (string)\mb_substr( |
|
7513 | 7513 | $str, |
7514 | 7514 | 0, |
7515 | 7515 | $offset |
@@ -7521,7 +7521,7 @@ discard block |
||
7521 | 7521 | return ''; |
7522 | 7522 | } |
7523 | 7523 | |
7524 | - return (string) self::substr( |
|
7524 | + return (string)self::substr( |
|
7525 | 7525 | $str, |
7526 | 7526 | 0, |
7527 | 7527 | $offset, |
@@ -7550,7 +7550,7 @@ discard block |
||
7550 | 7550 | return ''; |
7551 | 7551 | } |
7552 | 7552 | |
7553 | - return (string) \mb_substr( |
|
7553 | + return (string)\mb_substr( |
|
7554 | 7554 | $str, |
7555 | 7555 | 0, |
7556 | 7556 | $offset |
@@ -7564,7 +7564,7 @@ discard block |
||
7564 | 7564 | |
7565 | 7565 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7566 | 7566 | |
7567 | - return (string) self::substr( |
|
7567 | + return (string)self::substr( |
|
7568 | 7568 | $str, |
7569 | 7569 | 0, |
7570 | 7570 | $offset, |
@@ -7672,7 +7672,7 @@ discard block |
||
7672 | 7672 | */ |
7673 | 7673 | public static function str_surround(string $str, string $substring): string |
7674 | 7674 | { |
7675 | - return $substring . $str . $substring; |
|
7675 | + return $substring.$str.$substring; |
|
7676 | 7676 | } |
7677 | 7677 | |
7678 | 7678 | /** |
@@ -7729,9 +7729,9 @@ discard block |
||
7729 | 7729 | $word_define_chars = ''; |
7730 | 7730 | } |
7731 | 7731 | |
7732 | - $str = (string) \preg_replace_callback( |
|
7733 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
7734 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
7732 | + $str = (string)\preg_replace_callback( |
|
7733 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
7734 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
7735 | 7735 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
7736 | 7736 | return $match[0]; |
7737 | 7737 | } |
@@ -7822,16 +7822,16 @@ discard block |
||
7822 | 7822 | } |
7823 | 7823 | |
7824 | 7824 | // the main substitutions |
7825 | - $str = (string) \preg_replace_callback( |
|
7825 | + $str = (string)\preg_replace_callback( |
|
7826 | 7826 | '~\\b (_*) (?: # 1. Leading underscore and |
7827 | 7827 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
7828 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
7828 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
7829 | 7829 | | |
7830 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
7830 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
7831 | 7831 | | |
7832 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
7832 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
7833 | 7833 | | |
7834 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
7834 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
7835 | 7835 | ) (_*) \\b # 6. With trailing underscore |
7836 | 7836 | ~ux', |
7837 | 7837 | /** |
@@ -7839,7 +7839,7 @@ discard block |
||
7839 | 7839 | * |
7840 | 7840 | * @return string |
7841 | 7841 | */ |
7842 | - static function (array $matches) use ($encoding): string { |
|
7842 | + static function(array $matches) use ($encoding): string { |
|
7843 | 7843 | // preserve leading underscore |
7844 | 7844 | $str = $matches[1]; |
7845 | 7845 | if ($matches[2]) { |
@@ -7864,26 +7864,26 @@ discard block |
||
7864 | 7864 | ); |
7865 | 7865 | |
7866 | 7866 | // Exceptions for small words: capitalize at start of title... |
7867 | - $str = (string) \preg_replace_callback( |
|
7867 | + $str = (string)\preg_replace_callback( |
|
7868 | 7868 | '~( \\A [[:punct:]]* # start of title... |
7869 | 7869 | | [:.;?!][ ]+ # or of subsentence... |
7870 | 7870 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
7871 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
7871 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
7872 | 7872 | ~uxi', |
7873 | 7873 | /** |
7874 | 7874 | * @param string[] $matches |
7875 | 7875 | * |
7876 | 7876 | * @return string |
7877 | 7877 | */ |
7878 | - static function (array $matches) use ($encoding): string { |
|
7879 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
7878 | + static function(array $matches) use ($encoding): string { |
|
7879 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
7880 | 7880 | }, |
7881 | 7881 | $str |
7882 | 7882 | ); |
7883 | 7883 | |
7884 | 7884 | // ...and end of title |
7885 | - $str = (string) \preg_replace_callback( |
|
7886 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
7885 | + $str = (string)\preg_replace_callback( |
|
7886 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
7887 | 7887 | (?= [[:punct:]]* \Z # ...at the end of the title... |
7888 | 7888 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
7889 | 7889 | ~uxi', |
@@ -7892,7 +7892,7 @@ discard block |
||
7892 | 7892 | * |
7893 | 7893 | * @return string |
7894 | 7894 | */ |
7895 | - static function (array $matches) use ($encoding): string { |
|
7895 | + static function(array $matches) use ($encoding): string { |
|
7896 | 7896 | return static::ucfirst($matches[1], $encoding); |
7897 | 7897 | }, |
7898 | 7898 | $str |
@@ -7900,10 +7900,10 @@ discard block |
||
7900 | 7900 | |
7901 | 7901 | // Exceptions for small words in hyphenated compound words. |
7902 | 7902 | // e.g. "in-flight" -> In-Flight |
7903 | - $str = (string) \preg_replace_callback( |
|
7903 | + $str = (string)\preg_replace_callback( |
|
7904 | 7904 | '~\\b |
7905 | 7905 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
7906 | - ( ' . $small_words_rx . ' ) |
|
7906 | + ( ' . $small_words_rx.' ) |
|
7907 | 7907 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
7908 | 7908 | ~uxi', |
7909 | 7909 | /** |
@@ -7911,18 +7911,18 @@ discard block |
||
7911 | 7911 | * |
7912 | 7912 | * @return string |
7913 | 7913 | */ |
7914 | - static function (array $matches) use ($encoding): string { |
|
7914 | + static function(array $matches) use ($encoding): string { |
|
7915 | 7915 | return static::ucfirst($matches[1], $encoding); |
7916 | 7916 | }, |
7917 | 7917 | $str |
7918 | 7918 | ); |
7919 | 7919 | |
7920 | 7920 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
7921 | - $str = (string) \preg_replace_callback( |
|
7921 | + $str = (string)\preg_replace_callback( |
|
7922 | 7922 | '~\\b |
7923 | 7923 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
7924 | 7924 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
7925 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
7925 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
7926 | 7926 | (?! - ) # Negative lookahead for another - |
7927 | 7927 | ~uxi', |
7928 | 7928 | /** |
@@ -7930,8 +7930,8 @@ discard block |
||
7930 | 7930 | * |
7931 | 7931 | * @return string |
7932 | 7932 | */ |
7933 | - static function (array $matches) use ($encoding): string { |
|
7934 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
7933 | + static function(array $matches) use ($encoding): string { |
|
7934 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
7935 | 7935 | }, |
7936 | 7936 | $str |
7937 | 7937 | ); |
@@ -8040,7 +8040,7 @@ discard block |
||
8040 | 8040 | ); |
8041 | 8041 | |
8042 | 8042 | foreach ($tmp_return as &$item) { |
8043 | - $item = (string) $item; |
|
8043 | + $item = (string)$item; |
|
8044 | 8044 | } |
8045 | 8045 | |
8046 | 8046 | return $tmp_return; |
@@ -8089,39 +8089,39 @@ discard block |
||
8089 | 8089 | } |
8090 | 8090 | |
8091 | 8091 | if ($encoding === 'UTF-8') { |
8092 | - if ($length >= (int) \mb_strlen($str)) { |
|
8092 | + if ($length >= (int)\mb_strlen($str)) { |
|
8093 | 8093 | return $str; |
8094 | 8094 | } |
8095 | 8095 | |
8096 | 8096 | if ($substring !== '') { |
8097 | - $length -= (int) \mb_strlen($substring); |
|
8097 | + $length -= (int)\mb_strlen($substring); |
|
8098 | 8098 | |
8099 | 8099 | /** @noinspection UnnecessaryCastingInspection */ |
8100 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
8100 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
8101 | 8101 | } |
8102 | 8102 | |
8103 | 8103 | /** @noinspection UnnecessaryCastingInspection */ |
8104 | - return (string) \mb_substr($str, 0, $length); |
|
8104 | + return (string)\mb_substr($str, 0, $length); |
|
8105 | 8105 | } |
8106 | 8106 | |
8107 | 8107 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8108 | 8108 | |
8109 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8109 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8110 | 8110 | return $str; |
8111 | 8111 | } |
8112 | 8112 | |
8113 | 8113 | if ($substring !== '') { |
8114 | - $length -= (int) self::strlen($substring, $encoding); |
|
8114 | + $length -= (int)self::strlen($substring, $encoding); |
|
8115 | 8115 | } |
8116 | 8116 | |
8117 | 8117 | return ( |
8118 | - (string) self::substr( |
|
8118 | + (string)self::substr( |
|
8119 | 8119 | $str, |
8120 | 8120 | 0, |
8121 | 8121 | $length, |
8122 | 8122 | $encoding |
8123 | 8123 | ) |
8124 | - ) . $substring; |
|
8124 | + ).$substring; |
|
8125 | 8125 | } |
8126 | 8126 | |
8127 | 8127 | /** |
@@ -8151,12 +8151,12 @@ discard block |
||
8151 | 8151 | } |
8152 | 8152 | |
8153 | 8153 | if ($encoding === 'UTF-8') { |
8154 | - if ($length >= (int) \mb_strlen($str)) { |
|
8154 | + if ($length >= (int)\mb_strlen($str)) { |
|
8155 | 8155 | return $str; |
8156 | 8156 | } |
8157 | 8157 | |
8158 | 8158 | // need to further trim the string so we can append the substring |
8159 | - $length -= (int) \mb_strlen($substring); |
|
8159 | + $length -= (int)\mb_strlen($substring); |
|
8160 | 8160 | if ($length <= 0) { |
8161 | 8161 | return $substring; |
8162 | 8162 | } |
@@ -8178,18 +8178,18 @@ discard block |
||
8178 | 8178 | || |
8179 | 8179 | ($space_position !== false && $ignore_do_not_split_words_for_one_word === false) |
8180 | 8180 | ) { |
8181 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
8181 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
8182 | 8182 | } |
8183 | 8183 | } |
8184 | 8184 | } else { |
8185 | 8185 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8186 | 8186 | |
8187 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8187 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8188 | 8188 | return $str; |
8189 | 8189 | } |
8190 | 8190 | |
8191 | 8191 | // need to further trim the string so we can append the substring |
8192 | - $length -= (int) self::strlen($substring, $encoding); |
|
8192 | + $length -= (int)self::strlen($substring, $encoding); |
|
8193 | 8193 | if ($length <= 0) { |
8194 | 8194 | return $substring; |
8195 | 8195 | } |
@@ -8211,12 +8211,12 @@ discard block |
||
8211 | 8211 | || |
8212 | 8212 | ($space_position !== false && $ignore_do_not_split_words_for_one_word === false) |
8213 | 8213 | ) { |
8214 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
8214 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
8215 | 8215 | } |
8216 | 8216 | } |
8217 | 8217 | } |
8218 | 8218 | |
8219 | - return $truncated . $substring; |
|
8219 | + return $truncated.$substring; |
|
8220 | 8220 | } |
8221 | 8221 | |
8222 | 8222 | /** |
@@ -8313,13 +8313,13 @@ discard block |
||
8313 | 8313 | } |
8314 | 8314 | } elseif ($format === 2) { |
8315 | 8315 | $number_of_words = []; |
8316 | - $offset = (int) self::strlen($str_parts[0]); |
|
8316 | + $offset = (int)self::strlen($str_parts[0]); |
|
8317 | 8317 | for ($i = 1; $i < $len; $i += 2) { |
8318 | 8318 | $number_of_words[$offset] = $str_parts[$i]; |
8319 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
8319 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
8320 | 8320 | } |
8321 | 8321 | } else { |
8322 | - $number_of_words = (int) (($len - 1) / 2); |
|
8322 | + $number_of_words = (int)(($len - 1) / 2); |
|
8323 | 8323 | } |
8324 | 8324 | |
8325 | 8325 | return $number_of_words; |
@@ -8440,21 +8440,21 @@ discard block |
||
8440 | 8440 | } |
8441 | 8441 | |
8442 | 8442 | if ($char_list === '') { |
8443 | - return (int) self::strlen($str, $encoding); |
|
8443 | + return (int)self::strlen($str, $encoding); |
|
8444 | 8444 | } |
8445 | 8445 | |
8446 | 8446 | if ($offset !== null || $length !== null) { |
8447 | 8447 | if ($encoding === 'UTF-8') { |
8448 | 8448 | if ($length === null) { |
8449 | 8449 | /** @noinspection UnnecessaryCastingInspection */ |
8450 | - $str_tmp = \mb_substr($str, (int) $offset); |
|
8450 | + $str_tmp = \mb_substr($str, (int)$offset); |
|
8451 | 8451 | } else { |
8452 | 8452 | /** @noinspection UnnecessaryCastingInspection */ |
8453 | - $str_tmp = \mb_substr($str, (int) $offset, $length); |
|
8453 | + $str_tmp = \mb_substr($str, (int)$offset, $length); |
|
8454 | 8454 | } |
8455 | 8455 | } else { |
8456 | 8456 | /** @noinspection UnnecessaryCastingInspection */ |
8457 | - $str_tmp = self::substr($str, (int) $offset, $length, $encoding); |
|
8457 | + $str_tmp = self::substr($str, (int)$offset, $length, $encoding); |
|
8458 | 8458 | } |
8459 | 8459 | |
8460 | 8460 | if ($str_tmp === false) { |
@@ -8470,7 +8470,7 @@ discard block |
||
8470 | 8470 | } |
8471 | 8471 | |
8472 | 8472 | $matches = []; |
8473 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
8473 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
8474 | 8474 | $return = self::strlen($matches[1], $encoding); |
8475 | 8475 | if ($return === false) { |
8476 | 8476 | return 0; |
@@ -8479,7 +8479,7 @@ discard block |
||
8479 | 8479 | return $return; |
8480 | 8480 | } |
8481 | 8481 | |
8482 | - return (int) self::strlen($str, $encoding); |
|
8482 | + return (int)self::strlen($str, $encoding); |
|
8483 | 8483 | } |
8484 | 8484 | |
8485 | 8485 | /** |
@@ -8612,7 +8612,7 @@ discard block |
||
8612 | 8612 | return ''; |
8613 | 8613 | } |
8614 | 8614 | |
8615 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
8615 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
8616 | 8616 | } |
8617 | 8617 | |
8618 | 8618 | /** |
@@ -8677,7 +8677,7 @@ discard block |
||
8677 | 8677 | // fallback for ascii only |
8678 | 8678 | // |
8679 | 8679 | |
8680 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
8680 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
8681 | 8681 | return \stripos($haystack, $needle, $offset); |
8682 | 8682 | } |
8683 | 8683 | |
@@ -8745,7 +8745,7 @@ discard block |
||
8745 | 8745 | && |
8746 | 8746 | self::$SUPPORT['mbstring'] === false |
8747 | 8747 | ) { |
8748 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8748 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8749 | 8749 | } |
8750 | 8750 | |
8751 | 8751 | if ( |
@@ -8759,11 +8759,11 @@ discard block |
||
8759 | 8759 | } |
8760 | 8760 | } |
8761 | 8761 | |
8762 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
8762 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
8763 | 8763 | return \stristr($haystack, $needle, $before_needle); |
8764 | 8764 | } |
8765 | 8765 | |
8766 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
8766 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
8767 | 8767 | |
8768 | 8768 | if (!isset($match[1])) { |
8769 | 8769 | return false; |
@@ -8773,7 +8773,7 @@ discard block |
||
8773 | 8773 | return $match[1]; |
8774 | 8774 | } |
8775 | 8775 | |
8776 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
8776 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
8777 | 8777 | } |
8778 | 8778 | |
8779 | 8779 | /** |
@@ -8845,7 +8845,7 @@ discard block |
||
8845 | 8845 | && |
8846 | 8846 | self::$SUPPORT['iconv'] === false |
8847 | 8847 | ) { |
8848 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8848 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8849 | 8849 | } |
8850 | 8850 | |
8851 | 8851 | // |
@@ -8961,8 +8961,8 @@ discard block |
||
8961 | 8961 | } |
8962 | 8962 | |
8963 | 8963 | return \strnatcmp( |
8964 | - (string) self::strtonatfold($str1), |
|
8965 | - (string) self::strtonatfold($str2) |
|
8964 | + (string)self::strtonatfold($str1), |
|
8965 | + (string)self::strtonatfold($str2) |
|
8966 | 8966 | ); |
8967 | 8967 | } |
8968 | 8968 | |
@@ -9020,11 +9020,11 @@ discard block |
||
9020 | 9020 | } |
9021 | 9021 | |
9022 | 9022 | if ($encoding === 'UTF-8') { |
9023 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
9024 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
9023 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
9024 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
9025 | 9025 | } else { |
9026 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
9027 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
9026 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
9027 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
9028 | 9028 | } |
9029 | 9029 | |
9030 | 9030 | return self::strcmp($str1, $str2); |
@@ -9046,8 +9046,8 @@ discard block |
||
9046 | 9046 | return false; |
9047 | 9047 | } |
9048 | 9048 | |
9049 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
9050 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
9049 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
9050 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
9051 | 9051 | } |
9052 | 9052 | |
9053 | 9053 | return false; |
@@ -9080,10 +9080,10 @@ discard block |
||
9080 | 9080 | } |
9081 | 9081 | |
9082 | 9082 | // iconv and mbstring do not support integer $needle |
9083 | - if ((int) $needle === $needle) { |
|
9084 | - $needle = (string) self::chr($needle); |
|
9083 | + if ((int)$needle === $needle) { |
|
9084 | + $needle = (string)self::chr($needle); |
|
9085 | 9085 | } |
9086 | - $needle = (string) $needle; |
|
9086 | + $needle = (string)$needle; |
|
9087 | 9087 | |
9088 | 9088 | if ($needle === '') { |
9089 | 9089 | return false; |
@@ -9130,7 +9130,7 @@ discard block |
||
9130 | 9130 | && |
9131 | 9131 | self::$SUPPORT['mbstring'] === false |
9132 | 9132 | ) { |
9133 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9133 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9134 | 9134 | } |
9135 | 9135 | |
9136 | 9136 | // |
@@ -9171,7 +9171,7 @@ discard block |
||
9171 | 9171 | // fallback for ascii only |
9172 | 9172 | // |
9173 | 9173 | |
9174 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9174 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9175 | 9175 | return \strpos($haystack, $needle, $offset); |
9176 | 9176 | } |
9177 | 9177 | |
@@ -9183,7 +9183,7 @@ discard block |
||
9183 | 9183 | if ($haystack_tmp === false) { |
9184 | 9184 | $haystack_tmp = ''; |
9185 | 9185 | } |
9186 | - $haystack = (string) $haystack_tmp; |
|
9186 | + $haystack = (string)$haystack_tmp; |
|
9187 | 9187 | |
9188 | 9188 | if ($offset < 0) { |
9189 | 9189 | $offset = 0; |
@@ -9195,7 +9195,7 @@ discard block |
||
9195 | 9195 | } |
9196 | 9196 | |
9197 | 9197 | if ($pos) { |
9198 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9198 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9199 | 9199 | } |
9200 | 9200 | |
9201 | 9201 | return $offset + 0; |
@@ -9306,7 +9306,7 @@ discard block |
||
9306 | 9306 | && |
9307 | 9307 | self::$SUPPORT['mbstring'] === false |
9308 | 9308 | ) { |
9309 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9309 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9310 | 9310 | } |
9311 | 9311 | |
9312 | 9312 | // |
@@ -9318,7 +9318,7 @@ discard block |
||
9318 | 9318 | if ($needle_tmp === false) { |
9319 | 9319 | return false; |
9320 | 9320 | } |
9321 | - $needle = (string) $needle_tmp; |
|
9321 | + $needle = (string)$needle_tmp; |
|
9322 | 9322 | |
9323 | 9323 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
9324 | 9324 | if ($pos === false) { |
@@ -9340,7 +9340,7 @@ discard block |
||
9340 | 9340 | if ($needle_tmp === false) { |
9341 | 9341 | return false; |
9342 | 9342 | } |
9343 | - $needle = (string) $needle_tmp; |
|
9343 | + $needle = (string)$needle_tmp; |
|
9344 | 9344 | |
9345 | 9345 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
9346 | 9346 | if ($pos === false) { |
@@ -9376,7 +9376,7 @@ discard block |
||
9376 | 9376 | if ($encoding === 'UTF-8') { |
9377 | 9377 | if (self::$SUPPORT['intl'] === true) { |
9378 | 9378 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
9379 | - $i = (int) \grapheme_strlen($str); |
|
9379 | + $i = (int)\grapheme_strlen($str); |
|
9380 | 9380 | while ($i--) { |
9381 | 9381 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
9382 | 9382 | if ($reversed_tmp !== false) { |
@@ -9384,7 +9384,7 @@ discard block |
||
9384 | 9384 | } |
9385 | 9385 | } |
9386 | 9386 | } else { |
9387 | - $i = (int) \mb_strlen($str); |
|
9387 | + $i = (int)\mb_strlen($str); |
|
9388 | 9388 | while ($i--) { |
9389 | 9389 | $reversed_tmp = \mb_substr($str, $i, 1); |
9390 | 9390 | if ($reversed_tmp !== false) { |
@@ -9395,7 +9395,7 @@ discard block |
||
9395 | 9395 | } else { |
9396 | 9396 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9397 | 9397 | |
9398 | - $i = (int) self::strlen($str, $encoding); |
|
9398 | + $i = (int)self::strlen($str, $encoding); |
|
9399 | 9399 | while ($i--) { |
9400 | 9400 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
9401 | 9401 | if ($reversed_tmp !== false) { |
@@ -9469,7 +9469,7 @@ discard block |
||
9469 | 9469 | if ($needle_tmp === false) { |
9470 | 9470 | return false; |
9471 | 9471 | } |
9472 | - $needle = (string) $needle_tmp; |
|
9472 | + $needle = (string)$needle_tmp; |
|
9473 | 9473 | |
9474 | 9474 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
9475 | 9475 | if ($pos === false) { |
@@ -9508,10 +9508,10 @@ discard block |
||
9508 | 9508 | } |
9509 | 9509 | |
9510 | 9510 | // iconv and mbstring do not support integer $needle |
9511 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9512 | - $needle = (string) self::chr($needle); |
|
9511 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9512 | + $needle = (string)self::chr($needle); |
|
9513 | 9513 | } |
9514 | - $needle = (string) $needle; |
|
9514 | + $needle = (string)$needle; |
|
9515 | 9515 | |
9516 | 9516 | if ($needle === '') { |
9517 | 9517 | return false; |
@@ -9556,7 +9556,7 @@ discard block |
||
9556 | 9556 | && |
9557 | 9557 | self::$SUPPORT['mbstring'] === false |
9558 | 9558 | ) { |
9559 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9559 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9560 | 9560 | } |
9561 | 9561 | |
9562 | 9562 | // |
@@ -9580,7 +9580,7 @@ discard block |
||
9580 | 9580 | // fallback for ascii only |
9581 | 9581 | // |
9582 | 9582 | |
9583 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9583 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9584 | 9584 | return \strripos($haystack, $needle, $offset); |
9585 | 9585 | } |
9586 | 9586 | |
@@ -9657,10 +9657,10 @@ discard block |
||
9657 | 9657 | } |
9658 | 9658 | |
9659 | 9659 | // iconv and mbstring do not support integer $needle |
9660 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9661 | - $needle = (string) self::chr($needle); |
|
9660 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9661 | + $needle = (string)self::chr($needle); |
|
9662 | 9662 | } |
9663 | - $needle = (string) $needle; |
|
9663 | + $needle = (string)$needle; |
|
9664 | 9664 | |
9665 | 9665 | if ($needle === '') { |
9666 | 9666 | return false; |
@@ -9705,7 +9705,7 @@ discard block |
||
9705 | 9705 | && |
9706 | 9706 | self::$SUPPORT['mbstring'] === false |
9707 | 9707 | ) { |
9708 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9708 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9709 | 9709 | } |
9710 | 9710 | |
9711 | 9711 | // |
@@ -9729,7 +9729,7 @@ discard block |
||
9729 | 9729 | // fallback for ascii only |
9730 | 9730 | // |
9731 | 9731 | |
9732 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9732 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9733 | 9733 | return \strrpos($haystack, $needle, $offset); |
9734 | 9734 | } |
9735 | 9735 | |
@@ -9749,7 +9749,7 @@ discard block |
||
9749 | 9749 | if ($haystack_tmp === false) { |
9750 | 9750 | $haystack_tmp = ''; |
9751 | 9751 | } |
9752 | - $haystack = (string) $haystack_tmp; |
|
9752 | + $haystack = (string)$haystack_tmp; |
|
9753 | 9753 | } |
9754 | 9754 | |
9755 | 9755 | $pos = \strrpos($haystack, $needle); |
@@ -9763,7 +9763,7 @@ discard block |
||
9763 | 9763 | return false; |
9764 | 9764 | } |
9765 | 9765 | |
9766 | - return $offset + (int) self::strlen($str_tmp); |
|
9766 | + return $offset + (int)self::strlen($str_tmp); |
|
9767 | 9767 | } |
9768 | 9768 | |
9769 | 9769 | /** |
@@ -9825,12 +9825,12 @@ discard block |
||
9825 | 9825 | if ($offset || $length !== null) { |
9826 | 9826 | if ($encoding === 'UTF-8') { |
9827 | 9827 | if ($length === null) { |
9828 | - $str = (string) \mb_substr($str, $offset); |
|
9828 | + $str = (string)\mb_substr($str, $offset); |
|
9829 | 9829 | } else { |
9830 | - $str = (string) \mb_substr($str, $offset, $length); |
|
9830 | + $str = (string)\mb_substr($str, $offset, $length); |
|
9831 | 9831 | } |
9832 | 9832 | } else { |
9833 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
9833 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
9834 | 9834 | } |
9835 | 9835 | } |
9836 | 9836 | |
@@ -9840,7 +9840,7 @@ discard block |
||
9840 | 9840 | |
9841 | 9841 | $matches = []; |
9842 | 9842 | |
9843 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
9843 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
9844 | 9844 | } |
9845 | 9845 | |
9846 | 9846 | /** |
@@ -9909,7 +9909,7 @@ discard block |
||
9909 | 9909 | && |
9910 | 9910 | self::$SUPPORT['mbstring'] === false |
9911 | 9911 | ) { |
9912 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9912 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9913 | 9913 | } |
9914 | 9914 | |
9915 | 9915 | // |
@@ -9931,7 +9931,7 @@ discard block |
||
9931 | 9931 | // fallback for ascii only |
9932 | 9932 | // |
9933 | 9933 | |
9934 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9934 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9935 | 9935 | return \strstr($haystack, $needle, $before_needle); |
9936 | 9936 | } |
9937 | 9937 | |
@@ -9939,7 +9939,7 @@ discard block |
||
9939 | 9939 | // fallback via vanilla php |
9940 | 9940 | // |
9941 | 9941 | |
9942 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
9942 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
9943 | 9943 | |
9944 | 9944 | if (!isset($match[1])) { |
9945 | 9945 | return false; |
@@ -9949,7 +9949,7 @@ discard block |
||
9949 | 9949 | return $match[1]; |
9950 | 9950 | } |
9951 | 9951 | |
9952 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
9952 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
9953 | 9953 | } |
9954 | 9954 | |
9955 | 9955 | /** |
@@ -10067,7 +10067,7 @@ discard block |
||
10067 | 10067 | bool $try_to_keep_the_string_length = false |
10068 | 10068 | ): string { |
10069 | 10069 | // init |
10070 | - $str = (string) $str; |
|
10070 | + $str = (string)$str; |
|
10071 | 10071 | |
10072 | 10072 | if ($str === '') { |
10073 | 10073 | return ''; |
@@ -10096,19 +10096,19 @@ discard block |
||
10096 | 10096 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10097 | 10097 | } |
10098 | 10098 | |
10099 | - $language_code = $lang . '-Lower'; |
|
10099 | + $language_code = $lang.'-Lower'; |
|
10100 | 10100 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10101 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
10101 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
10102 | 10102 | |
10103 | 10103 | $language_code = 'Any-Lower'; |
10104 | 10104 | } |
10105 | 10105 | |
10106 | 10106 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10107 | 10107 | /** @noinspection UnnecessaryCastingInspection */ |
10108 | - return (string) \transliterator_transliterate($language_code, $str); |
|
10108 | + return (string)\transliterator_transliterate($language_code, $str); |
|
10109 | 10109 | } |
10110 | 10110 | |
10111 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
10111 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
10112 | 10112 | } |
10113 | 10113 | |
10114 | 10114 | // always fallback via symfony polyfill |
@@ -10137,7 +10137,7 @@ discard block |
||
10137 | 10137 | bool $try_to_keep_the_string_length = false |
10138 | 10138 | ): string { |
10139 | 10139 | // init |
10140 | - $str = (string) $str; |
|
10140 | + $str = (string)$str; |
|
10141 | 10141 | |
10142 | 10142 | if ($str === '') { |
10143 | 10143 | return ''; |
@@ -10166,19 +10166,19 @@ discard block |
||
10166 | 10166 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10167 | 10167 | } |
10168 | 10168 | |
10169 | - $language_code = $lang . '-Upper'; |
|
10169 | + $language_code = $lang.'-Upper'; |
|
10170 | 10170 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10171 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
10171 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
10172 | 10172 | |
10173 | 10173 | $language_code = 'Any-Upper'; |
10174 | 10174 | } |
10175 | 10175 | |
10176 | 10176 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10177 | 10177 | /** @noinspection UnnecessaryCastingInspection */ |
10178 | - return (string) \transliterator_transliterate($language_code, $str); |
|
10178 | + return (string)\transliterator_transliterate($language_code, $str); |
|
10179 | 10179 | } |
10180 | 10180 | |
10181 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
10181 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
10182 | 10182 | } |
10183 | 10183 | |
10184 | 10184 | // always fallback via symfony polyfill |
@@ -10223,7 +10223,7 @@ discard block |
||
10223 | 10223 | $from = \array_combine($from, $to); |
10224 | 10224 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
10225 | 10225 | if ($from === false) { |
10226 | - 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) . ')'); |
|
10226 | + 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).')'); |
|
10227 | 10227 | } |
10228 | 10228 | } |
10229 | 10229 | |
@@ -10283,9 +10283,9 @@ discard block |
||
10283 | 10283 | } |
10284 | 10284 | |
10285 | 10285 | $wide = 0; |
10286 | - $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); |
|
10286 | + $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); |
|
10287 | 10287 | |
10288 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
10288 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
10289 | 10289 | } |
10290 | 10290 | |
10291 | 10291 | /** |
@@ -10385,9 +10385,9 @@ discard block |
||
10385 | 10385 | } |
10386 | 10386 | |
10387 | 10387 | if ($length === null) { |
10388 | - $length = (int) $str_length; |
|
10388 | + $length = (int)$str_length; |
|
10389 | 10389 | } else { |
10390 | - $length = (int) $length; |
|
10390 | + $length = (int)$length; |
|
10391 | 10391 | } |
10392 | 10392 | |
10393 | 10393 | if ( |
@@ -10395,7 +10395,7 @@ discard block |
||
10395 | 10395 | && |
10396 | 10396 | self::$SUPPORT['mbstring'] === false |
10397 | 10397 | ) { |
10398 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10398 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10399 | 10399 | } |
10400 | 10400 | |
10401 | 10401 | // |
@@ -10483,16 +10483,16 @@ discard block |
||
10483 | 10483 | ) { |
10484 | 10484 | if ($encoding === 'UTF-8') { |
10485 | 10485 | if ($length === null) { |
10486 | - $str1 = (string) \mb_substr($str1, $offset); |
|
10486 | + $str1 = (string)\mb_substr($str1, $offset); |
|
10487 | 10487 | } else { |
10488 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
10488 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
10489 | 10489 | } |
10490 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
10490 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
10491 | 10491 | } else { |
10492 | 10492 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10493 | 10493 | |
10494 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
10495 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
10494 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
10495 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
10496 | 10496 | } |
10497 | 10497 | } |
10498 | 10498 | |
@@ -10554,13 +10554,13 @@ discard block |
||
10554 | 10554 | if ($length_tmp === false) { |
10555 | 10555 | return false; |
10556 | 10556 | } |
10557 | - $length = (int) $length_tmp; |
|
10557 | + $length = (int)$length_tmp; |
|
10558 | 10558 | } |
10559 | 10559 | |
10560 | 10560 | if ($encoding === 'UTF-8') { |
10561 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
10561 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
10562 | 10562 | } else { |
10563 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
10563 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
10564 | 10564 | } |
10565 | 10565 | } |
10566 | 10566 | |
@@ -10569,7 +10569,7 @@ discard block |
||
10569 | 10569 | && |
10570 | 10570 | self::$SUPPORT['mbstring'] === false |
10571 | 10571 | ) { |
10572 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10572 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10573 | 10573 | } |
10574 | 10574 | |
10575 | 10575 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10580,7 +10580,7 @@ discard block |
||
10580 | 10580 | return \mb_substr_count($haystack, $needle, $encoding); |
10581 | 10581 | } |
10582 | 10582 | |
10583 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10583 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10584 | 10584 | |
10585 | 10585 | return \count($matches); |
10586 | 10586 | } |
@@ -10627,7 +10627,7 @@ discard block |
||
10627 | 10627 | if ($length_tmp === false) { |
10628 | 10628 | return false; |
10629 | 10629 | } |
10630 | - $length = (int) $length_tmp; |
|
10630 | + $length = (int)$length_tmp; |
|
10631 | 10631 | } |
10632 | 10632 | |
10633 | 10633 | if ( |
@@ -10649,7 +10649,7 @@ discard block |
||
10649 | 10649 | if ($haystack_tmp === false) { |
10650 | 10650 | $haystack_tmp = ''; |
10651 | 10651 | } |
10652 | - $haystack = (string) $haystack_tmp; |
|
10652 | + $haystack = (string)$haystack_tmp; |
|
10653 | 10653 | } |
10654 | 10654 | |
10655 | 10655 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10688,10 +10688,10 @@ discard block |
||
10688 | 10688 | |
10689 | 10689 | if ($encoding === 'UTF-8') { |
10690 | 10690 | if ($case_sensitive) { |
10691 | - return (int) \mb_substr_count($str, $substring); |
|
10691 | + return (int)\mb_substr_count($str, $substring); |
|
10692 | 10692 | } |
10693 | 10693 | |
10694 | - return (int) \mb_substr_count( |
|
10694 | + return (int)\mb_substr_count( |
|
10695 | 10695 | \mb_strtoupper($str), |
10696 | 10696 | \mb_strtoupper($substring) |
10697 | 10697 | ); |
@@ -10700,10 +10700,10 @@ discard block |
||
10700 | 10700 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10701 | 10701 | |
10702 | 10702 | if ($case_sensitive) { |
10703 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
10703 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
10704 | 10704 | } |
10705 | 10705 | |
10706 | - return (int) \mb_substr_count( |
|
10706 | + return (int)\mb_substr_count( |
|
10707 | 10707 | self::strtocasefold($str, true, false, $encoding, null, false), |
10708 | 10708 | self::strtocasefold($substring, true, false, $encoding, null, false), |
10709 | 10709 | $encoding |
@@ -10729,7 +10729,7 @@ discard block |
||
10729 | 10729 | } |
10730 | 10730 | |
10731 | 10731 | if (self::str_istarts_with($haystack, $needle) === true) { |
10732 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10732 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10733 | 10733 | } |
10734 | 10734 | |
10735 | 10735 | return $haystack; |
@@ -10786,7 +10786,7 @@ discard block |
||
10786 | 10786 | } |
10787 | 10787 | |
10788 | 10788 | if (self::str_iends_with($haystack, $needle) === true) { |
10789 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
10789 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
10790 | 10790 | } |
10791 | 10791 | |
10792 | 10792 | return $haystack; |
@@ -10811,7 +10811,7 @@ discard block |
||
10811 | 10811 | } |
10812 | 10812 | |
10813 | 10813 | if (self::str_starts_with($haystack, $needle) === true) { |
10814 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10814 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10815 | 10815 | } |
10816 | 10816 | |
10817 | 10817 | return $haystack; |
@@ -10863,7 +10863,7 @@ discard block |
||
10863 | 10863 | if (\is_array($offset) === true) { |
10864 | 10864 | $offset = \array_slice($offset, 0, $num); |
10865 | 10865 | foreach ($offset as &$value_tmp) { |
10866 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
10866 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
10867 | 10867 | } |
10868 | 10868 | unset($value_tmp); |
10869 | 10869 | } else { |
@@ -10876,7 +10876,7 @@ discard block |
||
10876 | 10876 | } elseif (\is_array($length) === true) { |
10877 | 10877 | $length = \array_slice($length, 0, $num); |
10878 | 10878 | foreach ($length as &$value_tmp_V2) { |
10879 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
10879 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
10880 | 10880 | } |
10881 | 10881 | unset($value_tmp_V2); |
10882 | 10882 | } else { |
@@ -10896,8 +10896,8 @@ discard block |
||
10896 | 10896 | } |
10897 | 10897 | |
10898 | 10898 | // init |
10899 | - $str = (string) $str; |
|
10900 | - $replacement = (string) $replacement; |
|
10899 | + $str = (string)$str; |
|
10900 | + $replacement = (string)$replacement; |
|
10901 | 10901 | |
10902 | 10902 | if (\is_array($length) === true) { |
10903 | 10903 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -10912,16 +10912,16 @@ discard block |
||
10912 | 10912 | } |
10913 | 10913 | |
10914 | 10914 | if (self::$SUPPORT['mbstring'] === true) { |
10915 | - $string_length = (int) self::strlen($str, $encoding); |
|
10915 | + $string_length = (int)self::strlen($str, $encoding); |
|
10916 | 10916 | |
10917 | 10917 | if ($offset < 0) { |
10918 | - $offset = (int) \max(0, $string_length + $offset); |
|
10918 | + $offset = (int)\max(0, $string_length + $offset); |
|
10919 | 10919 | } elseif ($offset > $string_length) { |
10920 | 10920 | $offset = $string_length; |
10921 | 10921 | } |
10922 | 10922 | |
10923 | 10923 | if ($length !== null && $length < 0) { |
10924 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
10924 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
10925 | 10925 | } elseif ($length === null || $length > $string_length) { |
10926 | 10926 | $length = $string_length; |
10927 | 10927 | } |
@@ -10932,9 +10932,9 @@ discard block |
||
10932 | 10932 | } |
10933 | 10933 | |
10934 | 10934 | /** @noinspection AdditionOperationOnArraysInspection */ |
10935 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
10936 | - $replacement . |
|
10937 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10935 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
10936 | + $replacement. |
|
10937 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10938 | 10938 | } |
10939 | 10939 | |
10940 | 10940 | // |
@@ -10943,8 +10943,7 @@ discard block |
||
10943 | 10943 | |
10944 | 10944 | if (ASCII::is_ascii($str)) { |
10945 | 10945 | return ($length === null) ? |
10946 | - \substr_replace($str, $replacement, $offset) : |
|
10947 | - \substr_replace($str, $replacement, $offset, $length); |
|
10946 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
10948 | 10947 | } |
10949 | 10948 | |
10950 | 10949 | // |
@@ -10960,7 +10959,7 @@ discard block |
||
10960 | 10959 | // e.g.: non mbstring support + invalid chars |
10961 | 10960 | return ''; |
10962 | 10961 | } |
10963 | - $length = (int) $length_tmp; |
|
10962 | + $length = (int)$length_tmp; |
|
10964 | 10963 | } |
10965 | 10964 | |
10966 | 10965 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -10995,14 +10994,14 @@ discard block |
||
10995 | 10994 | && |
10996 | 10995 | \substr($haystack, -\strlen($needle)) === $needle |
10997 | 10996 | ) { |
10998 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
10997 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
10999 | 10998 | } |
11000 | 10999 | |
11001 | 11000 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
11002 | - return (string) self::substr( |
|
11001 | + return (string)self::substr( |
|
11003 | 11002 | $haystack, |
11004 | 11003 | 0, |
11005 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
11004 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
11006 | 11005 | $encoding |
11007 | 11006 | ); |
11008 | 11007 | } |
@@ -11032,10 +11031,10 @@ discard block |
||
11032 | 11031 | } |
11033 | 11032 | |
11034 | 11033 | if ($encoding === 'UTF-8') { |
11035 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
11034 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
11036 | 11035 | } |
11037 | 11036 | |
11038 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
11037 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
11039 | 11038 | } |
11040 | 11039 | |
11041 | 11040 | /** |
@@ -11219,7 +11218,7 @@ discard block |
||
11219 | 11218 | public static function to_boolean($str): bool |
11220 | 11219 | { |
11221 | 11220 | // init |
11222 | - $str = (string) $str; |
|
11221 | + $str = (string)$str; |
|
11223 | 11222 | |
11224 | 11223 | if ($str === '') { |
11225 | 11224 | return false; |
@@ -11247,10 +11246,10 @@ discard block |
||
11247 | 11246 | } |
11248 | 11247 | |
11249 | 11248 | if (\is_numeric($str)) { |
11250 | - return ((float) $str + 0) > 0; |
|
11249 | + return ((float)$str + 0) > 0; |
|
11251 | 11250 | } |
11252 | 11251 | |
11253 | - return (bool) \trim($str); |
|
11252 | + return (bool)\trim($str); |
|
11254 | 11253 | } |
11255 | 11254 | |
11256 | 11255 | /** |
@@ -11292,7 +11291,7 @@ discard block |
||
11292 | 11291 | return $str; |
11293 | 11292 | } |
11294 | 11293 | |
11295 | - $str = (string) $str; |
|
11294 | + $str = (string)$str; |
|
11296 | 11295 | if ($str === '') { |
11297 | 11296 | return ''; |
11298 | 11297 | } |
@@ -11340,7 +11339,7 @@ discard block |
||
11340 | 11339 | return $str; |
11341 | 11340 | } |
11342 | 11341 | |
11343 | - $str = (string) $str; |
|
11342 | + $str = (string)$str; |
|
11344 | 11343 | if ($str === '') { |
11345 | 11344 | return $str; |
11346 | 11345 | } |
@@ -11358,7 +11357,7 @@ discard block |
||
11358 | 11357 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
11359 | 11358 | |
11360 | 11359 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11361 | - $buf .= $c1 . $c2; |
|
11360 | + $buf .= $c1.$c2; |
|
11362 | 11361 | ++$i; |
11363 | 11362 | } else { // not valid UTF8 - convert it |
11364 | 11363 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11369,7 +11368,7 @@ discard block |
||
11369 | 11368 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
11370 | 11369 | |
11371 | 11370 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11372 | - $buf .= $c1 . $c2 . $c3; |
|
11371 | + $buf .= $c1.$c2.$c3; |
|
11373 | 11372 | $i += 2; |
11374 | 11373 | } else { // not valid UTF8 - convert it |
11375 | 11374 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11381,7 +11380,7 @@ discard block |
||
11381 | 11380 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
11382 | 11381 | |
11383 | 11382 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11384 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
11383 | + $buf .= $c1.$c2.$c3.$c4; |
|
11385 | 11384 | $i += 3; |
11386 | 11385 | } else { // not valid UTF8 - convert it |
11387 | 11386 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11407,13 +11406,13 @@ discard block |
||
11407 | 11406 | * |
11408 | 11407 | * @return string |
11409 | 11408 | */ |
11410 | - static function (array $matches): string { |
|
11409 | + static function(array $matches): string { |
|
11411 | 11410 | if (isset($matches[3])) { |
11412 | - $cp = (int) \hexdec($matches[3]); |
|
11411 | + $cp = (int)\hexdec($matches[3]); |
|
11413 | 11412 | } else { |
11414 | 11413 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
11415 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
11416 | - + (int) \hexdec($matches[2]) |
|
11414 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
11415 | + + (int)\hexdec($matches[2]) |
|
11417 | 11416 | + 0x10000 |
11418 | 11417 | - (0xD800 << 10) |
11419 | 11418 | - 0xDC00; |
@@ -11424,12 +11423,12 @@ discard block |
||
11424 | 11423 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
11425 | 11424 | |
11426 | 11425 | if ($cp < 0x80) { |
11427 | - return (string) self::chr($cp); |
|
11426 | + return (string)self::chr($cp); |
|
11428 | 11427 | } |
11429 | 11428 | |
11430 | 11429 | if ($cp < 0xA0) { |
11431 | 11430 | /** @noinspection UnnecessaryCastingInspection */ |
11432 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
11431 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
11433 | 11432 | } |
11434 | 11433 | |
11435 | 11434 | return self::decimal_to_chr($cp); |
@@ -11478,7 +11477,7 @@ discard block |
||
11478 | 11477 | } |
11479 | 11478 | |
11480 | 11479 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11481 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
11480 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
11482 | 11481 | } |
11483 | 11482 | |
11484 | 11483 | if ($chars) { |
@@ -11522,15 +11521,15 @@ discard block |
||
11522 | 11521 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
11523 | 11522 | |
11524 | 11523 | if ($encoding === 'UTF-8') { |
11525 | - $str_part_two = (string) \mb_substr($str, 1); |
|
11524 | + $str_part_two = (string)\mb_substr($str, 1); |
|
11526 | 11525 | |
11527 | 11526 | if ($use_mb_functions === true) { |
11528 | 11527 | $str_part_one = \mb_strtoupper( |
11529 | - (string) \mb_substr($str, 0, 1) |
|
11528 | + (string)\mb_substr($str, 0, 1) |
|
11530 | 11529 | ); |
11531 | 11530 | } else { |
11532 | 11531 | $str_part_one = self::strtoupper( |
11533 | - (string) \mb_substr($str, 0, 1), |
|
11532 | + (string)\mb_substr($str, 0, 1), |
|
11534 | 11533 | $encoding, |
11535 | 11534 | false, |
11536 | 11535 | $lang, |
@@ -11540,16 +11539,16 @@ discard block |
||
11540 | 11539 | } else { |
11541 | 11540 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11542 | 11541 | |
11543 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
11542 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
11544 | 11543 | |
11545 | 11544 | if ($use_mb_functions === true) { |
11546 | 11545 | $str_part_one = \mb_strtoupper( |
11547 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
11546 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
11548 | 11547 | $encoding |
11549 | 11548 | ); |
11550 | 11549 | } else { |
11551 | 11550 | $str_part_one = self::strtoupper( |
11552 | - (string) self::substr($str, 0, 1, $encoding), |
|
11551 | + (string)self::substr($str, 0, 1, $encoding), |
|
11553 | 11552 | $encoding, |
11554 | 11553 | false, |
11555 | 11554 | $lang, |
@@ -11558,7 +11557,7 @@ discard block |
||
11558 | 11557 | } |
11559 | 11558 | } |
11560 | 11559 | |
11561 | - return $str_part_one . $str_part_two; |
|
11560 | + return $str_part_one.$str_part_two; |
|
11562 | 11561 | } |
11563 | 11562 | |
11564 | 11563 | /** |
@@ -11613,7 +11612,7 @@ discard block |
||
11613 | 11612 | $str = self::clean($str); |
11614 | 11613 | } |
11615 | 11614 | |
11616 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
11615 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
11617 | 11616 | |
11618 | 11617 | if ( |
11619 | 11618 | $use_php_default_functions === true |
@@ -12001,7 +12000,7 @@ discard block |
||
12001 | 12000 | if ( |
12002 | 12001 | $keep_utf8_chars === true |
12003 | 12002 | && |
12004 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
12003 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
12005 | 12004 | ) { |
12006 | 12005 | return $str_backup; |
12007 | 12006 | } |
@@ -12080,17 +12079,17 @@ discard block |
||
12080 | 12079 | return ''; |
12081 | 12080 | } |
12082 | 12081 | |
12083 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
12082 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
12084 | 12083 | |
12085 | 12084 | if ( |
12086 | 12085 | !isset($matches[0]) |
12087 | 12086 | || |
12088 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
12087 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
12089 | 12088 | ) { |
12090 | 12089 | return $str; |
12091 | 12090 | } |
12092 | 12091 | |
12093 | - return \rtrim($matches[0]) . $str_add_on; |
|
12092 | + return \rtrim($matches[0]).$str_add_on; |
|
12094 | 12093 | } |
12095 | 12094 | |
12096 | 12095 | /** |
@@ -12177,7 +12176,7 @@ discard block |
||
12177 | 12176 | } |
12178 | 12177 | } |
12179 | 12178 | |
12180 | - return $str_return . \implode('', $chars); |
|
12179 | + return $str_return.\implode('', $chars); |
|
12181 | 12180 | } |
12182 | 12181 | |
12183 | 12182 | /** |
@@ -12229,7 +12228,7 @@ discard block |
||
12229 | 12228 | $final_break = ''; |
12230 | 12229 | } |
12231 | 12230 | |
12232 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
12231 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
12233 | 12232 | } |
12234 | 12233 | |
12235 | 12234 | /** |
@@ -12252,14 +12251,14 @@ discard block |
||
12252 | 12251 | */ |
12253 | 12252 | private static function html_entity_decode_helper(string $str, string $encoding) |
12254 | 12253 | { |
12255 | - return (string) \preg_replace_callback( |
|
12254 | + return (string)\preg_replace_callback( |
|
12256 | 12255 | "/&#\d{2,6};/", |
12257 | 12256 | /** |
12258 | 12257 | * @param string[] $matches |
12259 | 12258 | * |
12260 | 12259 | * @return string |
12261 | 12260 | */ |
12262 | - static function (array $matches) use ($encoding): string { |
|
12261 | + static function(array $matches) use ($encoding): string { |
|
12263 | 12262 | $return_tmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
12264 | 12263 | if ($return_tmp !== '"' && $return_tmp !== "'") { |
12265 | 12264 | return $return_tmp; |
@@ -12480,7 +12479,7 @@ discard block |
||
12480 | 12479 | /** @noinspection PhpIncludeInspection */ |
12481 | 12480 | /** @noinspection UsingInclusionReturnValueInspection */ |
12482 | 12481 | /** @psalm-suppress UnresolvableInclude */ |
12483 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
12482 | + return include __DIR__.'/data/'.$file.'.php'; |
|
12484 | 12483 | } |
12485 | 12484 | |
12486 | 12485 | /** |
@@ -12495,7 +12494,7 @@ discard block |
||
12495 | 12494 | |
12496 | 12495 | \uksort( |
12497 | 12496 | self::$EMOJI, |
12498 | - static function (string $a, string $b): int { |
|
12497 | + static function(string $a, string $b): int { |
|
12499 | 12498 | return \strlen($b) <=> \strlen($a); |
12500 | 12499 | } |
12501 | 12500 | ); |
@@ -12505,7 +12504,7 @@ discard block |
||
12505 | 12504 | |
12506 | 12505 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
12507 | 12506 | $tmp_key = \crc32($key); |
12508 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
12507 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
12509 | 12508 | } |
12510 | 12509 | |
12511 | 12510 | return true; |
@@ -12531,7 +12530,7 @@ discard block |
||
12531 | 12530 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
12532 | 12531 | return \defined('MB_OVERLOAD_STRING') |
12533 | 12532 | && |
12534 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12533 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12535 | 12534 | } |
12536 | 12535 | |
12537 | 12536 | /** |
@@ -12588,7 +12587,7 @@ discard block |
||
12588 | 12587 | { |
12589 | 12588 | static $RX_CLASS_CACHE = []; |
12590 | 12589 | |
12591 | - $cache_key = $s . $class; |
|
12590 | + $cache_key = $s.$class; |
|
12592 | 12591 | |
12593 | 12592 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
12594 | 12593 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -12600,7 +12599,7 @@ discard block |
||
12600 | 12599 | /** @noinspection AlterInForeachInspection */ |
12601 | 12600 | foreach (self::str_split($s) as &$s) { |
12602 | 12601 | if ($s === '-') { |
12603 | - $class_array[0] = '-' . $class_array[0]; |
|
12602 | + $class_array[0] = '-'.$class_array[0]; |
|
12604 | 12603 | } elseif (!isset($s[2])) { |
12605 | 12604 | $class_array[0] .= \preg_quote($s, '/'); |
12606 | 12605 | } elseif (self::strlen($s) === 1) { |
@@ -12611,13 +12610,13 @@ discard block |
||
12611 | 12610 | } |
12612 | 12611 | |
12613 | 12612 | if ($class_array[0]) { |
12614 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
12613 | + $class_array[0] = '['.$class_array[0].']'; |
|
12615 | 12614 | } |
12616 | 12615 | |
12617 | 12616 | if (\count($class_array) === 1) { |
12618 | 12617 | $return = $class_array[0]; |
12619 | 12618 | } else { |
12620 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
12619 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
12621 | 12620 | } |
12622 | 12621 | |
12623 | 12622 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -12696,7 +12695,7 @@ discard block |
||
12696 | 12695 | |
12697 | 12696 | if ($delimiter === '-') { |
12698 | 12697 | /** @noinspection AlterInForeachInspection */ |
12699 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
12698 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
12700 | 12699 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12701 | 12700 | $continue = true; |
12702 | 12701 | } |
@@ -12704,7 +12703,7 @@ discard block |
||
12704 | 12703 | } |
12705 | 12704 | |
12706 | 12705 | /** @noinspection AlterInForeachInspection */ |
12707 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
12706 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
12708 | 12707 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12709 | 12708 | $continue = true; |
12710 | 12709 | } |
@@ -12767,8 +12766,8 @@ discard block |
||
12767 | 12766 | } else { |
12768 | 12767 | /** @noinspection OffsetOperationsInspection */ |
12769 | 12768 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
12770 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
12771 | - $buf .= $cc1 . $cc2; |
|
12769 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
12770 | + $buf .= $cc1.$cc2; |
|
12772 | 12771 | } |
12773 | 12772 | |
12774 | 12773 | return $buf; |
@@ -12785,7 +12784,7 @@ discard block |
||
12785 | 12784 | { |
12786 | 12785 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
12787 | 12786 | if (\preg_match($pattern, $str)) { |
12788 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
12787 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
12789 | 12788 | } |
12790 | 12789 | |
12791 | 12790 | return $str; |