@@ -3,17 +3,17 @@ discard block |
||
| 3 | 3 | return [ |
| 4 | 4 | 0x80 => "\xe2\x82\xac", // € |
| 5 | 5 | 0x82 => "\xe2\x80\x9a", // ‚ |
| 6 | - 0x83 => "\xc6\x92", // ƒ |
|
| 6 | + 0x83 => "\xc6\x92", // ƒ |
|
| 7 | 7 | 0x84 => "\xe2\x80\x9e", // „ |
| 8 | 8 | 0x85 => "\xe2\x80\xa6", // … |
| 9 | 9 | 0x86 => "\xe2\x80\xa0", // † |
| 10 | 10 | 0x87 => "\xe2\x80\xa1", // ‡ |
| 11 | - 0x88 => "\xcb\x86", // ˆ |
|
| 11 | + 0x88 => "\xcb\x86", // ˆ |
|
| 12 | 12 | 0x89 => "\xe2\x80\xb0", // ‰ |
| 13 | - 0x8a => "\xc5\xa0", // Š |
|
| 13 | + 0x8a => "\xc5\xa0", // Š |
|
| 14 | 14 | 0x8b => "\xe2\x80\xb9", // ‹ |
| 15 | - 0x8c => "\xc5\x92", // Œ |
|
| 16 | - 0x8e => "\xc5\xbd", // Ž |
|
| 15 | + 0x8c => "\xc5\x92", // Œ |
|
| 16 | + 0x8e => "\xc5\xbd", // Ž |
|
| 17 | 17 | 0x91 => "\xe2\x80\x98", // ‘ |
| 18 | 18 | 0x92 => "\xe2\x80\x99", // ’ |
| 19 | 19 | 0x93 => "\xe2\x80\x9c", // “ |
@@ -21,106 +21,106 @@ discard block |
||
| 21 | 21 | 0x95 => "\xe2\x80\xa2", // • |
| 22 | 22 | 0x96 => "\xe2\x80\x93", // – |
| 23 | 23 | 0x97 => "\xe2\x80\x94", // — |
| 24 | - 0x98 => "\xcb\x9c", // ˜ |
|
| 24 | + 0x98 => "\xcb\x9c", // ˜ |
|
| 25 | 25 | 0x99 => "\xe2\x84\xa2", // ™ |
| 26 | - 0x9a => "\xc5\xa1", // š |
|
| 26 | + 0x9a => "\xc5\xa1", // š |
|
| 27 | 27 | 0x9b => "\xe2\x80\xba", // › |
| 28 | - 0x9c => "\xc5\x93", // œ |
|
| 29 | - 0x9e => "\xc5\xbe", // ž |
|
| 30 | - 0x9f => "\xc5\xb8", // Ÿ |
|
| 28 | + 0x9c => "\xc5\x93", // œ |
|
| 29 | + 0x9e => "\xc5\xbe", // ž |
|
| 30 | + 0x9f => "\xc5\xb8", // Ÿ |
|
| 31 | 31 | 0xa0 => "\xc2\xa0", |
| 32 | - 0xa1 => "\xc2\xa1", // ¡ |
|
| 33 | - 0xa2 => "\xc2\xa2", // ¢ |
|
| 34 | - 0xa3 => "\xc2\xa3", // £ |
|
| 35 | - 0xa4 => "\xc2\xa4", // ¤ |
|
| 36 | - 0xa5 => "\xc2\xa5", // ¥ |
|
| 37 | - 0xa6 => "\xc2\xa6", // ¦ |
|
| 38 | - 0xa7 => "\xc2\xa7", // § |
|
| 39 | - 0xa8 => "\xc2\xa8", // ¨ |
|
| 40 | - 0xa9 => "\xc2\xa9", // © |
|
| 41 | - 0xaa => "\xc2\xaa", // ª |
|
| 42 | - 0xab => "\xc2\xab", // « |
|
| 43 | - 0xac => "\xc2\xac", // ¬ |
|
| 44 | - 0xad => "\xc2\xad", // |
|
| 45 | - 0xae => "\xc2\xae", // ® |
|
| 46 | - 0xaf => "\xc2\xaf", // ¯ |
|
| 47 | - 0xb0 => "\xc2\xb0", // ° |
|
| 48 | - 0xb1 => "\xc2\xb1", // ± |
|
| 49 | - 0xb2 => "\xc2\xb2", // ² |
|
| 50 | - 0xb3 => "\xc2\xb3", // ³ |
|
| 51 | - 0xb4 => "\xc2\xb4", // ´ |
|
| 52 | - 0xb5 => "\xc2\xb5", // µ |
|
| 53 | - 0xb6 => "\xc2\xb6", // ¶ |
|
| 54 | - 0xb7 => "\xc2\xb7", // · |
|
| 55 | - 0xb8 => "\xc2\xb8", // ¸ |
|
| 56 | - 0xb9 => "\xc2\xb9", // ¹ |
|
| 57 | - 0xba => "\xc2\xba", // º |
|
| 58 | - 0xbb => "\xc2\xbb", // » |
|
| 59 | - 0xbc => "\xc2\xbc", // ¼ |
|
| 60 | - 0xbd => "\xc2\xbd", // ½ |
|
| 61 | - 0xbe => "\xc2\xbe", // ¾ |
|
| 62 | - 0xbf => "\xc2\xbf", // ¿ |
|
| 63 | - 0xc0 => "\xc3\x80", // À |
|
| 64 | - 0xc1 => "\xc3\x81", // Á |
|
| 65 | - 0xc2 => "\xc3\x82", // Â |
|
| 66 | - 0xc3 => "\xc3\x83", // Ã |
|
| 67 | - 0xc4 => "\xc3\x84", // Ä |
|
| 68 | - 0xc5 => "\xc3\x85", // Å |
|
| 69 | - 0xc6 => "\xc3\x86", // Æ |
|
| 70 | - 0xc7 => "\xc3\x87", // Ç |
|
| 71 | - 0xc8 => "\xc3\x88", // È |
|
| 72 | - 0xc9 => "\xc3\x89", // É |
|
| 73 | - 0xca => "\xc3\x8a", // Ê |
|
| 74 | - 0xcb => "\xc3\x8b", // Ë |
|
| 75 | - 0xcc => "\xc3\x8c", // Ì |
|
| 76 | - 0xcd => "\xc3\x8d", // Í |
|
| 77 | - 0xce => "\xc3\x8e", // Î |
|
| 78 | - 0xcf => "\xc3\x8f", // Ï |
|
| 79 | - 0xd0 => "\xc3\x90", // Ð |
|
| 80 | - 0xd1 => "\xc3\x91", // Ñ |
|
| 81 | - 0xd2 => "\xc3\x92", // Ò |
|
| 82 | - 0xd3 => "\xc3\x93", // Ó |
|
| 83 | - 0xd4 => "\xc3\x94", // Ô |
|
| 84 | - 0xd5 => "\xc3\x95", // Õ |
|
| 85 | - 0xd6 => "\xc3\x96", // Ö |
|
| 86 | - 0xd7 => "\xc3\x97", // × |
|
| 87 | - 0xd8 => "\xc3\x98", // Ø |
|
| 88 | - 0xd9 => "\xc3\x99", // Ù |
|
| 89 | - 0xda => "\xc3\x9a", // Ú |
|
| 90 | - 0xdb => "\xc3\x9b", // Û |
|
| 91 | - 0xdc => "\xc3\x9c", // Ü |
|
| 92 | - 0xdd => "\xc3\x9d", // Ý |
|
| 93 | - 0xde => "\xc3\x9e", // Þ |
|
| 94 | - 0xdf => "\xc3\x9f", // ß |
|
| 95 | - 0xe0 => "\xc3\xa0", // à |
|
| 96 | - 0xe1 => "\xc3\xa1", // á |
|
| 97 | - 0xe2 => "\xc3\xa2", // â |
|
| 98 | - 0xe3 => "\xc3\xa3", // ã |
|
| 99 | - 0xe4 => "\xc3\xa4", // ä |
|
| 100 | - 0xe5 => "\xc3\xa5", // å |
|
| 101 | - 0xe6 => "\xc3\xa6", // æ |
|
| 102 | - 0xe7 => "\xc3\xa7", // ç |
|
| 103 | - 0xe8 => "\xc3\xa8", // è |
|
| 104 | - 0xe9 => "\xc3\xa9", // é |
|
| 105 | - 0xea => "\xc3\xaa", // ê |
|
| 106 | - 0xeb => "\xc3\xab", // ë |
|
| 107 | - 0xec => "\xc3\xac", // ì |
|
| 108 | - 0xed => "\xc3\xad", // í |
|
| 109 | - 0xee => "\xc3\xae", // î |
|
| 110 | - 0xef => "\xc3\xaf", // ï |
|
| 111 | - 0xf0 => "\xc3\xb0", // ð |
|
| 112 | - 0xf1 => "\xc3\xb1", // ñ |
|
| 113 | - 0xf2 => "\xc3\xb2", // ò |
|
| 114 | - 0xf3 => "\xc3\xb3", // ó |
|
| 115 | - 0xf4 => "\xc3\xb4", // ô |
|
| 116 | - 0xf5 => "\xc3\xb5", // õ |
|
| 117 | - 0xf6 => "\xc3\xb6", // ö |
|
| 118 | - 0xf7 => "\xc3\xb7", // ÷ |
|
| 119 | - 0xf8 => "\xc3\xb8", // ø |
|
| 120 | - 0xf9 => "\xc3\xb9", // ù |
|
| 121 | - 0xfa => "\xc3\xba", // ú |
|
| 122 | - 0xfb => "\xc3\xbb", // û |
|
| 123 | - 0xfc => "\xc3\xbc", // ü |
|
| 124 | - 0xfd => "\xc3\xbd", // ý |
|
| 125 | - 0xfe => "\xc3\xbe", // þ |
|
| 32 | + 0xa1 => "\xc2\xa1", // ¡ |
|
| 33 | + 0xa2 => "\xc2\xa2", // ¢ |
|
| 34 | + 0xa3 => "\xc2\xa3", // £ |
|
| 35 | + 0xa4 => "\xc2\xa4", // ¤ |
|
| 36 | + 0xa5 => "\xc2\xa5", // ¥ |
|
| 37 | + 0xa6 => "\xc2\xa6", // ¦ |
|
| 38 | + 0xa7 => "\xc2\xa7", // § |
|
| 39 | + 0xa8 => "\xc2\xa8", // ¨ |
|
| 40 | + 0xa9 => "\xc2\xa9", // © |
|
| 41 | + 0xaa => "\xc2\xaa", // ª |
|
| 42 | + 0xab => "\xc2\xab", // « |
|
| 43 | + 0xac => "\xc2\xac", // ¬ |
|
| 44 | + 0xad => "\xc2\xad", // |
|
| 45 | + 0xae => "\xc2\xae", // ® |
|
| 46 | + 0xaf => "\xc2\xaf", // ¯ |
|
| 47 | + 0xb0 => "\xc2\xb0", // ° |
|
| 48 | + 0xb1 => "\xc2\xb1", // ± |
|
| 49 | + 0xb2 => "\xc2\xb2", // ² |
|
| 50 | + 0xb3 => "\xc2\xb3", // ³ |
|
| 51 | + 0xb4 => "\xc2\xb4", // ´ |
|
| 52 | + 0xb5 => "\xc2\xb5", // µ |
|
| 53 | + 0xb6 => "\xc2\xb6", // ¶ |
|
| 54 | + 0xb7 => "\xc2\xb7", // · |
|
| 55 | + 0xb8 => "\xc2\xb8", // ¸ |
|
| 56 | + 0xb9 => "\xc2\xb9", // ¹ |
|
| 57 | + 0xba => "\xc2\xba", // º |
|
| 58 | + 0xbb => "\xc2\xbb", // » |
|
| 59 | + 0xbc => "\xc2\xbc", // ¼ |
|
| 60 | + 0xbd => "\xc2\xbd", // ½ |
|
| 61 | + 0xbe => "\xc2\xbe", // ¾ |
|
| 62 | + 0xbf => "\xc2\xbf", // ¿ |
|
| 63 | + 0xc0 => "\xc3\x80", // À |
|
| 64 | + 0xc1 => "\xc3\x81", // Á |
|
| 65 | + 0xc2 => "\xc3\x82", // Â |
|
| 66 | + 0xc3 => "\xc3\x83", // Ã |
|
| 67 | + 0xc4 => "\xc3\x84", // Ä |
|
| 68 | + 0xc5 => "\xc3\x85", // Å |
|
| 69 | + 0xc6 => "\xc3\x86", // Æ |
|
| 70 | + 0xc7 => "\xc3\x87", // Ç |
|
| 71 | + 0xc8 => "\xc3\x88", // È |
|
| 72 | + 0xc9 => "\xc3\x89", // É |
|
| 73 | + 0xca => "\xc3\x8a", // Ê |
|
| 74 | + 0xcb => "\xc3\x8b", // Ë |
|
| 75 | + 0xcc => "\xc3\x8c", // Ì |
|
| 76 | + 0xcd => "\xc3\x8d", // Í |
|
| 77 | + 0xce => "\xc3\x8e", // Î |
|
| 78 | + 0xcf => "\xc3\x8f", // Ï |
|
| 79 | + 0xd0 => "\xc3\x90", // Ð |
|
| 80 | + 0xd1 => "\xc3\x91", // Ñ |
|
| 81 | + 0xd2 => "\xc3\x92", // Ò |
|
| 82 | + 0xd3 => "\xc3\x93", // Ó |
|
| 83 | + 0xd4 => "\xc3\x94", // Ô |
|
| 84 | + 0xd5 => "\xc3\x95", // Õ |
|
| 85 | + 0xd6 => "\xc3\x96", // Ö |
|
| 86 | + 0xd7 => "\xc3\x97", // × |
|
| 87 | + 0xd8 => "\xc3\x98", // Ø |
|
| 88 | + 0xd9 => "\xc3\x99", // Ù |
|
| 89 | + 0xda => "\xc3\x9a", // Ú |
|
| 90 | + 0xdb => "\xc3\x9b", // Û |
|
| 91 | + 0xdc => "\xc3\x9c", // Ü |
|
| 92 | + 0xdd => "\xc3\x9d", // Ý |
|
| 93 | + 0xde => "\xc3\x9e", // Þ |
|
| 94 | + 0xdf => "\xc3\x9f", // ß |
|
| 95 | + 0xe0 => "\xc3\xa0", // à |
|
| 96 | + 0xe1 => "\xc3\xa1", // á |
|
| 97 | + 0xe2 => "\xc3\xa2", // â |
|
| 98 | + 0xe3 => "\xc3\xa3", // ã |
|
| 99 | + 0xe4 => "\xc3\xa4", // ä |
|
| 100 | + 0xe5 => "\xc3\xa5", // å |
|
| 101 | + 0xe6 => "\xc3\xa6", // æ |
|
| 102 | + 0xe7 => "\xc3\xa7", // ç |
|
| 103 | + 0xe8 => "\xc3\xa8", // è |
|
| 104 | + 0xe9 => "\xc3\xa9", // é |
|
| 105 | + 0xea => "\xc3\xaa", // ê |
|
| 106 | + 0xeb => "\xc3\xab", // ë |
|
| 107 | + 0xec => "\xc3\xac", // ì |
|
| 108 | + 0xed => "\xc3\xad", // í |
|
| 109 | + 0xee => "\xc3\xae", // î |
|
| 110 | + 0xef => "\xc3\xaf", // ï |
|
| 111 | + 0xf0 => "\xc3\xb0", // ð |
|
| 112 | + 0xf1 => "\xc3\xb1", // ñ |
|
| 113 | + 0xf2 => "\xc3\xb2", // ò |
|
| 114 | + 0xf3 => "\xc3\xb3", // ó |
|
| 115 | + 0xf4 => "\xc3\xb4", // ô |
|
| 116 | + 0xf5 => "\xc3\xb5", // õ |
|
| 117 | + 0xf6 => "\xc3\xb6", // ö |
|
| 118 | + 0xf7 => "\xc3\xb7", // ÷ |
|
| 119 | + 0xf8 => "\xc3\xb8", // ø |
|
| 120 | + 0xf9 => "\xc3\xb9", // ù |
|
| 121 | + 0xfa => "\xc3\xba", // ú |
|
| 122 | + 0xfb => "\xc3\xbb", // û |
|
| 123 | + 0xfc => "\xc3\xbc", // ü |
|
| 124 | + 0xfd => "\xc3\xbd", // ý |
|
| 125 | + 0xfe => "\xc3\xbe", // þ |
|
| 126 | 126 | ]; |
@@ -583,22 +583,22 @@ discard block |
||
| 583 | 583 | * @psalm-suppress PossiblyNullArrayAccess |
| 584 | 584 | */ |
| 585 | 585 | $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
| 586 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 586 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 587 | 587 | } elseif ($code_point <= 0xFFFF) { |
| 588 | 588 | /** |
| 589 | 589 | * @psalm-suppress PossiblyNullArrayAccess |
| 590 | 590 | */ |
| 591 | 591 | $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
| 592 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 593 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 592 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 593 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 594 | 594 | } else { |
| 595 | 595 | /** |
| 596 | 596 | * @psalm-suppress PossiblyNullArrayAccess |
| 597 | 597 | */ |
| 598 | 598 | $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
| 599 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 600 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 601 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 599 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 600 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 601 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | if ($encoding !== 'UTF-8') { |
@@ -2292,10 +2292,10 @@ discard block |
||
| 2292 | 2292 | public static function get_unique_string($entropy_extra = '', bool $use_md5 = true): string |
| 2293 | 2293 | { |
| 2294 | 2294 | $unique_helper = \random_int(0, \mt_getrandmax()) . |
| 2295 | - \session_id() . |
|
| 2296 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
| 2297 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
| 2298 | - $entropy_extra; |
|
| 2295 | + \session_id() . |
|
| 2296 | + ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
| 2297 | + ($_SERVER['SERVER_ADDR'] ?? '') . |
|
| 2298 | + $entropy_extra; |
|
| 2299 | 2299 | |
| 2300 | 2300 | $unique_string = \uniqid($unique_helper, true); |
| 2301 | 2301 | |
@@ -5803,8 +5803,8 @@ discard block |
||
| 5803 | 5803 | |
| 5804 | 5804 | /** @noinspection UnnecessaryCastingInspection */ |
| 5805 | 5805 | return (string) \mb_substr($str, 0, $index) . |
| 5806 | - $substring . |
|
| 5807 | - (string) \mb_substr($str, $index, $len); |
|
| 5806 | + $substring . |
|
| 5807 | + (string) \mb_substr($str, $index, $len); |
|
| 5808 | 5808 | } |
| 5809 | 5809 | |
| 5810 | 5810 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -5815,8 +5815,8 @@ discard block |
||
| 5815 | 5815 | } |
| 5816 | 5816 | |
| 5817 | 5817 | return ((string) self::substr($str, 0, $index, $encoding)) . |
| 5818 | - $substring . |
|
| 5819 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
| 5818 | + $substring . |
|
| 5819 | + ((string) self::substr($str, $index, $len, $encoding)); |
|
| 5820 | 5820 | } |
| 5821 | 5821 | |
| 5822 | 5822 | /** |
@@ -7849,11 +7849,11 @@ discard block |
||
| 7849 | 7849 | if ($use_mb_functions === true) { |
| 7850 | 7850 | if ($encoding === 'UTF-8') { |
| 7851 | 7851 | return \mb_strtoupper(\mb_substr($match[0], 0, 1)) |
| 7852 | - . \mb_strtolower(\mb_substr($match[0], 1)); |
|
| 7852 | + . \mb_strtolower(\mb_substr($match[0], 1)); |
|
| 7853 | 7853 | } |
| 7854 | 7854 | |
| 7855 | 7855 | return \mb_strtoupper(\mb_substr($match[0], 0, 1, $encoding), $encoding) |
| 7856 | - . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
| 7856 | + . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
| 7857 | 7857 | } |
| 7858 | 7858 | |
| 7859 | 7859 | return self::ucfirst( |
@@ -8232,13 +8232,13 @@ discard block |
||
| 8232 | 8232 | } |
| 8233 | 8233 | |
| 8234 | 8234 | return ( |
| 8235 | - (string) self::substr( |
|
| 8236 | - $str, |
|
| 8237 | - 0, |
|
| 8238 | - $length, |
|
| 8239 | - $encoding |
|
| 8240 | - ) |
|
| 8241 | - ) . $substring; |
|
| 8235 | + (string) self::substr( |
|
| 8236 | + $str, |
|
| 8237 | + 0, |
|
| 8238 | + $length, |
|
| 8239 | + $encoding |
|
| 8240 | + ) |
|
| 8241 | + ) . $substring; |
|
| 8242 | 8242 | } |
| 8243 | 8243 | |
| 8244 | 8244 | /** |
@@ -11054,8 +11054,8 @@ discard block |
||
| 11054 | 11054 | |
| 11055 | 11055 | /** @noinspection AdditionOperationOnArraysInspection */ |
| 11056 | 11056 | return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
| 11057 | - $replacement . |
|
| 11058 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 11057 | + $replacement . |
|
| 11058 | + ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 11059 | 11059 | } |
| 11060 | 11060 | |
| 11061 | 11061 | // |
@@ -242,10 +242,10 @@ discard block |
||
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | if ($encoding === 'UTF-8') { |
| 245 | - return (string) \mb_substr($str, $pos, 1); |
|
| 245 | + return (string)\mb_substr($str, $pos, 1); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
| 248 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | /** |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | public static function add_bom_to_string(string $str): string |
| 263 | 263 | { |
| 264 | 264 | if (self::string_has_bom($str) === false) { |
| 265 | - $str = self::bom() . $str; |
|
| 265 | + $str = self::bom().$str; |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | return $str; |
@@ -297,8 +297,8 @@ discard block |
||
| 297 | 297 | $return = []; |
| 298 | 298 | foreach ($array as $key => &$value) { |
| 299 | 299 | $key = $case === \CASE_LOWER |
| 300 | - ? self::strtolower((string) $key, $encoding) |
|
| 301 | - : self::strtoupper((string) $key, $encoding); |
|
| 300 | + ? self::strtolower((string)$key, $encoding) |
|
| 301 | + : self::strtoupper((string)$key, $encoding); |
|
| 302 | 302 | |
| 303 | 303 | $return[$key] = $value; |
| 304 | 304 | } |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | return ''; |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
| 337 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
| 338 | 338 | $end_position = \mb_strpos($str, $end, $substr_index); |
| 339 | 339 | if ( |
| 340 | 340 | $end_position === false |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | return ''; |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
| 347 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | return ''; |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
| 357 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
| 358 | 358 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
| 359 | 359 | if ( |
| 360 | 360 | $end_position === false |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | return ''; |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - return (string) self::substr( |
|
| 367 | + return (string)self::substr( |
|
| 368 | 368 | $str, |
| 369 | 369 | $substr_index, |
| 370 | 370 | $end_position - $substr_index, |
@@ -440,10 +440,10 @@ discard block |
||
| 440 | 440 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
| 441 | 441 | { |
| 442 | 442 | if ($encoding === 'UTF-8') { |
| 443 | - return (string) \mb_substr($str, $index, 1); |
|
| 443 | + return (string)\mb_substr($str, $index, 1); |
|
| 444 | 444 | } |
| 445 | 445 | |
| 446 | - return (string) self::substr($str, $index, 1, $encoding); |
|
| 446 | + return (string)self::substr($str, $index, 1, $encoding); |
|
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | /** |
@@ -554,10 +554,10 @@ discard block |
||
| 554 | 554 | /** |
| 555 | 555 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 556 | 556 | */ |
| 557 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 557 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 558 | 558 | } |
| 559 | 559 | |
| 560 | - $cache_key = $code_point . '_' . $encoding; |
|
| 560 | + $cache_key = $code_point.'_'.$encoding; |
|
| 561 | 561 | if (isset($CHAR_CACHE[$cache_key]) === true) { |
| 562 | 562 | return $CHAR_CACHE[$cache_key]; |
| 563 | 563 | } |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | self::$CHR = self::getData('chr'); |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | - $code_point = (int) $code_point; |
|
| 606 | + $code_point = (int)$code_point; |
|
| 607 | 607 | if ($code_point <= 0x7F) { |
| 608 | 608 | /** |
| 609 | 609 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -613,22 +613,22 @@ discard block |
||
| 613 | 613 | /** |
| 614 | 614 | * @psalm-suppress PossiblyNullArrayAccess |
| 615 | 615 | */ |
| 616 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
| 616 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
| 617 | 617 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 618 | 618 | } elseif ($code_point <= 0xFFFF) { |
| 619 | 619 | /** |
| 620 | 620 | * @psalm-suppress PossiblyNullArrayAccess |
| 621 | 621 | */ |
| 622 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
| 623 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 622 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
| 623 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 624 | 624 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 625 | 625 | } else { |
| 626 | 626 | /** |
| 627 | 627 | * @psalm-suppress PossiblyNullArrayAccess |
| 628 | 628 | */ |
| 629 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
| 630 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 631 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 629 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
| 630 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
| 631 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 632 | 632 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 633 | 633 | } |
| 634 | 634 | |
@@ -680,7 +680,7 @@ discard block |
||
| 680 | 680 | |
| 681 | 681 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
| 682 | 682 | return \array_map( |
| 683 | - static function (string $data): int { |
|
| 683 | + static function(string $data): int { |
|
| 684 | 684 | // "mb_" is available if overload is used, so use it ... |
| 685 | 685 | return \mb_strlen($data, 'CP850'); // 8-BIT |
| 686 | 686 | }, |
@@ -760,7 +760,7 @@ discard block |
||
| 760 | 760 | $char = ''; |
| 761 | 761 | } |
| 762 | 762 | |
| 763 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
| 763 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
| 764 | 764 | } |
| 765 | 765 | |
| 766 | 766 | /** |
@@ -849,7 +849,7 @@ discard block |
||
| 849 | 849 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
| 850 | 850 | /x'; |
| 851 | 851 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
| 852 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
| 852 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
| 853 | 853 | |
| 854 | 854 | if ($replace_diamond_question_mark === true) { |
| 855 | 855 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -886,7 +886,7 @@ discard block |
||
| 886 | 886 | public static function cleanup($str): string |
| 887 | 887 | { |
| 888 | 888 | // init |
| 889 | - $str = (string) $str; |
|
| 889 | + $str = (string)$str; |
|
| 890 | 890 | |
| 891 | 891 | if ($str === '') { |
| 892 | 892 | return ''; |
@@ -980,7 +980,7 @@ discard block |
||
| 980 | 980 | { |
| 981 | 981 | if (self::$SUPPORT['mbstring'] === true) { |
| 982 | 982 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 983 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 983 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 984 | 984 | } |
| 985 | 985 | |
| 986 | 986 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -1024,7 +1024,7 @@ discard block |
||
| 1024 | 1024 | */ |
| 1025 | 1025 | public static function css_stripe_media_queries(string $str): string |
| 1026 | 1026 | { |
| 1027 | - return (string) \preg_replace( |
|
| 1027 | + return (string)\preg_replace( |
|
| 1028 | 1028 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
| 1029 | 1029 | '', |
| 1030 | 1030 | $str |
@@ -1055,7 +1055,7 @@ discard block |
||
| 1055 | 1055 | */ |
| 1056 | 1056 | public static function decimal_to_chr($int): string |
| 1057 | 1057 | { |
| 1058 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
| 1058 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
| 1059 | 1059 | } |
| 1060 | 1060 | |
| 1061 | 1061 | /** |
@@ -1106,16 +1106,16 @@ discard block |
||
| 1106 | 1106 | self::initEmojiData(); |
| 1107 | 1107 | |
| 1108 | 1108 | if ($use_reversible_string_mappings === true) { |
| 1109 | - return (string) \str_replace( |
|
| 1110 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1111 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1109 | + return (string)\str_replace( |
|
| 1110 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1111 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1112 | 1112 | $str |
| 1113 | 1113 | ); |
| 1114 | 1114 | } |
| 1115 | 1115 | |
| 1116 | - return (string) \str_replace( |
|
| 1117 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 1118 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1116 | + return (string)\str_replace( |
|
| 1117 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 1118 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1119 | 1119 | $str |
| 1120 | 1120 | ); |
| 1121 | 1121 | } |
@@ -1139,16 +1139,16 @@ discard block |
||
| 1139 | 1139 | self::initEmojiData(); |
| 1140 | 1140 | |
| 1141 | 1141 | if ($use_reversible_string_mappings === true) { |
| 1142 | - return (string) \str_replace( |
|
| 1143 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1144 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1142 | + return (string)\str_replace( |
|
| 1143 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1144 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1145 | 1145 | $str |
| 1146 | 1146 | ); |
| 1147 | 1147 | } |
| 1148 | 1148 | |
| 1149 | - return (string) \str_replace( |
|
| 1150 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1151 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 1149 | + return (string)\str_replace( |
|
| 1150 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1151 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 1152 | 1152 | $str |
| 1153 | 1153 | ); |
| 1154 | 1154 | } |
@@ -1204,7 +1204,7 @@ discard block |
||
| 1204 | 1204 | if ($to_encoding === 'JSON') { |
| 1205 | 1205 | $return = self::json_encode($str); |
| 1206 | 1206 | if ($return === false) { |
| 1207 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
| 1207 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
| 1208 | 1208 | } |
| 1209 | 1209 | |
| 1210 | 1210 | return $return; |
@@ -1294,7 +1294,7 @@ discard block |
||
| 1294 | 1294 | /** |
| 1295 | 1295 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 1296 | 1296 | */ |
| 1297 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
| 1297 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
| 1298 | 1298 | } |
| 1299 | 1299 | |
| 1300 | 1300 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1392,31 +1392,31 @@ discard block |
||
| 1392 | 1392 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
| 1393 | 1393 | |
| 1394 | 1394 | if ($length === null) { |
| 1395 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
| 1395 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
| 1396 | 1396 | } |
| 1397 | 1397 | |
| 1398 | 1398 | if ($search === '') { |
| 1399 | 1399 | if ($encoding === 'UTF-8') { |
| 1400 | 1400 | if ($length > 0) { |
| 1401 | - $string_length = (int) \mb_strlen($str); |
|
| 1401 | + $string_length = (int)\mb_strlen($str); |
|
| 1402 | 1402 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
| 1403 | 1403 | } else { |
| 1404 | 1404 | $end = 0; |
| 1405 | 1405 | } |
| 1406 | 1406 | |
| 1407 | - $pos = (int) \min( |
|
| 1407 | + $pos = (int)\min( |
|
| 1408 | 1408 | \mb_strpos($str, ' ', $end), |
| 1409 | 1409 | \mb_strpos($str, '.', $end) |
| 1410 | 1410 | ); |
| 1411 | 1411 | } else { |
| 1412 | 1412 | if ($length > 0) { |
| 1413 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 1413 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 1414 | 1414 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
| 1415 | 1415 | } else { |
| 1416 | 1416 | $end = 0; |
| 1417 | 1417 | } |
| 1418 | 1418 | |
| 1419 | - $pos = (int) \min( |
|
| 1419 | + $pos = (int)\min( |
|
| 1420 | 1420 | self::strpos($str, ' ', $end, $encoding), |
| 1421 | 1421 | self::strpos($str, '.', $end, $encoding) |
| 1422 | 1422 | ); |
@@ -1433,18 +1433,18 @@ discard block |
||
| 1433 | 1433 | return ''; |
| 1434 | 1434 | } |
| 1435 | 1435 | |
| 1436 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1436 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1437 | 1437 | } |
| 1438 | 1438 | |
| 1439 | 1439 | return $str; |
| 1440 | 1440 | } |
| 1441 | 1441 | |
| 1442 | 1442 | if ($encoding === 'UTF-8') { |
| 1443 | - $word_position = (int) \mb_stripos($str, $search); |
|
| 1444 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
| 1443 | + $word_position = (int)\mb_stripos($str, $search); |
|
| 1444 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
| 1445 | 1445 | } else { |
| 1446 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
| 1447 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
| 1446 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
| 1447 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
| 1448 | 1448 | } |
| 1449 | 1449 | |
| 1450 | 1450 | $pos_start = 0; |
@@ -1456,12 +1456,12 @@ discard block |
||
| 1456 | 1456 | } |
| 1457 | 1457 | if ($half_text !== false) { |
| 1458 | 1458 | if ($encoding === 'UTF-8') { |
| 1459 | - $pos_start = (int) \max( |
|
| 1459 | + $pos_start = (int)\max( |
|
| 1460 | 1460 | \mb_strrpos($half_text, ' '), |
| 1461 | 1461 | \mb_strrpos($half_text, '.') |
| 1462 | 1462 | ); |
| 1463 | 1463 | } else { |
| 1464 | - $pos_start = (int) \max( |
|
| 1464 | + $pos_start = (int)\max( |
|
| 1465 | 1465 | self::strrpos($half_text, ' ', 0, $encoding), |
| 1466 | 1466 | self::strrpos($half_text, '.', 0, $encoding) |
| 1467 | 1467 | ); |
@@ -1471,19 +1471,19 @@ discard block |
||
| 1471 | 1471 | |
| 1472 | 1472 | if ($word_position && $half_side > 0) { |
| 1473 | 1473 | $offset = $pos_start + $length - 1; |
| 1474 | - $real_length = (int) self::strlen($str, $encoding); |
|
| 1474 | + $real_length = (int)self::strlen($str, $encoding); |
|
| 1475 | 1475 | |
| 1476 | 1476 | if ($offset > $real_length) { |
| 1477 | 1477 | $offset = $real_length; |
| 1478 | 1478 | } |
| 1479 | 1479 | |
| 1480 | 1480 | if ($encoding === 'UTF-8') { |
| 1481 | - $pos_end = (int) \min( |
|
| 1481 | + $pos_end = (int)\min( |
|
| 1482 | 1482 | \mb_strpos($str, ' ', $offset), |
| 1483 | 1483 | \mb_strpos($str, '.', $offset) |
| 1484 | 1484 | ) - $pos_start; |
| 1485 | 1485 | } else { |
| 1486 | - $pos_end = (int) \min( |
|
| 1486 | + $pos_end = (int)\min( |
|
| 1487 | 1487 | self::strpos($str, ' ', $offset, $encoding), |
| 1488 | 1488 | self::strpos($str, '.', $offset, $encoding) |
| 1489 | 1489 | ) - $pos_start; |
@@ -1491,12 +1491,12 @@ discard block |
||
| 1491 | 1491 | |
| 1492 | 1492 | if (!$pos_end || $pos_end <= 0) { |
| 1493 | 1493 | if ($encoding === 'UTF-8') { |
| 1494 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
| 1494 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
| 1495 | 1495 | } else { |
| 1496 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
| 1496 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
| 1497 | 1497 | } |
| 1498 | 1498 | if ($str_sub !== false) { |
| 1499 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
| 1499 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
| 1500 | 1500 | } else { |
| 1501 | 1501 | $extract = ''; |
| 1502 | 1502 | } |
@@ -1507,26 +1507,26 @@ discard block |
||
| 1507 | 1507 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
| 1508 | 1508 | } |
| 1509 | 1509 | if ($str_sub !== false) { |
| 1510 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1510 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1511 | 1511 | } else { |
| 1512 | 1512 | $extract = ''; |
| 1513 | 1513 | } |
| 1514 | 1514 | } |
| 1515 | 1515 | } else { |
| 1516 | 1516 | $offset = $length - 1; |
| 1517 | - $true_length = (int) self::strlen($str, $encoding); |
|
| 1517 | + $true_length = (int)self::strlen($str, $encoding); |
|
| 1518 | 1518 | |
| 1519 | 1519 | if ($offset > $true_length) { |
| 1520 | 1520 | $offset = $true_length; |
| 1521 | 1521 | } |
| 1522 | 1522 | |
| 1523 | 1523 | if ($encoding === 'UTF-8') { |
| 1524 | - $pos_end = (int) \min( |
|
| 1524 | + $pos_end = (int)\min( |
|
| 1525 | 1525 | \mb_strpos($str, ' ', $offset), |
| 1526 | 1526 | \mb_strpos($str, '.', $offset) |
| 1527 | 1527 | ); |
| 1528 | 1528 | } else { |
| 1529 | - $pos_end = (int) \min( |
|
| 1529 | + $pos_end = (int)\min( |
|
| 1530 | 1530 | self::strpos($str, ' ', $offset, $encoding), |
| 1531 | 1531 | self::strpos($str, '.', $offset, $encoding) |
| 1532 | 1532 | ); |
@@ -1539,7 +1539,7 @@ discard block |
||
| 1539 | 1539 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
| 1540 | 1540 | } |
| 1541 | 1541 | if ($str_sub !== false) { |
| 1542 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1542 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1543 | 1543 | } else { |
| 1544 | 1544 | $extract = ''; |
| 1545 | 1545 | } |
@@ -1666,7 +1666,7 @@ discard block |
||
| 1666 | 1666 | { |
| 1667 | 1667 | $file_content = \file_get_contents($file_path); |
| 1668 | 1668 | if ($file_content === false) { |
| 1669 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
| 1669 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
| 1670 | 1670 | } |
| 1671 | 1671 | |
| 1672 | 1672 | return self::string_has_bom($file_content); |
@@ -1734,7 +1734,7 @@ discard block |
||
| 1734 | 1734 | ) { |
| 1735 | 1735 | // Prevent leading combining chars |
| 1736 | 1736 | // for NFC-safe concatenations. |
| 1737 | - $var = $leading_combining . $var; |
|
| 1737 | + $var = $leading_combining.$var; |
|
| 1738 | 1738 | } |
| 1739 | 1739 | } |
| 1740 | 1740 | |
@@ -2009,10 +2009,10 @@ discard block |
||
| 2009 | 2009 | } |
| 2010 | 2010 | |
| 2011 | 2011 | if ($encoding === 'UTF-8') { |
| 2012 | - return (string) \mb_substr($str, 0, $n); |
|
| 2012 | + return (string)\mb_substr($str, 0, $n); |
|
| 2013 | 2013 | } |
| 2014 | 2014 | |
| 2015 | - return (string) self::substr($str, 0, $n, $encoding); |
|
| 2015 | + return (string)self::substr($str, 0, $n, $encoding); |
|
| 2016 | 2016 | } |
| 2017 | 2017 | |
| 2018 | 2018 | /** |
@@ -2027,7 +2027,7 @@ discard block |
||
| 2027 | 2027 | */ |
| 2028 | 2028 | public static function fits_inside(string $str, int $box_size): bool |
| 2029 | 2029 | { |
| 2030 | - return (int) self::strlen($str) <= $box_size; |
|
| 2030 | + return (int)self::strlen($str) <= $box_size; |
|
| 2031 | 2031 | } |
| 2032 | 2032 | |
| 2033 | 2033 | /** |
@@ -2106,7 +2106,7 @@ discard block |
||
| 2106 | 2106 | return $str; |
| 2107 | 2107 | } |
| 2108 | 2108 | |
| 2109 | - $str = (string) $str; |
|
| 2109 | + $str = (string)$str; |
|
| 2110 | 2110 | $last = ''; |
| 2111 | 2111 | while ($last !== $str) { |
| 2112 | 2112 | $last = $str; |
@@ -2312,7 +2312,7 @@ discard block |
||
| 2312 | 2312 | return $fallback; |
| 2313 | 2313 | } |
| 2314 | 2314 | /** @noinspection OffsetOperationsInspection */ |
| 2315 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
| 2315 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
| 2316 | 2316 | |
| 2317 | 2317 | // DEBUG |
| 2318 | 2318 | //var_dump($type_code); |
@@ -2370,7 +2370,7 @@ discard block |
||
| 2370 | 2370 | // |
| 2371 | 2371 | |
| 2372 | 2372 | if ($encoding === 'UTF-8') { |
| 2373 | - $max_length = (int) \mb_strlen($possible_chars); |
|
| 2373 | + $max_length = (int)\mb_strlen($possible_chars); |
|
| 2374 | 2374 | if ($max_length === 0) { |
| 2375 | 2375 | return ''; |
| 2376 | 2376 | } |
@@ -2391,7 +2391,7 @@ discard block |
||
| 2391 | 2391 | } else { |
| 2392 | 2392 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 2393 | 2393 | |
| 2394 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
| 2394 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
| 2395 | 2395 | if ($max_length === 0) { |
| 2396 | 2396 | return ''; |
| 2397 | 2397 | } |
@@ -2422,16 +2422,16 @@ discard block |
||
| 2422 | 2422 | */ |
| 2423 | 2423 | public static function get_unique_string($entropy_extra = '', bool $use_md5 = true): string |
| 2424 | 2424 | { |
| 2425 | - $unique_helper = \random_int(0, \mt_getrandmax()) . |
|
| 2426 | - \session_id() . |
|
| 2427 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
| 2428 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
| 2425 | + $unique_helper = \random_int(0, \mt_getrandmax()). |
|
| 2426 | + \session_id(). |
|
| 2427 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
| 2428 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
| 2429 | 2429 | $entropy_extra; |
| 2430 | 2430 | |
| 2431 | 2431 | $unique_string = \uniqid($unique_helper, true); |
| 2432 | 2432 | |
| 2433 | 2433 | if ($use_md5) { |
| 2434 | - $unique_string = \md5($unique_string . $unique_helper); |
|
| 2434 | + $unique_string = \md5($unique_string.$unique_helper); |
|
| 2435 | 2435 | } |
| 2436 | 2436 | |
| 2437 | 2437 | return $unique_string; |
@@ -2541,7 +2541,7 @@ discard block |
||
| 2541 | 2541 | public static function hex_to_int($hexdec) |
| 2542 | 2542 | { |
| 2543 | 2543 | // init |
| 2544 | - $hexdec = (string) $hexdec; |
|
| 2544 | + $hexdec = (string)$hexdec; |
|
| 2545 | 2545 | |
| 2546 | 2546 | if ($hexdec === '') { |
| 2547 | 2547 | return false; |
@@ -2638,7 +2638,7 @@ discard block |
||
| 2638 | 2638 | return \implode( |
| 2639 | 2639 | '', |
| 2640 | 2640 | \array_map( |
| 2641 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
| 2641 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
| 2642 | 2642 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
| 2643 | 2643 | }, |
| 2644 | 2644 | self::str_split($str) |
@@ -2750,7 +2750,7 @@ discard block |
||
| 2750 | 2750 | /** |
| 2751 | 2751 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 2752 | 2752 | */ |
| 2753 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 2753 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 2754 | 2754 | } |
| 2755 | 2755 | |
| 2756 | 2756 | do { |
@@ -2759,7 +2759,7 @@ discard block |
||
| 2759 | 2759 | if (\strpos($str, '&') !== false) { |
| 2760 | 2760 | if (\strpos($str, '&#') !== false) { |
| 2761 | 2761 | // decode also numeric & UTF16 two byte entities |
| 2762 | - $str = (string) \preg_replace( |
|
| 2762 | + $str = (string)\preg_replace( |
|
| 2763 | 2763 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
| 2764 | 2764 | '$1;', |
| 2765 | 2765 | $str |
@@ -2809,7 +2809,7 @@ discard block |
||
| 2809 | 2809 | */ |
| 2810 | 2810 | public static function html_stripe_empty_tags(string $str): string |
| 2811 | 2811 | { |
| 2812 | - return (string) \preg_replace( |
|
| 2812 | + return (string)\preg_replace( |
|
| 2813 | 2813 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
| 2814 | 2814 | '', |
| 2815 | 2815 | $str |
@@ -3129,9 +3129,9 @@ discard block |
||
| 3129 | 3129 | { |
| 3130 | 3130 | $hex = \dechex($int); |
| 3131 | 3131 | |
| 3132 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
| 3132 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
| 3133 | 3133 | |
| 3134 | - return $prefix . $hex . ''; |
|
| 3134 | + return $prefix.$hex.''; |
|
| 3135 | 3135 | } |
| 3136 | 3136 | |
| 3137 | 3137 | /** |
@@ -3421,7 +3421,7 @@ discard block |
||
| 3421 | 3421 | */ |
| 3422 | 3422 | public static function is_binary($input, bool $strict = false): bool |
| 3423 | 3423 | { |
| 3424 | - $input = (string) $input; |
|
| 3424 | + $input = (string)$input; |
|
| 3425 | 3425 | if ($input === '') { |
| 3426 | 3426 | return false; |
| 3427 | 3427 | } |
@@ -3710,7 +3710,7 @@ discard block |
||
| 3710 | 3710 | public static function is_utf16($str, $check_if_string_is_binary = true) |
| 3711 | 3711 | { |
| 3712 | 3712 | // init |
| 3713 | - $str = (string) $str; |
|
| 3713 | + $str = (string)$str; |
|
| 3714 | 3714 | $str_chars = []; |
| 3715 | 3715 | |
| 3716 | 3716 | if ( |
@@ -3796,7 +3796,7 @@ discard block |
||
| 3796 | 3796 | public static function is_utf32($str, $check_if_string_is_binary = true) |
| 3797 | 3797 | { |
| 3798 | 3798 | // init |
| 3799 | - $str = (string) $str; |
|
| 3799 | + $str = (string)$str; |
|
| 3800 | 3800 | $str_chars = []; |
| 3801 | 3801 | |
| 3802 | 3802 | if ( |
@@ -3888,7 +3888,7 @@ discard block |
||
| 3888 | 3888 | return true; |
| 3889 | 3889 | } |
| 3890 | 3890 | |
| 3891 | - return self::is_utf8_string((string) $str, $strict); |
|
| 3891 | + return self::is_utf8_string((string)$str, $strict); |
|
| 3892 | 3892 | } |
| 3893 | 3893 | |
| 3894 | 3894 | /** |
@@ -4038,15 +4038,15 @@ discard block |
||
| 4038 | 4038 | $use_mb_functions = ($lang === null && $try_to_keep_the_string_length === false); |
| 4039 | 4039 | |
| 4040 | 4040 | if ($encoding === 'UTF-8') { |
| 4041 | - $str_part_two = (string) \mb_substr($str, 1); |
|
| 4041 | + $str_part_two = (string)\mb_substr($str, 1); |
|
| 4042 | 4042 | |
| 4043 | 4043 | if ($use_mb_functions === true) { |
| 4044 | 4044 | $str_part_one = \mb_strtolower( |
| 4045 | - (string) \mb_substr($str, 0, 1) |
|
| 4045 | + (string)\mb_substr($str, 0, 1) |
|
| 4046 | 4046 | ); |
| 4047 | 4047 | } else { |
| 4048 | 4048 | $str_part_one = self::strtolower( |
| 4049 | - (string) \mb_substr($str, 0, 1), |
|
| 4049 | + (string)\mb_substr($str, 0, 1), |
|
| 4050 | 4050 | $encoding, |
| 4051 | 4051 | false, |
| 4052 | 4052 | $lang, |
@@ -4056,10 +4056,10 @@ discard block |
||
| 4056 | 4056 | } else { |
| 4057 | 4057 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4058 | 4058 | |
| 4059 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
| 4059 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
| 4060 | 4060 | |
| 4061 | 4061 | $str_part_one = self::strtolower( |
| 4062 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 4062 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 4063 | 4063 | $encoding, |
| 4064 | 4064 | false, |
| 4065 | 4065 | $lang, |
@@ -4067,7 +4067,7 @@ discard block |
||
| 4067 | 4067 | ); |
| 4068 | 4068 | } |
| 4069 | 4069 | |
| 4070 | - return $str_part_one . $str_part_two; |
|
| 4070 | + return $str_part_one.$str_part_two; |
|
| 4071 | 4071 | } |
| 4072 | 4072 | |
| 4073 | 4073 | /** |
@@ -4214,7 +4214,7 @@ discard block |
||
| 4214 | 4214 | } |
| 4215 | 4215 | |
| 4216 | 4216 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4217 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 4217 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 4218 | 4218 | } |
| 4219 | 4219 | |
| 4220 | 4220 | if ($chars) { |
@@ -4267,7 +4267,7 @@ discard block |
||
| 4267 | 4267 | { |
| 4268 | 4268 | $bytes = self::chr_size_list($str); |
| 4269 | 4269 | if ($bytes !== []) { |
| 4270 | - return (int) \max($bytes); |
|
| 4270 | + return (int)\max($bytes); |
|
| 4271 | 4271 | } |
| 4272 | 4272 | |
| 4273 | 4273 | return 0; |
@@ -4349,7 +4349,7 @@ discard block |
||
| 4349 | 4349 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
| 4350 | 4350 | |
| 4351 | 4351 | // init |
| 4352 | - $encoding = (string) $encoding; |
|
| 4352 | + $encoding = (string)$encoding; |
|
| 4353 | 4353 | |
| 4354 | 4354 | if (!$encoding) { |
| 4355 | 4355 | return $fallback; |
@@ -4411,7 +4411,7 @@ discard block |
||
| 4411 | 4411 | |
| 4412 | 4412 | $encoding_original = $encoding; |
| 4413 | 4413 | $encoding = \strtoupper($encoding); |
| 4414 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
| 4414 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
| 4415 | 4415 | |
| 4416 | 4416 | $equivalences = [ |
| 4417 | 4417 | 'ISO8859' => 'ISO-8859-1', |
@@ -4569,13 +4569,13 @@ discard block |
||
| 4569 | 4569 | static $CHAR_CACHE = []; |
| 4570 | 4570 | |
| 4571 | 4571 | // init |
| 4572 | - $chr = (string) $chr; |
|
| 4572 | + $chr = (string)$chr; |
|
| 4573 | 4573 | |
| 4574 | 4574 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
| 4575 | 4575 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4576 | 4576 | } |
| 4577 | 4577 | |
| 4578 | - $cache_key = $chr . '_' . $encoding; |
|
| 4578 | + $cache_key = $chr.'_'.$encoding; |
|
| 4579 | 4579 | if (isset($CHAR_CACHE[$cache_key]) === true) { |
| 4580 | 4580 | return $CHAR_CACHE[$cache_key]; |
| 4581 | 4581 | } |
@@ -4610,7 +4610,7 @@ discard block |
||
| 4610 | 4610 | // |
| 4611 | 4611 | |
| 4612 | 4612 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 4613 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
| 4613 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
| 4614 | 4614 | /** @noinspection OffsetOperationsInspection */ |
| 4615 | 4615 | $code = $chr ? $chr[1] : 0; |
| 4616 | 4616 | |
@@ -4618,21 +4618,21 @@ discard block |
||
| 4618 | 4618 | if ($code >= 0xF0 && isset($chr[4])) { |
| 4619 | 4619 | /** @noinspection UnnecessaryCastingInspection */ |
| 4620 | 4620 | /** @noinspection OffsetOperationsInspection */ |
| 4621 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 4621 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 4622 | 4622 | } |
| 4623 | 4623 | |
| 4624 | 4624 | /** @noinspection OffsetOperationsInspection */ |
| 4625 | 4625 | if ($code >= 0xE0 && isset($chr[3])) { |
| 4626 | 4626 | /** @noinspection UnnecessaryCastingInspection */ |
| 4627 | 4627 | /** @noinspection OffsetOperationsInspection */ |
| 4628 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 4628 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 4629 | 4629 | } |
| 4630 | 4630 | |
| 4631 | 4631 | /** @noinspection OffsetOperationsInspection */ |
| 4632 | 4632 | if ($code >= 0xC0 && isset($chr[2])) { |
| 4633 | 4633 | /** @noinspection UnnecessaryCastingInspection */ |
| 4634 | 4634 | /** @noinspection OffsetOperationsInspection */ |
| 4635 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 4635 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 4636 | 4636 | } |
| 4637 | 4637 | |
| 4638 | 4638 | return $CHAR_CACHE[$cache_key] = $code; |
@@ -4689,7 +4689,7 @@ discard block |
||
| 4689 | 4689 | public static function pcre_utf8_support(): bool |
| 4690 | 4690 | { |
| 4691 | 4691 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 4692 | - return (bool) @\preg_match('//u', ''); |
|
| 4692 | + return (bool)@\preg_match('//u', ''); |
|
| 4693 | 4693 | } |
| 4694 | 4694 | |
| 4695 | 4695 | /** |
@@ -4727,14 +4727,14 @@ discard block |
||
| 4727 | 4727 | * @psalm-suppress RedundantConditionGivenDocblockType |
| 4728 | 4728 | */ |
| 4729 | 4729 | if (!\is_numeric($step)) { |
| 4730 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
| 4730 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
| 4731 | 4731 | } |
| 4732 | 4732 | |
| 4733 | 4733 | /** |
| 4734 | 4734 | * @psalm-suppress RedundantConditionGivenDocblockType - false-positive from psalm? |
| 4735 | 4735 | */ |
| 4736 | 4736 | if ($step <= 0) { |
| 4737 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
| 4737 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
| 4738 | 4738 | } |
| 4739 | 4739 | } |
| 4740 | 4740 | |
@@ -4746,14 +4746,14 @@ discard block |
||
| 4746 | 4746 | $is_xdigit = false; |
| 4747 | 4747 | |
| 4748 | 4748 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4749 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
| 4749 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
| 4750 | 4750 | $is_digit = true; |
| 4751 | - $start = (int) $var1; |
|
| 4751 | + $start = (int)$var1; |
|
| 4752 | 4752 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
| 4753 | 4753 | $is_xdigit = true; |
| 4754 | - $start = (int) self::hex_to_int($var1); |
|
| 4754 | + $start = (int)self::hex_to_int($var1); |
|
| 4755 | 4755 | } elseif (!$use_ctype && \is_numeric($var1)) { |
| 4756 | - $start = (int) $var1; |
|
| 4756 | + $start = (int)$var1; |
|
| 4757 | 4757 | } else { |
| 4758 | 4758 | $start = self::ord($var1); |
| 4759 | 4759 | } |
@@ -4763,11 +4763,11 @@ discard block |
||
| 4763 | 4763 | } |
| 4764 | 4764 | |
| 4765 | 4765 | if ($is_digit) { |
| 4766 | - $end = (int) $var2; |
|
| 4766 | + $end = (int)$var2; |
|
| 4767 | 4767 | } elseif ($is_xdigit) { |
| 4768 | - $end = (int) self::hex_to_int($var2); |
|
| 4768 | + $end = (int)self::hex_to_int($var2); |
|
| 4769 | 4769 | } elseif (!$use_ctype && \is_numeric($var2)) { |
| 4770 | - $end = (int) $var2; |
|
| 4770 | + $end = (int)$var2; |
|
| 4771 | 4771 | } else { |
| 4772 | 4772 | $end = self::ord($var2); |
| 4773 | 4773 | } |
@@ -4778,7 +4778,7 @@ discard block |
||
| 4778 | 4778 | |
| 4779 | 4779 | $array = []; |
| 4780 | 4780 | foreach (\range($start, $end, $step) as $i) { |
| 4781 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
| 4781 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
| 4782 | 4782 | } |
| 4783 | 4783 | |
| 4784 | 4784 | return $array; |
@@ -4888,8 +4888,8 @@ discard block |
||
| 4888 | 4888 | $delimiter = '/'; |
| 4889 | 4889 | } |
| 4890 | 4890 | |
| 4891 | - return (string) \preg_replace( |
|
| 4892 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
| 4891 | + return (string)\preg_replace( |
|
| 4892 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
| 4893 | 4893 | $replacement, |
| 4894 | 4894 | $str |
| 4895 | 4895 | ); |
@@ -4937,9 +4937,9 @@ discard block |
||
| 4937 | 4937 | return ''; |
| 4938 | 4938 | } |
| 4939 | 4939 | |
| 4940 | - $str_length -= (int) $bom_byte_length; |
|
| 4940 | + $str_length -= (int)$bom_byte_length; |
|
| 4941 | 4941 | |
| 4942 | - $str = (string) $str_tmp; |
|
| 4942 | + $str = (string)$str_tmp; |
|
| 4943 | 4943 | } |
| 4944 | 4944 | } |
| 4945 | 4945 | |
@@ -4968,7 +4968,7 @@ discard block |
||
| 4968 | 4968 | */ |
| 4969 | 4969 | if (\is_array($what) === true) { |
| 4970 | 4970 | foreach ($what as $item) { |
| 4971 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
| 4971 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
| 4972 | 4972 | } |
| 4973 | 4973 | } |
| 4974 | 4974 | |
@@ -5006,7 +5006,7 @@ discard block |
||
| 5006 | 5006 | */ |
| 5007 | 5007 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
| 5008 | 5008 | { |
| 5009 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 5009 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 5010 | 5010 | } |
| 5011 | 5011 | |
| 5012 | 5012 | /** |
@@ -5061,17 +5061,17 @@ discard block |
||
| 5061 | 5061 | ): string { |
| 5062 | 5062 | if ($substring && \strpos($str, $substring) === 0) { |
| 5063 | 5063 | if ($encoding === 'UTF-8') { |
| 5064 | - return (string) \mb_substr( |
|
| 5064 | + return (string)\mb_substr( |
|
| 5065 | 5065 | $str, |
| 5066 | - (int) \mb_strlen($substring) |
|
| 5066 | + (int)\mb_strlen($substring) |
|
| 5067 | 5067 | ); |
| 5068 | 5068 | } |
| 5069 | 5069 | |
| 5070 | 5070 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5071 | 5071 | |
| 5072 | - return (string) self::substr( |
|
| 5072 | + return (string)self::substr( |
|
| 5073 | 5073 | $str, |
| 5074 | - (int) self::strlen($substring, $encoding), |
|
| 5074 | + (int)self::strlen($substring, $encoding), |
|
| 5075 | 5075 | null, |
| 5076 | 5076 | $encoding |
| 5077 | 5077 | ); |
@@ -5099,19 +5099,19 @@ discard block |
||
| 5099 | 5099 | ): string { |
| 5100 | 5100 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
| 5101 | 5101 | if ($encoding === 'UTF-8') { |
| 5102 | - return (string) \mb_substr( |
|
| 5102 | + return (string)\mb_substr( |
|
| 5103 | 5103 | $str, |
| 5104 | 5104 | 0, |
| 5105 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
| 5105 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
| 5106 | 5106 | ); |
| 5107 | 5107 | } |
| 5108 | 5108 | |
| 5109 | 5109 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5110 | 5110 | |
| 5111 | - return (string) self::substr( |
|
| 5111 | + return (string)self::substr( |
|
| 5112 | 5112 | $str, |
| 5113 | 5113 | 0, |
| 5114 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
| 5114 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
| 5115 | 5115 | $encoding |
| 5116 | 5116 | ); |
| 5117 | 5117 | } |
@@ -5210,7 +5210,7 @@ discard block |
||
| 5210 | 5210 | $save = \mb_substitute_character(); |
| 5211 | 5211 | \mb_substitute_character($replacement_char_helper); |
| 5212 | 5212 | // the polyfill maybe return false, so cast to string |
| 5213 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 5213 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 5214 | 5214 | \mb_substitute_character($save); |
| 5215 | 5215 | } |
| 5216 | 5216 | |
@@ -5254,7 +5254,7 @@ discard block |
||
| 5254 | 5254 | } |
| 5255 | 5255 | |
| 5256 | 5256 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5257 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 5257 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 5258 | 5258 | } |
| 5259 | 5259 | |
| 5260 | 5260 | if ($chars) { |
@@ -5284,7 +5284,7 @@ discard block |
||
| 5284 | 5284 | $html .= '<pre>'; |
| 5285 | 5285 | /** @noinspection AlterInForeachInspection */ |
| 5286 | 5286 | foreach (self::$SUPPORT as $key => &$value) { |
| 5287 | - $html .= $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
| 5287 | + $html .= $key.' - '.\print_r($value, true)."\n<br>"; |
|
| 5288 | 5288 | } |
| 5289 | 5289 | $html .= '</pre>'; |
| 5290 | 5290 | |
@@ -5324,7 +5324,7 @@ discard block |
||
| 5324 | 5324 | return $char; |
| 5325 | 5325 | } |
| 5326 | 5326 | |
| 5327 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
| 5327 | + return '&#'.self::ord($char, $encoding).';'; |
|
| 5328 | 5328 | } |
| 5329 | 5329 | |
| 5330 | 5330 | /** |
@@ -5427,11 +5427,11 @@ discard block |
||
| 5427 | 5427 | $lang, |
| 5428 | 5428 | $try_to_keep_the_string_length |
| 5429 | 5429 | ); |
| 5430 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
| 5430 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
| 5431 | 5431 | |
| 5432 | 5432 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
| 5433 | 5433 | |
| 5434 | - $str = (string) \preg_replace_callback( |
|
| 5434 | + $str = (string)\preg_replace_callback( |
|
| 5435 | 5435 | '/[-_\\s]+(.)?/u', |
| 5436 | 5436 | /** |
| 5437 | 5437 | * @param array $match |
@@ -5440,7 +5440,7 @@ discard block |
||
| 5440 | 5440 | * |
| 5441 | 5441 | * @return string |
| 5442 | 5442 | */ |
| 5443 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
| 5443 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
| 5444 | 5444 | if (isset($match[1])) { |
| 5445 | 5445 | if ($use_mb_functions === true) { |
| 5446 | 5446 | if ($encoding === 'UTF-8') { |
@@ -5458,7 +5458,7 @@ discard block |
||
| 5458 | 5458 | $str |
| 5459 | 5459 | ); |
| 5460 | 5460 | |
| 5461 | - return (string) \preg_replace_callback( |
|
| 5461 | + return (string)\preg_replace_callback( |
|
| 5462 | 5462 | '/[\\p{N}]+(.)?/u', |
| 5463 | 5463 | /** |
| 5464 | 5464 | * @param array $match |
@@ -5467,7 +5467,7 @@ discard block |
||
| 5467 | 5467 | * |
| 5468 | 5468 | * @return string |
| 5469 | 5469 | */ |
| 5470 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
| 5470 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
| 5471 | 5471 | if ($use_mb_functions === true) { |
| 5472 | 5472 | if ($encoding === 'UTF-8') { |
| 5473 | 5473 | return \mb_strtoupper($match[0]); |
@@ -5659,7 +5659,7 @@ discard block |
||
| 5659 | 5659 | ): string { |
| 5660 | 5660 | if (self::$SUPPORT['mbstring'] === true) { |
| 5661 | 5661 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5662 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
| 5662 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
| 5663 | 5663 | |
| 5664 | 5664 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
| 5665 | 5665 | if ($use_mb_functions === true && $encoding === 'UTF-8') { |
@@ -5669,10 +5669,10 @@ discard block |
||
| 5669 | 5669 | } |
| 5670 | 5670 | |
| 5671 | 5671 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5672 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
| 5672 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
| 5673 | 5673 | } |
| 5674 | 5674 | |
| 5675 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
| 5675 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
| 5676 | 5676 | |
| 5677 | 5677 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
| 5678 | 5678 | if ($use_mb_functions === true && $encoding === 'UTF-8') { |
@@ -5681,7 +5681,7 @@ discard block |
||
| 5681 | 5681 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
| 5682 | 5682 | } |
| 5683 | 5683 | |
| 5684 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
| 5684 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
| 5685 | 5685 | } |
| 5686 | 5686 | |
| 5687 | 5687 | /** |
@@ -5698,7 +5698,7 @@ discard block |
||
| 5698 | 5698 | public static function str_detect_encoding($str) |
| 5699 | 5699 | { |
| 5700 | 5700 | // init |
| 5701 | - $str = (string) $str; |
|
| 5701 | + $str = (string)$str; |
|
| 5702 | 5702 | |
| 5703 | 5703 | // |
| 5704 | 5704 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5800,7 +5800,7 @@ discard block |
||
| 5800 | 5800 | foreach (self::$ENCODINGS as $encoding_tmp) { |
| 5801 | 5801 | // INFO: //IGNORE but still throw notice |
| 5802 | 5802 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 5803 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
| 5803 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
| 5804 | 5804 | return $encoding_tmp; |
| 5805 | 5805 | } |
| 5806 | 5806 | } |
@@ -5897,7 +5897,7 @@ discard block |
||
| 5897 | 5897 | return $str; |
| 5898 | 5898 | } |
| 5899 | 5899 | |
| 5900 | - return $substring . $str; |
|
| 5900 | + return $substring.$str; |
|
| 5901 | 5901 | } |
| 5902 | 5902 | |
| 5903 | 5903 | /** |
@@ -6188,27 +6188,27 @@ discard block |
||
| 6188 | 6188 | string $encoding = 'UTF-8' |
| 6189 | 6189 | ): string { |
| 6190 | 6190 | if ($encoding === 'UTF-8') { |
| 6191 | - $len = (int) \mb_strlen($str); |
|
| 6191 | + $len = (int)\mb_strlen($str); |
|
| 6192 | 6192 | if ($index > $len) { |
| 6193 | 6193 | return $str; |
| 6194 | 6194 | } |
| 6195 | 6195 | |
| 6196 | 6196 | /** @noinspection UnnecessaryCastingInspection */ |
| 6197 | - return (string) \mb_substr($str, 0, $index) . |
|
| 6198 | - $substring . |
|
| 6199 | - (string) \mb_substr($str, $index, $len); |
|
| 6197 | + return (string)\mb_substr($str, 0, $index). |
|
| 6198 | + $substring. |
|
| 6199 | + (string)\mb_substr($str, $index, $len); |
|
| 6200 | 6200 | } |
| 6201 | 6201 | |
| 6202 | 6202 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6203 | 6203 | |
| 6204 | - $len = (int) self::strlen($str, $encoding); |
|
| 6204 | + $len = (int)self::strlen($str, $encoding); |
|
| 6205 | 6205 | if ($index > $len) { |
| 6206 | 6206 | return $str; |
| 6207 | 6207 | } |
| 6208 | 6208 | |
| 6209 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
| 6210 | - $substring . |
|
| 6211 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
| 6209 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
| 6210 | + $substring. |
|
| 6211 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
| 6212 | 6212 | } |
| 6213 | 6213 | |
| 6214 | 6214 | /** |
@@ -6240,15 +6240,15 @@ discard block |
||
| 6240 | 6240 | */ |
| 6241 | 6241 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
| 6242 | 6242 | { |
| 6243 | - $search = (array) $search; |
|
| 6243 | + $search = (array)$search; |
|
| 6244 | 6244 | |
| 6245 | 6245 | /** @noinspection AlterInForeachInspection */ |
| 6246 | 6246 | foreach ($search as &$s) { |
| 6247 | - $s = (string) $s; |
|
| 6247 | + $s = (string)$s; |
|
| 6248 | 6248 | if ($s === '') { |
| 6249 | 6249 | $s = '/^(?<=.)$/'; |
| 6250 | 6250 | } else { |
| 6251 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
| 6251 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
| 6252 | 6252 | } |
| 6253 | 6253 | } |
| 6254 | 6254 | |
@@ -6282,11 +6282,11 @@ discard block |
||
| 6282 | 6282 | } |
| 6283 | 6283 | |
| 6284 | 6284 | if ($search === '') { |
| 6285 | - return $str . $replacement; |
|
| 6285 | + return $str.$replacement; |
|
| 6286 | 6286 | } |
| 6287 | 6287 | |
| 6288 | 6288 | if (\stripos($str, $search) === 0) { |
| 6289 | - return $replacement . \substr($str, \strlen($search)); |
|
| 6289 | + return $replacement.\substr($str, \strlen($search)); |
|
| 6290 | 6290 | } |
| 6291 | 6291 | |
| 6292 | 6292 | return $str; |
@@ -6317,11 +6317,11 @@ discard block |
||
| 6317 | 6317 | } |
| 6318 | 6318 | |
| 6319 | 6319 | if ($search === '') { |
| 6320 | - return $str . $replacement; |
|
| 6320 | + return $str.$replacement; |
|
| 6321 | 6321 | } |
| 6322 | 6322 | |
| 6323 | 6323 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 6324 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 6324 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 6325 | 6325 | } |
| 6326 | 6326 | |
| 6327 | 6327 | return $str; |
@@ -6407,15 +6407,15 @@ discard block |
||
| 6407 | 6407 | } |
| 6408 | 6408 | |
| 6409 | 6409 | if ($encoding === 'UTF-8') { |
| 6410 | - return (string) \mb_substr( |
|
| 6410 | + return (string)\mb_substr( |
|
| 6411 | 6411 | $str, |
| 6412 | - $offset + (int) \mb_strlen($separator) |
|
| 6412 | + $offset + (int)\mb_strlen($separator) |
|
| 6413 | 6413 | ); |
| 6414 | 6414 | } |
| 6415 | 6415 | |
| 6416 | - return (string) self::substr( |
|
| 6416 | + return (string)self::substr( |
|
| 6417 | 6417 | $str, |
| 6418 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6418 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6419 | 6419 | null, |
| 6420 | 6420 | $encoding |
| 6421 | 6421 | ); |
@@ -6447,15 +6447,15 @@ discard block |
||
| 6447 | 6447 | } |
| 6448 | 6448 | |
| 6449 | 6449 | if ($encoding === 'UTF-8') { |
| 6450 | - return (string) \mb_substr( |
|
| 6450 | + return (string)\mb_substr( |
|
| 6451 | 6451 | $str, |
| 6452 | - $offset + (int) self::strlen($separator) |
|
| 6452 | + $offset + (int)self::strlen($separator) |
|
| 6453 | 6453 | ); |
| 6454 | 6454 | } |
| 6455 | 6455 | |
| 6456 | - return (string) self::substr( |
|
| 6456 | + return (string)self::substr( |
|
| 6457 | 6457 | $str, |
| 6458 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6458 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6459 | 6459 | null, |
| 6460 | 6460 | $encoding |
| 6461 | 6461 | ); |
@@ -6487,10 +6487,10 @@ discard block |
||
| 6487 | 6487 | } |
| 6488 | 6488 | |
| 6489 | 6489 | if ($encoding === 'UTF-8') { |
| 6490 | - return (string) \mb_substr($str, 0, $offset); |
|
| 6490 | + return (string)\mb_substr($str, 0, $offset); |
|
| 6491 | 6491 | } |
| 6492 | 6492 | |
| 6493 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 6493 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 6494 | 6494 | } |
| 6495 | 6495 | |
| 6496 | 6496 | /** |
@@ -6519,7 +6519,7 @@ discard block |
||
| 6519 | 6519 | return ''; |
| 6520 | 6520 | } |
| 6521 | 6521 | |
| 6522 | - return (string) \mb_substr($str, 0, $offset); |
|
| 6522 | + return (string)\mb_substr($str, 0, $offset); |
|
| 6523 | 6523 | } |
| 6524 | 6524 | |
| 6525 | 6525 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6527,7 +6527,7 @@ discard block |
||
| 6527 | 6527 | return ''; |
| 6528 | 6528 | } |
| 6529 | 6529 | |
| 6530 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 6530 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 6531 | 6531 | } |
| 6532 | 6532 | |
| 6533 | 6533 | /** |
@@ -6629,12 +6629,12 @@ discard block |
||
| 6629 | 6629 | } |
| 6630 | 6630 | |
| 6631 | 6631 | if ($encoding === 'UTF-8') { |
| 6632 | - return (string) \mb_substr($str, -$n); |
|
| 6632 | + return (string)\mb_substr($str, -$n); |
|
| 6633 | 6633 | } |
| 6634 | 6634 | |
| 6635 | 6635 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6636 | 6636 | |
| 6637 | - return (string) self::substr($str, -$n, null, $encoding); |
|
| 6637 | + return (string)self::substr($str, -$n, null, $encoding); |
|
| 6638 | 6638 | } |
| 6639 | 6639 | |
| 6640 | 6640 | /** |
@@ -6660,21 +6660,21 @@ discard block |
||
| 6660 | 6660 | } |
| 6661 | 6661 | |
| 6662 | 6662 | if ($encoding === 'UTF-8') { |
| 6663 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 6663 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 6664 | 6664 | return $str; |
| 6665 | 6665 | } |
| 6666 | 6666 | |
| 6667 | 6667 | /** @noinspection UnnecessaryCastingInspection */ |
| 6668 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
| 6668 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
| 6669 | 6669 | } |
| 6670 | 6670 | |
| 6671 | 6671 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6672 | 6672 | |
| 6673 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 6673 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 6674 | 6674 | return $str; |
| 6675 | 6675 | } |
| 6676 | 6676 | |
| 6677 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
| 6677 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
| 6678 | 6678 | } |
| 6679 | 6679 | |
| 6680 | 6680 | /** |
@@ -6701,12 +6701,12 @@ discard block |
||
| 6701 | 6701 | |
| 6702 | 6702 | if ($encoding === 'UTF-8') { |
| 6703 | 6703 | /** @noinspection UnnecessaryCastingInspection */ |
| 6704 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 6704 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 6705 | 6705 | return $str; |
| 6706 | 6706 | } |
| 6707 | 6707 | |
| 6708 | 6708 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
| 6709 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
| 6709 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
| 6710 | 6710 | } |
| 6711 | 6711 | |
| 6712 | 6712 | $str = \mb_substr($str, 0, $length); |
@@ -6716,22 +6716,22 @@ discard block |
||
| 6716 | 6716 | $new_str = \implode(' ', $array); |
| 6717 | 6717 | |
| 6718 | 6718 | if ($new_str === '') { |
| 6719 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
| 6719 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
| 6720 | 6720 | } |
| 6721 | 6721 | } else { |
| 6722 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 6722 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 6723 | 6723 | return $str; |
| 6724 | 6724 | } |
| 6725 | 6725 | |
| 6726 | 6726 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
| 6727 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
| 6727 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
| 6728 | 6728 | } |
| 6729 | 6729 | |
| 6730 | 6730 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 6731 | 6731 | $str = self::substr($str, 0, $length, $encoding); |
| 6732 | 6732 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 6733 | 6733 | if ($str === false) { |
| 6734 | - return '' . $str_add_on; |
|
| 6734 | + return ''.$str_add_on; |
|
| 6735 | 6735 | } |
| 6736 | 6736 | |
| 6737 | 6737 | $array = \explode(' ', $str); |
@@ -6739,11 +6739,11 @@ discard block |
||
| 6739 | 6739 | $new_str = \implode(' ', $array); |
| 6740 | 6740 | |
| 6741 | 6741 | if ($new_str === '') { |
| 6742 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
| 6742 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
| 6743 | 6743 | } |
| 6744 | 6744 | } |
| 6745 | 6745 | |
| 6746 | - return $new_str . $str_add_on; |
|
| 6746 | + return $new_str.$str_add_on; |
|
| 6747 | 6747 | } |
| 6748 | 6748 | |
| 6749 | 6749 | /** |
@@ -6766,7 +6766,7 @@ discard block |
||
| 6766 | 6766 | $longest_common_prefix = ''; |
| 6767 | 6767 | |
| 6768 | 6768 | if ($encoding === 'UTF-8') { |
| 6769 | - $max_length = (int) \min( |
|
| 6769 | + $max_length = (int)\min( |
|
| 6770 | 6770 | \mb_strlen($str1), |
| 6771 | 6771 | \mb_strlen($str2) |
| 6772 | 6772 | ); |
@@ -6787,7 +6787,7 @@ discard block |
||
| 6787 | 6787 | } else { |
| 6788 | 6788 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6789 | 6789 | |
| 6790 | - $max_length = (int) \min( |
|
| 6790 | + $max_length = (int)\min( |
|
| 6791 | 6791 | self::strlen($str1, $encoding), |
| 6792 | 6792 | self::strlen($str2, $encoding) |
| 6793 | 6793 | ); |
@@ -6836,13 +6836,13 @@ discard block |
||
| 6836 | 6836 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
| 6837 | 6837 | |
| 6838 | 6838 | if ($encoding === 'UTF-8') { |
| 6839 | - $str_length = (int) \mb_strlen($str1); |
|
| 6840 | - $other_length = (int) \mb_strlen($str2); |
|
| 6839 | + $str_length = (int)\mb_strlen($str1); |
|
| 6840 | + $other_length = (int)\mb_strlen($str2); |
|
| 6841 | 6841 | } else { |
| 6842 | 6842 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6843 | 6843 | |
| 6844 | - $str_length = (int) self::strlen($str1, $encoding); |
|
| 6845 | - $other_length = (int) self::strlen($str2, $encoding); |
|
| 6844 | + $str_length = (int)self::strlen($str1, $encoding); |
|
| 6845 | + $other_length = (int)self::strlen($str2, $encoding); |
|
| 6846 | 6846 | } |
| 6847 | 6847 | |
| 6848 | 6848 | // Return if either string is empty |
@@ -6895,10 +6895,10 @@ discard block |
||
| 6895 | 6895 | } |
| 6896 | 6896 | |
| 6897 | 6897 | if ($encoding === 'UTF-8') { |
| 6898 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
| 6898 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
| 6899 | 6899 | } |
| 6900 | 6900 | |
| 6901 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
| 6901 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
| 6902 | 6902 | } |
| 6903 | 6903 | |
| 6904 | 6904 | /** |
@@ -6922,7 +6922,7 @@ discard block |
||
| 6922 | 6922 | } |
| 6923 | 6923 | |
| 6924 | 6924 | if ($encoding === 'UTF-8') { |
| 6925 | - $max_length = (int) \min( |
|
| 6925 | + $max_length = (int)\min( |
|
| 6926 | 6926 | \mb_strlen($str1, $encoding), |
| 6927 | 6927 | \mb_strlen($str2, $encoding) |
| 6928 | 6928 | ); |
@@ -6936,7 +6936,7 @@ discard block |
||
| 6936 | 6936 | && |
| 6937 | 6937 | $char === \mb_substr($str2, -$i, 1) |
| 6938 | 6938 | ) { |
| 6939 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
| 6939 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
| 6940 | 6940 | } else { |
| 6941 | 6941 | break; |
| 6942 | 6942 | } |
@@ -6944,7 +6944,7 @@ discard block |
||
| 6944 | 6944 | } else { |
| 6945 | 6945 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6946 | 6946 | |
| 6947 | - $max_length = (int) \min( |
|
| 6947 | + $max_length = (int)\min( |
|
| 6948 | 6948 | self::strlen($str1, $encoding), |
| 6949 | 6949 | self::strlen($str2, $encoding) |
| 6950 | 6950 | ); |
@@ -6958,7 +6958,7 @@ discard block |
||
| 6958 | 6958 | && |
| 6959 | 6959 | $char === self::substr($str2, -$i, 1, $encoding) |
| 6960 | 6960 | ) { |
| 6961 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
| 6961 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
| 6962 | 6962 | } else { |
| 6963 | 6963 | break; |
| 6964 | 6964 | } |
@@ -6980,7 +6980,7 @@ discard block |
||
| 6980 | 6980 | */ |
| 6981 | 6981 | public static function str_matches_pattern(string $str, string $pattern): bool |
| 6982 | 6982 | { |
| 6983 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
| 6983 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
| 6984 | 6984 | } |
| 6985 | 6985 | |
| 6986 | 6986 | /** |
@@ -6999,7 +6999,7 @@ discard block |
||
| 6999 | 6999 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
| 7000 | 7000 | { |
| 7001 | 7001 | // init |
| 7002 | - $length = (int) self::strlen($str, $encoding); |
|
| 7002 | + $length = (int)self::strlen($str, $encoding); |
|
| 7003 | 7003 | |
| 7004 | 7004 | if ($offset >= 0) { |
| 7005 | 7005 | return $length > $offset; |
@@ -7028,7 +7028,7 @@ discard block |
||
| 7028 | 7028 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
| 7029 | 7029 | { |
| 7030 | 7030 | // init |
| 7031 | - $length = (int) self::strlen($str); |
|
| 7031 | + $length = (int)self::strlen($str); |
|
| 7032 | 7032 | |
| 7033 | 7033 | if ( |
| 7034 | 7034 | ($index >= 0 && $length <= $index) |
@@ -7070,7 +7070,7 @@ discard block |
||
| 7070 | 7070 | return $str; |
| 7071 | 7071 | } |
| 7072 | 7072 | |
| 7073 | - if ($pad_type !== (int) $pad_type) { |
|
| 7073 | + if ($pad_type !== (int)$pad_type) { |
|
| 7074 | 7074 | if ($pad_type === 'left') { |
| 7075 | 7075 | $pad_type = \STR_PAD_LEFT; |
| 7076 | 7076 | } elseif ($pad_type === 'right') { |
@@ -7079,23 +7079,23 @@ discard block |
||
| 7079 | 7079 | $pad_type = \STR_PAD_BOTH; |
| 7080 | 7080 | } else { |
| 7081 | 7081 | throw new \InvalidArgumentException( |
| 7082 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
| 7082 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
| 7083 | 7083 | ); |
| 7084 | 7084 | } |
| 7085 | 7085 | } |
| 7086 | 7086 | |
| 7087 | 7087 | if ($encoding === 'UTF-8') { |
| 7088 | - $str_length = (int) \mb_strlen($str); |
|
| 7088 | + $str_length = (int)\mb_strlen($str); |
|
| 7089 | 7089 | |
| 7090 | 7090 | if ($pad_length >= $str_length) { |
| 7091 | 7091 | switch ($pad_type) { |
| 7092 | 7092 | case \STR_PAD_LEFT: |
| 7093 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 7093 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 7094 | 7094 | |
| 7095 | 7095 | $diff = ($pad_length - $str_length); |
| 7096 | 7096 | |
| 7097 | - $pre = (string) \mb_substr( |
|
| 7098 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7097 | + $pre = (string)\mb_substr( |
|
| 7098 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7099 | 7099 | 0, |
| 7100 | 7100 | $diff |
| 7101 | 7101 | ); |
@@ -7106,16 +7106,16 @@ discard block |
||
| 7106 | 7106 | case \STR_PAD_BOTH: |
| 7107 | 7107 | $diff = ($pad_length - $str_length); |
| 7108 | 7108 | |
| 7109 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 7109 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 7110 | 7110 | |
| 7111 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 7111 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 7112 | 7112 | |
| 7113 | - $pre = (string) \mb_substr( |
|
| 7113 | + $pre = (string)\mb_substr( |
|
| 7114 | 7114 | \str_repeat($pad_string, $ps_length_left), |
| 7115 | 7115 | 0, |
| 7116 | 7116 | $ps_length_left |
| 7117 | 7117 | ); |
| 7118 | - $post = (string) \mb_substr( |
|
| 7118 | + $post = (string)\mb_substr( |
|
| 7119 | 7119 | \str_repeat($pad_string, $ps_length_right), |
| 7120 | 7120 | 0, |
| 7121 | 7121 | $ps_length_right |
@@ -7125,19 +7125,19 @@ discard block |
||
| 7125 | 7125 | |
| 7126 | 7126 | case \STR_PAD_RIGHT: |
| 7127 | 7127 | default: |
| 7128 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 7128 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 7129 | 7129 | |
| 7130 | 7130 | $diff = ($pad_length - $str_length); |
| 7131 | 7131 | |
| 7132 | - $post = (string) \mb_substr( |
|
| 7133 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7132 | + $post = (string)\mb_substr( |
|
| 7133 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7134 | 7134 | 0, |
| 7135 | 7135 | $diff |
| 7136 | 7136 | ); |
| 7137 | 7137 | $pre = ''; |
| 7138 | 7138 | } |
| 7139 | 7139 | |
| 7140 | - return $pre . $str . $post; |
|
| 7140 | + return $pre.$str.$post; |
|
| 7141 | 7141 | } |
| 7142 | 7142 | |
| 7143 | 7143 | return $str; |
@@ -7145,17 +7145,17 @@ discard block |
||
| 7145 | 7145 | |
| 7146 | 7146 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7147 | 7147 | |
| 7148 | - $str_length = (int) self::strlen($str, $encoding); |
|
| 7148 | + $str_length = (int)self::strlen($str, $encoding); |
|
| 7149 | 7149 | |
| 7150 | 7150 | if ($pad_length >= $str_length) { |
| 7151 | 7151 | switch ($pad_type) { |
| 7152 | 7152 | case \STR_PAD_LEFT: |
| 7153 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 7153 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 7154 | 7154 | |
| 7155 | 7155 | $diff = ($pad_length - $str_length); |
| 7156 | 7156 | |
| 7157 | - $pre = (string) self::substr( |
|
| 7158 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7157 | + $pre = (string)self::substr( |
|
| 7158 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7159 | 7159 | 0, |
| 7160 | 7160 | $diff, |
| 7161 | 7161 | $encoding |
@@ -7167,17 +7167,17 @@ discard block |
||
| 7167 | 7167 | case \STR_PAD_BOTH: |
| 7168 | 7168 | $diff = ($pad_length - $str_length); |
| 7169 | 7169 | |
| 7170 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 7170 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 7171 | 7171 | |
| 7172 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 7172 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 7173 | 7173 | |
| 7174 | - $pre = (string) self::substr( |
|
| 7174 | + $pre = (string)self::substr( |
|
| 7175 | 7175 | \str_repeat($pad_string, $ps_length_left), |
| 7176 | 7176 | 0, |
| 7177 | 7177 | $ps_length_left, |
| 7178 | 7178 | $encoding |
| 7179 | 7179 | ); |
| 7180 | - $post = (string) self::substr( |
|
| 7180 | + $post = (string)self::substr( |
|
| 7181 | 7181 | \str_repeat($pad_string, $ps_length_right), |
| 7182 | 7182 | 0, |
| 7183 | 7183 | $ps_length_right, |
@@ -7188,12 +7188,12 @@ discard block |
||
| 7188 | 7188 | |
| 7189 | 7189 | case \STR_PAD_RIGHT: |
| 7190 | 7190 | default: |
| 7191 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 7191 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 7192 | 7192 | |
| 7193 | 7193 | $diff = ($pad_length - $str_length); |
| 7194 | 7194 | |
| 7195 | - $post = (string) self::substr( |
|
| 7196 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7195 | + $post = (string)self::substr( |
|
| 7196 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7197 | 7197 | 0, |
| 7198 | 7198 | $diff, |
| 7199 | 7199 | $encoding |
@@ -7201,7 +7201,7 @@ discard block |
||
| 7201 | 7201 | $pre = ''; |
| 7202 | 7202 | } |
| 7203 | 7203 | |
| 7204 | - return $pre . $str . $post; |
|
| 7204 | + return $pre.$str.$post; |
|
| 7205 | 7205 | } |
| 7206 | 7206 | |
| 7207 | 7207 | return $str; |
@@ -7398,11 +7398,11 @@ discard block |
||
| 7398 | 7398 | } |
| 7399 | 7399 | |
| 7400 | 7400 | if ($search === '') { |
| 7401 | - return $str . $replacement; |
|
| 7401 | + return $str.$replacement; |
|
| 7402 | 7402 | } |
| 7403 | 7403 | |
| 7404 | 7404 | if (\strpos($str, $search) === 0) { |
| 7405 | - return $replacement . \substr($str, \strlen($search)); |
|
| 7405 | + return $replacement.\substr($str, \strlen($search)); |
|
| 7406 | 7406 | } |
| 7407 | 7407 | |
| 7408 | 7408 | return $str; |
@@ -7436,11 +7436,11 @@ discard block |
||
| 7436 | 7436 | } |
| 7437 | 7437 | |
| 7438 | 7438 | if ($search === '') { |
| 7439 | - return $str . $replacement; |
|
| 7439 | + return $str.$replacement; |
|
| 7440 | 7440 | } |
| 7441 | 7441 | |
| 7442 | 7442 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 7443 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 7443 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 7444 | 7444 | } |
| 7445 | 7445 | |
| 7446 | 7446 | return $str; |
@@ -7474,7 +7474,7 @@ discard block |
||
| 7474 | 7474 | $subject, |
| 7475 | 7475 | $replace, |
| 7476 | 7476 | $pos, |
| 7477 | - (int) self::strlen($search) |
|
| 7477 | + (int)self::strlen($search) |
|
| 7478 | 7478 | ); |
| 7479 | 7479 | } |
| 7480 | 7480 | |
@@ -7508,7 +7508,7 @@ discard block |
||
| 7508 | 7508 | $subject, |
| 7509 | 7509 | $replace, |
| 7510 | 7510 | $pos, |
| 7511 | - (int) self::strlen($search) |
|
| 7511 | + (int)self::strlen($search) |
|
| 7512 | 7512 | ); |
| 7513 | 7513 | } |
| 7514 | 7514 | |
@@ -7531,7 +7531,7 @@ discard block |
||
| 7531 | 7531 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
| 7532 | 7532 | { |
| 7533 | 7533 | if ($encoding === 'UTF-8') { |
| 7534 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
| 7534 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
| 7535 | 7535 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 7536 | 7536 | \shuffle($indexes); |
| 7537 | 7537 | |
@@ -7547,7 +7547,7 @@ discard block |
||
| 7547 | 7547 | } else { |
| 7548 | 7548 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7549 | 7549 | |
| 7550 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
| 7550 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
| 7551 | 7551 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 7552 | 7552 | \shuffle($indexes); |
| 7553 | 7553 | |
@@ -7590,11 +7590,11 @@ discard block |
||
| 7590 | 7590 | ) { |
| 7591 | 7591 | if ($encoding === 'UTF-8') { |
| 7592 | 7592 | if ($end === null) { |
| 7593 | - $length = (int) \mb_strlen($str); |
|
| 7593 | + $length = (int)\mb_strlen($str); |
|
| 7594 | 7594 | } elseif ($end >= 0 && $end <= $start) { |
| 7595 | 7595 | return ''; |
| 7596 | 7596 | } elseif ($end < 0) { |
| 7597 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
| 7597 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
| 7598 | 7598 | } else { |
| 7599 | 7599 | $length = $end - $start; |
| 7600 | 7600 | } |
@@ -7605,11 +7605,11 @@ discard block |
||
| 7605 | 7605 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7606 | 7606 | |
| 7607 | 7607 | if ($end === null) { |
| 7608 | - $length = (int) self::strlen($str, $encoding); |
|
| 7608 | + $length = (int)self::strlen($str, $encoding); |
|
| 7609 | 7609 | } elseif ($end >= 0 && $end <= $start) { |
| 7610 | 7610 | return ''; |
| 7611 | 7611 | } elseif ($end < 0) { |
| 7612 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
| 7612 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
| 7613 | 7613 | } else { |
| 7614 | 7614 | $length = $end - $start; |
| 7615 | 7615 | } |
@@ -7644,7 +7644,7 @@ discard block |
||
| 7644 | 7644 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7645 | 7645 | } |
| 7646 | 7646 | |
| 7647 | - $str = (string) \preg_replace_callback( |
|
| 7647 | + $str = (string)\preg_replace_callback( |
|
| 7648 | 7648 | '/([\\p{N}|\\p{Lu}])/u', |
| 7649 | 7649 | /** |
| 7650 | 7650 | * @param string[] $matches |
@@ -7653,28 +7653,28 @@ discard block |
||
| 7653 | 7653 | * |
| 7654 | 7654 | * @return string |
| 7655 | 7655 | */ |
| 7656 | - static function (array $matches) use ($encoding): string { |
|
| 7656 | + static function(array $matches) use ($encoding): string { |
|
| 7657 | 7657 | $match = $matches[1]; |
| 7658 | - $match_int = (int) $match; |
|
| 7658 | + $match_int = (int)$match; |
|
| 7659 | 7659 | |
| 7660 | - if ((string) $match_int === $match) { |
|
| 7661 | - return '_' . $match . '_'; |
|
| 7660 | + if ((string)$match_int === $match) { |
|
| 7661 | + return '_'.$match.'_'; |
|
| 7662 | 7662 | } |
| 7663 | 7663 | |
| 7664 | 7664 | if ($encoding === 'UTF-8') { |
| 7665 | - return '_' . \mb_strtolower($match); |
|
| 7665 | + return '_'.\mb_strtolower($match); |
|
| 7666 | 7666 | } |
| 7667 | 7667 | |
| 7668 | - return '_' . self::strtolower($match, $encoding); |
|
| 7668 | + return '_'.self::strtolower($match, $encoding); |
|
| 7669 | 7669 | }, |
| 7670 | 7670 | $str |
| 7671 | 7671 | ); |
| 7672 | 7672 | |
| 7673 | - $str = (string) \preg_replace( |
|
| 7673 | + $str = (string)\preg_replace( |
|
| 7674 | 7674 | [ |
| 7675 | - '/\\s+/u', // convert spaces to "_" |
|
| 7675 | + '/\\s+/u', // convert spaces to "_" |
|
| 7676 | 7676 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
| 7677 | - '/_+/', // remove double "_" |
|
| 7677 | + '/_+/', // remove double "_" |
|
| 7678 | 7678 | ], |
| 7679 | 7679 | [ |
| 7680 | 7680 | '_', |
@@ -7756,7 +7756,7 @@ discard block |
||
| 7756 | 7756 | } |
| 7757 | 7757 | |
| 7758 | 7758 | // init |
| 7759 | - $str = (string) $str; |
|
| 7759 | + $str = (string)$str; |
|
| 7760 | 7760 | |
| 7761 | 7761 | if ($str === '') { |
| 7762 | 7762 | return []; |
@@ -7813,7 +7813,7 @@ discard block |
||
| 7813 | 7813 | ($str[$i] & "\xE0") === "\xC0" |
| 7814 | 7814 | ) { |
| 7815 | 7815 | if (($str[$i + 1] & "\xC0") === "\x80") { |
| 7816 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
| 7816 | + $ret[] = $str[$i].$str[$i + 1]; |
|
| 7817 | 7817 | |
| 7818 | 7818 | ++$i; |
| 7819 | 7819 | } |
@@ -7827,7 +7827,7 @@ discard block |
||
| 7827 | 7827 | && |
| 7828 | 7828 | ($str[$i + 2] & "\xC0") === "\x80" |
| 7829 | 7829 | ) { |
| 7830 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
| 7830 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
| 7831 | 7831 | |
| 7832 | 7832 | $i += 2; |
| 7833 | 7833 | } |
@@ -7843,7 +7843,7 @@ discard block |
||
| 7843 | 7843 | && |
| 7844 | 7844 | ($str[$i + 3] & "\xC0") === "\x80" |
| 7845 | 7845 | ) { |
| 7846 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
| 7846 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
| 7847 | 7847 | |
| 7848 | 7848 | $i += 3; |
| 7849 | 7849 | } |
@@ -7855,7 +7855,7 @@ discard block |
||
| 7855 | 7855 | $ret = \array_chunk($ret, $length); |
| 7856 | 7856 | |
| 7857 | 7857 | return \array_map( |
| 7858 | - static function (array &$item): string { |
|
| 7858 | + static function(array &$item): string { |
|
| 7859 | 7859 | return \implode('', $item); |
| 7860 | 7860 | }, |
| 7861 | 7861 | $ret |
@@ -7921,7 +7921,7 @@ discard block |
||
| 7921 | 7921 | $limit = -1; |
| 7922 | 7922 | } |
| 7923 | 7923 | |
| 7924 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
| 7924 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
| 7925 | 7925 | |
| 7926 | 7926 | if ($array === false) { |
| 7927 | 7927 | return []; |
@@ -8011,9 +8011,9 @@ discard block |
||
| 8011 | 8011 | return ''; |
| 8012 | 8012 | } |
| 8013 | 8013 | |
| 8014 | - return (string) \mb_substr( |
|
| 8014 | + return (string)\mb_substr( |
|
| 8015 | 8015 | $str, |
| 8016 | - $offset + (int) \mb_strlen($separator) |
|
| 8016 | + $offset + (int)\mb_strlen($separator) |
|
| 8017 | 8017 | ); |
| 8018 | 8018 | } |
| 8019 | 8019 | |
@@ -8022,9 +8022,9 @@ discard block |
||
| 8022 | 8022 | return ''; |
| 8023 | 8023 | } |
| 8024 | 8024 | |
| 8025 | - return (string) \mb_substr( |
|
| 8025 | + return (string)\mb_substr( |
|
| 8026 | 8026 | $str, |
| 8027 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 8027 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 8028 | 8028 | null, |
| 8029 | 8029 | $encoding |
| 8030 | 8030 | ); |
@@ -8053,9 +8053,9 @@ discard block |
||
| 8053 | 8053 | return ''; |
| 8054 | 8054 | } |
| 8055 | 8055 | |
| 8056 | - return (string) \mb_substr( |
|
| 8056 | + return (string)\mb_substr( |
|
| 8057 | 8057 | $str, |
| 8058 | - $offset + (int) \mb_strlen($separator) |
|
| 8058 | + $offset + (int)\mb_strlen($separator) |
|
| 8059 | 8059 | ); |
| 8060 | 8060 | } |
| 8061 | 8061 | |
@@ -8064,9 +8064,9 @@ discard block |
||
| 8064 | 8064 | return ''; |
| 8065 | 8065 | } |
| 8066 | 8066 | |
| 8067 | - return (string) self::substr( |
|
| 8067 | + return (string)self::substr( |
|
| 8068 | 8068 | $str, |
| 8069 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 8069 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 8070 | 8070 | null, |
| 8071 | 8071 | $encoding |
| 8072 | 8072 | ); |
@@ -8098,7 +8098,7 @@ discard block |
||
| 8098 | 8098 | return ''; |
| 8099 | 8099 | } |
| 8100 | 8100 | |
| 8101 | - return (string) \mb_substr( |
|
| 8101 | + return (string)\mb_substr( |
|
| 8102 | 8102 | $str, |
| 8103 | 8103 | 0, |
| 8104 | 8104 | $offset |
@@ -8110,7 +8110,7 @@ discard block |
||
| 8110 | 8110 | return ''; |
| 8111 | 8111 | } |
| 8112 | 8112 | |
| 8113 | - return (string) self::substr( |
|
| 8113 | + return (string)self::substr( |
|
| 8114 | 8114 | $str, |
| 8115 | 8115 | 0, |
| 8116 | 8116 | $offset, |
@@ -8141,7 +8141,7 @@ discard block |
||
| 8141 | 8141 | return ''; |
| 8142 | 8142 | } |
| 8143 | 8143 | |
| 8144 | - return (string) \mb_substr( |
|
| 8144 | + return (string)\mb_substr( |
|
| 8145 | 8145 | $str, |
| 8146 | 8146 | 0, |
| 8147 | 8147 | $offset |
@@ -8155,7 +8155,7 @@ discard block |
||
| 8155 | 8155 | |
| 8156 | 8156 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8157 | 8157 | |
| 8158 | - return (string) self::substr( |
|
| 8158 | + return (string)self::substr( |
|
| 8159 | 8159 | $str, |
| 8160 | 8160 | 0, |
| 8161 | 8161 | $offset, |
@@ -8270,7 +8270,7 @@ discard block |
||
| 8270 | 8270 | */ |
| 8271 | 8271 | public static function str_surround(string $str, string $substring): string |
| 8272 | 8272 | { |
| 8273 | - return $substring . $str . $substring; |
|
| 8273 | + return $substring.$str.$substring; |
|
| 8274 | 8274 | } |
| 8275 | 8275 | |
| 8276 | 8276 | /** |
@@ -8332,9 +8332,9 @@ discard block |
||
| 8332 | 8332 | $word_define_chars = ''; |
| 8333 | 8333 | } |
| 8334 | 8334 | |
| 8335 | - $str = (string) \preg_replace_callback( |
|
| 8336 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
| 8337 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
| 8335 | + $str = (string)\preg_replace_callback( |
|
| 8336 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
| 8337 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
| 8338 | 8338 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
| 8339 | 8339 | return $match[0]; |
| 8340 | 8340 | } |
@@ -8433,16 +8433,16 @@ discard block |
||
| 8433 | 8433 | } |
| 8434 | 8434 | |
| 8435 | 8435 | // the main substitutions |
| 8436 | - $str = (string) \preg_replace_callback( |
|
| 8436 | + $str = (string)\preg_replace_callback( |
|
| 8437 | 8437 | '~\\b (_*) (?: # 1. Leading underscore and |
| 8438 | 8438 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
| 8439 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
| 8439 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
| 8440 | 8440 | | |
| 8441 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
| 8441 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
| 8442 | 8442 | | |
| 8443 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
| 8443 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
| 8444 | 8444 | | |
| 8445 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
| 8445 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
| 8446 | 8446 | ) (_*) \\b # 6. With trailing underscore |
| 8447 | 8447 | ~ux', |
| 8448 | 8448 | /** |
@@ -8452,7 +8452,7 @@ discard block |
||
| 8452 | 8452 | * |
| 8453 | 8453 | * @return string |
| 8454 | 8454 | */ |
| 8455 | - static function (array $matches) use ($encoding): string { |
|
| 8455 | + static function(array $matches) use ($encoding): string { |
|
| 8456 | 8456 | // preserve leading underscore |
| 8457 | 8457 | $str = $matches[1]; |
| 8458 | 8458 | if ($matches[2]) { |
@@ -8477,11 +8477,11 @@ discard block |
||
| 8477 | 8477 | ); |
| 8478 | 8478 | |
| 8479 | 8479 | // Exceptions for small words: capitalize at start of title... |
| 8480 | - $str = (string) \preg_replace_callback( |
|
| 8480 | + $str = (string)\preg_replace_callback( |
|
| 8481 | 8481 | '~( \\A [[:punct:]]* # start of title... |
| 8482 | 8482 | | [:.;?!][ ]+ # or of subsentence... |
| 8483 | 8483 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
| 8484 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
| 8484 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
| 8485 | 8485 | ~uxi', |
| 8486 | 8486 | /** |
| 8487 | 8487 | * @param string[] $matches |
@@ -8490,15 +8490,15 @@ discard block |
||
| 8490 | 8490 | * |
| 8491 | 8491 | * @return string |
| 8492 | 8492 | */ |
| 8493 | - static function (array $matches) use ($encoding): string { |
|
| 8494 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
| 8493 | + static function(array $matches) use ($encoding): string { |
|
| 8494 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
| 8495 | 8495 | }, |
| 8496 | 8496 | $str |
| 8497 | 8497 | ); |
| 8498 | 8498 | |
| 8499 | 8499 | // ...and end of title |
| 8500 | - $str = (string) \preg_replace_callback( |
|
| 8501 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
| 8500 | + $str = (string)\preg_replace_callback( |
|
| 8501 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
| 8502 | 8502 | (?= [[:punct:]]* \Z # ...at the end of the title... |
| 8503 | 8503 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
| 8504 | 8504 | ~uxi', |
@@ -8509,7 +8509,7 @@ discard block |
||
| 8509 | 8509 | * |
| 8510 | 8510 | * @return string |
| 8511 | 8511 | */ |
| 8512 | - static function (array $matches) use ($encoding): string { |
|
| 8512 | + static function(array $matches) use ($encoding): string { |
|
| 8513 | 8513 | return static::ucfirst($matches[1], $encoding); |
| 8514 | 8514 | }, |
| 8515 | 8515 | $str |
@@ -8517,10 +8517,10 @@ discard block |
||
| 8517 | 8517 | |
| 8518 | 8518 | // Exceptions for small words in hyphenated compound words. |
| 8519 | 8519 | // e.g. "in-flight" -> In-Flight |
| 8520 | - $str = (string) \preg_replace_callback( |
|
| 8520 | + $str = (string)\preg_replace_callback( |
|
| 8521 | 8521 | '~\\b |
| 8522 | 8522 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
| 8523 | - ( ' . $small_words_rx . ' ) |
|
| 8523 | + ( ' . $small_words_rx.' ) |
|
| 8524 | 8524 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
| 8525 | 8525 | ~uxi', |
| 8526 | 8526 | /** |
@@ -8530,18 +8530,18 @@ discard block |
||
| 8530 | 8530 | * |
| 8531 | 8531 | * @return string |
| 8532 | 8532 | */ |
| 8533 | - static function (array $matches) use ($encoding): string { |
|
| 8533 | + static function(array $matches) use ($encoding): string { |
|
| 8534 | 8534 | return static::ucfirst($matches[1], $encoding); |
| 8535 | 8535 | }, |
| 8536 | 8536 | $str |
| 8537 | 8537 | ); |
| 8538 | 8538 | |
| 8539 | 8539 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
| 8540 | - $str = (string) \preg_replace_callback( |
|
| 8540 | + $str = (string)\preg_replace_callback( |
|
| 8541 | 8541 | '~\\b |
| 8542 | 8542 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
| 8543 | 8543 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
| 8544 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
| 8544 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
| 8545 | 8545 | (?! - ) # Negative lookahead for another - |
| 8546 | 8546 | ~uxi', |
| 8547 | 8547 | /** |
@@ -8551,8 +8551,8 @@ discard block |
||
| 8551 | 8551 | * |
| 8552 | 8552 | * @return string |
| 8553 | 8553 | */ |
| 8554 | - static function (array $matches) use ($encoding): string { |
|
| 8555 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
| 8554 | + static function(array $matches) use ($encoding): string { |
|
| 8555 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
| 8556 | 8556 | }, |
| 8557 | 8557 | $str |
| 8558 | 8558 | ); |
@@ -8667,7 +8667,7 @@ discard block |
||
| 8667 | 8667 | ); |
| 8668 | 8668 | |
| 8669 | 8669 | foreach ($tmp_return as &$item) { |
| 8670 | - $item = (string) $item; |
|
| 8670 | + $item = (string)$item; |
|
| 8671 | 8671 | } |
| 8672 | 8672 | |
| 8673 | 8673 | return $tmp_return; |
@@ -8721,39 +8721,39 @@ discard block |
||
| 8721 | 8721 | } |
| 8722 | 8722 | |
| 8723 | 8723 | if ($encoding === 'UTF-8') { |
| 8724 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 8724 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 8725 | 8725 | return $str; |
| 8726 | 8726 | } |
| 8727 | 8727 | |
| 8728 | 8728 | if ($substring !== '') { |
| 8729 | - $length -= (int) \mb_strlen($substring); |
|
| 8729 | + $length -= (int)\mb_strlen($substring); |
|
| 8730 | 8730 | |
| 8731 | 8731 | /** @noinspection UnnecessaryCastingInspection */ |
| 8732 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
| 8732 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
| 8733 | 8733 | } |
| 8734 | 8734 | |
| 8735 | 8735 | /** @noinspection UnnecessaryCastingInspection */ |
| 8736 | - return (string) \mb_substr($str, 0, $length); |
|
| 8736 | + return (string)\mb_substr($str, 0, $length); |
|
| 8737 | 8737 | } |
| 8738 | 8738 | |
| 8739 | 8739 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8740 | 8740 | |
| 8741 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 8741 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 8742 | 8742 | return $str; |
| 8743 | 8743 | } |
| 8744 | 8744 | |
| 8745 | 8745 | if ($substring !== '') { |
| 8746 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 8746 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 8747 | 8747 | } |
| 8748 | 8748 | |
| 8749 | 8749 | return ( |
| 8750 | - (string) self::substr( |
|
| 8750 | + (string)self::substr( |
|
| 8751 | 8751 | $str, |
| 8752 | 8752 | 0, |
| 8753 | 8753 | $length, |
| 8754 | 8754 | $encoding |
| 8755 | 8755 | ) |
| 8756 | - ) . $substring; |
|
| 8756 | + ).$substring; |
|
| 8757 | 8757 | } |
| 8758 | 8758 | |
| 8759 | 8759 | /** |
@@ -8787,12 +8787,12 @@ discard block |
||
| 8787 | 8787 | } |
| 8788 | 8788 | |
| 8789 | 8789 | if ($encoding === 'UTF-8') { |
| 8790 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 8790 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 8791 | 8791 | return $str; |
| 8792 | 8792 | } |
| 8793 | 8793 | |
| 8794 | 8794 | // need to further trim the string so we can append the substring |
| 8795 | - $length -= (int) \mb_strlen($substring); |
|
| 8795 | + $length -= (int)\mb_strlen($substring); |
|
| 8796 | 8796 | if ($length <= 0) { |
| 8797 | 8797 | return $substring; |
| 8798 | 8798 | } |
@@ -8814,18 +8814,18 @@ discard block |
||
| 8814 | 8814 | || |
| 8815 | 8815 | ($space_position !== false && $ignore_do_not_split_words_for_one_word === false) |
| 8816 | 8816 | ) { |
| 8817 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
| 8817 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
| 8818 | 8818 | } |
| 8819 | 8819 | } |
| 8820 | 8820 | } else { |
| 8821 | 8821 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8822 | 8822 | |
| 8823 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 8823 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 8824 | 8824 | return $str; |
| 8825 | 8825 | } |
| 8826 | 8826 | |
| 8827 | 8827 | // need to further trim the string so we can append the substring |
| 8828 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 8828 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 8829 | 8829 | if ($length <= 0) { |
| 8830 | 8830 | return $substring; |
| 8831 | 8831 | } |
@@ -8847,12 +8847,12 @@ discard block |
||
| 8847 | 8847 | || |
| 8848 | 8848 | ($space_position !== false && $ignore_do_not_split_words_for_one_word === false) |
| 8849 | 8849 | ) { |
| 8850 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
| 8850 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
| 8851 | 8851 | } |
| 8852 | 8852 | } |
| 8853 | 8853 | } |
| 8854 | 8854 | |
| 8855 | - return $truncated . $substring; |
|
| 8855 | + return $truncated.$substring; |
|
| 8856 | 8856 | } |
| 8857 | 8857 | |
| 8858 | 8858 | /** |
@@ -8961,13 +8961,13 @@ discard block |
||
| 8961 | 8961 | } |
| 8962 | 8962 | } elseif ($format === 2) { |
| 8963 | 8963 | $number_of_words = []; |
| 8964 | - $offset = (int) self::strlen($str_parts[0]); |
|
| 8964 | + $offset = (int)self::strlen($str_parts[0]); |
|
| 8965 | 8965 | for ($i = 1; $i < $len; $i += 2) { |
| 8966 | 8966 | $number_of_words[$offset] = $str_parts[$i]; |
| 8967 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
| 8967 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
| 8968 | 8968 | } |
| 8969 | 8969 | } else { |
| 8970 | - $number_of_words = (int) (($len - 1) / 2); |
|
| 8970 | + $number_of_words = (int)(($len - 1) / 2); |
|
| 8971 | 8971 | } |
| 8972 | 8972 | |
| 8973 | 8973 | return $number_of_words; |
@@ -9096,21 +9096,21 @@ discard block |
||
| 9096 | 9096 | } |
| 9097 | 9097 | |
| 9098 | 9098 | if ($char_list === '') { |
| 9099 | - return (int) self::strlen($str, $encoding); |
|
| 9099 | + return (int)self::strlen($str, $encoding); |
|
| 9100 | 9100 | } |
| 9101 | 9101 | |
| 9102 | 9102 | if ($offset !== null || $length !== null) { |
| 9103 | 9103 | if ($encoding === 'UTF-8') { |
| 9104 | 9104 | if ($length === null) { |
| 9105 | 9105 | /** @noinspection UnnecessaryCastingInspection */ |
| 9106 | - $str_tmp = \mb_substr($str, (int) $offset); |
|
| 9106 | + $str_tmp = \mb_substr($str, (int)$offset); |
|
| 9107 | 9107 | } else { |
| 9108 | 9108 | /** @noinspection UnnecessaryCastingInspection */ |
| 9109 | - $str_tmp = \mb_substr($str, (int) $offset, $length); |
|
| 9109 | + $str_tmp = \mb_substr($str, (int)$offset, $length); |
|
| 9110 | 9110 | } |
| 9111 | 9111 | } else { |
| 9112 | 9112 | /** @noinspection UnnecessaryCastingInspection */ |
| 9113 | - $str_tmp = self::substr($str, (int) $offset, $length, $encoding); |
|
| 9113 | + $str_tmp = self::substr($str, (int)$offset, $length, $encoding); |
|
| 9114 | 9114 | } |
| 9115 | 9115 | |
| 9116 | 9116 | if ($str_tmp === false) { |
@@ -9126,7 +9126,7 @@ discard block |
||
| 9126 | 9126 | } |
| 9127 | 9127 | |
| 9128 | 9128 | $matches = []; |
| 9129 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
| 9129 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
| 9130 | 9130 | $return = self::strlen($matches[1], $encoding); |
| 9131 | 9131 | if ($return === false) { |
| 9132 | 9132 | return 0; |
@@ -9135,7 +9135,7 @@ discard block |
||
| 9135 | 9135 | return $return; |
| 9136 | 9136 | } |
| 9137 | 9137 | |
| 9138 | - return (int) self::strlen($str, $encoding); |
|
| 9138 | + return (int)self::strlen($str, $encoding); |
|
| 9139 | 9139 | } |
| 9140 | 9140 | |
| 9141 | 9141 | /** |
@@ -9190,7 +9190,7 @@ discard block |
||
| 9190 | 9190 | |
| 9191 | 9191 | $str = ''; |
| 9192 | 9192 | foreach ($array as $strPart) { |
| 9193 | - $str .= '&#' . (int) $strPart . ';'; |
|
| 9193 | + $str .= '&#'.(int)$strPart.';'; |
|
| 9194 | 9194 | } |
| 9195 | 9195 | |
| 9196 | 9196 | return self::html_entity_decode($str, \ENT_QUOTES | \ENT_HTML5); |
@@ -9279,7 +9279,7 @@ discard block |
||
| 9279 | 9279 | return ''; |
| 9280 | 9280 | } |
| 9281 | 9281 | |
| 9282 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
| 9282 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
| 9283 | 9283 | } |
| 9284 | 9284 | |
| 9285 | 9285 | /** |
@@ -9346,7 +9346,7 @@ discard block |
||
| 9346 | 9346 | // fallback for ascii only |
| 9347 | 9347 | // |
| 9348 | 9348 | |
| 9349 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 9349 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 9350 | 9350 | return \stripos($haystack, $needle, $offset); |
| 9351 | 9351 | } |
| 9352 | 9352 | |
@@ -9419,7 +9419,7 @@ discard block |
||
| 9419 | 9419 | /** |
| 9420 | 9420 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 9421 | 9421 | */ |
| 9422 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9422 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9423 | 9423 | } |
| 9424 | 9424 | |
| 9425 | 9425 | if ( |
@@ -9433,11 +9433,11 @@ discard block |
||
| 9433 | 9433 | } |
| 9434 | 9434 | } |
| 9435 | 9435 | |
| 9436 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
| 9436 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
| 9437 | 9437 | return \stristr($haystack, $needle, $before_needle); |
| 9438 | 9438 | } |
| 9439 | 9439 | |
| 9440 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
| 9440 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
| 9441 | 9441 | |
| 9442 | 9442 | if (!isset($match[1])) { |
| 9443 | 9443 | return false; |
@@ -9447,7 +9447,7 @@ discard block |
||
| 9447 | 9447 | return $match[1]; |
| 9448 | 9448 | } |
| 9449 | 9449 | |
| 9450 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
| 9450 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
| 9451 | 9451 | } |
| 9452 | 9452 | |
| 9453 | 9453 | /** |
@@ -9524,7 +9524,7 @@ discard block |
||
| 9524 | 9524 | /** |
| 9525 | 9525 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 9526 | 9526 | */ |
| 9527 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9527 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9528 | 9528 | } |
| 9529 | 9529 | |
| 9530 | 9530 | // |
@@ -9646,8 +9646,8 @@ discard block |
||
| 9646 | 9646 | } |
| 9647 | 9647 | |
| 9648 | 9648 | return \strnatcmp( |
| 9649 | - (string) self::strtonatfold($str1), |
|
| 9650 | - (string) self::strtonatfold($str2) |
|
| 9649 | + (string)self::strtonatfold($str1), |
|
| 9650 | + (string)self::strtonatfold($str2) |
|
| 9651 | 9651 | ); |
| 9652 | 9652 | } |
| 9653 | 9653 | |
@@ -9709,11 +9709,11 @@ discard block |
||
| 9709 | 9709 | } |
| 9710 | 9710 | |
| 9711 | 9711 | if ($encoding === 'UTF-8') { |
| 9712 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
| 9713 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
| 9712 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
| 9713 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
| 9714 | 9714 | } else { |
| 9715 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
| 9716 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
| 9715 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
| 9716 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
| 9717 | 9717 | } |
| 9718 | 9718 | |
| 9719 | 9719 | return self::strcmp($str1, $str2); |
@@ -9737,8 +9737,8 @@ discard block |
||
| 9737 | 9737 | return false; |
| 9738 | 9738 | } |
| 9739 | 9739 | |
| 9740 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
| 9741 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
| 9740 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
| 9741 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
| 9742 | 9742 | } |
| 9743 | 9743 | |
| 9744 | 9744 | return false; |
@@ -9773,10 +9773,10 @@ discard block |
||
| 9773 | 9773 | } |
| 9774 | 9774 | |
| 9775 | 9775 | // iconv and mbstring do not support integer $needle |
| 9776 | - if ((int) $needle === $needle) { |
|
| 9777 | - $needle = (string) self::chr($needle); |
|
| 9776 | + if ((int)$needle === $needle) { |
|
| 9777 | + $needle = (string)self::chr($needle); |
|
| 9778 | 9778 | } |
| 9779 | - $needle = (string) $needle; |
|
| 9779 | + $needle = (string)$needle; |
|
| 9780 | 9780 | |
| 9781 | 9781 | if ($needle === '') { |
| 9782 | 9782 | return false; |
@@ -9826,7 +9826,7 @@ discard block |
||
| 9826 | 9826 | /** |
| 9827 | 9827 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 9828 | 9828 | */ |
| 9829 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9829 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9830 | 9830 | } |
| 9831 | 9831 | |
| 9832 | 9832 | // |
@@ -9867,7 +9867,7 @@ discard block |
||
| 9867 | 9867 | // fallback for ascii only |
| 9868 | 9868 | // |
| 9869 | 9869 | |
| 9870 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 9870 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 9871 | 9871 | return \strpos($haystack, $needle, $offset); |
| 9872 | 9872 | } |
| 9873 | 9873 | |
@@ -9879,7 +9879,7 @@ discard block |
||
| 9879 | 9879 | if ($haystack_tmp === false) { |
| 9880 | 9880 | $haystack_tmp = ''; |
| 9881 | 9881 | } |
| 9882 | - $haystack = (string) $haystack_tmp; |
|
| 9882 | + $haystack = (string)$haystack_tmp; |
|
| 9883 | 9883 | |
| 9884 | 9884 | if ($offset < 0) { |
| 9885 | 9885 | $offset = 0; |
@@ -9891,7 +9891,7 @@ discard block |
||
| 9891 | 9891 | } |
| 9892 | 9892 | |
| 9893 | 9893 | if ($pos) { |
| 9894 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 9894 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 9895 | 9895 | } |
| 9896 | 9896 | |
| 9897 | 9897 | return $offset + 0; |
@@ -10009,7 +10009,7 @@ discard block |
||
| 10009 | 10009 | /** |
| 10010 | 10010 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10011 | 10011 | */ |
| 10012 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10012 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10013 | 10013 | } |
| 10014 | 10014 | |
| 10015 | 10015 | // |
@@ -10021,7 +10021,7 @@ discard block |
||
| 10021 | 10021 | if ($needle_tmp === false) { |
| 10022 | 10022 | return false; |
| 10023 | 10023 | } |
| 10024 | - $needle = (string) $needle_tmp; |
|
| 10024 | + $needle = (string)$needle_tmp; |
|
| 10025 | 10025 | |
| 10026 | 10026 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
| 10027 | 10027 | if ($pos === false) { |
@@ -10043,7 +10043,7 @@ discard block |
||
| 10043 | 10043 | if ($needle_tmp === false) { |
| 10044 | 10044 | return false; |
| 10045 | 10045 | } |
| 10046 | - $needle = (string) $needle_tmp; |
|
| 10046 | + $needle = (string)$needle_tmp; |
|
| 10047 | 10047 | |
| 10048 | 10048 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
| 10049 | 10049 | if ($pos === false) { |
@@ -10081,7 +10081,7 @@ discard block |
||
| 10081 | 10081 | if ($encoding === 'UTF-8') { |
| 10082 | 10082 | if (self::$SUPPORT['intl'] === true) { |
| 10083 | 10083 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
| 10084 | - $i = (int) \grapheme_strlen($str); |
|
| 10084 | + $i = (int)\grapheme_strlen($str); |
|
| 10085 | 10085 | while ($i--) { |
| 10086 | 10086 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
| 10087 | 10087 | if ($reversed_tmp !== false) { |
@@ -10089,7 +10089,7 @@ discard block |
||
| 10089 | 10089 | } |
| 10090 | 10090 | } |
| 10091 | 10091 | } else { |
| 10092 | - $i = (int) \mb_strlen($str); |
|
| 10092 | + $i = (int)\mb_strlen($str); |
|
| 10093 | 10093 | while ($i--) { |
| 10094 | 10094 | $reversed_tmp = \mb_substr($str, $i, 1); |
| 10095 | 10095 | if ($reversed_tmp !== false) { |
@@ -10100,7 +10100,7 @@ discard block |
||
| 10100 | 10100 | } else { |
| 10101 | 10101 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 10102 | 10102 | |
| 10103 | - $i = (int) self::strlen($str, $encoding); |
|
| 10103 | + $i = (int)self::strlen($str, $encoding); |
|
| 10104 | 10104 | while ($i--) { |
| 10105 | 10105 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
| 10106 | 10106 | if ($reversed_tmp !== false) { |
@@ -10176,7 +10176,7 @@ discard block |
||
| 10176 | 10176 | if ($needle_tmp === false) { |
| 10177 | 10177 | return false; |
| 10178 | 10178 | } |
| 10179 | - $needle = (string) $needle_tmp; |
|
| 10179 | + $needle = (string)$needle_tmp; |
|
| 10180 | 10180 | |
| 10181 | 10181 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
| 10182 | 10182 | if ($pos === false) { |
@@ -10217,10 +10217,10 @@ discard block |
||
| 10217 | 10217 | } |
| 10218 | 10218 | |
| 10219 | 10219 | // iconv and mbstring do not support integer $needle |
| 10220 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 10221 | - $needle = (string) self::chr($needle); |
|
| 10220 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 10221 | + $needle = (string)self::chr($needle); |
|
| 10222 | 10222 | } |
| 10223 | - $needle = (string) $needle; |
|
| 10223 | + $needle = (string)$needle; |
|
| 10224 | 10224 | |
| 10225 | 10225 | if ($needle === '') { |
| 10226 | 10226 | return false; |
@@ -10268,7 +10268,7 @@ discard block |
||
| 10268 | 10268 | /** |
| 10269 | 10269 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10270 | 10270 | */ |
| 10271 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10271 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10272 | 10272 | } |
| 10273 | 10273 | |
| 10274 | 10274 | // |
@@ -10292,7 +10292,7 @@ discard block |
||
| 10292 | 10292 | // fallback for ascii only |
| 10293 | 10293 | // |
| 10294 | 10294 | |
| 10295 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10295 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10296 | 10296 | return \strripos($haystack, $needle, $offset); |
| 10297 | 10297 | } |
| 10298 | 10298 | |
@@ -10373,10 +10373,10 @@ discard block |
||
| 10373 | 10373 | } |
| 10374 | 10374 | |
| 10375 | 10375 | // iconv and mbstring do not support integer $needle |
| 10376 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 10377 | - $needle = (string) self::chr($needle); |
|
| 10376 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 10377 | + $needle = (string)self::chr($needle); |
|
| 10378 | 10378 | } |
| 10379 | - $needle = (string) $needle; |
|
| 10379 | + $needle = (string)$needle; |
|
| 10380 | 10380 | |
| 10381 | 10381 | if ($needle === '') { |
| 10382 | 10382 | return false; |
@@ -10424,7 +10424,7 @@ discard block |
||
| 10424 | 10424 | /** |
| 10425 | 10425 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10426 | 10426 | */ |
| 10427 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10427 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10428 | 10428 | } |
| 10429 | 10429 | |
| 10430 | 10430 | // |
@@ -10448,7 +10448,7 @@ discard block |
||
| 10448 | 10448 | // fallback for ascii only |
| 10449 | 10449 | // |
| 10450 | 10450 | |
| 10451 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10451 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10452 | 10452 | return \strrpos($haystack, $needle, $offset); |
| 10453 | 10453 | } |
| 10454 | 10454 | |
@@ -10468,7 +10468,7 @@ discard block |
||
| 10468 | 10468 | if ($haystack_tmp === false) { |
| 10469 | 10469 | $haystack_tmp = ''; |
| 10470 | 10470 | } |
| 10471 | - $haystack = (string) $haystack_tmp; |
|
| 10471 | + $haystack = (string)$haystack_tmp; |
|
| 10472 | 10472 | } |
| 10473 | 10473 | |
| 10474 | 10474 | $pos = \strrpos($haystack, $needle); |
@@ -10482,7 +10482,7 @@ discard block |
||
| 10482 | 10482 | return false; |
| 10483 | 10483 | } |
| 10484 | 10484 | |
| 10485 | - return $offset + (int) self::strlen($str_tmp); |
|
| 10485 | + return $offset + (int)self::strlen($str_tmp); |
|
| 10486 | 10486 | } |
| 10487 | 10487 | |
| 10488 | 10488 | /** |
@@ -10548,12 +10548,12 @@ discard block |
||
| 10548 | 10548 | if ($offset || $length !== null) { |
| 10549 | 10549 | if ($encoding === 'UTF-8') { |
| 10550 | 10550 | if ($length === null) { |
| 10551 | - $str = (string) \mb_substr($str, $offset); |
|
| 10551 | + $str = (string)\mb_substr($str, $offset); |
|
| 10552 | 10552 | } else { |
| 10553 | - $str = (string) \mb_substr($str, $offset, $length); |
|
| 10553 | + $str = (string)\mb_substr($str, $offset, $length); |
|
| 10554 | 10554 | } |
| 10555 | 10555 | } else { |
| 10556 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
| 10556 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
| 10557 | 10557 | } |
| 10558 | 10558 | } |
| 10559 | 10559 | |
@@ -10563,7 +10563,7 @@ discard block |
||
| 10563 | 10563 | |
| 10564 | 10564 | $matches = []; |
| 10565 | 10565 | |
| 10566 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
| 10566 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
| 10567 | 10567 | } |
| 10568 | 10568 | |
| 10569 | 10569 | /** |
@@ -10637,7 +10637,7 @@ discard block |
||
| 10637 | 10637 | /** |
| 10638 | 10638 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10639 | 10639 | */ |
| 10640 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10640 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10641 | 10641 | } |
| 10642 | 10642 | |
| 10643 | 10643 | // |
@@ -10659,7 +10659,7 @@ discard block |
||
| 10659 | 10659 | // fallback for ascii only |
| 10660 | 10660 | // |
| 10661 | 10661 | |
| 10662 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10662 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10663 | 10663 | return \strstr($haystack, $needle, $before_needle); |
| 10664 | 10664 | } |
| 10665 | 10665 | |
@@ -10667,7 +10667,7 @@ discard block |
||
| 10667 | 10667 | // fallback via vanilla php |
| 10668 | 10668 | // |
| 10669 | 10669 | |
| 10670 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
| 10670 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
| 10671 | 10671 | |
| 10672 | 10672 | if (!isset($match[1])) { |
| 10673 | 10673 | return false; |
@@ -10677,7 +10677,7 @@ discard block |
||
| 10677 | 10677 | return $match[1]; |
| 10678 | 10678 | } |
| 10679 | 10679 | |
| 10680 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
| 10680 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
| 10681 | 10681 | } |
| 10682 | 10682 | |
| 10683 | 10683 | /** |
@@ -10803,7 +10803,7 @@ discard block |
||
| 10803 | 10803 | bool $try_to_keep_the_string_length = false |
| 10804 | 10804 | ): string { |
| 10805 | 10805 | // init |
| 10806 | - $str = (string) $str; |
|
| 10806 | + $str = (string)$str; |
|
| 10807 | 10807 | |
| 10808 | 10808 | if ($str === '') { |
| 10809 | 10809 | return ''; |
@@ -10832,25 +10832,25 @@ discard block |
||
| 10832 | 10832 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 10833 | 10833 | } |
| 10834 | 10834 | |
| 10835 | - $language_code = $lang . '-Lower'; |
|
| 10835 | + $language_code = $lang.'-Lower'; |
|
| 10836 | 10836 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 10837 | 10837 | /** |
| 10838 | 10838 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10839 | 10839 | */ |
| 10840 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
| 10840 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
| 10841 | 10841 | |
| 10842 | 10842 | $language_code = 'Any-Lower'; |
| 10843 | 10843 | } |
| 10844 | 10844 | |
| 10845 | 10845 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 10846 | 10846 | /** @noinspection UnnecessaryCastingInspection */ |
| 10847 | - return (string) \transliterator_transliterate($language_code, $str); |
|
| 10847 | + return (string)\transliterator_transliterate($language_code, $str); |
|
| 10848 | 10848 | } |
| 10849 | 10849 | |
| 10850 | 10850 | /** |
| 10851 | 10851 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10852 | 10852 | */ |
| 10853 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
| 10853 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
| 10854 | 10854 | } |
| 10855 | 10855 | |
| 10856 | 10856 | // always fallback via symfony polyfill |
@@ -10883,7 +10883,7 @@ discard block |
||
| 10883 | 10883 | bool $try_to_keep_the_string_length = false |
| 10884 | 10884 | ): string { |
| 10885 | 10885 | // init |
| 10886 | - $str = (string) $str; |
|
| 10886 | + $str = (string)$str; |
|
| 10887 | 10887 | |
| 10888 | 10888 | if ($str === '') { |
| 10889 | 10889 | return ''; |
@@ -10912,25 +10912,25 @@ discard block |
||
| 10912 | 10912 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 10913 | 10913 | } |
| 10914 | 10914 | |
| 10915 | - $language_code = $lang . '-Upper'; |
|
| 10915 | + $language_code = $lang.'-Upper'; |
|
| 10916 | 10916 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 10917 | 10917 | /** |
| 10918 | 10918 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10919 | 10919 | */ |
| 10920 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
| 10920 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
| 10921 | 10921 | |
| 10922 | 10922 | $language_code = 'Any-Upper'; |
| 10923 | 10923 | } |
| 10924 | 10924 | |
| 10925 | 10925 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 10926 | 10926 | /** @noinspection UnnecessaryCastingInspection */ |
| 10927 | - return (string) \transliterator_transliterate($language_code, $str); |
|
| 10927 | + return (string)\transliterator_transliterate($language_code, $str); |
|
| 10928 | 10928 | } |
| 10929 | 10929 | |
| 10930 | 10930 | /** |
| 10931 | 10931 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10932 | 10932 | */ |
| 10933 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
| 10933 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
| 10934 | 10934 | } |
| 10935 | 10935 | |
| 10936 | 10936 | // always fallback via symfony polyfill |
@@ -10977,7 +10977,7 @@ discard block |
||
| 10977 | 10977 | $from = \array_combine($from, $to); |
| 10978 | 10978 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 10979 | 10979 | if ($from === false) { |
| 10980 | - 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) . ')'); |
|
| 10980 | + 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).')'); |
|
| 10981 | 10981 | } |
| 10982 | 10982 | } |
| 10983 | 10983 | |
@@ -11039,9 +11039,9 @@ discard block |
||
| 11039 | 11039 | } |
| 11040 | 11040 | |
| 11041 | 11041 | $wide = 0; |
| 11042 | - $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); |
|
| 11042 | + $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); |
|
| 11043 | 11043 | |
| 11044 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
| 11044 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
| 11045 | 11045 | } |
| 11046 | 11046 | |
| 11047 | 11047 | /** |
@@ -11143,9 +11143,9 @@ discard block |
||
| 11143 | 11143 | } |
| 11144 | 11144 | |
| 11145 | 11145 | if ($length === null) { |
| 11146 | - $length = (int) $str_length; |
|
| 11146 | + $length = (int)$str_length; |
|
| 11147 | 11147 | } else { |
| 11148 | - $length = (int) $length; |
|
| 11148 | + $length = (int)$length; |
|
| 11149 | 11149 | } |
| 11150 | 11150 | |
| 11151 | 11151 | if ( |
@@ -11156,7 +11156,7 @@ discard block |
||
| 11156 | 11156 | /** |
| 11157 | 11157 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11158 | 11158 | */ |
| 11159 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11159 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11160 | 11160 | } |
| 11161 | 11161 | |
| 11162 | 11162 | // |
@@ -11246,16 +11246,16 @@ discard block |
||
| 11246 | 11246 | ) { |
| 11247 | 11247 | if ($encoding === 'UTF-8') { |
| 11248 | 11248 | if ($length === null) { |
| 11249 | - $str1 = (string) \mb_substr($str1, $offset); |
|
| 11249 | + $str1 = (string)\mb_substr($str1, $offset); |
|
| 11250 | 11250 | } else { |
| 11251 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
| 11251 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
| 11252 | 11252 | } |
| 11253 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
| 11253 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
| 11254 | 11254 | } else { |
| 11255 | 11255 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 11256 | 11256 | |
| 11257 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
| 11258 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
| 11257 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
| 11258 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
| 11259 | 11259 | } |
| 11260 | 11260 | } |
| 11261 | 11261 | |
@@ -11319,13 +11319,13 @@ discard block |
||
| 11319 | 11319 | if ($length_tmp === false) { |
| 11320 | 11320 | return false; |
| 11321 | 11321 | } |
| 11322 | - $length = (int) $length_tmp; |
|
| 11322 | + $length = (int)$length_tmp; |
|
| 11323 | 11323 | } |
| 11324 | 11324 | |
| 11325 | 11325 | if ($encoding === 'UTF-8') { |
| 11326 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
| 11326 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
| 11327 | 11327 | } else { |
| 11328 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
| 11328 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
| 11329 | 11329 | } |
| 11330 | 11330 | } |
| 11331 | 11331 | |
@@ -11337,7 +11337,7 @@ discard block |
||
| 11337 | 11337 | /** |
| 11338 | 11338 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11339 | 11339 | */ |
| 11340 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11340 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11341 | 11341 | } |
| 11342 | 11342 | |
| 11343 | 11343 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -11348,7 +11348,7 @@ discard block |
||
| 11348 | 11348 | return \mb_substr_count($haystack, $needle, $encoding); |
| 11349 | 11349 | } |
| 11350 | 11350 | |
| 11351 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 11351 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 11352 | 11352 | |
| 11353 | 11353 | return \count($matches); |
| 11354 | 11354 | } |
@@ -11397,7 +11397,7 @@ discard block |
||
| 11397 | 11397 | if ($length_tmp === false) { |
| 11398 | 11398 | return false; |
| 11399 | 11399 | } |
| 11400 | - $length = (int) $length_tmp; |
|
| 11400 | + $length = (int)$length_tmp; |
|
| 11401 | 11401 | } |
| 11402 | 11402 | |
| 11403 | 11403 | if ( |
@@ -11419,7 +11419,7 @@ discard block |
||
| 11419 | 11419 | if ($haystack_tmp === false) { |
| 11420 | 11420 | $haystack_tmp = ''; |
| 11421 | 11421 | } |
| 11422 | - $haystack = (string) $haystack_tmp; |
|
| 11422 | + $haystack = (string)$haystack_tmp; |
|
| 11423 | 11423 | } |
| 11424 | 11424 | |
| 11425 | 11425 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -11460,10 +11460,10 @@ discard block |
||
| 11460 | 11460 | |
| 11461 | 11461 | if ($encoding === 'UTF-8') { |
| 11462 | 11462 | if ($case_sensitive) { |
| 11463 | - return (int) \mb_substr_count($str, $substring); |
|
| 11463 | + return (int)\mb_substr_count($str, $substring); |
|
| 11464 | 11464 | } |
| 11465 | 11465 | |
| 11466 | - return (int) \mb_substr_count( |
|
| 11466 | + return (int)\mb_substr_count( |
|
| 11467 | 11467 | \mb_strtoupper($str), |
| 11468 | 11468 | \mb_strtoupper($substring) |
| 11469 | 11469 | ); |
@@ -11472,10 +11472,10 @@ discard block |
||
| 11472 | 11472 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 11473 | 11473 | |
| 11474 | 11474 | if ($case_sensitive) { |
| 11475 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
| 11475 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
| 11476 | 11476 | } |
| 11477 | 11477 | |
| 11478 | - return (int) \mb_substr_count( |
|
| 11478 | + return (int)\mb_substr_count( |
|
| 11479 | 11479 | self::strtocasefold($str, true, false, $encoding, null, false), |
| 11480 | 11480 | self::strtocasefold($substring, true, false, $encoding, null, false), |
| 11481 | 11481 | $encoding |
@@ -11503,7 +11503,7 @@ discard block |
||
| 11503 | 11503 | } |
| 11504 | 11504 | |
| 11505 | 11505 | if (self::str_istarts_with($haystack, $needle) === true) { |
| 11506 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 11506 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 11507 | 11507 | } |
| 11508 | 11508 | |
| 11509 | 11509 | return $haystack; |
@@ -11564,7 +11564,7 @@ discard block |
||
| 11564 | 11564 | } |
| 11565 | 11565 | |
| 11566 | 11566 | if (self::str_iends_with($haystack, $needle) === true) { |
| 11567 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
| 11567 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
| 11568 | 11568 | } |
| 11569 | 11569 | |
| 11570 | 11570 | return $haystack; |
@@ -11591,7 +11591,7 @@ discard block |
||
| 11591 | 11591 | } |
| 11592 | 11592 | |
| 11593 | 11593 | if (self::str_starts_with($haystack, $needle) === true) { |
| 11594 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 11594 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 11595 | 11595 | } |
| 11596 | 11596 | |
| 11597 | 11597 | return $haystack; |
@@ -11645,7 +11645,7 @@ discard block |
||
| 11645 | 11645 | if (\is_array($offset) === true) { |
| 11646 | 11646 | $offset = \array_slice($offset, 0, $num); |
| 11647 | 11647 | foreach ($offset as &$value_tmp) { |
| 11648 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
| 11648 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
| 11649 | 11649 | } |
| 11650 | 11650 | unset($value_tmp); |
| 11651 | 11651 | } else { |
@@ -11658,7 +11658,7 @@ discard block |
||
| 11658 | 11658 | } elseif (\is_array($length) === true) { |
| 11659 | 11659 | $length = \array_slice($length, 0, $num); |
| 11660 | 11660 | foreach ($length as &$value_tmp_V2) { |
| 11661 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
| 11661 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
| 11662 | 11662 | } |
| 11663 | 11663 | unset($value_tmp_V2); |
| 11664 | 11664 | } else { |
@@ -11678,8 +11678,8 @@ discard block |
||
| 11678 | 11678 | } |
| 11679 | 11679 | |
| 11680 | 11680 | // init |
| 11681 | - $str = (string) $str; |
|
| 11682 | - $replacement = (string) $replacement; |
|
| 11681 | + $str = (string)$str; |
|
| 11682 | + $replacement = (string)$replacement; |
|
| 11683 | 11683 | |
| 11684 | 11684 | if (\is_array($length) === true) { |
| 11685 | 11685 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -11694,16 +11694,16 @@ discard block |
||
| 11694 | 11694 | } |
| 11695 | 11695 | |
| 11696 | 11696 | if (self::$SUPPORT['mbstring'] === true) { |
| 11697 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 11697 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 11698 | 11698 | |
| 11699 | 11699 | if ($offset < 0) { |
| 11700 | - $offset = (int) \max(0, $string_length + $offset); |
|
| 11700 | + $offset = (int)\max(0, $string_length + $offset); |
|
| 11701 | 11701 | } elseif ($offset > $string_length) { |
| 11702 | 11702 | $offset = $string_length; |
| 11703 | 11703 | } |
| 11704 | 11704 | |
| 11705 | 11705 | if ($length !== null && $length < 0) { |
| 11706 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
| 11706 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
| 11707 | 11707 | } elseif ($length === null || $length > $string_length) { |
| 11708 | 11708 | $length = $string_length; |
| 11709 | 11709 | } |
@@ -11714,9 +11714,9 @@ discard block |
||
| 11714 | 11714 | } |
| 11715 | 11715 | |
| 11716 | 11716 | /** @noinspection AdditionOperationOnArraysInspection */ |
| 11717 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
| 11718 | - $replacement . |
|
| 11719 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 11717 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
| 11718 | + $replacement. |
|
| 11719 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 11720 | 11720 | } |
| 11721 | 11721 | |
| 11722 | 11722 | // |
@@ -11725,8 +11725,7 @@ discard block |
||
| 11725 | 11725 | |
| 11726 | 11726 | if (ASCII::is_ascii($str)) { |
| 11727 | 11727 | return ($length === null) ? |
| 11728 | - \substr_replace($str, $replacement, $offset) : |
|
| 11729 | - \substr_replace($str, $replacement, $offset, $length); |
|
| 11728 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
| 11730 | 11729 | } |
| 11731 | 11730 | |
| 11732 | 11731 | // |
@@ -11742,7 +11741,7 @@ discard block |
||
| 11742 | 11741 | // e.g.: non mbstring support + invalid chars |
| 11743 | 11742 | return ''; |
| 11744 | 11743 | } |
| 11745 | - $length = (int) $length_tmp; |
|
| 11744 | + $length = (int)$length_tmp; |
|
| 11746 | 11745 | } |
| 11747 | 11746 | |
| 11748 | 11747 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -11779,14 +11778,14 @@ discard block |
||
| 11779 | 11778 | && |
| 11780 | 11779 | \substr($haystack, -\strlen($needle)) === $needle |
| 11781 | 11780 | ) { |
| 11782 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
| 11781 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
| 11783 | 11782 | } |
| 11784 | 11783 | |
| 11785 | 11784 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
| 11786 | - return (string) self::substr( |
|
| 11785 | + return (string)self::substr( |
|
| 11787 | 11786 | $haystack, |
| 11788 | 11787 | 0, |
| 11789 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
| 11788 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
| 11790 | 11789 | $encoding |
| 11791 | 11790 | ); |
| 11792 | 11791 | } |
@@ -11818,10 +11817,10 @@ discard block |
||
| 11818 | 11817 | } |
| 11819 | 11818 | |
| 11820 | 11819 | if ($encoding === 'UTF-8') { |
| 11821 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 11820 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 11822 | 11821 | } |
| 11823 | 11822 | |
| 11824 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 11823 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 11825 | 11824 | } |
| 11826 | 11825 | |
| 11827 | 11826 | /** |
@@ -12029,7 +12028,7 @@ discard block |
||
| 12029 | 12028 | public static function to_boolean($str): bool |
| 12030 | 12029 | { |
| 12031 | 12030 | // init |
| 12032 | - $str = (string) $str; |
|
| 12031 | + $str = (string)$str; |
|
| 12033 | 12032 | |
| 12034 | 12033 | if ($str === '') { |
| 12035 | 12034 | return false; |
@@ -12057,10 +12056,10 @@ discard block |
||
| 12057 | 12056 | } |
| 12058 | 12057 | |
| 12059 | 12058 | if (\is_numeric($str)) { |
| 12060 | - return ((float) $str + 0) > 0; |
|
| 12059 | + return ((float)$str + 0) > 0; |
|
| 12061 | 12060 | } |
| 12062 | 12061 | |
| 12063 | - return (bool) \trim($str); |
|
| 12062 | + return (bool)\trim($str); |
|
| 12064 | 12063 | } |
| 12065 | 12064 | |
| 12066 | 12065 | /** |
@@ -12106,7 +12105,7 @@ discard block |
||
| 12106 | 12105 | return $str; |
| 12107 | 12106 | } |
| 12108 | 12107 | |
| 12109 | - $str = (string) $str; |
|
| 12108 | + $str = (string)$str; |
|
| 12110 | 12109 | if ($str === '') { |
| 12111 | 12110 | return ''; |
| 12112 | 12111 | } |
@@ -12158,7 +12157,7 @@ discard block |
||
| 12158 | 12157 | return $str; |
| 12159 | 12158 | } |
| 12160 | 12159 | |
| 12161 | - $str = (string) $str; |
|
| 12160 | + $str = (string)$str; |
|
| 12162 | 12161 | if ($str === '') { |
| 12163 | 12162 | return $str; |
| 12164 | 12163 | } |
@@ -12176,7 +12175,7 @@ discard block |
||
| 12176 | 12175 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
| 12177 | 12176 | |
| 12178 | 12177 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 12179 | - $buf .= $c1 . $c2; |
|
| 12178 | + $buf .= $c1.$c2; |
|
| 12180 | 12179 | ++$i; |
| 12181 | 12180 | } else { // not valid UTF8 - convert it |
| 12182 | 12181 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12187,7 +12186,7 @@ discard block |
||
| 12187 | 12186 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
| 12188 | 12187 | |
| 12189 | 12188 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 12190 | - $buf .= $c1 . $c2 . $c3; |
|
| 12189 | + $buf .= $c1.$c2.$c3; |
|
| 12191 | 12190 | $i += 2; |
| 12192 | 12191 | } else { // not valid UTF8 - convert it |
| 12193 | 12192 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12199,7 +12198,7 @@ discard block |
||
| 12199 | 12198 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
| 12200 | 12199 | |
| 12201 | 12200 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 12202 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
| 12201 | + $buf .= $c1.$c2.$c3.$c4; |
|
| 12203 | 12202 | $i += 3; |
| 12204 | 12203 | } else { // not valid UTF8 - convert it |
| 12205 | 12204 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12227,13 +12226,13 @@ discard block |
||
| 12227 | 12226 | * |
| 12228 | 12227 | * @return string |
| 12229 | 12228 | */ |
| 12230 | - static function (array $matches): string { |
|
| 12229 | + static function(array $matches): string { |
|
| 12231 | 12230 | if (isset($matches[3])) { |
| 12232 | - $cp = (int) \hexdec($matches[3]); |
|
| 12231 | + $cp = (int)\hexdec($matches[3]); |
|
| 12233 | 12232 | } else { |
| 12234 | 12233 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
| 12235 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
| 12236 | - + (int) \hexdec($matches[2]) |
|
| 12234 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
| 12235 | + + (int)\hexdec($matches[2]) |
|
| 12237 | 12236 | + 0x10000 |
| 12238 | 12237 | - (0xD800 << 10) |
| 12239 | 12238 | - 0xDC00; |
@@ -12244,12 +12243,12 @@ discard block |
||
| 12244 | 12243 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
| 12245 | 12244 | |
| 12246 | 12245 | if ($cp < 0x80) { |
| 12247 | - return (string) self::chr($cp); |
|
| 12246 | + return (string)self::chr($cp); |
|
| 12248 | 12247 | } |
| 12249 | 12248 | |
| 12250 | 12249 | if ($cp < 0xA0) { |
| 12251 | 12250 | /** @noinspection UnnecessaryCastingInspection */ |
| 12252 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
| 12251 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
| 12253 | 12252 | } |
| 12254 | 12253 | |
| 12255 | 12254 | return self::decimal_to_chr($cp); |
@@ -12282,7 +12281,7 @@ discard block |
||
| 12282 | 12281 | public static function to_int(string $str) |
| 12283 | 12282 | { |
| 12284 | 12283 | if (\is_numeric($str)) { |
| 12285 | - return (int) $str; |
|
| 12284 | + return (int)$str; |
|
| 12286 | 12285 | } |
| 12287 | 12286 | |
| 12288 | 12287 | return null; |
@@ -12313,7 +12312,7 @@ discard block |
||
| 12313 | 12312 | || |
| 12314 | 12313 | $input_type === 'double' |
| 12315 | 12314 | ) { |
| 12316 | - return (string) $input; |
|
| 12315 | + return (string)$input; |
|
| 12317 | 12316 | } |
| 12318 | 12317 | |
| 12319 | 12318 | if ( |
@@ -12321,7 +12320,7 @@ discard block |
||
| 12321 | 12320 | && |
| 12322 | 12321 | \method_exists($input, '__toString') |
| 12323 | 12322 | ) { |
| 12324 | - return (string) $input; |
|
| 12323 | + return (string)$input; |
|
| 12325 | 12324 | } |
| 12326 | 12325 | |
| 12327 | 12326 | return null; |
@@ -12358,7 +12357,7 @@ discard block |
||
| 12358 | 12357 | } |
| 12359 | 12358 | |
| 12360 | 12359 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 12361 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 12360 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 12362 | 12361 | } |
| 12363 | 12362 | |
| 12364 | 12363 | if ($chars) { |
@@ -12406,15 +12405,15 @@ discard block |
||
| 12406 | 12405 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
| 12407 | 12406 | |
| 12408 | 12407 | if ($encoding === 'UTF-8') { |
| 12409 | - $str_part_two = (string) \mb_substr($str, 1); |
|
| 12408 | + $str_part_two = (string)\mb_substr($str, 1); |
|
| 12410 | 12409 | |
| 12411 | 12410 | if ($use_mb_functions === true) { |
| 12412 | 12411 | $str_part_one = \mb_strtoupper( |
| 12413 | - (string) \mb_substr($str, 0, 1) |
|
| 12412 | + (string)\mb_substr($str, 0, 1) |
|
| 12414 | 12413 | ); |
| 12415 | 12414 | } else { |
| 12416 | 12415 | $str_part_one = self::strtoupper( |
| 12417 | - (string) \mb_substr($str, 0, 1), |
|
| 12416 | + (string)\mb_substr($str, 0, 1), |
|
| 12418 | 12417 | $encoding, |
| 12419 | 12418 | false, |
| 12420 | 12419 | $lang, |
@@ -12424,16 +12423,16 @@ discard block |
||
| 12424 | 12423 | } else { |
| 12425 | 12424 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 12426 | 12425 | |
| 12427 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
| 12426 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
| 12428 | 12427 | |
| 12429 | 12428 | if ($use_mb_functions === true) { |
| 12430 | 12429 | $str_part_one = \mb_strtoupper( |
| 12431 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
| 12430 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
| 12432 | 12431 | $encoding |
| 12433 | 12432 | ); |
| 12434 | 12433 | } else { |
| 12435 | 12434 | $str_part_one = self::strtoupper( |
| 12436 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 12435 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 12437 | 12436 | $encoding, |
| 12438 | 12437 | false, |
| 12439 | 12438 | $lang, |
@@ -12442,7 +12441,7 @@ discard block |
||
| 12442 | 12441 | } |
| 12443 | 12442 | } |
| 12444 | 12443 | |
| 12445 | - return $str_part_one . $str_part_two; |
|
| 12444 | + return $str_part_one.$str_part_two; |
|
| 12446 | 12445 | } |
| 12447 | 12446 | |
| 12448 | 12447 | /** |
@@ -12501,7 +12500,7 @@ discard block |
||
| 12501 | 12500 | $str = self::clean($str); |
| 12502 | 12501 | } |
| 12503 | 12502 | |
| 12504 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
| 12503 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
| 12505 | 12504 | |
| 12506 | 12505 | if ( |
| 12507 | 12506 | $use_php_default_functions === true |
@@ -12912,7 +12911,7 @@ discard block |
||
| 12912 | 12911 | if ( |
| 12913 | 12912 | $keep_utf8_chars === true |
| 12914 | 12913 | && |
| 12915 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
| 12914 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
| 12916 | 12915 | ) { |
| 12917 | 12916 | return $str_backup; |
| 12918 | 12917 | } |
@@ -12999,17 +12998,17 @@ discard block |
||
| 12999 | 12998 | return ''; |
| 13000 | 12999 | } |
| 13001 | 13000 | |
| 13002 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
| 13001 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
| 13003 | 13002 | |
| 13004 | 13003 | if ( |
| 13005 | 13004 | !isset($matches[0]) |
| 13006 | 13005 | || |
| 13007 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
| 13006 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
| 13008 | 13007 | ) { |
| 13009 | 13008 | return $str; |
| 13010 | 13009 | } |
| 13011 | 13010 | |
| 13012 | - return \rtrim($matches[0]) . $str_add_on; |
|
| 13011 | + return \rtrim($matches[0]).$str_add_on; |
|
| 13013 | 13012 | } |
| 13014 | 13013 | |
| 13015 | 13014 | /** |
@@ -13098,7 +13097,7 @@ discard block |
||
| 13098 | 13097 | } |
| 13099 | 13098 | } |
| 13100 | 13099 | |
| 13101 | - return $str_return . \implode('', $chars); |
|
| 13100 | + return $str_return.\implode('', $chars); |
|
| 13102 | 13101 | } |
| 13103 | 13102 | |
| 13104 | 13103 | /** |
@@ -13152,7 +13151,7 @@ discard block |
||
| 13152 | 13151 | $final_break = ''; |
| 13153 | 13152 | } |
| 13154 | 13153 | |
| 13155 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
| 13154 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
| 13156 | 13155 | } |
| 13157 | 13156 | |
| 13158 | 13157 | /** |
@@ -13387,7 +13386,7 @@ discard block |
||
| 13387 | 13386 | /** @noinspection PhpIncludeInspection */ |
| 13388 | 13387 | /** @noinspection UsingInclusionReturnValueInspection */ |
| 13389 | 13388 | /** @psalm-suppress UnresolvableInclude */ |
| 13390 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
| 13389 | + return include __DIR__.'/data/'.$file.'.php'; |
|
| 13391 | 13390 | } |
| 13392 | 13391 | |
| 13393 | 13392 | /** |
@@ -13404,7 +13403,7 @@ discard block |
||
| 13404 | 13403 | |
| 13405 | 13404 | \uksort( |
| 13406 | 13405 | self::$EMOJI, |
| 13407 | - static function (string $a, string $b): int { |
|
| 13406 | + static function(string $a, string $b): int { |
|
| 13408 | 13407 | return \strlen($b) <=> \strlen($a); |
| 13409 | 13408 | } |
| 13410 | 13409 | ); |
@@ -13414,7 +13413,7 @@ discard block |
||
| 13414 | 13413 | |
| 13415 | 13414 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
| 13416 | 13415 | $tmp_key = \crc32($key); |
| 13417 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
| 13416 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
| 13418 | 13417 | } |
| 13419 | 13418 | |
| 13420 | 13419 | return true; |
@@ -13442,7 +13441,7 @@ discard block |
||
| 13442 | 13441 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 13443 | 13442 | return \defined('MB_OVERLOAD_STRING') |
| 13444 | 13443 | && |
| 13445 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 13444 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 13446 | 13445 | } |
| 13447 | 13446 | |
| 13448 | 13447 | /** |
@@ -13508,7 +13507,7 @@ discard block |
||
| 13508 | 13507 | */ |
| 13509 | 13508 | static $RX_CLASS_CACHE = []; |
| 13510 | 13509 | |
| 13511 | - $cache_key = $s . '_' . $class; |
|
| 13510 | + $cache_key = $s.'_'.$class; |
|
| 13512 | 13511 | |
| 13513 | 13512 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
| 13514 | 13513 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -13520,7 +13519,7 @@ discard block |
||
| 13520 | 13519 | /** @noinspection AlterInForeachInspection */ |
| 13521 | 13520 | foreach (self::str_split($s) as &$s) { |
| 13522 | 13521 | if ($s === '-') { |
| 13523 | - $class_array[0] = '-' . $class_array[0]; |
|
| 13522 | + $class_array[0] = '-'.$class_array[0]; |
|
| 13524 | 13523 | } elseif (!isset($s[2])) { |
| 13525 | 13524 | $class_array[0] .= \preg_quote($s, '/'); |
| 13526 | 13525 | } elseif (self::strlen($s) === 1) { |
@@ -13531,13 +13530,13 @@ discard block |
||
| 13531 | 13530 | } |
| 13532 | 13531 | |
| 13533 | 13532 | if ($class_array[0]) { |
| 13534 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
| 13533 | + $class_array[0] = '['.$class_array[0].']'; |
|
| 13535 | 13534 | } |
| 13536 | 13535 | |
| 13537 | 13536 | if (\count($class_array) === 1) { |
| 13538 | 13537 | $return = $class_array[0]; |
| 13539 | 13538 | } else { |
| 13540 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
| 13539 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
| 13541 | 13540 | } |
| 13542 | 13541 | |
| 13543 | 13542 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -13618,7 +13617,7 @@ discard block |
||
| 13618 | 13617 | |
| 13619 | 13618 | if ($delimiter === '-') { |
| 13620 | 13619 | /** @noinspection AlterInForeachInspection */ |
| 13621 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
| 13620 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
| 13622 | 13621 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
| 13623 | 13622 | $continue = true; |
| 13624 | 13623 | } |
@@ -13626,7 +13625,7 @@ discard block |
||
| 13626 | 13625 | } |
| 13627 | 13626 | |
| 13628 | 13627 | /** @noinspection AlterInForeachInspection */ |
| 13629 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
| 13628 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
| 13630 | 13629 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
| 13631 | 13630 | $continue = true; |
| 13632 | 13631 | } |
@@ -13693,8 +13692,8 @@ discard block |
||
| 13693 | 13692 | } else { |
| 13694 | 13693 | /** @noinspection OffsetOperationsInspection */ |
| 13695 | 13694 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
| 13696 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
| 13697 | - $buf .= $cc1 . $cc2; |
|
| 13695 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
| 13696 | + $buf .= $cc1.$cc2; |
|
| 13698 | 13697 | } |
| 13699 | 13698 | |
| 13700 | 13699 | return $buf; |
@@ -13713,7 +13712,7 @@ discard block |
||
| 13713 | 13712 | { |
| 13714 | 13713 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
| 13715 | 13714 | if (\preg_match($pattern, $str)) { |
| 13716 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
| 13715 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
| 13717 | 13716 | } |
| 13718 | 13717 | |
| 13719 | 13718 | return $str; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | return false; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - $uri = (string) $_SERVER['REQUEST_URI']; |
|
| 86 | + $uri = (string)$_SERVER['REQUEST_URI']; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | $uriOrig = $uri; |
@@ -100,27 +100,27 @@ discard block |
||
| 100 | 100 | // When not, assumes Windows-1252 and redirects to the corresponding UTF-8 encoded URL |
| 101 | 101 | // |
| 102 | 102 | |
| 103 | - $uri = (string) \preg_replace_callback( |
|
| 103 | + $uri = (string)\preg_replace_callback( |
|
| 104 | 104 | '/[\x80-\xFF]+/', |
| 105 | 105 | /** |
| 106 | 106 | * @param array $m |
| 107 | 107 | * |
| 108 | 108 | * @return string |
| 109 | 109 | */ |
| 110 | - static function (array $m): string { |
|
| 110 | + static function(array $m): string { |
|
| 111 | 111 | return \rawurlencode($m[0]); |
| 112 | 112 | }, |
| 113 | 113 | $uri |
| 114 | 114 | ); |
| 115 | 115 | |
| 116 | - $uri = (string) \preg_replace_callback( |
|
| 116 | + $uri = (string)\preg_replace_callback( |
|
| 117 | 117 | '/(?:%[89A-F][0-9A-F])+/i', |
| 118 | 118 | /** |
| 119 | 119 | * @param array $m |
| 120 | 120 | * |
| 121 | 121 | * @return string |
| 122 | 122 | */ |
| 123 | - static function (array $m): string { |
|
| 123 | + static function(array $m): string { |
|
| 124 | 124 | return \rawurlencode(UTF8::rawurldecode($m[0])); |
| 125 | 125 | }, |
| 126 | 126 | $uri |
@@ -134,19 +134,19 @@ discard block |
||
| 134 | 134 | \headers_sent() === false |
| 135 | 135 | ) { |
| 136 | 136 | $severProtocol = ($_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'); |
| 137 | - \header($severProtocol . ' 301 Moved Permanently'); |
|
| 137 | + \header($severProtocol.' 301 Moved Permanently'); |
|
| 138 | 138 | |
| 139 | 139 | if (\strncmp($uri, '/', 1) === 0) { |
| 140 | - \header('Location: /' . \ltrim($uri, '/')); |
|
| 140 | + \header('Location: /'.\ltrim($uri, '/')); |
|
| 141 | 141 | } else { |
| 142 | - \header('Location: ' . $uri); |
|
| 142 | + \header('Location: '.$uri); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | exit(); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | if (\strncmp($uri, '/', 1) === 0) { |
| 149 | - $uri = '/' . \ltrim($uri, '/'); |
|
| 149 | + $uri = '/'.\ltrim($uri, '/'); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | return $uri; |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | return false; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - $length = (int) $length; |
|
| 192 | + $length = (int)$length; |
|
| 193 | 193 | |
| 194 | 194 | if ($length <= 0) { |
| 195 | 195 | return false; |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | static $_IS_PHP; |
| 231 | 231 | |
| 232 | - $version = (string) $version; |
|
| 232 | + $version = (string)$version; |
|
| 233 | 233 | |
| 234 | 234 | if (!isset($_IS_PHP[$version])) { |
| 235 | 235 | $_IS_PHP[$version] = \version_compare(\PHP_VERSION, $version, '>='); |