@@ -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 | ]; |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require __DIR__ . '/../vendor/autoload.php'; |
|
| 4 | -require __DIR__ . '/vendor/autoload.php'; |
|
| 3 | +require __DIR__.'/../vendor/autoload.php'; |
|
| 4 | +require __DIR__.'/vendor/autoload.php'; |
|
| 5 | 5 | |
| 6 | 6 | $readmeText = (new \voku\PhpReadmeHelper\GenerateApi())->generate( |
| 7 | - __DIR__ . '/../src/voku/helper/UTF8.php', |
|
| 8 | - __DIR__ . '/docs/base.md' |
|
| 7 | + __DIR__.'/../src/voku/helper/UTF8.php', |
|
| 8 | + __DIR__.'/docs/base.md' |
|
| 9 | 9 | ); |
| 10 | 10 | |
| 11 | -file_put_contents(__DIR__ . '/../README.md', $readmeText); |
|
| 11 | +file_put_contents(__DIR__.'/../README.md', $readmeText); |
|
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | return false; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - $length = (int) $length; |
|
| 50 | + $length = (int)$length; |
|
| 51 | 51 | |
| 52 | 52 | if ($length <= 0) { |
| 53 | 53 | return false; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | static $_IS_PHP; |
| 108 | 108 | |
| 109 | - $version = (string) $version; |
|
| 109 | + $version = (string)$version; |
|
| 110 | 110 | |
| 111 | 111 | if (!isset($_IS_PHP[$version])) { |
| 112 | 112 | $_IS_PHP[$version] = \version_compare(\PHP_VERSION, $version, '>='); |
@@ -1,1 +1,1 @@ |
||
| 1 | -<?php return ['' => 0, "\x00" => 0, "\x01" => 1, "\x02" => 2, "\x03" => 3, "\x04" => 4, "\x05" => 5, "\x06" => 6, "\x07" => 7, "\x08" => 8, "\x09" => 9, "\x0A" => 10, "\x0B" => 11, "\x0C" => 12, "\x0D" => 13, "\x0E" => 14, "\x0F" => 15, "\x10" => 16, "\x11" => 17, "\x12" => 18, "\x13" => 19, "\x14" => 20, "\x15" => 21, "\x16" => 22, "\x17" => 23, "\x18" => 24, "\x19" => 25, "\x1A" => 26, "\x1B" => 27, "\x1C" => 28, "\x1D" => 29, "\x1E" => 30, "\x1F" => 31, "\x20" => 32, "\x21" => 33, "\x22" => 34, "\x23" => 35, "\x24" => 36, "\x25" => 37, "\x26" => 38, "\x27" => 39, "\x28" => 40, "\x29" => 41, "\x2A" => 42, "\x2B" => 43, "\x2C" => 44, "\x2D" => 45, "\x2E" => 46, "\x2F" => 47, "\x30" => 48, "\x31" => 49, "\x32" => 50, "\x33" => 51, "\x34" => 52, "\x35" => 53, "\x36" => 54, "\x37" => 55, "\x38" => 56, "\x39" => 57, "\x3A" => 58, "\x3B" => 59, "\x3C" => 60, "\x3D" => 61, "\x3E" => 62, "\x3F" => 63, "\x40" => 64, "\x41" => 65, "\x42" => 66, "\x43" => 67, "\x44" => 68, "\x45" => 69, "\x46" => 70, "\x47" => 71, "\x48" => 72, "\x49" => 73, "\x4A" => 74, "\x4B" => 75, "\x4C" => 76, "\x4D" => 77, "\x4E" => 78, "\x4F" => 79, "\x50" => 80, "\x51" => 81, "\x52" => 82, "\x53" => 83, "\x54" => 84, "\x55" => 85, "\x56" => 86, "\x57" => 87, "\x58" => 88, "\x59" => 89, "\x5A" => 90, "\x5B" => 91, "\x5C" => 92, "\x5D" => 93, "\x5E" => 94, "\x5F" => 95, "\x60" => 96, "\x61" => 97, "\x62" => 98, "\x63" => 99, "\x64" => 100, "\x65" => 101, "\x66" => 102, "\x67" => 103, "\x68" => 104, "\x69" => 105, "\x6A" => 106, "\x6B" => 107, "\x6C" => 108, "\x6D" => 109, "\x6E" => 110, "\x6F" => 111, "\x70" => 112, "\x71" => 113, "\x72" => 114, "\x73" => 115, "\x74" => 116, "\x75" => 117, "\x76" => 118, "\x77" => 119, "\x78" => 120, "\x79" => 121, "\x7A" => 122, "\x7B" => 123, "\x7C" => 124, "\x7D" => 125, "\x7E" => 126, "\x7F" => 127, "\x80" => 128, "\x81" => 129, "\x82" => 130, "\x83" => 131, "\x84" => 132, "\x85" => 133, "\x86" => 134, "\x87" => 135, "\x88" => 136, "\x89" => 137, "\x8A" => 138, "\x8B" => 139, "\x8C" => 140, "\x8D" => 141, "\x8E" => 142, "\x8F" => 143, "\x90" => 144, "\x91" => 145, "\x92" => 146, "\x93" => 147, "\x94" => 148, "\x95" => 149, "\x96" => 150, "\x97" => 151, "\x98" => 152, "\x99" => 153, "\x9A" => 154, "\x9B" => 155, "\x9C" => 156, "\x9D" => 157, "\x9E" => 158, "\x9F" => 159, "\xA0" => 160, "\xA1" => 161, "\xA2" => 162, "\xA3" => 163, "\xA4" => 164, "\xA5" => 165, "\xA6" => 166, "\xA7" => 167, "\xA8" => 168, "\xA9" => 169, "\xAA" => 170, "\xAB" => 171, "\xAC" => 172, "\xAD" => 173, "\xAE" => 174, "\xAF" => 175, "\xB0" => 176, "\xB1" => 177, "\xB2" => 178, "\xB3" => 179, "\xB4" => 180, "\xB5" => 181, "\xB6" => 182, "\xB7" => 183, "\xB8" => 184, "\xB9" => 185, "\xBA" => 186, "\xBB" => 187, "\xBC" => 188, "\xBD" => 189, "\xBE" => 190, "\xBF" => 191, "\xC0" => 192, "\xC1" => 193, "\xC2" => 194, "\xC3" => 195, "\xC4" => 196, "\xC5" => 197, "\xC6" => 198, "\xC7" => 199, "\xC8" => 200, "\xC9" => 201, "\xCA" => 202, "\xCB" => 203, "\xCC" => 204, "\xCD" => 205, "\xCE" => 206, "\xCF" => 207, "\xD0" => 208, "\xD1" => 209, "\xD2" => 210, "\xD3" => 211, "\xD4" => 212, "\xD5" => 213, "\xD6" => 214, "\xD7" => 215, "\xD8" => 216, "\xD9" => 217, "\xDA" => 218, "\xDB" => 219, "\xDC" => 220, "\xDD" => 221, "\xDE" => 222, "\xDF" => 223, "\xE0" => 224, "\xE1" => 225, "\xE2" => 226, "\xE3" => 227, "\xE4" => 228, "\xE5" => 229, "\xE6" => 230, "\xE7" => 231, "\xE8" => 232, "\xE9" => 233, "\xEA" => 234, "\xEB" => 235, "\xEC" => 236, "\xED" => 237, "\xEE" => 238, "\xEF" => 239, "\xF0" => 240, "\xF1" => 241, "\xF2" => 242, "\xF3" => 243, "\xF4" => 244, "\xF5" => 245, "\xF6" => 246, "\xF7" => 247, "\xF8" => 248, "\xF9" => 249, "\xFA" => 250, "\xFB" => 251, "\xFC" => 252, "\xFD" => 253, "\xFE" => 254, "\xFF" => 255]; |
|
| 1 | +<?php return ['' => 0, "\x00" => 0, "\x01" => 1, "\x02" => 2, "\x03" => 3, "\x04" => 4, "\x05" => 5, "\x06" => 6, "\x07" => 7, "\x08" => 8, "\x09" => 9, "\x0A" => 10, "\x0B" => 11, "\x0C" => 12, "\x0D" => 13, "\x0E" => 14, "\x0F" => 15, "\x10" => 16, "\x11" => 17, "\x12" => 18, "\x13" => 19, "\x14" => 20, "\x15" => 21, "\x16" => 22, "\x17" => 23, "\x18" => 24, "\x19" => 25, "\x1A" => 26, "\x1B" => 27, "\x1C" => 28, "\x1D" => 29, "\x1E" => 30, "\x1F" => 31, "\x20" => 32, "\x21" => 33, "\x22" => 34, "\x23" => 35, "\x24" => 36, "\x25" => 37, "\x26" => 38, "\x27" => 39, "\x28" => 40, "\x29" => 41, "\x2A" => 42, "\x2B" => 43, "\x2C" => 44, "\x2D" => 45, "\x2E" => 46, "\x2F" => 47, "\x30" => 48, "\x31" => 49, "\x32" => 50, "\x33" => 51, "\x34" => 52, "\x35" => 53, "\x36" => 54, "\x37" => 55, "\x38" => 56, "\x39" => 57, "\x3A" => 58, "\x3B" => 59, "\x3C" => 60, "\x3D" => 61, "\x3E" => 62, "\x3F" => 63, "\x40" => 64, "\x41" => 65, "\x42" => 66, "\x43" => 67, "\x44" => 68, "\x45" => 69, "\x46" => 70, "\x47" => 71, "\x48" => 72, "\x49" => 73, "\x4A" => 74, "\x4B" => 75, "\x4C" => 76, "\x4D" => 77, "\x4E" => 78, "\x4F" => 79, "\x50" => 80, "\x51" => 81, "\x52" => 82, "\x53" => 83, "\x54" => 84, "\x55" => 85, "\x56" => 86, "\x57" => 87, "\x58" => 88, "\x59" => 89, "\x5A" => 90, "\x5B" => 91, "\x5C" => 92, "\x5D" => 93, "\x5E" => 94, "\x5F" => 95, "\x60" => 96, "\x61" => 97, "\x62" => 98, "\x63" => 99, "\x64" => 100, "\x65" => 101, "\x66" => 102, "\x67" => 103, "\x68" => 104, "\x69" => 105, "\x6A" => 106, "\x6B" => 107, "\x6C" => 108, "\x6D" => 109, "\x6E" => 110, "\x6F" => 111, "\x70" => 112, "\x71" => 113, "\x72" => 114, "\x73" => 115, "\x74" => 116, "\x75" => 117, "\x76" => 118, "\x77" => 119, "\x78" => 120, "\x79" => 121, "\x7A" => 122, "\x7B" => 123, "\x7C" => 124, "\x7D" => 125, "\x7E" => 126, "\x7F" => 127, "\x80" => 128, "\x81" => 129, "\x82" => 130, "\x83" => 131, "\x84" => 132, "\x85" => 133, "\x86" => 134, "\x87" => 135, "\x88" => 136, "\x89" => 137, "\x8A" => 138, "\x8B" => 139, "\x8C" => 140, "\x8D" => 141, "\x8E" => 142, "\x8F" => 143, "\x90" => 144, "\x91" => 145, "\x92" => 146, "\x93" => 147, "\x94" => 148, "\x95" => 149, "\x96" => 150, "\x97" => 151, "\x98" => 152, "\x99" => 153, "\x9A" => 154, "\x9B" => 155, "\x9C" => 156, "\x9D" => 157, "\x9E" => 158, "\x9F" => 159, "\xA0" => 160, "\xA1" => 161, "\xA2" => 162, "\xA3" => 163, "\xA4" => 164, "\xA5" => 165, "\xA6" => 166, "\xA7" => 167, "\xA8" => 168, "\xA9" => 169, "\xAA" => 170, "\xAB" => 171, "\xAC" => 172, "\xAD" => 173, "\xAE" => 174, "\xAF" => 175, "\xB0" => 176, "\xB1" => 177, "\xB2" => 178, "\xB3" => 179, "\xB4" => 180, "\xB5" => 181, "\xB6" => 182, "\xB7" => 183, "\xB8" => 184, "\xB9" => 185, "\xBA" => 186, "\xBB" => 187, "\xBC" => 188, "\xBD" => 189, "\xBE" => 190, "\xBF" => 191, "\xC0" => 192, "\xC1" => 193, "\xC2" => 194, "\xC3" => 195, "\xC4" => 196, "\xC5" => 197, "\xC6" => 198, "\xC7" => 199, "\xC8" => 200, "\xC9" => 201, "\xCA" => 202, "\xCB" => 203, "\xCC" => 204, "\xCD" => 205, "\xCE" => 206, "\xCF" => 207, "\xD0" => 208, "\xD1" => 209, "\xD2" => 210, "\xD3" => 211, "\xD4" => 212, "\xD5" => 213, "\xD6" => 214, "\xD7" => 215, "\xD8" => 216, "\xD9" => 217, "\xDA" => 218, "\xDB" => 219, "\xDC" => 220, "\xDD" => 221, "\xDE" => 222, "\xDF" => 223, "\xE0" => 224, "\xE1" => 225, "\xE2" => 226, "\xE3" => 227, "\xE4" => 228, "\xE5" => 229, "\xE6" => 230, "\xE7" => 231, "\xE8" => 232, "\xE9" => 233, "\xEA" => 234, "\xEB" => 235, "\xEC" => 236, "\xED" => 237, "\xEE" => 238, "\xEF" => 239, "\xF0" => 240, "\xF1" => 241, "\xF2" => 242, "\xF3" => 243, "\xF4" => 244, "\xF5" => 245, "\xF6" => 246, "\xF7" => 247, "\xF8" => 248, "\xF9" => 249, "\xFA" => 250, "\xFB" => 251, "\xFC" => 252, "\xFD" => 253, "\xFE" => 254, "\xFF" => 255]; |
|
@@ -263,10 +263,10 @@ discard block |
||
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | if ($encoding === 'UTF-8') { |
| 266 | - return (string) \mb_substr($str, $pos, 1); |
|
| 266 | + return (string)\mb_substr($str, $pos, 1); |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
| 269 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | /** |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | public static function add_bom_to_string(string $str): string |
| 287 | 287 | { |
| 288 | 288 | if (!self::string_has_bom($str)) { |
| 289 | - $str = self::bom() . $str; |
|
| 289 | + $str = self::bom().$str; |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | return $str; |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | return ''; |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
| 361 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
| 362 | 362 | $end_position = \mb_strpos($str, $end, $substr_index); |
| 363 | 363 | if ( |
| 364 | 364 | $end_position === false |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | return ''; |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
| 371 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | return ''; |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
| 381 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
| 382 | 382 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
| 383 | 383 | if ( |
| 384 | 384 | $end_position === false |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | return ''; |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | - return (string) self::substr( |
|
| 391 | + return (string)self::substr( |
|
| 392 | 392 | $str, |
| 393 | 393 | $substr_index, |
| 394 | 394 | $end_position - $substr_index, |
@@ -472,10 +472,10 @@ discard block |
||
| 472 | 472 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
| 473 | 473 | { |
| 474 | 474 | if ($encoding === 'UTF-8') { |
| 475 | - return (string) \mb_substr($str, $index, 1); |
|
| 475 | + return (string)\mb_substr($str, $index, 1); |
|
| 476 | 476 | } |
| 477 | 477 | |
| 478 | - return (string) self::substr($str, $index, 1, $encoding); |
|
| 478 | + return (string)self::substr($str, $index, 1, $encoding); |
|
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | /** |
@@ -590,14 +590,14 @@ discard block |
||
| 590 | 590 | /** |
| 591 | 591 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 592 | 592 | */ |
| 593 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 593 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 594 | 594 | } |
| 595 | 595 | |
| 596 | 596 | if (!\is_int($code_point) || $code_point <= 0) { |
| 597 | 597 | return null; |
| 598 | 598 | } |
| 599 | 599 | |
| 600 | - $cache_key = $code_point . '_' . $encoding; |
|
| 600 | + $cache_key = $code_point.'_'.$encoding; |
|
| 601 | 601 | if (isset($CHAR_CACHE[$cache_key])) { |
| 602 | 602 | return $CHAR_CACHE[$cache_key]; |
| 603 | 603 | } |
@@ -642,27 +642,27 @@ discard block |
||
| 642 | 642 | self::$CHR = self::getData('chr'); |
| 643 | 643 | } |
| 644 | 644 | |
| 645 | - $code_point = (int) $code_point; |
|
| 645 | + $code_point = (int)$code_point; |
|
| 646 | 646 | if ($code_point <= 0x7FF) { |
| 647 | 647 | /** |
| 648 | 648 | * @psalm-suppress PossiblyNullArrayAccess |
| 649 | 649 | */ |
| 650 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
| 650 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
| 651 | 651 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 652 | 652 | } elseif ($code_point <= 0xFFFF) { |
| 653 | 653 | /** |
| 654 | 654 | * @psalm-suppress PossiblyNullArrayAccess |
| 655 | 655 | */ |
| 656 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
| 657 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 656 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
| 657 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 658 | 658 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 659 | 659 | } else { |
| 660 | 660 | /** |
| 661 | 661 | * @psalm-suppress PossiblyNullArrayAccess |
| 662 | 662 | */ |
| 663 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
| 664 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 665 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 663 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
| 664 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
| 665 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 666 | 666 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 667 | 667 | } |
| 668 | 668 | |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | |
| 720 | 720 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
| 721 | 721 | return \array_map( |
| 722 | - static function (string $data): int { |
|
| 722 | + static function(string $data): int { |
|
| 723 | 723 | // "mb_" is available if overload is used, so use it ... |
| 724 | 724 | return \mb_strlen($data, 'CP850'); // 8-BIT |
| 725 | 725 | }, |
@@ -806,7 +806,7 @@ discard block |
||
| 806 | 806 | $char = ''; |
| 807 | 807 | } |
| 808 | 808 | |
| 809 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
| 809 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
| 810 | 810 | } |
| 811 | 811 | |
| 812 | 812 | /** |
@@ -883,7 +883,7 @@ discard block |
||
| 883 | 883 | | ( [\x80-\xBF] ) # invalid byte in range 10000000 - 10111111 |
| 884 | 884 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
| 885 | 885 | /x'; |
| 886 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
| 886 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
| 887 | 887 | |
| 888 | 888 | if ($replace_diamond_question_mark) { |
| 889 | 889 | $str = self::replace_diamond_question_mark($str); |
@@ -922,7 +922,7 @@ discard block |
||
| 922 | 922 | public static function cleanup($str): string |
| 923 | 923 | { |
| 924 | 924 | // init |
| 925 | - $str = (string) $str; |
|
| 925 | + $str = (string)$str; |
|
| 926 | 926 | |
| 927 | 927 | if ($str === '') { |
| 928 | 928 | return ''; |
@@ -1023,7 +1023,7 @@ discard block |
||
| 1023 | 1023 | public static function collapse_whitespace(string $str): string |
| 1024 | 1024 | { |
| 1025 | 1025 | if (self::$SUPPORT['mbstring'] === true) { |
| 1026 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 1026 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 1027 | 1027 | } |
| 1028 | 1028 | |
| 1029 | 1029 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -1127,9 +1127,9 @@ discard block |
||
| 1127 | 1127 | // - 0-9 (U+0061 - U+007A) |
| 1128 | 1128 | // - ISO 10646 characters U+00A1 and higher |
| 1129 | 1129 | // We strip out any character not in the above list. |
| 1130 | - $str = (string) \preg_replace('/[^\x{002D}\x{0030}-\x{0039}\x{0041}-\x{005A}\x{005F}\x{0061}-\x{007A}\x{00A1}-\x{FFFF}]/u', '', $str); |
|
| 1130 | + $str = (string)\preg_replace('/[^\x{002D}\x{0030}-\x{0039}\x{0041}-\x{005A}\x{005F}\x{0061}-\x{007A}\x{00A1}-\x{FFFF}]/u', '', $str); |
|
| 1131 | 1131 | // Identifiers cannot start with a digit, two hyphens, or a hyphen followed by a digit. |
| 1132 | - $str = (string) \preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
| 1132 | + $str = (string)\preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
| 1133 | 1133 | |
| 1134 | 1134 | return \trim($str, '-'); |
| 1135 | 1135 | } |
@@ -1145,7 +1145,7 @@ discard block |
||
| 1145 | 1145 | */ |
| 1146 | 1146 | public static function css_stripe_media_queries(string $str): string |
| 1147 | 1147 | { |
| 1148 | - return (string) \preg_replace( |
|
| 1148 | + return (string)\preg_replace( |
|
| 1149 | 1149 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
| 1150 | 1150 | '', |
| 1151 | 1151 | $str |
@@ -1186,7 +1186,7 @@ discard block |
||
| 1186 | 1186 | { |
| 1187 | 1187 | // We cannot use html_entity_decode() here, as it will not return |
| 1188 | 1188 | // characters for many values < 160. |
| 1189 | - return mb_convert_encoding('&#' . $int . ';', 'UTF-8', 'HTML-ENTITIES'); |
|
| 1189 | + return mb_convert_encoding('&#'.$int.';', 'UTF-8', 'HTML-ENTITIES'); |
|
| 1190 | 1190 | } |
| 1191 | 1191 | |
| 1192 | 1192 | /** |
@@ -1236,7 +1236,7 @@ discard block |
||
| 1236 | 1236 | $flagOffset = 0x1F1E6; |
| 1237 | 1237 | $asciiOffset = 0x41; |
| 1238 | 1238 | |
| 1239 | - return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? '') . |
|
| 1239 | + return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? ''). |
|
| 1240 | 1240 | (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
| 1241 | 1241 | } |
| 1242 | 1242 | |
@@ -1270,16 +1270,16 @@ discard block |
||
| 1270 | 1270 | } |
| 1271 | 1271 | |
| 1272 | 1272 | if ($use_reversible_string_mappings) { |
| 1273 | - return (string) \str_replace( |
|
| 1274 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1275 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1273 | + return (string)\str_replace( |
|
| 1274 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1275 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1276 | 1276 | $str |
| 1277 | 1277 | ); |
| 1278 | 1278 | } |
| 1279 | 1279 | |
| 1280 | - return (string) \str_replace( |
|
| 1281 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 1282 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1280 | + return (string)\str_replace( |
|
| 1281 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 1282 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1283 | 1283 | $str |
| 1284 | 1284 | ); |
| 1285 | 1285 | } |
@@ -1314,16 +1314,16 @@ discard block |
||
| 1314 | 1314 | } |
| 1315 | 1315 | |
| 1316 | 1316 | if ($use_reversible_string_mappings) { |
| 1317 | - return (string) \str_replace( |
|
| 1318 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1319 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1317 | + return (string)\str_replace( |
|
| 1318 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1319 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1320 | 1320 | $str |
| 1321 | 1321 | ); |
| 1322 | 1322 | } |
| 1323 | 1323 | |
| 1324 | - return (string) \str_replace( |
|
| 1325 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1326 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 1324 | + return (string)\str_replace( |
|
| 1325 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1326 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 1327 | 1327 | $str |
| 1328 | 1328 | ); |
| 1329 | 1329 | } |
@@ -1389,7 +1389,7 @@ discard block |
||
| 1389 | 1389 | if ($to_encoding === 'JSON') { |
| 1390 | 1390 | $return = self::json_encode($str); |
| 1391 | 1391 | if ($return === false) { |
| 1392 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
| 1392 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
| 1393 | 1393 | } |
| 1394 | 1394 | |
| 1395 | 1395 | return $return; |
@@ -1478,7 +1478,7 @@ discard block |
||
| 1478 | 1478 | /** |
| 1479 | 1479 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 1480 | 1480 | */ |
| 1481 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
| 1481 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
| 1482 | 1482 | } |
| 1483 | 1483 | |
| 1484 | 1484 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1579,31 +1579,31 @@ discard block |
||
| 1579 | 1579 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
| 1580 | 1580 | |
| 1581 | 1581 | if ($length === null) { |
| 1582 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2); |
|
| 1582 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2); |
|
| 1583 | 1583 | } |
| 1584 | 1584 | |
| 1585 | 1585 | if ($search === '') { |
| 1586 | 1586 | if ($encoding === 'UTF-8') { |
| 1587 | 1587 | if ($length > 0) { |
| 1588 | - $string_length = (int) \mb_strlen($str); |
|
| 1588 | + $string_length = (int)\mb_strlen($str); |
|
| 1589 | 1589 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
| 1590 | 1590 | } else { |
| 1591 | 1591 | $end = 0; |
| 1592 | 1592 | } |
| 1593 | 1593 | |
| 1594 | - $pos = (int) \min( |
|
| 1594 | + $pos = (int)\min( |
|
| 1595 | 1595 | \mb_strpos($str, ' ', $end), |
| 1596 | 1596 | \mb_strpos($str, '.', $end) |
| 1597 | 1597 | ); |
| 1598 | 1598 | } else { |
| 1599 | 1599 | if ($length > 0) { |
| 1600 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 1600 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 1601 | 1601 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
| 1602 | 1602 | } else { |
| 1603 | 1603 | $end = 0; |
| 1604 | 1604 | } |
| 1605 | 1605 | |
| 1606 | - $pos = (int) \min( |
|
| 1606 | + $pos = (int)\min( |
|
| 1607 | 1607 | self::strpos($str, ' ', $end, $encoding), |
| 1608 | 1608 | self::strpos($str, '.', $end, $encoding) |
| 1609 | 1609 | ); |
@@ -1620,18 +1620,18 @@ discard block |
||
| 1620 | 1620 | return ''; |
| 1621 | 1621 | } |
| 1622 | 1622 | |
| 1623 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1623 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1624 | 1624 | } |
| 1625 | 1625 | |
| 1626 | 1626 | return $str; |
| 1627 | 1627 | } |
| 1628 | 1628 | |
| 1629 | 1629 | if ($encoding === 'UTF-8') { |
| 1630 | - $word_position = (int) \mb_stripos($str, $search); |
|
| 1631 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
| 1630 | + $word_position = (int)\mb_stripos($str, $search); |
|
| 1631 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
| 1632 | 1632 | } else { |
| 1633 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
| 1634 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
| 1633 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
| 1634 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
| 1635 | 1635 | } |
| 1636 | 1636 | |
| 1637 | 1637 | $pos_start = 0; |
@@ -1643,12 +1643,12 @@ discard block |
||
| 1643 | 1643 | } |
| 1644 | 1644 | if ($half_text !== false) { |
| 1645 | 1645 | if ($encoding === 'UTF-8') { |
| 1646 | - $pos_start = (int) \max( |
|
| 1646 | + $pos_start = (int)\max( |
|
| 1647 | 1647 | \mb_strrpos($half_text, ' '), |
| 1648 | 1648 | \mb_strrpos($half_text, '.') |
| 1649 | 1649 | ); |
| 1650 | 1650 | } else { |
| 1651 | - $pos_start = (int) \max( |
|
| 1651 | + $pos_start = (int)\max( |
|
| 1652 | 1652 | self::strrpos($half_text, ' ', 0, $encoding), |
| 1653 | 1653 | self::strrpos($half_text, '.', 0, $encoding) |
| 1654 | 1654 | ); |
@@ -1658,19 +1658,19 @@ discard block |
||
| 1658 | 1658 | |
| 1659 | 1659 | if ($word_position && $half_side > 0) { |
| 1660 | 1660 | $offset = $pos_start + $length - 1; |
| 1661 | - $real_length = (int) self::strlen($str, $encoding); |
|
| 1661 | + $real_length = (int)self::strlen($str, $encoding); |
|
| 1662 | 1662 | |
| 1663 | 1663 | if ($offset > $real_length) { |
| 1664 | 1664 | $offset = $real_length; |
| 1665 | 1665 | } |
| 1666 | 1666 | |
| 1667 | 1667 | if ($encoding === 'UTF-8') { |
| 1668 | - $pos_end = (int) \min( |
|
| 1668 | + $pos_end = (int)\min( |
|
| 1669 | 1669 | \mb_strpos($str, ' ', $offset), |
| 1670 | 1670 | \mb_strpos($str, '.', $offset) |
| 1671 | 1671 | ) - $pos_start; |
| 1672 | 1672 | } else { |
| 1673 | - $pos_end = (int) \min( |
|
| 1673 | + $pos_end = (int)\min( |
|
| 1674 | 1674 | self::strpos($str, ' ', $offset, $encoding), |
| 1675 | 1675 | self::strpos($str, '.', $offset, $encoding) |
| 1676 | 1676 | ) - $pos_start; |
@@ -1678,12 +1678,12 @@ discard block |
||
| 1678 | 1678 | |
| 1679 | 1679 | if (!$pos_end || $pos_end <= 0) { |
| 1680 | 1680 | if ($encoding === 'UTF-8') { |
| 1681 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
| 1681 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
| 1682 | 1682 | } else { |
| 1683 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
| 1683 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
| 1684 | 1684 | } |
| 1685 | 1685 | if ($str_sub !== false) { |
| 1686 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
| 1686 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
| 1687 | 1687 | } else { |
| 1688 | 1688 | $extract = ''; |
| 1689 | 1689 | } |
@@ -1694,26 +1694,26 @@ discard block |
||
| 1694 | 1694 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
| 1695 | 1695 | } |
| 1696 | 1696 | if ($str_sub !== false) { |
| 1697 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1697 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1698 | 1698 | } else { |
| 1699 | 1699 | $extract = ''; |
| 1700 | 1700 | } |
| 1701 | 1701 | } |
| 1702 | 1702 | } else { |
| 1703 | 1703 | $offset = $length - 1; |
| 1704 | - $true_length = (int) self::strlen($str, $encoding); |
|
| 1704 | + $true_length = (int)self::strlen($str, $encoding); |
|
| 1705 | 1705 | |
| 1706 | 1706 | if ($offset > $true_length) { |
| 1707 | 1707 | $offset = $true_length; |
| 1708 | 1708 | } |
| 1709 | 1709 | |
| 1710 | 1710 | if ($encoding === 'UTF-8') { |
| 1711 | - $pos_end = (int) \min( |
|
| 1711 | + $pos_end = (int)\min( |
|
| 1712 | 1712 | \mb_strpos($str, ' ', $offset), |
| 1713 | 1713 | \mb_strpos($str, '.', $offset) |
| 1714 | 1714 | ); |
| 1715 | 1715 | } else { |
| 1716 | - $pos_end = (int) \min( |
|
| 1716 | + $pos_end = (int)\min( |
|
| 1717 | 1717 | self::strpos($str, ' ', $offset, $encoding), |
| 1718 | 1718 | self::strpos($str, '.', $offset, $encoding) |
| 1719 | 1719 | ); |
@@ -1726,7 +1726,7 @@ discard block |
||
| 1726 | 1726 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
| 1727 | 1727 | } |
| 1728 | 1728 | if ($str_sub !== false) { |
| 1729 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1729 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1730 | 1730 | } else { |
| 1731 | 1731 | $extract = ''; |
| 1732 | 1732 | } |
@@ -1861,7 +1861,7 @@ discard block |
||
| 1861 | 1861 | { |
| 1862 | 1862 | $file_content = \file_get_contents($file_path); |
| 1863 | 1863 | if ($file_content === false) { |
| 1864 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
| 1864 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
| 1865 | 1865 | } |
| 1866 | 1866 | |
| 1867 | 1867 | return self::string_has_bom($file_content); |
@@ -1929,7 +1929,7 @@ discard block |
||
| 1929 | 1929 | ) { |
| 1930 | 1930 | // Prevent leading combining chars |
| 1931 | 1931 | // for NFC-safe concatenations. |
| 1932 | - $var = $leading_combining . $var; |
|
| 1932 | + $var = $leading_combining.$var; |
|
| 1933 | 1933 | } |
| 1934 | 1934 | } |
| 1935 | 1935 | |
@@ -2253,10 +2253,10 @@ discard block |
||
| 2253 | 2253 | } |
| 2254 | 2254 | |
| 2255 | 2255 | if ($encoding === 'UTF-8') { |
| 2256 | - return (string) \mb_substr($str, 0, $n); |
|
| 2256 | + return (string)\mb_substr($str, 0, $n); |
|
| 2257 | 2257 | } |
| 2258 | 2258 | |
| 2259 | - return (string) self::substr($str, 0, $n, $encoding); |
|
| 2259 | + return (string)self::substr($str, 0, $n, $encoding); |
|
| 2260 | 2260 | } |
| 2261 | 2261 | |
| 2262 | 2262 | /** |
@@ -2274,7 +2274,7 @@ discard block |
||
| 2274 | 2274 | */ |
| 2275 | 2275 | public static function fits_inside(string $str, int $box_size): bool |
| 2276 | 2276 | { |
| 2277 | - return (int) self::strlen($str) <= $box_size; |
|
| 2277 | + return (int)self::strlen($str) <= $box_size; |
|
| 2278 | 2278 | } |
| 2279 | 2279 | |
| 2280 | 2280 | /** |
@@ -2359,7 +2359,7 @@ discard block |
||
| 2359 | 2359 | return $str; |
| 2360 | 2360 | } |
| 2361 | 2361 | |
| 2362 | - $str = (string) $str; |
|
| 2362 | + $str = (string)$str; |
|
| 2363 | 2363 | $last = ''; |
| 2364 | 2364 | while ($last !== $str) { |
| 2365 | 2365 | $last = $str; |
@@ -2559,7 +2559,7 @@ discard block |
||
| 2559 | 2559 | if ($str_info === false) { |
| 2560 | 2560 | return $fallback; |
| 2561 | 2561 | } |
| 2562 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
| 2562 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
| 2563 | 2563 | |
| 2564 | 2564 | // DEBUG |
| 2565 | 2565 | //var_dump($type_code); |
@@ -2617,7 +2617,7 @@ discard block |
||
| 2617 | 2617 | // |
| 2618 | 2618 | |
| 2619 | 2619 | if ($encoding === 'UTF-8') { |
| 2620 | - $max_length = (int) \mb_strlen($possible_chars); |
|
| 2620 | + $max_length = (int)\mb_strlen($possible_chars); |
|
| 2621 | 2621 | if ($max_length === 0) { |
| 2622 | 2622 | return ''; |
| 2623 | 2623 | } |
@@ -2637,7 +2637,7 @@ discard block |
||
| 2637 | 2637 | } else { |
| 2638 | 2638 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 2639 | 2639 | |
| 2640 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
| 2640 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
| 2641 | 2641 | if ($max_length === 0) { |
| 2642 | 2642 | return ''; |
| 2643 | 2643 | } |
@@ -2673,16 +2673,16 @@ discard block |
||
| 2673 | 2673 | $rand_int = \mt_rand(0, \mt_getrandmax()); |
| 2674 | 2674 | } |
| 2675 | 2675 | |
| 2676 | - $unique_helper = $rand_int . |
|
| 2677 | - \session_id() . |
|
| 2678 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
| 2679 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
| 2676 | + $unique_helper = $rand_int. |
|
| 2677 | + \session_id(). |
|
| 2678 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
| 2679 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
| 2680 | 2680 | $extra_entropy; |
| 2681 | 2681 | |
| 2682 | 2682 | $unique_string = \uniqid($unique_helper, true); |
| 2683 | 2683 | |
| 2684 | 2684 | if ($use_md5) { |
| 2685 | - $unique_string = \md5($unique_string . $unique_helper); |
|
| 2685 | + $unique_string = \md5($unique_string.$unique_helper); |
|
| 2686 | 2686 | } |
| 2687 | 2687 | |
| 2688 | 2688 | return $unique_string; |
@@ -2761,7 +2761,7 @@ discard block |
||
| 2761 | 2761 | public static function hex_to_chr(string $hexdec) |
| 2762 | 2762 | { |
| 2763 | 2763 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Invalid characters passed for attempted conversion, these have been ignored */ |
| 2764 | - return self::decimal_to_chr((int) @\hexdec($hexdec)); |
|
| 2764 | + return self::decimal_to_chr((int)@\hexdec($hexdec)); |
|
| 2765 | 2765 | } |
| 2766 | 2766 | |
| 2767 | 2767 | /** |
@@ -2781,7 +2781,7 @@ discard block |
||
| 2781 | 2781 | public static function hex_to_int($hexdec) |
| 2782 | 2782 | { |
| 2783 | 2783 | // init |
| 2784 | - $hexdec = (string) $hexdec; |
|
| 2784 | + $hexdec = (string)$hexdec; |
|
| 2785 | 2785 | |
| 2786 | 2786 | if ($hexdec === '') { |
| 2787 | 2787 | return false; |
@@ -2859,7 +2859,7 @@ discard block |
||
| 2859 | 2859 | return \implode( |
| 2860 | 2860 | '', |
| 2861 | 2861 | \array_map( |
| 2862 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
| 2862 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
| 2863 | 2863 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
| 2864 | 2864 | }, |
| 2865 | 2865 | self::str_split($str) |
@@ -2973,7 +2973,7 @@ discard block |
||
| 2973 | 2973 | /** |
| 2974 | 2974 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 2975 | 2975 | */ |
| 2976 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 2976 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 2977 | 2977 | } |
| 2978 | 2978 | |
| 2979 | 2979 | do { |
@@ -2982,7 +2982,7 @@ discard block |
||
| 2982 | 2982 | if (\strpos($str, '&') !== false) { |
| 2983 | 2983 | if (\strpos($str, '&#') !== false) { |
| 2984 | 2984 | // decode also numeric & UTF16 two byte entities |
| 2985 | - $str = (string) \preg_replace( |
|
| 2985 | + $str = (string)\preg_replace( |
|
| 2986 | 2986 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
| 2987 | 2987 | '$1;', |
| 2988 | 2988 | $str |
@@ -3032,7 +3032,7 @@ discard block |
||
| 3032 | 3032 | */ |
| 3033 | 3033 | public static function html_stripe_empty_tags(string $str): string |
| 3034 | 3034 | { |
| 3035 | - return (string) \preg_replace( |
|
| 3035 | + return (string)\preg_replace( |
|
| 3036 | 3036 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
| 3037 | 3037 | '', |
| 3038 | 3038 | $str |
@@ -3343,9 +3343,9 @@ discard block |
||
| 3343 | 3343 | { |
| 3344 | 3344 | $hex = \dechex($int); |
| 3345 | 3345 | |
| 3346 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
| 3346 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
| 3347 | 3347 | |
| 3348 | - return $prefix . $hex . ''; |
|
| 3348 | + return $prefix.$hex.''; |
|
| 3349 | 3349 | } |
| 3350 | 3350 | |
| 3351 | 3351 | /** |
@@ -3513,7 +3513,7 @@ discard block |
||
| 3513 | 3513 | */ |
| 3514 | 3514 | public static function is_binary($input, bool $strict = false): bool |
| 3515 | 3515 | { |
| 3516 | - $input = (string) $input; |
|
| 3516 | + $input = (string)$input; |
|
| 3517 | 3517 | if ($input === '') { |
| 3518 | 3518 | return false; |
| 3519 | 3519 | } |
@@ -3865,7 +3865,7 @@ discard block |
||
| 3865 | 3865 | public static function is_utf16($str, bool $check_if_string_is_binary = true) |
| 3866 | 3866 | { |
| 3867 | 3867 | // init |
| 3868 | - $str = (string) $str; |
|
| 3868 | + $str = (string)$str; |
|
| 3869 | 3869 | $str_chars = []; |
| 3870 | 3870 | |
| 3871 | 3871 | // fix for the "binary"-check |
@@ -3964,7 +3964,7 @@ discard block |
||
| 3964 | 3964 | public static function is_utf32($str, bool $check_if_string_is_binary = true) |
| 3965 | 3965 | { |
| 3966 | 3966 | // init |
| 3967 | - $str = (string) $str; |
|
| 3967 | + $str = (string)$str; |
|
| 3968 | 3968 | $str_chars = []; |
| 3969 | 3969 | |
| 3970 | 3970 | // fix for the "binary"-check |
@@ -4067,7 +4067,7 @@ discard block |
||
| 4067 | 4067 | return true; |
| 4068 | 4068 | } |
| 4069 | 4069 | |
| 4070 | - return self::is_utf8_string((string) $str, $strict); |
|
| 4070 | + return self::is_utf8_string((string)$str, $strict); |
|
| 4071 | 4071 | } |
| 4072 | 4072 | |
| 4073 | 4073 | /** |
@@ -4231,15 +4231,15 @@ discard block |
||
| 4231 | 4231 | $use_mb_functions = ($lang === null && !$try_to_keep_the_string_length); |
| 4232 | 4232 | |
| 4233 | 4233 | if ($encoding === 'UTF-8') { |
| 4234 | - $str_part_two = (string) \mb_substr($str, 1); |
|
| 4234 | + $str_part_two = (string)\mb_substr($str, 1); |
|
| 4235 | 4235 | |
| 4236 | 4236 | if ($use_mb_functions) { |
| 4237 | 4237 | $str_part_one = \mb_strtolower( |
| 4238 | - (string) \mb_substr($str, 0, 1) |
|
| 4238 | + (string)\mb_substr($str, 0, 1) |
|
| 4239 | 4239 | ); |
| 4240 | 4240 | } else { |
| 4241 | 4241 | $str_part_one = self::strtolower( |
| 4242 | - (string) \mb_substr($str, 0, 1), |
|
| 4242 | + (string)\mb_substr($str, 0, 1), |
|
| 4243 | 4243 | $encoding, |
| 4244 | 4244 | false, |
| 4245 | 4245 | $lang, |
@@ -4249,10 +4249,10 @@ discard block |
||
| 4249 | 4249 | } else { |
| 4250 | 4250 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4251 | 4251 | |
| 4252 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
| 4252 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
| 4253 | 4253 | |
| 4254 | 4254 | $str_part_one = self::strtolower( |
| 4255 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 4255 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 4256 | 4256 | $encoding, |
| 4257 | 4257 | false, |
| 4258 | 4258 | $lang, |
@@ -4260,7 +4260,7 @@ discard block |
||
| 4260 | 4260 | ); |
| 4261 | 4261 | } |
| 4262 | 4262 | |
| 4263 | - return $str_part_one . $str_part_two; |
|
| 4263 | + return $str_part_one.$str_part_two; |
|
| 4264 | 4264 | } |
| 4265 | 4265 | |
| 4266 | 4266 | /** |
@@ -4375,7 +4375,7 @@ discard block |
||
| 4375 | 4375 | $pattern = '^[\\s]+'; |
| 4376 | 4376 | } |
| 4377 | 4377 | |
| 4378 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 4378 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 4379 | 4379 | } |
| 4380 | 4380 | |
| 4381 | 4381 | if ($chars !== null) { |
@@ -4412,7 +4412,7 @@ discard block |
||
| 4412 | 4412 | |
| 4413 | 4413 | $codepoint_max = \max($codepoints); |
| 4414 | 4414 | |
| 4415 | - return self::chr((int) $codepoint_max); |
|
| 4415 | + return self::chr((int)$codepoint_max); |
|
| 4416 | 4416 | } |
| 4417 | 4417 | |
| 4418 | 4418 | /** |
@@ -4432,7 +4432,7 @@ discard block |
||
| 4432 | 4432 | { |
| 4433 | 4433 | $bytes = self::chr_size_list($str); |
| 4434 | 4434 | if ($bytes !== []) { |
| 4435 | - return (int) \max($bytes); |
|
| 4435 | + return (int)\max($bytes); |
|
| 4436 | 4436 | } |
| 4437 | 4437 | |
| 4438 | 4438 | return 0; |
@@ -4478,7 +4478,7 @@ discard block |
||
| 4478 | 4478 | |
| 4479 | 4479 | $codepoint_min = \min($codepoints); |
| 4480 | 4480 | |
| 4481 | - return self::chr((int) $codepoint_min); |
|
| 4481 | + return self::chr((int)$codepoint_min); |
|
| 4482 | 4482 | } |
| 4483 | 4483 | |
| 4484 | 4484 | /** |
@@ -4508,7 +4508,7 @@ discard block |
||
| 4508 | 4508 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
| 4509 | 4509 | |
| 4510 | 4510 | // init |
| 4511 | - $encoding = (string) $encoding; |
|
| 4511 | + $encoding = (string)$encoding; |
|
| 4512 | 4512 | |
| 4513 | 4513 | if (!$encoding) { |
| 4514 | 4514 | return $fallback; |
@@ -4570,7 +4570,7 @@ discard block |
||
| 4570 | 4570 | |
| 4571 | 4571 | $encoding_original = $encoding; |
| 4572 | 4572 | $encoding = \strtoupper($encoding); |
| 4573 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
| 4573 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
| 4574 | 4574 | |
| 4575 | 4575 | $equivalences = [ |
| 4576 | 4576 | 'ISO8859' => 'ISO-8859-1', |
@@ -4737,13 +4737,13 @@ discard block |
||
| 4737 | 4737 | static $CHAR_CACHE = []; |
| 4738 | 4738 | |
| 4739 | 4739 | // init |
| 4740 | - $chr = (string) $chr; |
|
| 4740 | + $chr = (string)$chr; |
|
| 4741 | 4741 | |
| 4742 | 4742 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
| 4743 | 4743 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4744 | 4744 | } |
| 4745 | 4745 | |
| 4746 | - $cache_key = $chr . '_' . $encoding; |
|
| 4746 | + $cache_key = $chr.'_'.$encoding; |
|
| 4747 | 4747 | if (isset($CHAR_CACHE[$cache_key])) { |
| 4748 | 4748 | return $CHAR_CACHE[$cache_key]; |
| 4749 | 4749 | } |
@@ -4776,7 +4776,7 @@ discard block |
||
| 4776 | 4776 | // fallback via vanilla php |
| 4777 | 4777 | // |
| 4778 | 4778 | |
| 4779 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
| 4779 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
| 4780 | 4780 | /** @noinspection PhpSillyAssignmentInspection - hack for phpstan */ |
| 4781 | 4781 | /** @var int[] $chr - "unpack": only false if the format string contains errors */ |
| 4782 | 4782 | $chr = $chr; |
@@ -4853,7 +4853,7 @@ discard block |
||
| 4853 | 4853 | public static function pcre_utf8_support(): bool |
| 4854 | 4854 | { |
| 4855 | 4855 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 4856 | - return (bool) @\preg_match('//u', ''); |
|
| 4856 | + return (bool)@\preg_match('//u', ''); |
|
| 4857 | 4857 | } |
| 4858 | 4858 | |
| 4859 | 4859 | /** |
@@ -4894,14 +4894,14 @@ discard block |
||
| 4894 | 4894 | * @psalm-suppress DocblockTypeContradiction |
| 4895 | 4895 | */ |
| 4896 | 4896 | if (!\is_numeric($step)) { |
| 4897 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
| 4897 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
| 4898 | 4898 | } |
| 4899 | 4899 | |
| 4900 | 4900 | /** |
| 4901 | 4901 | * @psalm-suppress RedundantConditionGivenDocblockType - false-positive from psalm? |
| 4902 | 4902 | */ |
| 4903 | 4903 | if ($step <= 0) { |
| 4904 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
| 4904 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
| 4905 | 4905 | } |
| 4906 | 4906 | } |
| 4907 | 4907 | |
@@ -4912,16 +4912,16 @@ discard block |
||
| 4912 | 4912 | $is_digit = false; |
| 4913 | 4913 | $is_xdigit = false; |
| 4914 | 4914 | |
| 4915 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
| 4915 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
| 4916 | 4916 | $is_digit = true; |
| 4917 | - $start = (int) $var1; |
|
| 4917 | + $start = (int)$var1; |
|
| 4918 | 4918 | } elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
| 4919 | 4919 | $is_xdigit = true; |
| 4920 | - $start = (int) self::hex_to_int((string) $var1); |
|
| 4920 | + $start = (int)self::hex_to_int((string)$var1); |
|
| 4921 | 4921 | } elseif (!$use_ctype && \is_numeric($var1)) { |
| 4922 | - $start = (int) $var1; |
|
| 4922 | + $start = (int)$var1; |
|
| 4923 | 4923 | } else { |
| 4924 | - $start = self::ord((string) $var1); |
|
| 4924 | + $start = self::ord((string)$var1); |
|
| 4925 | 4925 | } |
| 4926 | 4926 | |
| 4927 | 4927 | if (!$start) { |
@@ -4929,13 +4929,13 @@ discard block |
||
| 4929 | 4929 | } |
| 4930 | 4930 | |
| 4931 | 4931 | if ($is_digit) { |
| 4932 | - $end = (int) $var2; |
|
| 4932 | + $end = (int)$var2; |
|
| 4933 | 4933 | } elseif ($is_xdigit) { |
| 4934 | - $end = (int) self::hex_to_int((string) $var2); |
|
| 4934 | + $end = (int)self::hex_to_int((string)$var2); |
|
| 4935 | 4935 | } elseif (!$use_ctype && \is_numeric($var2)) { |
| 4936 | - $end = (int) $var2; |
|
| 4936 | + $end = (int)$var2; |
|
| 4937 | 4937 | } else { |
| 4938 | - $end = self::ord((string) $var2); |
|
| 4938 | + $end = self::ord((string)$var2); |
|
| 4939 | 4939 | } |
| 4940 | 4940 | |
| 4941 | 4941 | if (!$end) { |
@@ -4944,7 +4944,7 @@ discard block |
||
| 4944 | 4944 | |
| 4945 | 4945 | $array = []; |
| 4946 | 4946 | foreach (\range($start, $end, $step) as $i) { |
| 4947 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
| 4947 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
| 4948 | 4948 | } |
| 4949 | 4949 | |
| 4950 | 4950 | return $array; |
@@ -5040,8 +5040,8 @@ discard block |
||
| 5040 | 5040 | $delimiter = '/'; |
| 5041 | 5041 | } |
| 5042 | 5042 | |
| 5043 | - return (string) \preg_replace( |
|
| 5044 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
| 5043 | + return (string)\preg_replace( |
|
| 5044 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
| 5045 | 5045 | $replacement, |
| 5046 | 5046 | $str |
| 5047 | 5047 | ); |
@@ -5076,7 +5076,7 @@ discard block |
||
| 5076 | 5076 | |
| 5077 | 5077 | $str_length -= $bom_byte_length; |
| 5078 | 5078 | |
| 5079 | - $str = (string) $str_tmp; |
|
| 5079 | + $str = (string)$str_tmp; |
|
| 5080 | 5080 | } |
| 5081 | 5081 | } |
| 5082 | 5082 | |
@@ -5107,7 +5107,7 @@ discard block |
||
| 5107 | 5107 | */ |
| 5108 | 5108 | if (\is_array($what)) { |
| 5109 | 5109 | foreach ($what as $item) { |
| 5110 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
| 5110 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
| 5111 | 5111 | } |
| 5112 | 5112 | } |
| 5113 | 5113 | |
@@ -5145,7 +5145,7 @@ discard block |
||
| 5145 | 5145 | */ |
| 5146 | 5146 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
| 5147 | 5147 | { |
| 5148 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 5148 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 5149 | 5149 | } |
| 5150 | 5150 | |
| 5151 | 5151 | /** |
@@ -5209,17 +5209,17 @@ discard block |
||
| 5209 | 5209 | \strpos($str, $substring) === 0 |
| 5210 | 5210 | ) { |
| 5211 | 5211 | if ($encoding === 'UTF-8') { |
| 5212 | - return (string) \mb_substr( |
|
| 5212 | + return (string)\mb_substr( |
|
| 5213 | 5213 | $str, |
| 5214 | - (int) \mb_strlen($substring) |
|
| 5214 | + (int)\mb_strlen($substring) |
|
| 5215 | 5215 | ); |
| 5216 | 5216 | } |
| 5217 | 5217 | |
| 5218 | 5218 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5219 | 5219 | |
| 5220 | - return (string) self::substr( |
|
| 5220 | + return (string)self::substr( |
|
| 5221 | 5221 | $str, |
| 5222 | - (int) self::strlen($substring, $encoding), |
|
| 5222 | + (int)self::strlen($substring, $encoding), |
|
| 5223 | 5223 | null, |
| 5224 | 5224 | $encoding |
| 5225 | 5225 | ); |
@@ -5247,19 +5247,19 @@ discard block |
||
| 5247 | 5247 | ): string { |
| 5248 | 5248 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
| 5249 | 5249 | if ($encoding === 'UTF-8') { |
| 5250 | - return (string) \mb_substr( |
|
| 5250 | + return (string)\mb_substr( |
|
| 5251 | 5251 | $str, |
| 5252 | 5252 | 0, |
| 5253 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
| 5253 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
| 5254 | 5254 | ); |
| 5255 | 5255 | } |
| 5256 | 5256 | |
| 5257 | 5257 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5258 | 5258 | |
| 5259 | - return (string) self::substr( |
|
| 5259 | + return (string)self::substr( |
|
| 5260 | 5260 | $str, |
| 5261 | 5261 | 0, |
| 5262 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
| 5262 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
| 5263 | 5263 | $encoding |
| 5264 | 5264 | ); |
| 5265 | 5265 | } |
@@ -5362,7 +5362,7 @@ discard block |
||
| 5362 | 5362 | /** @noinspection PhpUsageOfSilenceOperatorInspection - ignore "Unknown character" warnings, it's working anyway */ |
| 5363 | 5363 | @\mb_substitute_character($replacement_char_helper); |
| 5364 | 5364 | // the polyfill maybe return false, so cast to string |
| 5365 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 5365 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 5366 | 5366 | \mb_substitute_character($save); |
| 5367 | 5367 | } |
| 5368 | 5368 | |
@@ -5407,7 +5407,7 @@ discard block |
||
| 5407 | 5407 | $pattern = '[\\s]+$'; |
| 5408 | 5408 | } |
| 5409 | 5409 | |
| 5410 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 5410 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 5411 | 5411 | } |
| 5412 | 5412 | |
| 5413 | 5413 | if ($chars !== null) { |
@@ -5436,7 +5436,7 @@ discard block |
||
| 5436 | 5436 | |
| 5437 | 5437 | $html .= '<pre>'; |
| 5438 | 5438 | foreach (self::$SUPPORT as $key => &$value) { |
| 5439 | - $html .= $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
| 5439 | + $html .= $key.' - '.\print_r($value, true)."\n<br>"; |
|
| 5440 | 5440 | } |
| 5441 | 5441 | $html .= '</pre>'; |
| 5442 | 5442 | |
@@ -5478,7 +5478,7 @@ discard block |
||
| 5478 | 5478 | return $char; |
| 5479 | 5479 | } |
| 5480 | 5480 | |
| 5481 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
| 5481 | + return '&#'.self::ord($char, $encoding).';'; |
|
| 5482 | 5482 | } |
| 5483 | 5483 | |
| 5484 | 5484 | /** |
@@ -5541,11 +5541,11 @@ discard block |
||
| 5541 | 5541 | $lang, |
| 5542 | 5542 | $try_to_keep_the_string_length |
| 5543 | 5543 | ); |
| 5544 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
| 5544 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
| 5545 | 5545 | |
| 5546 | 5546 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 5547 | 5547 | |
| 5548 | - $str = (string) \preg_replace_callback( |
|
| 5548 | + $str = (string)\preg_replace_callback( |
|
| 5549 | 5549 | '/[-_\\s]+(.)?/u', |
| 5550 | 5550 | /** |
| 5551 | 5551 | * @param array $match |
@@ -5554,7 +5554,7 @@ discard block |
||
| 5554 | 5554 | * |
| 5555 | 5555 | * @return string |
| 5556 | 5556 | */ |
| 5557 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
| 5557 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
| 5558 | 5558 | if (isset($match[1])) { |
| 5559 | 5559 | if ($use_mb_functions) { |
| 5560 | 5560 | if ($encoding === 'UTF-8') { |
@@ -5572,7 +5572,7 @@ discard block |
||
| 5572 | 5572 | $str |
| 5573 | 5573 | ); |
| 5574 | 5574 | |
| 5575 | - return (string) \preg_replace_callback( |
|
| 5575 | + return (string)\preg_replace_callback( |
|
| 5576 | 5576 | '/[\\p{N}]+(.)?/u', |
| 5577 | 5577 | /** |
| 5578 | 5578 | * @param array $match |
@@ -5581,7 +5581,7 @@ discard block |
||
| 5581 | 5581 | * |
| 5582 | 5582 | * @return string |
| 5583 | 5583 | */ |
| 5584 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
| 5584 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
| 5585 | 5585 | if ($use_mb_functions) { |
| 5586 | 5586 | if ($encoding === 'UTF-8') { |
| 5587 | 5587 | return \mb_strtoupper($match[0]); |
@@ -5674,12 +5674,12 @@ discard block |
||
| 5674 | 5674 | |
| 5675 | 5675 | foreach ($needles as &$needle) { |
| 5676 | 5676 | if ($case_sensitive) { |
| 5677 | - if (!$needle || \strpos($haystack, (string) $needle) === false) { |
|
| 5677 | + if (!$needle || \strpos($haystack, (string)$needle) === false) { |
|
| 5678 | 5678 | return false; |
| 5679 | 5679 | } |
| 5680 | 5680 | } |
| 5681 | 5681 | |
| 5682 | - if (!$needle || \mb_stripos($haystack, (string) $needle) === false) { |
|
| 5682 | + if (!$needle || \mb_stripos($haystack, (string)$needle) === false) { |
|
| 5683 | 5683 | return false; |
| 5684 | 5684 | } |
| 5685 | 5685 | } |
@@ -5716,14 +5716,14 @@ discard block |
||
| 5716 | 5716 | } |
| 5717 | 5717 | |
| 5718 | 5718 | if ($case_sensitive) { |
| 5719 | - if (\strpos($haystack, (string) $needle) !== false) { |
|
| 5719 | + if (\strpos($haystack, (string)$needle) !== false) { |
|
| 5720 | 5720 | return true; |
| 5721 | 5721 | } |
| 5722 | 5722 | |
| 5723 | 5723 | continue; |
| 5724 | 5724 | } |
| 5725 | 5725 | |
| 5726 | - if (\mb_stripos($haystack, (string) $needle) !== false) { |
|
| 5726 | + if (\mb_stripos($haystack, (string)$needle) !== false) { |
|
| 5727 | 5727 | return true; |
| 5728 | 5728 | } |
| 5729 | 5729 | } |
@@ -5776,7 +5776,7 @@ discard block |
||
| 5776 | 5776 | bool $try_to_keep_the_string_length = false |
| 5777 | 5777 | ): string { |
| 5778 | 5778 | if (self::$SUPPORT['mbstring'] === true) { |
| 5779 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
| 5779 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
| 5780 | 5780 | |
| 5781 | 5781 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 5782 | 5782 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -5785,10 +5785,10 @@ discard block |
||
| 5785 | 5785 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
| 5786 | 5786 | } |
| 5787 | 5787 | |
| 5788 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
| 5788 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
| 5789 | 5789 | } |
| 5790 | 5790 | |
| 5791 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
| 5791 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
| 5792 | 5792 | |
| 5793 | 5793 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 5794 | 5794 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -5797,7 +5797,7 @@ discard block |
||
| 5797 | 5797 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
| 5798 | 5798 | } |
| 5799 | 5799 | |
| 5800 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
| 5800 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
| 5801 | 5801 | } |
| 5802 | 5802 | |
| 5803 | 5803 | /** |
@@ -5821,7 +5821,7 @@ discard block |
||
| 5821 | 5821 | public static function str_detect_encoding($str) |
| 5822 | 5822 | { |
| 5823 | 5823 | // init |
| 5824 | - $str = (string) $str; |
|
| 5824 | + $str = (string)$str; |
|
| 5825 | 5825 | |
| 5826 | 5826 | // |
| 5827 | 5827 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5923,7 +5923,7 @@ discard block |
||
| 5923 | 5923 | foreach (self::$ENCODINGS as $encoding_tmp) { |
| 5924 | 5924 | // INFO: //IGNORE but still throw notice |
| 5925 | 5925 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 5926 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
| 5926 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
| 5927 | 5927 | return $encoding_tmp; |
| 5928 | 5928 | } |
| 5929 | 5929 | } |
@@ -6013,7 +6013,7 @@ discard block |
||
| 6013 | 6013 | return $str; |
| 6014 | 6014 | } |
| 6015 | 6015 | |
| 6016 | - return $substring . $str; |
|
| 6016 | + return $substring.$str; |
|
| 6017 | 6017 | } |
| 6018 | 6018 | |
| 6019 | 6019 | /** |
@@ -6143,27 +6143,27 @@ discard block |
||
| 6143 | 6143 | string $encoding = 'UTF-8' |
| 6144 | 6144 | ): string { |
| 6145 | 6145 | if ($encoding === 'UTF-8') { |
| 6146 | - $len = (int) \mb_strlen($str); |
|
| 6146 | + $len = (int)\mb_strlen($str); |
|
| 6147 | 6147 | if ($index > $len) { |
| 6148 | 6148 | return $str; |
| 6149 | 6149 | } |
| 6150 | 6150 | |
| 6151 | 6151 | /** @noinspection UnnecessaryCastingInspection */ |
| 6152 | - return (string) \mb_substr($str, 0, $index) . |
|
| 6153 | - $substring . |
|
| 6154 | - (string) \mb_substr($str, $index, $len); |
|
| 6152 | + return (string)\mb_substr($str, 0, $index). |
|
| 6153 | + $substring. |
|
| 6154 | + (string)\mb_substr($str, $index, $len); |
|
| 6155 | 6155 | } |
| 6156 | 6156 | |
| 6157 | 6157 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6158 | 6158 | |
| 6159 | - $len = (int) self::strlen($str, $encoding); |
|
| 6159 | + $len = (int)self::strlen($str, $encoding); |
|
| 6160 | 6160 | if ($index > $len) { |
| 6161 | 6161 | return $str; |
| 6162 | 6162 | } |
| 6163 | 6163 | |
| 6164 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
| 6165 | - $substring . |
|
| 6166 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
| 6164 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
| 6165 | + $substring. |
|
| 6166 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
| 6167 | 6167 | } |
| 6168 | 6168 | |
| 6169 | 6169 | /** |
@@ -6203,15 +6203,15 @@ discard block |
||
| 6203 | 6203 | */ |
| 6204 | 6204 | public static function str_ireplace($search, $replacement, $subject, &$count = null) |
| 6205 | 6205 | { |
| 6206 | - $search = (array) $search; |
|
| 6206 | + $search = (array)$search; |
|
| 6207 | 6207 | |
| 6208 | 6208 | /** @noinspection AlterInForeachInspection */ |
| 6209 | 6209 | foreach ($search as &$s) { |
| 6210 | - $s = (string) $s; |
|
| 6210 | + $s = (string)$s; |
|
| 6211 | 6211 | if ($s === '') { |
| 6212 | 6212 | $s = '/^(?<=.)$/'; |
| 6213 | 6213 | } else { |
| 6214 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
| 6214 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
| 6215 | 6215 | } |
| 6216 | 6216 | } |
| 6217 | 6217 | |
@@ -6259,12 +6259,12 @@ discard block |
||
| 6259 | 6259 | } |
| 6260 | 6260 | |
| 6261 | 6261 | if ($search === '') { |
| 6262 | - return $str . $replacement; |
|
| 6262 | + return $str.$replacement; |
|
| 6263 | 6263 | } |
| 6264 | 6264 | |
| 6265 | 6265 | $searchLength = \strlen($search); |
| 6266 | 6266 | if (\strncasecmp($str, $search, $searchLength) === 0) { |
| 6267 | - return $replacement . \substr($str, $searchLength); |
|
| 6267 | + return $replacement.\substr($str, $searchLength); |
|
| 6268 | 6268 | } |
| 6269 | 6269 | |
| 6270 | 6270 | return $str; |
@@ -6295,11 +6295,11 @@ discard block |
||
| 6295 | 6295 | } |
| 6296 | 6296 | |
| 6297 | 6297 | if ($search === '') { |
| 6298 | - return $str . $replacement; |
|
| 6298 | + return $str.$replacement; |
|
| 6299 | 6299 | } |
| 6300 | 6300 | |
| 6301 | 6301 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 6302 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 6302 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 6303 | 6303 | } |
| 6304 | 6304 | |
| 6305 | 6305 | return $str; |
@@ -6357,7 +6357,7 @@ discard block |
||
| 6357 | 6357 | } |
| 6358 | 6358 | |
| 6359 | 6359 | foreach ($substrings as &$substring) { |
| 6360 | - if (self::str_istarts_with($str, (string) $substring)) { |
|
| 6360 | + if (self::str_istarts_with($str, (string)$substring)) { |
|
| 6361 | 6361 | return true; |
| 6362 | 6362 | } |
| 6363 | 6363 | } |
@@ -6391,15 +6391,15 @@ discard block |
||
| 6391 | 6391 | } |
| 6392 | 6392 | |
| 6393 | 6393 | if ($encoding === 'UTF-8') { |
| 6394 | - return (string) \mb_substr( |
|
| 6394 | + return (string)\mb_substr( |
|
| 6395 | 6395 | $str, |
| 6396 | - $offset + (int) \mb_strlen($separator) |
|
| 6396 | + $offset + (int)\mb_strlen($separator) |
|
| 6397 | 6397 | ); |
| 6398 | 6398 | } |
| 6399 | 6399 | |
| 6400 | - return (string) self::substr( |
|
| 6400 | + return (string)self::substr( |
|
| 6401 | 6401 | $str, |
| 6402 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6402 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6403 | 6403 | null, |
| 6404 | 6404 | $encoding |
| 6405 | 6405 | ); |
@@ -6431,15 +6431,15 @@ discard block |
||
| 6431 | 6431 | } |
| 6432 | 6432 | |
| 6433 | 6433 | if ($encoding === 'UTF-8') { |
| 6434 | - return (string) \mb_substr( |
|
| 6434 | + return (string)\mb_substr( |
|
| 6435 | 6435 | $str, |
| 6436 | - $offset + (int) self::strlen($separator) |
|
| 6436 | + $offset + (int)self::strlen($separator) |
|
| 6437 | 6437 | ); |
| 6438 | 6438 | } |
| 6439 | 6439 | |
| 6440 | - return (string) self::substr( |
|
| 6440 | + return (string)self::substr( |
|
| 6441 | 6441 | $str, |
| 6442 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6442 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6443 | 6443 | null, |
| 6444 | 6444 | $encoding |
| 6445 | 6445 | ); |
@@ -6471,10 +6471,10 @@ discard block |
||
| 6471 | 6471 | } |
| 6472 | 6472 | |
| 6473 | 6473 | if ($encoding === 'UTF-8') { |
| 6474 | - return (string) \mb_substr($str, 0, $offset); |
|
| 6474 | + return (string)\mb_substr($str, 0, $offset); |
|
| 6475 | 6475 | } |
| 6476 | 6476 | |
| 6477 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 6477 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 6478 | 6478 | } |
| 6479 | 6479 | |
| 6480 | 6480 | /** |
@@ -6503,7 +6503,7 @@ discard block |
||
| 6503 | 6503 | return ''; |
| 6504 | 6504 | } |
| 6505 | 6505 | |
| 6506 | - return (string) \mb_substr($str, 0, $offset); |
|
| 6506 | + return (string)\mb_substr($str, 0, $offset); |
|
| 6507 | 6507 | } |
| 6508 | 6508 | |
| 6509 | 6509 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6511,7 +6511,7 @@ discard block |
||
| 6511 | 6511 | return ''; |
| 6512 | 6512 | } |
| 6513 | 6513 | |
| 6514 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 6514 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 6515 | 6515 | } |
| 6516 | 6516 | |
| 6517 | 6517 | /** |
@@ -6613,12 +6613,12 @@ discard block |
||
| 6613 | 6613 | } |
| 6614 | 6614 | |
| 6615 | 6615 | if ($encoding === 'UTF-8') { |
| 6616 | - return (string) \mb_substr($str, -$n); |
|
| 6616 | + return (string)\mb_substr($str, -$n); |
|
| 6617 | 6617 | } |
| 6618 | 6618 | |
| 6619 | 6619 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6620 | 6620 | |
| 6621 | - return (string) self::substr($str, -$n, null, $encoding); |
|
| 6621 | + return (string)self::substr($str, -$n, null, $encoding); |
|
| 6622 | 6622 | } |
| 6623 | 6623 | |
| 6624 | 6624 | /** |
@@ -6644,21 +6644,21 @@ discard block |
||
| 6644 | 6644 | } |
| 6645 | 6645 | |
| 6646 | 6646 | if ($encoding === 'UTF-8') { |
| 6647 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 6647 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 6648 | 6648 | return $str; |
| 6649 | 6649 | } |
| 6650 | 6650 | |
| 6651 | 6651 | /** @noinspection UnnecessaryCastingInspection */ |
| 6652 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
| 6652 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
| 6653 | 6653 | } |
| 6654 | 6654 | |
| 6655 | 6655 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6656 | 6656 | |
| 6657 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 6657 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 6658 | 6658 | return $str; |
| 6659 | 6659 | } |
| 6660 | 6660 | |
| 6661 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
| 6661 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
| 6662 | 6662 | } |
| 6663 | 6663 | |
| 6664 | 6664 | /** |
@@ -6686,12 +6686,12 @@ discard block |
||
| 6686 | 6686 | } |
| 6687 | 6687 | |
| 6688 | 6688 | if ($encoding === 'UTF-8') { |
| 6689 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 6689 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 6690 | 6690 | return $str; |
| 6691 | 6691 | } |
| 6692 | 6692 | |
| 6693 | 6693 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
| 6694 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
| 6694 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
| 6695 | 6695 | } |
| 6696 | 6696 | |
| 6697 | 6697 | $str = \mb_substr($str, 0, $length); |
@@ -6700,32 +6700,32 @@ discard block |
||
| 6700 | 6700 | $new_str = \implode(' ', $array); |
| 6701 | 6701 | |
| 6702 | 6702 | if ($new_str === '') { |
| 6703 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
| 6703 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
| 6704 | 6704 | } |
| 6705 | 6705 | } else { |
| 6706 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 6706 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 6707 | 6707 | return $str; |
| 6708 | 6708 | } |
| 6709 | 6709 | |
| 6710 | 6710 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
| 6711 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
| 6711 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
| 6712 | 6712 | } |
| 6713 | 6713 | |
| 6714 | 6714 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 6715 | 6715 | $str = self::substr($str, 0, $length, $encoding); |
| 6716 | 6716 | if ($str === false) { |
| 6717 | - return '' . $str_add_on; |
|
| 6717 | + return ''.$str_add_on; |
|
| 6718 | 6718 | } |
| 6719 | 6719 | |
| 6720 | 6720 | $array = \explode(' ', $str, -1); |
| 6721 | 6721 | $new_str = \implode(' ', $array); |
| 6722 | 6722 | |
| 6723 | 6723 | if ($new_str === '') { |
| 6724 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
| 6724 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
| 6725 | 6725 | } |
| 6726 | 6726 | } |
| 6727 | 6727 | |
| 6728 | - return $new_str . $str_add_on; |
|
| 6728 | + return $new_str.$str_add_on; |
|
| 6729 | 6729 | } |
| 6730 | 6730 | |
| 6731 | 6731 | /** |
@@ -6748,7 +6748,7 @@ discard block |
||
| 6748 | 6748 | $longest_common_prefix = ''; |
| 6749 | 6749 | |
| 6750 | 6750 | if ($encoding === 'UTF-8') { |
| 6751 | - $max_length = (int) \min( |
|
| 6751 | + $max_length = (int)\min( |
|
| 6752 | 6752 | \mb_strlen($str1), |
| 6753 | 6753 | \mb_strlen($str2) |
| 6754 | 6754 | ); |
@@ -6769,7 +6769,7 @@ discard block |
||
| 6769 | 6769 | } else { |
| 6770 | 6770 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6771 | 6771 | |
| 6772 | - $max_length = (int) \min( |
|
| 6772 | + $max_length = (int)\min( |
|
| 6773 | 6773 | self::strlen($str1, $encoding), |
| 6774 | 6774 | self::strlen($str2, $encoding) |
| 6775 | 6775 | ); |
@@ -6818,13 +6818,13 @@ discard block |
||
| 6818 | 6818 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
| 6819 | 6819 | |
| 6820 | 6820 | if ($encoding === 'UTF-8') { |
| 6821 | - $str_length = (int) \mb_strlen($str1); |
|
| 6822 | - $other_length = (int) \mb_strlen($str2); |
|
| 6821 | + $str_length = (int)\mb_strlen($str1); |
|
| 6822 | + $other_length = (int)\mb_strlen($str2); |
|
| 6823 | 6823 | } else { |
| 6824 | 6824 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6825 | 6825 | |
| 6826 | - $str_length = (int) self::strlen($str1, $encoding); |
|
| 6827 | - $other_length = (int) self::strlen($str2, $encoding); |
|
| 6826 | + $str_length = (int)self::strlen($str1, $encoding); |
|
| 6827 | + $other_length = (int)self::strlen($str2, $encoding); |
|
| 6828 | 6828 | } |
| 6829 | 6829 | |
| 6830 | 6830 | // Return if either string is empty |
@@ -6877,10 +6877,10 @@ discard block |
||
| 6877 | 6877 | } |
| 6878 | 6878 | |
| 6879 | 6879 | if ($encoding === 'UTF-8') { |
| 6880 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
| 6880 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
| 6881 | 6881 | } |
| 6882 | 6882 | |
| 6883 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
| 6883 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
| 6884 | 6884 | } |
| 6885 | 6885 | |
| 6886 | 6886 | /** |
@@ -6904,7 +6904,7 @@ discard block |
||
| 6904 | 6904 | } |
| 6905 | 6905 | |
| 6906 | 6906 | if ($encoding === 'UTF-8') { |
| 6907 | - $max_length = (int) \min( |
|
| 6907 | + $max_length = (int)\min( |
|
| 6908 | 6908 | \mb_strlen($str1, $encoding), |
| 6909 | 6909 | \mb_strlen($str2, $encoding) |
| 6910 | 6910 | ); |
@@ -6918,7 +6918,7 @@ discard block |
||
| 6918 | 6918 | && |
| 6919 | 6919 | $char === \mb_substr($str2, -$i, 1) |
| 6920 | 6920 | ) { |
| 6921 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
| 6921 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
| 6922 | 6922 | } else { |
| 6923 | 6923 | break; |
| 6924 | 6924 | } |
@@ -6926,7 +6926,7 @@ discard block |
||
| 6926 | 6926 | } else { |
| 6927 | 6927 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6928 | 6928 | |
| 6929 | - $max_length = (int) \min( |
|
| 6929 | + $max_length = (int)\min( |
|
| 6930 | 6930 | self::strlen($str1, $encoding), |
| 6931 | 6931 | self::strlen($str2, $encoding) |
| 6932 | 6932 | ); |
@@ -6940,7 +6940,7 @@ discard block |
||
| 6940 | 6940 | && |
| 6941 | 6941 | $char === self::substr($str2, -$i, 1, $encoding) |
| 6942 | 6942 | ) { |
| 6943 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
| 6943 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
| 6944 | 6944 | } else { |
| 6945 | 6945 | break; |
| 6946 | 6946 | } |
@@ -6963,7 +6963,7 @@ discard block |
||
| 6963 | 6963 | */ |
| 6964 | 6964 | public static function str_matches_pattern(string $str, string $pattern): bool |
| 6965 | 6965 | { |
| 6966 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
| 6966 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
| 6967 | 6967 | } |
| 6968 | 6968 | |
| 6969 | 6969 | /** |
@@ -6983,7 +6983,7 @@ discard block |
||
| 6983 | 6983 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
| 6984 | 6984 | { |
| 6985 | 6985 | // init |
| 6986 | - $length = (int) self::strlen($str, $encoding); |
|
| 6986 | + $length = (int)self::strlen($str, $encoding); |
|
| 6987 | 6987 | |
| 6988 | 6988 | if ($offset >= 0) { |
| 6989 | 6989 | return $length > $offset; |
@@ -7012,7 +7012,7 @@ discard block |
||
| 7012 | 7012 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
| 7013 | 7013 | { |
| 7014 | 7014 | // init |
| 7015 | - $length = (int) self::strlen($str); |
|
| 7015 | + $length = (int)self::strlen($str); |
|
| 7016 | 7016 | |
| 7017 | 7017 | if ( |
| 7018 | 7018 | ($index >= 0 && $length <= $index) |
@@ -7056,7 +7056,7 @@ discard block |
||
| 7056 | 7056 | return $str; |
| 7057 | 7057 | } |
| 7058 | 7058 | |
| 7059 | - if ($pad_type !== (int) $pad_type) { |
|
| 7059 | + if ($pad_type !== (int)$pad_type) { |
|
| 7060 | 7060 | if ($pad_type === 'left') { |
| 7061 | 7061 | $pad_type = \STR_PAD_LEFT; |
| 7062 | 7062 | } elseif ($pad_type === 'right') { |
@@ -7065,23 +7065,23 @@ discard block |
||
| 7065 | 7065 | $pad_type = \STR_PAD_BOTH; |
| 7066 | 7066 | } else { |
| 7067 | 7067 | throw new \InvalidArgumentException( |
| 7068 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
| 7068 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
| 7069 | 7069 | ); |
| 7070 | 7070 | } |
| 7071 | 7071 | } |
| 7072 | 7072 | |
| 7073 | 7073 | if ($encoding === 'UTF-8') { |
| 7074 | - $str_length = (int) \mb_strlen($str); |
|
| 7074 | + $str_length = (int)\mb_strlen($str); |
|
| 7075 | 7075 | |
| 7076 | 7076 | if ($pad_length >= $str_length) { |
| 7077 | 7077 | switch ($pad_type) { |
| 7078 | 7078 | case \STR_PAD_LEFT: |
| 7079 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 7079 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 7080 | 7080 | |
| 7081 | 7081 | $diff = ($pad_length - $str_length); |
| 7082 | 7082 | |
| 7083 | - $pre = (string) \mb_substr( |
|
| 7084 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7083 | + $pre = (string)\mb_substr( |
|
| 7084 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7085 | 7085 | 0, |
| 7086 | 7086 | $diff |
| 7087 | 7087 | ); |
@@ -7092,16 +7092,16 @@ discard block |
||
| 7092 | 7092 | case \STR_PAD_BOTH: |
| 7093 | 7093 | $diff = ($pad_length - $str_length); |
| 7094 | 7094 | |
| 7095 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 7095 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 7096 | 7096 | |
| 7097 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 7097 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 7098 | 7098 | |
| 7099 | - $pre = (string) \mb_substr( |
|
| 7099 | + $pre = (string)\mb_substr( |
|
| 7100 | 7100 | \str_repeat($pad_string, $ps_length_left), |
| 7101 | 7101 | 0, |
| 7102 | 7102 | $ps_length_left |
| 7103 | 7103 | ); |
| 7104 | - $post = (string) \mb_substr( |
|
| 7104 | + $post = (string)\mb_substr( |
|
| 7105 | 7105 | \str_repeat($pad_string, $ps_length_right), |
| 7106 | 7106 | 0, |
| 7107 | 7107 | $ps_length_right |
@@ -7111,19 +7111,19 @@ discard block |
||
| 7111 | 7111 | |
| 7112 | 7112 | case \STR_PAD_RIGHT: |
| 7113 | 7113 | default: |
| 7114 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 7114 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 7115 | 7115 | |
| 7116 | 7116 | $diff = ($pad_length - $str_length); |
| 7117 | 7117 | |
| 7118 | - $post = (string) \mb_substr( |
|
| 7119 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7118 | + $post = (string)\mb_substr( |
|
| 7119 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7120 | 7120 | 0, |
| 7121 | 7121 | $diff |
| 7122 | 7122 | ); |
| 7123 | 7123 | $pre = ''; |
| 7124 | 7124 | } |
| 7125 | 7125 | |
| 7126 | - return $pre . $str . $post; |
|
| 7126 | + return $pre.$str.$post; |
|
| 7127 | 7127 | } |
| 7128 | 7128 | |
| 7129 | 7129 | return $str; |
@@ -7131,17 +7131,17 @@ discard block |
||
| 7131 | 7131 | |
| 7132 | 7132 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7133 | 7133 | |
| 7134 | - $str_length = (int) self::strlen($str, $encoding); |
|
| 7134 | + $str_length = (int)self::strlen($str, $encoding); |
|
| 7135 | 7135 | |
| 7136 | 7136 | if ($pad_length >= $str_length) { |
| 7137 | 7137 | switch ($pad_type) { |
| 7138 | 7138 | case \STR_PAD_LEFT: |
| 7139 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 7139 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 7140 | 7140 | |
| 7141 | 7141 | $diff = ($pad_length - $str_length); |
| 7142 | 7142 | |
| 7143 | - $pre = (string) self::substr( |
|
| 7144 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7143 | + $pre = (string)self::substr( |
|
| 7144 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7145 | 7145 | 0, |
| 7146 | 7146 | $diff, |
| 7147 | 7147 | $encoding |
@@ -7153,17 +7153,17 @@ discard block |
||
| 7153 | 7153 | case \STR_PAD_BOTH: |
| 7154 | 7154 | $diff = ($pad_length - $str_length); |
| 7155 | 7155 | |
| 7156 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 7156 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 7157 | 7157 | |
| 7158 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 7158 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 7159 | 7159 | |
| 7160 | - $pre = (string) self::substr( |
|
| 7160 | + $pre = (string)self::substr( |
|
| 7161 | 7161 | \str_repeat($pad_string, $ps_length_left), |
| 7162 | 7162 | 0, |
| 7163 | 7163 | $ps_length_left, |
| 7164 | 7164 | $encoding |
| 7165 | 7165 | ); |
| 7166 | - $post = (string) self::substr( |
|
| 7166 | + $post = (string)self::substr( |
|
| 7167 | 7167 | \str_repeat($pad_string, $ps_length_right), |
| 7168 | 7168 | 0, |
| 7169 | 7169 | $ps_length_right, |
@@ -7174,12 +7174,12 @@ discard block |
||
| 7174 | 7174 | |
| 7175 | 7175 | case \STR_PAD_RIGHT: |
| 7176 | 7176 | default: |
| 7177 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 7177 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 7178 | 7178 | |
| 7179 | 7179 | $diff = ($pad_length - $str_length); |
| 7180 | 7180 | |
| 7181 | - $post = (string) self::substr( |
|
| 7182 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7181 | + $post = (string)self::substr( |
|
| 7182 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7183 | 7183 | 0, |
| 7184 | 7184 | $diff, |
| 7185 | 7185 | $encoding |
@@ -7187,7 +7187,7 @@ discard block |
||
| 7187 | 7187 | $pre = ''; |
| 7188 | 7188 | } |
| 7189 | 7189 | |
| 7190 | - return $pre . $str . $post; |
|
| 7190 | + return $pre.$str.$post; |
|
| 7191 | 7191 | } |
| 7192 | 7192 | |
| 7193 | 7193 | return $str; |
@@ -7398,12 +7398,12 @@ discard block |
||
| 7398 | 7398 | } |
| 7399 | 7399 | |
| 7400 | 7400 | if ($search === '') { |
| 7401 | - return $str . $replacement; |
|
| 7401 | + return $str.$replacement; |
|
| 7402 | 7402 | } |
| 7403 | 7403 | |
| 7404 | 7404 | $searchLength = \strlen($search); |
| 7405 | 7405 | if (\strncmp($str, $search, $searchLength) === 0) { |
| 7406 | - return $replacement . \substr($str, $searchLength); |
|
| 7406 | + return $replacement.\substr($str, $searchLength); |
|
| 7407 | 7407 | } |
| 7408 | 7408 | |
| 7409 | 7409 | return $str; |
@@ -7437,11 +7437,11 @@ discard block |
||
| 7437 | 7437 | } |
| 7438 | 7438 | |
| 7439 | 7439 | if ($search === '') { |
| 7440 | - return $str . $replacement; |
|
| 7440 | + return $str.$replacement; |
|
| 7441 | 7441 | } |
| 7442 | 7442 | |
| 7443 | 7443 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 7444 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 7444 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 7445 | 7445 | } |
| 7446 | 7446 | |
| 7447 | 7447 | return $str; |
@@ -7475,7 +7475,7 @@ discard block |
||
| 7475 | 7475 | $subject, |
| 7476 | 7476 | $replace, |
| 7477 | 7477 | $pos, |
| 7478 | - (int) self::strlen($search) |
|
| 7478 | + (int)self::strlen($search) |
|
| 7479 | 7479 | ); |
| 7480 | 7480 | } |
| 7481 | 7481 | |
@@ -7509,7 +7509,7 @@ discard block |
||
| 7509 | 7509 | $subject, |
| 7510 | 7510 | $replace, |
| 7511 | 7511 | $pos, |
| 7512 | - (int) self::strlen($search) |
|
| 7512 | + (int)self::strlen($search) |
|
| 7513 | 7513 | ); |
| 7514 | 7514 | } |
| 7515 | 7515 | |
@@ -7532,7 +7532,7 @@ discard block |
||
| 7532 | 7532 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
| 7533 | 7533 | { |
| 7534 | 7534 | if ($encoding === 'UTF-8') { |
| 7535 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
| 7535 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
| 7536 | 7536 | \shuffle($indexes); |
| 7537 | 7537 | |
| 7538 | 7538 | // init |
@@ -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 | \shuffle($indexes); |
| 7552 | 7552 | |
| 7553 | 7553 | // init |
@@ -7589,11 +7589,11 @@ discard block |
||
| 7589 | 7589 | ) { |
| 7590 | 7590 | if ($encoding === 'UTF-8') { |
| 7591 | 7591 | if ($end === null) { |
| 7592 | - $length = (int) \mb_strlen($str); |
|
| 7592 | + $length = (int)\mb_strlen($str); |
|
| 7593 | 7593 | } elseif ($end >= 0 && $end <= $start) { |
| 7594 | 7594 | return ''; |
| 7595 | 7595 | } elseif ($end < 0) { |
| 7596 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
| 7596 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
| 7597 | 7597 | } else { |
| 7598 | 7598 | $length = $end - $start; |
| 7599 | 7599 | } |
@@ -7604,11 +7604,11 @@ discard block |
||
| 7604 | 7604 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7605 | 7605 | |
| 7606 | 7606 | if ($end === null) { |
| 7607 | - $length = (int) self::strlen($str, $encoding); |
|
| 7607 | + $length = (int)self::strlen($str, $encoding); |
|
| 7608 | 7608 | } elseif ($end >= 0 && $end <= $start) { |
| 7609 | 7609 | return ''; |
| 7610 | 7610 | } elseif ($end < 0) { |
| 7611 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
| 7611 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
| 7612 | 7612 | } else { |
| 7613 | 7613 | $length = $end - $start; |
| 7614 | 7614 | } |
@@ -7643,7 +7643,7 @@ discard block |
||
| 7643 | 7643 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7644 | 7644 | } |
| 7645 | 7645 | |
| 7646 | - $str = (string) \preg_replace_callback( |
|
| 7646 | + $str = (string)\preg_replace_callback( |
|
| 7647 | 7647 | '/([\\p{N}|\\p{Lu}])/u', |
| 7648 | 7648 | /** |
| 7649 | 7649 | * @param string[] $matches |
@@ -7652,28 +7652,28 @@ discard block |
||
| 7652 | 7652 | * |
| 7653 | 7653 | * @return string |
| 7654 | 7654 | */ |
| 7655 | - static function (array $matches) use ($encoding): string { |
|
| 7655 | + static function(array $matches) use ($encoding): string { |
|
| 7656 | 7656 | $match = $matches[1]; |
| 7657 | - $match_int = (int) $match; |
|
| 7657 | + $match_int = (int)$match; |
|
| 7658 | 7658 | |
| 7659 | - if ((string) $match_int === $match) { |
|
| 7660 | - return '_' . $match . '_'; |
|
| 7659 | + if ((string)$match_int === $match) { |
|
| 7660 | + return '_'.$match.'_'; |
|
| 7661 | 7661 | } |
| 7662 | 7662 | |
| 7663 | 7663 | if ($encoding === 'UTF-8') { |
| 7664 | - return '_' . \mb_strtolower($match); |
|
| 7664 | + return '_'.\mb_strtolower($match); |
|
| 7665 | 7665 | } |
| 7666 | 7666 | |
| 7667 | - return '_' . self::strtolower($match, $encoding); |
|
| 7667 | + return '_'.self::strtolower($match, $encoding); |
|
| 7668 | 7668 | }, |
| 7669 | 7669 | $str |
| 7670 | 7670 | ); |
| 7671 | 7671 | |
| 7672 | - $str = (string) \preg_replace( |
|
| 7672 | + $str = (string)\preg_replace( |
|
| 7673 | 7673 | [ |
| 7674 | - '/\\s+/u', // convert spaces to "_" |
|
| 7674 | + '/\\s+/u', // convert spaces to "_" |
|
| 7675 | 7675 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
| 7676 | - '/_+/', // remove double "_" |
|
| 7676 | + '/_+/', // remove double "_" |
|
| 7677 | 7677 | ], |
| 7678 | 7678 | [ |
| 7679 | 7679 | '_', |
@@ -7801,7 +7801,7 @@ discard block |
||
| 7801 | 7801 | } |
| 7802 | 7802 | |
| 7803 | 7803 | // init |
| 7804 | - $input = (string) $input; |
|
| 7804 | + $input = (string)$input; |
|
| 7805 | 7805 | |
| 7806 | 7806 | if ($input === '') { |
| 7807 | 7807 | return []; |
@@ -7857,7 +7857,7 @@ discard block |
||
| 7857 | 7857 | ($input[$i] & "\xE0") === "\xC0" |
| 7858 | 7858 | ) { |
| 7859 | 7859 | if (($input[$i + 1] & "\xC0") === "\x80") { |
| 7860 | - $ret[] = $input[$i] . $input[$i + 1]; |
|
| 7860 | + $ret[] = $input[$i].$input[$i + 1]; |
|
| 7861 | 7861 | |
| 7862 | 7862 | ++$i; |
| 7863 | 7863 | } |
@@ -7871,7 +7871,7 @@ discard block |
||
| 7871 | 7871 | && |
| 7872 | 7872 | ($input[$i + 2] & "\xC0") === "\x80" |
| 7873 | 7873 | ) { |
| 7874 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2]; |
|
| 7874 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2]; |
|
| 7875 | 7875 | |
| 7876 | 7876 | $i += 2; |
| 7877 | 7877 | } |
@@ -7887,7 +7887,7 @@ discard block |
||
| 7887 | 7887 | && |
| 7888 | 7888 | ($input[$i + 3] & "\xC0") === "\x80" |
| 7889 | 7889 | ) { |
| 7890 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2] . $input[$i + 3]; |
|
| 7890 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2].$input[$i + 3]; |
|
| 7891 | 7891 | |
| 7892 | 7892 | $i += 3; |
| 7893 | 7893 | } |
@@ -7897,7 +7897,7 @@ discard block |
||
| 7897 | 7897 | |
| 7898 | 7898 | if ($length > 1) { |
| 7899 | 7899 | return \array_map( |
| 7900 | - static function (array $item): string { |
|
| 7900 | + static function(array $item): string { |
|
| 7901 | 7901 | return \implode('', $item); |
| 7902 | 7902 | }, |
| 7903 | 7903 | \array_chunk($ret, $length) |
@@ -7969,7 +7969,7 @@ discard block |
||
| 7969 | 7969 | $limit = -1; |
| 7970 | 7970 | } |
| 7971 | 7971 | |
| 7972 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
| 7972 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
| 7973 | 7973 | if ($array === false) { |
| 7974 | 7974 | return []; |
| 7975 | 7975 | } |
@@ -8038,7 +8038,7 @@ discard block |
||
| 8038 | 8038 | } |
| 8039 | 8039 | |
| 8040 | 8040 | foreach ($substrings as &$substring) { |
| 8041 | - if (self::str_starts_with($str, (string) $substring)) { |
|
| 8041 | + if (self::str_starts_with($str, (string)$substring)) { |
|
| 8042 | 8042 | return true; |
| 8043 | 8043 | } |
| 8044 | 8044 | } |
@@ -8069,9 +8069,9 @@ discard block |
||
| 8069 | 8069 | return ''; |
| 8070 | 8070 | } |
| 8071 | 8071 | |
| 8072 | - return (string) \mb_substr( |
|
| 8072 | + return (string)\mb_substr( |
|
| 8073 | 8073 | $str, |
| 8074 | - $offset + (int) \mb_strlen($separator) |
|
| 8074 | + $offset + (int)\mb_strlen($separator) |
|
| 8075 | 8075 | ); |
| 8076 | 8076 | } |
| 8077 | 8077 | |
@@ -8080,9 +8080,9 @@ discard block |
||
| 8080 | 8080 | return ''; |
| 8081 | 8081 | } |
| 8082 | 8082 | |
| 8083 | - return (string) \mb_substr( |
|
| 8083 | + return (string)\mb_substr( |
|
| 8084 | 8084 | $str, |
| 8085 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 8085 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 8086 | 8086 | null, |
| 8087 | 8087 | $encoding |
| 8088 | 8088 | ); |
@@ -8114,9 +8114,9 @@ discard block |
||
| 8114 | 8114 | return ''; |
| 8115 | 8115 | } |
| 8116 | 8116 | |
| 8117 | - return (string) \mb_substr( |
|
| 8117 | + return (string)\mb_substr( |
|
| 8118 | 8118 | $str, |
| 8119 | - $offset + (int) \mb_strlen($separator) |
|
| 8119 | + $offset + (int)\mb_strlen($separator) |
|
| 8120 | 8120 | ); |
| 8121 | 8121 | } |
| 8122 | 8122 | |
@@ -8125,9 +8125,9 @@ discard block |
||
| 8125 | 8125 | return ''; |
| 8126 | 8126 | } |
| 8127 | 8127 | |
| 8128 | - return (string) self::substr( |
|
| 8128 | + return (string)self::substr( |
|
| 8129 | 8129 | $str, |
| 8130 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 8130 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 8131 | 8131 | null, |
| 8132 | 8132 | $encoding |
| 8133 | 8133 | ); |
@@ -8159,7 +8159,7 @@ discard block |
||
| 8159 | 8159 | return ''; |
| 8160 | 8160 | } |
| 8161 | 8161 | |
| 8162 | - return (string) \mb_substr( |
|
| 8162 | + return (string)\mb_substr( |
|
| 8163 | 8163 | $str, |
| 8164 | 8164 | 0, |
| 8165 | 8165 | $offset |
@@ -8171,7 +8171,7 @@ discard block |
||
| 8171 | 8171 | return ''; |
| 8172 | 8172 | } |
| 8173 | 8173 | |
| 8174 | - return (string) self::substr( |
|
| 8174 | + return (string)self::substr( |
|
| 8175 | 8175 | $str, |
| 8176 | 8176 | 0, |
| 8177 | 8177 | $offset, |
@@ -8202,7 +8202,7 @@ discard block |
||
| 8202 | 8202 | return ''; |
| 8203 | 8203 | } |
| 8204 | 8204 | |
| 8205 | - return (string) \mb_substr( |
|
| 8205 | + return (string)\mb_substr( |
|
| 8206 | 8206 | $str, |
| 8207 | 8207 | 0, |
| 8208 | 8208 | $offset |
@@ -8216,7 +8216,7 @@ discard block |
||
| 8216 | 8216 | |
| 8217 | 8217 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8218 | 8218 | |
| 8219 | - return (string) self::substr( |
|
| 8219 | + return (string)self::substr( |
|
| 8220 | 8220 | $str, |
| 8221 | 8221 | 0, |
| 8222 | 8222 | $offset, |
@@ -8331,7 +8331,7 @@ discard block |
||
| 8331 | 8331 | */ |
| 8332 | 8332 | public static function str_surround(string $str, string $substring): string |
| 8333 | 8333 | { |
| 8334 | - return $substring . $str . $substring; |
|
| 8334 | + return $substring.$str.$substring; |
|
| 8335 | 8335 | } |
| 8336 | 8336 | |
| 8337 | 8337 | /** |
@@ -8393,9 +8393,9 @@ discard block |
||
| 8393 | 8393 | $word_define_chars = ''; |
| 8394 | 8394 | } |
| 8395 | 8395 | |
| 8396 | - $str = (string) \preg_replace_callback( |
|
| 8397 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
| 8398 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
| 8396 | + $str = (string)\preg_replace_callback( |
|
| 8397 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
| 8398 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
| 8399 | 8399 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
| 8400 | 8400 | return $match[0]; |
| 8401 | 8401 | } |
@@ -8561,16 +8561,16 @@ discard block |
||
| 8561 | 8561 | } |
| 8562 | 8562 | |
| 8563 | 8563 | // the main substitutions |
| 8564 | - $str = (string) \preg_replace_callback( |
|
| 8564 | + $str = (string)\preg_replace_callback( |
|
| 8565 | 8565 | '~\\b (_*) (?: # 1. Leading underscore and |
| 8566 | 8566 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
| 8567 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
| 8567 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
| 8568 | 8568 | | |
| 8569 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
| 8569 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
| 8570 | 8570 | | |
| 8571 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
| 8571 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
| 8572 | 8572 | | |
| 8573 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
| 8573 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
| 8574 | 8574 | ) (_*) \\b # 6. With trailing underscore |
| 8575 | 8575 | ~ux', |
| 8576 | 8576 | /** |
@@ -8580,7 +8580,7 @@ discard block |
||
| 8580 | 8580 | * |
| 8581 | 8581 | * @return string |
| 8582 | 8582 | */ |
| 8583 | - static function (array $matches) use ($encoding): string { |
|
| 8583 | + static function(array $matches) use ($encoding): string { |
|
| 8584 | 8584 | // preserve leading underscore |
| 8585 | 8585 | $str = $matches[1]; |
| 8586 | 8586 | if ($matches[2]) { |
@@ -8605,11 +8605,11 @@ discard block |
||
| 8605 | 8605 | ); |
| 8606 | 8606 | |
| 8607 | 8607 | // Exceptions for small words: capitalize at start of title... |
| 8608 | - $str = (string) \preg_replace_callback( |
|
| 8608 | + $str = (string)\preg_replace_callback( |
|
| 8609 | 8609 | '~( \\A [[:punct:]]* # start of title... |
| 8610 | 8610 | | [:.;?!][ ]+ # or of subsentence... |
| 8611 | 8611 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
| 8612 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
| 8612 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
| 8613 | 8613 | ~uxi', |
| 8614 | 8614 | /** |
| 8615 | 8615 | * @param string[] $matches |
@@ -8618,15 +8618,15 @@ discard block |
||
| 8618 | 8618 | * |
| 8619 | 8619 | * @return string |
| 8620 | 8620 | */ |
| 8621 | - static function (array $matches) use ($encoding): string { |
|
| 8622 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
| 8621 | + static function(array $matches) use ($encoding): string { |
|
| 8622 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
| 8623 | 8623 | }, |
| 8624 | 8624 | $str |
| 8625 | 8625 | ); |
| 8626 | 8626 | |
| 8627 | 8627 | // ...and end of title |
| 8628 | - $str = (string) \preg_replace_callback( |
|
| 8629 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
| 8628 | + $str = (string)\preg_replace_callback( |
|
| 8629 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
| 8630 | 8630 | (?= [[:punct:]]* \Z # ...at the end of the title... |
| 8631 | 8631 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
| 8632 | 8632 | ~uxi', |
@@ -8637,7 +8637,7 @@ discard block |
||
| 8637 | 8637 | * |
| 8638 | 8638 | * @return string |
| 8639 | 8639 | */ |
| 8640 | - static function (array $matches) use ($encoding): string { |
|
| 8640 | + static function(array $matches) use ($encoding): string { |
|
| 8641 | 8641 | return static::ucfirst($matches[1], $encoding); |
| 8642 | 8642 | }, |
| 8643 | 8643 | $str |
@@ -8645,10 +8645,10 @@ discard block |
||
| 8645 | 8645 | |
| 8646 | 8646 | // Exceptions for small words in hyphenated compound words. |
| 8647 | 8647 | // e.g. "in-flight" -> In-Flight |
| 8648 | - $str = (string) \preg_replace_callback( |
|
| 8648 | + $str = (string)\preg_replace_callback( |
|
| 8649 | 8649 | '~\\b |
| 8650 | 8650 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
| 8651 | - ( ' . $small_words_rx . ' ) |
|
| 8651 | + ( ' . $small_words_rx.' ) |
|
| 8652 | 8652 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
| 8653 | 8653 | ~uxi', |
| 8654 | 8654 | /** |
@@ -8658,18 +8658,18 @@ discard block |
||
| 8658 | 8658 | * |
| 8659 | 8659 | * @return string |
| 8660 | 8660 | */ |
| 8661 | - static function (array $matches) use ($encoding): string { |
|
| 8661 | + static function(array $matches) use ($encoding): string { |
|
| 8662 | 8662 | return static::ucfirst($matches[1], $encoding); |
| 8663 | 8663 | }, |
| 8664 | 8664 | $str |
| 8665 | 8665 | ); |
| 8666 | 8666 | |
| 8667 | 8667 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
| 8668 | - $str = (string) \preg_replace_callback( |
|
| 8668 | + $str = (string)\preg_replace_callback( |
|
| 8669 | 8669 | '~\\b |
| 8670 | 8670 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
| 8671 | 8671 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
| 8672 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
| 8672 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
| 8673 | 8673 | (?! - ) # Negative lookahead for another - |
| 8674 | 8674 | ~uxi', |
| 8675 | 8675 | /** |
@@ -8679,8 +8679,8 @@ discard block |
||
| 8679 | 8679 | * |
| 8680 | 8680 | * @return string |
| 8681 | 8681 | */ |
| 8682 | - static function (array $matches) use ($encoding): string { |
|
| 8683 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
| 8682 | + static function(array $matches) use ($encoding): string { |
|
| 8683 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
| 8684 | 8684 | }, |
| 8685 | 8685 | $str |
| 8686 | 8686 | ); |
@@ -8798,7 +8798,7 @@ discard block |
||
| 8798 | 8798 | ); |
| 8799 | 8799 | |
| 8800 | 8800 | foreach ($tmp_return as &$item) { |
| 8801 | - $item = (string) $item; |
|
| 8801 | + $item = (string)$item; |
|
| 8802 | 8802 | } |
| 8803 | 8803 | |
| 8804 | 8804 | return $tmp_return; |
@@ -8830,38 +8830,38 @@ discard block |
||
| 8830 | 8830 | } |
| 8831 | 8831 | |
| 8832 | 8832 | if ($encoding === 'UTF-8') { |
| 8833 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 8833 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 8834 | 8834 | return $str; |
| 8835 | 8835 | } |
| 8836 | 8836 | |
| 8837 | 8837 | if ($substring !== '') { |
| 8838 | - $length -= (int) \mb_strlen($substring); |
|
| 8838 | + $length -= (int)\mb_strlen($substring); |
|
| 8839 | 8839 | |
| 8840 | 8840 | /** @noinspection UnnecessaryCastingInspection */ |
| 8841 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
| 8841 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
| 8842 | 8842 | } |
| 8843 | 8843 | |
| 8844 | - return (string) \mb_substr($str, 0, $length); |
|
| 8844 | + return (string)\mb_substr($str, 0, $length); |
|
| 8845 | 8845 | } |
| 8846 | 8846 | |
| 8847 | 8847 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8848 | 8848 | |
| 8849 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 8849 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 8850 | 8850 | return $str; |
| 8851 | 8851 | } |
| 8852 | 8852 | |
| 8853 | 8853 | if ($substring !== '') { |
| 8854 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 8854 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 8855 | 8855 | } |
| 8856 | 8856 | |
| 8857 | 8857 | return ( |
| 8858 | - (string) self::substr( |
|
| 8858 | + (string)self::substr( |
|
| 8859 | 8859 | $str, |
| 8860 | 8860 | 0, |
| 8861 | 8861 | $length, |
| 8862 | 8862 | $encoding |
| 8863 | 8863 | ) |
| 8864 | - ) . $substring; |
|
| 8864 | + ).$substring; |
|
| 8865 | 8865 | } |
| 8866 | 8866 | |
| 8867 | 8867 | /** |
@@ -8895,12 +8895,12 @@ discard block |
||
| 8895 | 8895 | } |
| 8896 | 8896 | |
| 8897 | 8897 | if ($encoding === 'UTF-8') { |
| 8898 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 8898 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 8899 | 8899 | return $str; |
| 8900 | 8900 | } |
| 8901 | 8901 | |
| 8902 | 8902 | // need to further trim the string so we can append the substring |
| 8903 | - $length -= (int) \mb_strlen($substring); |
|
| 8903 | + $length -= (int)\mb_strlen($substring); |
|
| 8904 | 8904 | if ($length <= 0) { |
| 8905 | 8905 | return $substring; |
| 8906 | 8906 | } |
@@ -8926,18 +8926,18 @@ discard block |
||
| 8926 | 8926 | !$ignore_do_not_split_words_for_one_word |
| 8927 | 8927 | ) |
| 8928 | 8928 | ) { |
| 8929 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
| 8929 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
| 8930 | 8930 | } |
| 8931 | 8931 | } |
| 8932 | 8932 | } else { |
| 8933 | 8933 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8934 | 8934 | |
| 8935 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 8935 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 8936 | 8936 | return $str; |
| 8937 | 8937 | } |
| 8938 | 8938 | |
| 8939 | 8939 | // need to further trim the string so we can append the substring |
| 8940 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 8940 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 8941 | 8941 | if ($length <= 0) { |
| 8942 | 8942 | return $substring; |
| 8943 | 8943 | } |
@@ -8963,12 +8963,12 @@ discard block |
||
| 8963 | 8963 | !$ignore_do_not_split_words_for_one_word |
| 8964 | 8964 | ) |
| 8965 | 8965 | ) { |
| 8966 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
| 8966 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
| 8967 | 8967 | } |
| 8968 | 8968 | } |
| 8969 | 8969 | } |
| 8970 | 8970 | |
| 8971 | - return $truncated . $substring; |
|
| 8971 | + return $truncated.$substring; |
|
| 8972 | 8972 | } |
| 8973 | 8973 | |
| 8974 | 8974 | /** |
@@ -9063,13 +9063,13 @@ discard block |
||
| 9063 | 9063 | } |
| 9064 | 9064 | } elseif ($format === 2) { |
| 9065 | 9065 | $number_of_words = []; |
| 9066 | - $offset = (int) self::strlen($str_parts[0]); |
|
| 9066 | + $offset = (int)self::strlen($str_parts[0]); |
|
| 9067 | 9067 | for ($i = 1; $i < $len; $i += 2) { |
| 9068 | 9068 | $number_of_words[$offset] = $str_parts[$i]; |
| 9069 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
| 9069 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
| 9070 | 9070 | } |
| 9071 | 9071 | } else { |
| 9072 | - $number_of_words = (int) (($len - 1) / 2); |
|
| 9072 | + $number_of_words = (int)(($len - 1) / 2); |
|
| 9073 | 9073 | } |
| 9074 | 9074 | |
| 9075 | 9075 | return $number_of_words; |
@@ -9172,7 +9172,7 @@ discard block |
||
| 9172 | 9172 | } |
| 9173 | 9173 | |
| 9174 | 9174 | if ($char_list === '') { |
| 9175 | - return (int) self::strlen($str, $encoding); |
|
| 9175 | + return (int)self::strlen($str, $encoding); |
|
| 9176 | 9176 | } |
| 9177 | 9177 | |
| 9178 | 9178 | if ($offset || $length !== null) { |
@@ -9198,7 +9198,7 @@ discard block |
||
| 9198 | 9198 | } |
| 9199 | 9199 | |
| 9200 | 9200 | $matches = []; |
| 9201 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
| 9201 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
| 9202 | 9202 | $return = self::strlen($matches[1], $encoding); |
| 9203 | 9203 | if ($return === false) { |
| 9204 | 9204 | return 0; |
@@ -9207,7 +9207,7 @@ discard block |
||
| 9207 | 9207 | return $return; |
| 9208 | 9208 | } |
| 9209 | 9209 | |
| 9210 | - return (int) self::strlen($str, $encoding); |
|
| 9210 | + return (int)self::strlen($str, $encoding); |
|
| 9211 | 9211 | } |
| 9212 | 9212 | |
| 9213 | 9213 | /** |
@@ -9238,7 +9238,7 @@ discard block |
||
| 9238 | 9238 | |
| 9239 | 9239 | $str = ''; |
| 9240 | 9240 | foreach ($intOrHex as $strPart) { |
| 9241 | - $str .= '&#' . (int) $strPart . ';'; |
|
| 9241 | + $str .= '&#'.(int)$strPart.';'; |
|
| 9242 | 9242 | } |
| 9243 | 9243 | |
| 9244 | 9244 | // We cannot use html_entity_decode() here, as it will not return |
@@ -9336,7 +9336,7 @@ discard block |
||
| 9336 | 9336 | return ''; |
| 9337 | 9337 | } |
| 9338 | 9338 | |
| 9339 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
| 9339 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
| 9340 | 9340 | } |
| 9341 | 9341 | |
| 9342 | 9342 | /** |
@@ -9415,7 +9415,7 @@ discard block |
||
| 9415 | 9415 | // fallback for ascii only |
| 9416 | 9416 | // |
| 9417 | 9417 | |
| 9418 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 9418 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 9419 | 9419 | return \stripos($haystack, $needle, $offset); |
| 9420 | 9420 | } |
| 9421 | 9421 | |
@@ -9504,7 +9504,7 @@ discard block |
||
| 9504 | 9504 | /** |
| 9505 | 9505 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 9506 | 9506 | */ |
| 9507 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9507 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9508 | 9508 | } |
| 9509 | 9509 | |
| 9510 | 9510 | if ( |
@@ -9518,11 +9518,11 @@ discard block |
||
| 9518 | 9518 | } |
| 9519 | 9519 | } |
| 9520 | 9520 | |
| 9521 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
| 9521 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
| 9522 | 9522 | return \stristr($haystack, $needle, $before_needle); |
| 9523 | 9523 | } |
| 9524 | 9524 | |
| 9525 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
| 9525 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
| 9526 | 9526 | |
| 9527 | 9527 | if (!isset($match[1])) { |
| 9528 | 9528 | return false; |
@@ -9532,7 +9532,7 @@ discard block |
||
| 9532 | 9532 | return $match[1]; |
| 9533 | 9533 | } |
| 9534 | 9534 | |
| 9535 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
| 9535 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
| 9536 | 9536 | } |
| 9537 | 9537 | |
| 9538 | 9538 | /** |
@@ -9615,7 +9615,7 @@ discard block |
||
| 9615 | 9615 | /** |
| 9616 | 9616 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 9617 | 9617 | */ |
| 9618 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9618 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9619 | 9619 | } |
| 9620 | 9620 | |
| 9621 | 9621 | // |
@@ -9753,8 +9753,8 @@ discard block |
||
| 9753 | 9753 | } |
| 9754 | 9754 | |
| 9755 | 9755 | return \strnatcmp( |
| 9756 | - (string) self::strtonatfold($str1), |
|
| 9757 | - (string) self::strtonatfold($str2) |
|
| 9756 | + (string)self::strtonatfold($str1), |
|
| 9757 | + (string)self::strtonatfold($str2) |
|
| 9758 | 9758 | ); |
| 9759 | 9759 | } |
| 9760 | 9760 | |
@@ -9824,11 +9824,11 @@ discard block |
||
| 9824 | 9824 | } |
| 9825 | 9825 | |
| 9826 | 9826 | if ($encoding === 'UTF-8') { |
| 9827 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
| 9828 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
| 9827 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
| 9828 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
| 9829 | 9829 | } else { |
| 9830 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
| 9831 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
| 9830 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
| 9831 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
| 9832 | 9832 | } |
| 9833 | 9833 | |
| 9834 | 9834 | return self::strcmp($str1, $str2); |
@@ -9855,8 +9855,8 @@ discard block |
||
| 9855 | 9855 | return false; |
| 9856 | 9856 | } |
| 9857 | 9857 | |
| 9858 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
| 9859 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
| 9858 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
| 9859 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
| 9860 | 9860 | } |
| 9861 | 9861 | |
| 9862 | 9862 | return false; |
@@ -9901,10 +9901,10 @@ discard block |
||
| 9901 | 9901 | } |
| 9902 | 9902 | |
| 9903 | 9903 | // iconv and mbstring do not support integer $needle |
| 9904 | - if ((int) $needle === $needle) { |
|
| 9905 | - $needle = (string) self::chr($needle); |
|
| 9904 | + if ((int)$needle === $needle) { |
|
| 9905 | + $needle = (string)self::chr($needle); |
|
| 9906 | 9906 | } |
| 9907 | - $needle = (string) $needle; |
|
| 9907 | + $needle = (string)$needle; |
|
| 9908 | 9908 | |
| 9909 | 9909 | if ($haystack === '') { |
| 9910 | 9910 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -9964,7 +9964,7 @@ discard block |
||
| 9964 | 9964 | /** |
| 9965 | 9965 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 9966 | 9966 | */ |
| 9967 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9967 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9968 | 9968 | } |
| 9969 | 9969 | |
| 9970 | 9970 | // |
@@ -10005,7 +10005,7 @@ discard block |
||
| 10005 | 10005 | // fallback for ascii only |
| 10006 | 10006 | // |
| 10007 | 10007 | |
| 10008 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10008 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10009 | 10009 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Offset not contained in string */ |
| 10010 | 10010 | return @\strpos($haystack, $needle, $offset); |
| 10011 | 10011 | } |
@@ -10018,7 +10018,7 @@ discard block |
||
| 10018 | 10018 | if ($haystack_tmp === false) { |
| 10019 | 10019 | $haystack_tmp = ''; |
| 10020 | 10020 | } |
| 10021 | - $haystack = (string) $haystack_tmp; |
|
| 10021 | + $haystack = (string)$haystack_tmp; |
|
| 10022 | 10022 | |
| 10023 | 10023 | if ($offset < 0) { |
| 10024 | 10024 | $offset = 0; |
@@ -10030,7 +10030,7 @@ discard block |
||
| 10030 | 10030 | } |
| 10031 | 10031 | |
| 10032 | 10032 | if ($pos) { |
| 10033 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 10033 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 10034 | 10034 | } |
| 10035 | 10035 | |
| 10036 | 10036 | return $offset + 0; |
@@ -10185,7 +10185,7 @@ discard block |
||
| 10185 | 10185 | /** |
| 10186 | 10186 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10187 | 10187 | */ |
| 10188 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10188 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10189 | 10189 | } |
| 10190 | 10190 | |
| 10191 | 10191 | // |
@@ -10260,7 +10260,7 @@ discard block |
||
| 10260 | 10260 | if ($encoding === 'UTF-8') { |
| 10261 | 10261 | if (self::$SUPPORT['intl'] === true) { |
| 10262 | 10262 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
| 10263 | - $i = (int) \grapheme_strlen($str); |
|
| 10263 | + $i = (int)\grapheme_strlen($str); |
|
| 10264 | 10264 | while ($i--) { |
| 10265 | 10265 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
| 10266 | 10266 | if ($reversed_tmp !== false) { |
@@ -10268,7 +10268,7 @@ discard block |
||
| 10268 | 10268 | } |
| 10269 | 10269 | } |
| 10270 | 10270 | } else { |
| 10271 | - $i = (int) \mb_strlen($str); |
|
| 10271 | + $i = (int)\mb_strlen($str); |
|
| 10272 | 10272 | while ($i--) { |
| 10273 | 10273 | $reversed_tmp = \mb_substr($str, $i, 1); |
| 10274 | 10274 | if ($reversed_tmp !== false) { |
@@ -10279,7 +10279,7 @@ discard block |
||
| 10279 | 10279 | } else { |
| 10280 | 10280 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 10281 | 10281 | |
| 10282 | - $i = (int) self::strlen($str, $encoding); |
|
| 10282 | + $i = (int)self::strlen($str, $encoding); |
|
| 10283 | 10283 | while ($i--) { |
| 10284 | 10284 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
| 10285 | 10285 | if ($reversed_tmp !== false) { |
@@ -10407,10 +10407,10 @@ discard block |
||
| 10407 | 10407 | } |
| 10408 | 10408 | |
| 10409 | 10409 | // iconv and mbstring do not support integer $needle |
| 10410 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 10411 | - $needle = (string) self::chr($needle); |
|
| 10410 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 10411 | + $needle = (string)self::chr($needle); |
|
| 10412 | 10412 | } |
| 10413 | - $needle = (string) $needle; |
|
| 10413 | + $needle = (string)$needle; |
|
| 10414 | 10414 | |
| 10415 | 10415 | if ($haystack === '') { |
| 10416 | 10416 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -10466,7 +10466,7 @@ discard block |
||
| 10466 | 10466 | /** |
| 10467 | 10467 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10468 | 10468 | */ |
| 10469 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10469 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10470 | 10470 | } |
| 10471 | 10471 | |
| 10472 | 10472 | // |
@@ -10490,7 +10490,7 @@ discard block |
||
| 10490 | 10490 | // fallback for ascii only |
| 10491 | 10491 | // |
| 10492 | 10492 | |
| 10493 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10493 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10494 | 10494 | return \strripos($haystack, $needle, $offset); |
| 10495 | 10495 | } |
| 10496 | 10496 | |
@@ -10579,10 +10579,10 @@ discard block |
||
| 10579 | 10579 | } |
| 10580 | 10580 | |
| 10581 | 10581 | // iconv and mbstring do not support integer $needle |
| 10582 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 10583 | - $needle = (string) self::chr($needle); |
|
| 10582 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 10583 | + $needle = (string)self::chr($needle); |
|
| 10584 | 10584 | } |
| 10585 | - $needle = (string) $needle; |
|
| 10585 | + $needle = (string)$needle; |
|
| 10586 | 10586 | |
| 10587 | 10587 | if ($haystack === '') { |
| 10588 | 10588 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -10638,7 +10638,7 @@ discard block |
||
| 10638 | 10638 | /** |
| 10639 | 10639 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10640 | 10640 | */ |
| 10641 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10641 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10642 | 10642 | } |
| 10643 | 10643 | |
| 10644 | 10644 | // |
@@ -10662,7 +10662,7 @@ discard block |
||
| 10662 | 10662 | // fallback for ascii only |
| 10663 | 10663 | // |
| 10664 | 10664 | |
| 10665 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10665 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10666 | 10666 | return \strrpos($haystack, $needle, $offset); |
| 10667 | 10667 | } |
| 10668 | 10668 | |
@@ -10682,7 +10682,7 @@ discard block |
||
| 10682 | 10682 | if ($haystack_tmp === false) { |
| 10683 | 10683 | $haystack_tmp = ''; |
| 10684 | 10684 | } |
| 10685 | - $haystack = (string) $haystack_tmp; |
|
| 10685 | + $haystack = (string)$haystack_tmp; |
|
| 10686 | 10686 | } |
| 10687 | 10687 | |
| 10688 | 10688 | $pos = \strrpos($haystack, $needle); |
@@ -10696,7 +10696,7 @@ discard block |
||
| 10696 | 10696 | return false; |
| 10697 | 10697 | } |
| 10698 | 10698 | |
| 10699 | - return $offset + (int) self::strlen($str_tmp); |
|
| 10699 | + return $offset + (int)self::strlen($str_tmp); |
|
| 10700 | 10700 | } |
| 10701 | 10701 | |
| 10702 | 10702 | /** |
@@ -10764,12 +10764,12 @@ discard block |
||
| 10764 | 10764 | if ($offset || $length !== null) { |
| 10765 | 10765 | if ($encoding === 'UTF-8') { |
| 10766 | 10766 | if ($length === null) { |
| 10767 | - $str = (string) \mb_substr($str, $offset); |
|
| 10767 | + $str = (string)\mb_substr($str, $offset); |
|
| 10768 | 10768 | } else { |
| 10769 | - $str = (string) \mb_substr($str, $offset, $length); |
|
| 10769 | + $str = (string)\mb_substr($str, $offset, $length); |
|
| 10770 | 10770 | } |
| 10771 | 10771 | } else { |
| 10772 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
| 10772 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
| 10773 | 10773 | } |
| 10774 | 10774 | } |
| 10775 | 10775 | |
@@ -10779,7 +10779,7 @@ discard block |
||
| 10779 | 10779 | |
| 10780 | 10780 | $matches = []; |
| 10781 | 10781 | |
| 10782 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
| 10782 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
| 10783 | 10783 | } |
| 10784 | 10784 | |
| 10785 | 10785 | /** |
@@ -10873,7 +10873,7 @@ discard block |
||
| 10873 | 10873 | /** |
| 10874 | 10874 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10875 | 10875 | */ |
| 10876 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10876 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10877 | 10877 | } |
| 10878 | 10878 | |
| 10879 | 10879 | // |
@@ -10895,7 +10895,7 @@ discard block |
||
| 10895 | 10895 | // fallback for ascii only |
| 10896 | 10896 | // |
| 10897 | 10897 | |
| 10898 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10898 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10899 | 10899 | return \strstr($haystack, $needle, $before_needle); |
| 10900 | 10900 | } |
| 10901 | 10901 | |
@@ -10903,7 +10903,7 @@ discard block |
||
| 10903 | 10903 | // fallback via vanilla php |
| 10904 | 10904 | // |
| 10905 | 10905 | |
| 10906 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
| 10906 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
| 10907 | 10907 | |
| 10908 | 10908 | if (!isset($match[1])) { |
| 10909 | 10909 | return false; |
@@ -10913,7 +10913,7 @@ discard block |
||
| 10913 | 10913 | return $match[1]; |
| 10914 | 10914 | } |
| 10915 | 10915 | |
| 10916 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
| 10916 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
| 10917 | 10917 | } |
| 10918 | 10918 | |
| 10919 | 10919 | /** |
@@ -11043,7 +11043,7 @@ discard block |
||
| 11043 | 11043 | bool $try_to_keep_the_string_length = false |
| 11044 | 11044 | ): string { |
| 11045 | 11045 | // init |
| 11046 | - $str = (string) $str; |
|
| 11046 | + $str = (string)$str; |
|
| 11047 | 11047 | |
| 11048 | 11048 | if ($str === '') { |
| 11049 | 11049 | return ''; |
@@ -11072,23 +11072,23 @@ discard block |
||
| 11072 | 11072 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 11073 | 11073 | } |
| 11074 | 11074 | |
| 11075 | - $language_code = $lang . '-Lower'; |
|
| 11075 | + $language_code = $lang.'-Lower'; |
|
| 11076 | 11076 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 11077 | 11077 | /** |
| 11078 | 11078 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11079 | 11079 | */ |
| 11080 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
| 11080 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
| 11081 | 11081 | |
| 11082 | 11082 | $language_code = 'Any-Lower'; |
| 11083 | 11083 | } |
| 11084 | 11084 | |
| 11085 | - return (string) \transliterator_transliterate($language_code, $str); |
|
| 11085 | + return (string)\transliterator_transliterate($language_code, $str); |
|
| 11086 | 11086 | } |
| 11087 | 11087 | |
| 11088 | 11088 | /** |
| 11089 | 11089 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11090 | 11090 | */ |
| 11091 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
| 11091 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
| 11092 | 11092 | } |
| 11093 | 11093 | |
| 11094 | 11094 | // always fallback via symfony polyfill |
@@ -11123,7 +11123,7 @@ discard block |
||
| 11123 | 11123 | bool $try_to_keep_the_string_length = false |
| 11124 | 11124 | ): string { |
| 11125 | 11125 | // init |
| 11126 | - $str = (string) $str; |
|
| 11126 | + $str = (string)$str; |
|
| 11127 | 11127 | |
| 11128 | 11128 | if ($str === '') { |
| 11129 | 11129 | return ''; |
@@ -11152,23 +11152,23 @@ discard block |
||
| 11152 | 11152 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 11153 | 11153 | } |
| 11154 | 11154 | |
| 11155 | - $language_code = $lang . '-Upper'; |
|
| 11155 | + $language_code = $lang.'-Upper'; |
|
| 11156 | 11156 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 11157 | 11157 | /** |
| 11158 | 11158 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11159 | 11159 | */ |
| 11160 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
| 11160 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
| 11161 | 11161 | |
| 11162 | 11162 | $language_code = 'Any-Upper'; |
| 11163 | 11163 | } |
| 11164 | 11164 | |
| 11165 | - return (string) \transliterator_transliterate($language_code, $str); |
|
| 11165 | + return (string)\transliterator_transliterate($language_code, $str); |
|
| 11166 | 11166 | } |
| 11167 | 11167 | |
| 11168 | 11168 | /** |
| 11169 | 11169 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11170 | 11170 | */ |
| 11171 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
| 11171 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
| 11172 | 11172 | } |
| 11173 | 11173 | |
| 11174 | 11174 | // always fallback via symfony polyfill |
@@ -11231,7 +11231,7 @@ discard block |
||
| 11231 | 11231 | |
| 11232 | 11232 | $from = \array_combine($from, $to); |
| 11233 | 11233 | if ($from === false) { |
| 11234 | - 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) . ')'); |
|
| 11234 | + 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).')'); |
|
| 11235 | 11235 | } |
| 11236 | 11236 | } |
| 11237 | 11237 | |
@@ -11297,9 +11297,9 @@ discard block |
||
| 11297 | 11297 | } |
| 11298 | 11298 | |
| 11299 | 11299 | $wide = 0; |
| 11300 | - $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); |
|
| 11300 | + $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); |
|
| 11301 | 11301 | |
| 11302 | - return ($wide << 1) + (int) self::strlen($str); |
|
| 11302 | + return ($wide << 1) + (int)self::strlen($str); |
|
| 11303 | 11303 | } |
| 11304 | 11304 | |
| 11305 | 11305 | /** |
@@ -11408,7 +11408,7 @@ discard block |
||
| 11408 | 11408 | /** |
| 11409 | 11409 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11410 | 11410 | */ |
| 11411 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11411 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11412 | 11412 | } |
| 11413 | 11413 | |
| 11414 | 11414 | // |
@@ -11503,16 +11503,16 @@ discard block |
||
| 11503 | 11503 | ) { |
| 11504 | 11504 | if ($encoding === 'UTF-8') { |
| 11505 | 11505 | if ($length === null) { |
| 11506 | - $str1 = (string) \mb_substr($str1, $offset); |
|
| 11506 | + $str1 = (string)\mb_substr($str1, $offset); |
|
| 11507 | 11507 | } else { |
| 11508 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
| 11508 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
| 11509 | 11509 | } |
| 11510 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
| 11510 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
| 11511 | 11511 | } else { |
| 11512 | 11512 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 11513 | 11513 | |
| 11514 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
| 11515 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
| 11514 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
| 11515 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
| 11516 | 11516 | } |
| 11517 | 11517 | } |
| 11518 | 11518 | |
@@ -11591,9 +11591,9 @@ discard block |
||
| 11591 | 11591 | } |
| 11592 | 11592 | |
| 11593 | 11593 | if ($encoding === 'UTF-8') { |
| 11594 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
| 11594 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
| 11595 | 11595 | } else { |
| 11596 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
| 11596 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
| 11597 | 11597 | } |
| 11598 | 11598 | } |
| 11599 | 11599 | |
@@ -11605,7 +11605,7 @@ discard block |
||
| 11605 | 11605 | /** |
| 11606 | 11606 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11607 | 11607 | */ |
| 11608 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11608 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11609 | 11609 | } |
| 11610 | 11610 | |
| 11611 | 11611 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -11616,7 +11616,7 @@ discard block |
||
| 11616 | 11616 | return \mb_substr_count($haystack, $needle, $encoding); |
| 11617 | 11617 | } |
| 11618 | 11618 | |
| 11619 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 11619 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 11620 | 11620 | |
| 11621 | 11621 | return \count($matches); |
| 11622 | 11622 | } |
@@ -11688,7 +11688,7 @@ discard block |
||
| 11688 | 11688 | if ($haystack_tmp === false) { |
| 11689 | 11689 | $haystack_tmp = ''; |
| 11690 | 11690 | } |
| 11691 | - $haystack = (string) $haystack_tmp; |
|
| 11691 | + $haystack = (string)$haystack_tmp; |
|
| 11692 | 11692 | } |
| 11693 | 11693 | |
| 11694 | 11694 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -11729,10 +11729,10 @@ discard block |
||
| 11729 | 11729 | |
| 11730 | 11730 | if ($encoding === 'UTF-8') { |
| 11731 | 11731 | if ($case_sensitive) { |
| 11732 | - return (int) \mb_substr_count($str, $substring); |
|
| 11732 | + return (int)\mb_substr_count($str, $substring); |
|
| 11733 | 11733 | } |
| 11734 | 11734 | |
| 11735 | - return (int) \mb_substr_count( |
|
| 11735 | + return (int)\mb_substr_count( |
|
| 11736 | 11736 | \mb_strtoupper($str), |
| 11737 | 11737 | \mb_strtoupper($substring) |
| 11738 | 11738 | ); |
@@ -11741,10 +11741,10 @@ discard block |
||
| 11741 | 11741 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 11742 | 11742 | |
| 11743 | 11743 | if ($case_sensitive) { |
| 11744 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
| 11744 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
| 11745 | 11745 | } |
| 11746 | 11746 | |
| 11747 | - return (int) \mb_substr_count( |
|
| 11747 | + return (int)\mb_substr_count( |
|
| 11748 | 11748 | self::strtocasefold($str, true, false, $encoding, null, false), |
| 11749 | 11749 | self::strtocasefold($substring, true, false, $encoding, null, false), |
| 11750 | 11750 | $encoding |
@@ -11778,7 +11778,7 @@ discard block |
||
| 11778 | 11778 | } |
| 11779 | 11779 | |
| 11780 | 11780 | if (self::str_istarts_with($haystack, $needle)) { |
| 11781 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 11781 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 11782 | 11782 | } |
| 11783 | 11783 | |
| 11784 | 11784 | return $haystack; |
@@ -11845,7 +11845,7 @@ discard block |
||
| 11845 | 11845 | } |
| 11846 | 11846 | |
| 11847 | 11847 | if (self::str_iends_with($haystack, $needle)) { |
| 11848 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
| 11848 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
| 11849 | 11849 | } |
| 11850 | 11850 | |
| 11851 | 11851 | return $haystack; |
@@ -11878,7 +11878,7 @@ discard block |
||
| 11878 | 11878 | } |
| 11879 | 11879 | |
| 11880 | 11880 | if (self::str_starts_with($haystack, $needle)) { |
| 11881 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 11881 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 11882 | 11882 | } |
| 11883 | 11883 | |
| 11884 | 11884 | return $haystack; |
@@ -11939,7 +11939,7 @@ discard block |
||
| 11939 | 11939 | if (\is_array($offset)) { |
| 11940 | 11940 | $offset = \array_slice($offset, 0, $num); |
| 11941 | 11941 | foreach ($offset as &$value_tmp) { |
| 11942 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
| 11942 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
| 11943 | 11943 | } |
| 11944 | 11944 | unset($value_tmp); |
| 11945 | 11945 | } else { |
@@ -11952,7 +11952,7 @@ discard block |
||
| 11952 | 11952 | } elseif (\is_array($length)) { |
| 11953 | 11953 | $length = \array_slice($length, 0, $num); |
| 11954 | 11954 | foreach ($length as &$value_tmp_V2) { |
| 11955 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
| 11955 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
| 11956 | 11956 | } |
| 11957 | 11957 | unset($value_tmp_V2); |
| 11958 | 11958 | } else { |
@@ -11973,8 +11973,8 @@ discard block |
||
| 11973 | 11973 | } |
| 11974 | 11974 | |
| 11975 | 11975 | // init |
| 11976 | - $str = (string) $str; |
|
| 11977 | - $replacement = (string) $replacement; |
|
| 11976 | + $str = (string)$str; |
|
| 11977 | + $replacement = (string)$replacement; |
|
| 11978 | 11978 | |
| 11979 | 11979 | if (\is_array($length)) { |
| 11980 | 11980 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -11989,16 +11989,16 @@ discard block |
||
| 11989 | 11989 | } |
| 11990 | 11990 | |
| 11991 | 11991 | if (self::$SUPPORT['mbstring'] === true) { |
| 11992 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 11992 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 11993 | 11993 | |
| 11994 | 11994 | if ($offset < 0) { |
| 11995 | - $offset = (int) \max(0, $string_length + $offset); |
|
| 11995 | + $offset = (int)\max(0, $string_length + $offset); |
|
| 11996 | 11996 | } elseif ($offset > $string_length) { |
| 11997 | 11997 | $offset = $string_length; |
| 11998 | 11998 | } |
| 11999 | 11999 | |
| 12000 | 12000 | if ($length !== null && $length < 0) { |
| 12001 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
| 12001 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
| 12002 | 12002 | } elseif ($length === null || $length > $string_length) { |
| 12003 | 12003 | $length = $string_length; |
| 12004 | 12004 | } |
@@ -12007,9 +12007,9 @@ discard block |
||
| 12007 | 12007 | $length = $string_length - $offset; |
| 12008 | 12008 | } |
| 12009 | 12009 | |
| 12010 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
| 12011 | - $replacement . |
|
| 12012 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 12010 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
| 12011 | + $replacement. |
|
| 12012 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 12013 | 12013 | } |
| 12014 | 12014 | |
| 12015 | 12015 | // |
@@ -12018,8 +12018,7 @@ discard block |
||
| 12018 | 12018 | |
| 12019 | 12019 | if (ASCII::is_ascii($str)) { |
| 12020 | 12020 | return ($length === null) ? |
| 12021 | - \substr_replace($str, $replacement, $offset) : |
|
| 12022 | - \substr_replace($str, $replacement, $offset, $length); |
|
| 12021 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
| 12023 | 12022 | } |
| 12024 | 12023 | |
| 12025 | 12024 | // |
@@ -12078,14 +12077,14 @@ discard block |
||
| 12078 | 12077 | && |
| 12079 | 12078 | \substr($haystack, -\strlen($needle)) === $needle |
| 12080 | 12079 | ) { |
| 12081 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
| 12080 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
| 12082 | 12081 | } |
| 12083 | 12082 | |
| 12084 | 12083 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
| 12085 | - return (string) self::substr( |
|
| 12084 | + return (string)self::substr( |
|
| 12086 | 12085 | $haystack, |
| 12087 | 12086 | 0, |
| 12088 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
| 12087 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
| 12089 | 12088 | $encoding |
| 12090 | 12089 | ); |
| 12091 | 12090 | } |
@@ -12120,10 +12119,10 @@ discard block |
||
| 12120 | 12119 | } |
| 12121 | 12120 | |
| 12122 | 12121 | if ($encoding === 'UTF-8') { |
| 12123 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 12122 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 12124 | 12123 | } |
| 12125 | 12124 | |
| 12126 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 12125 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 12127 | 12126 | } |
| 12128 | 12127 | |
| 12129 | 12128 | /** |
@@ -12262,7 +12261,7 @@ discard block |
||
| 12262 | 12261 | public static function to_boolean($str): bool |
| 12263 | 12262 | { |
| 12264 | 12263 | // init |
| 12265 | - $str = (string) $str; |
|
| 12264 | + $str = (string)$str; |
|
| 12266 | 12265 | |
| 12267 | 12266 | if ($str === '') { |
| 12268 | 12267 | return false; |
@@ -12290,10 +12289,10 @@ discard block |
||
| 12290 | 12289 | } |
| 12291 | 12290 | |
| 12292 | 12291 | if (\is_numeric($str)) { |
| 12293 | - return ((float) $str) > 0; |
|
| 12292 | + return ((float)$str) > 0; |
|
| 12294 | 12293 | } |
| 12295 | 12294 | |
| 12296 | - return (bool) \trim($str); |
|
| 12295 | + return (bool)\trim($str); |
|
| 12297 | 12296 | } |
| 12298 | 12297 | |
| 12299 | 12298 | /** |
@@ -12345,7 +12344,7 @@ discard block |
||
| 12345 | 12344 | return $str; |
| 12346 | 12345 | } |
| 12347 | 12346 | |
| 12348 | - $str = (string) $str; |
|
| 12347 | + $str = (string)$str; |
|
| 12349 | 12348 | if ($str === '') { |
| 12350 | 12349 | return ''; |
| 12351 | 12350 | } |
@@ -12433,7 +12432,7 @@ discard block |
||
| 12433 | 12432 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
| 12434 | 12433 | |
| 12435 | 12434 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 12436 | - $buf .= $c1 . $c2; |
|
| 12435 | + $buf .= $c1.$c2; |
|
| 12437 | 12436 | ++$i; |
| 12438 | 12437 | } else { // not valid UTF8 - convert it |
| 12439 | 12438 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12444,7 +12443,7 @@ discard block |
||
| 12444 | 12443 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
| 12445 | 12444 | |
| 12446 | 12445 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 12447 | - $buf .= $c1 . $c2 . $c3; |
|
| 12446 | + $buf .= $c1.$c2.$c3; |
|
| 12448 | 12447 | $i += 2; |
| 12449 | 12448 | } else { // not valid UTF8 - convert it |
| 12450 | 12449 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12456,7 +12455,7 @@ discard block |
||
| 12456 | 12455 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
| 12457 | 12456 | |
| 12458 | 12457 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 12459 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
| 12458 | + $buf .= $c1.$c2.$c3.$c4; |
|
| 12460 | 12459 | $i += 3; |
| 12461 | 12460 | } else { // not valid UTF8 - convert it |
| 12462 | 12461 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12484,13 +12483,13 @@ discard block |
||
| 12484 | 12483 | * |
| 12485 | 12484 | * @return string |
| 12486 | 12485 | */ |
| 12487 | - static function (array $matches): string { |
|
| 12486 | + static function(array $matches): string { |
|
| 12488 | 12487 | if (isset($matches[3])) { |
| 12489 | - $cp = (int) \hexdec($matches[3]); |
|
| 12488 | + $cp = (int)\hexdec($matches[3]); |
|
| 12490 | 12489 | } else { |
| 12491 | 12490 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
| 12492 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
| 12493 | - + (int) \hexdec($matches[2]) |
|
| 12491 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
| 12492 | + + (int)\hexdec($matches[2]) |
|
| 12494 | 12493 | + 0x10000 |
| 12495 | 12494 | - (0xD800 << 10) |
| 12496 | 12495 | - 0xDC00; |
@@ -12501,12 +12500,12 @@ discard block |
||
| 12501 | 12500 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
| 12502 | 12501 | |
| 12503 | 12502 | if ($cp < 0x80) { |
| 12504 | - return (string) self::chr($cp); |
|
| 12503 | + return (string)self::chr($cp); |
|
| 12505 | 12504 | } |
| 12506 | 12505 | |
| 12507 | 12506 | if ($cp < 0xA0) { |
| 12508 | 12507 | /** @noinspection UnnecessaryCastingInspection */ |
| 12509 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
| 12508 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
| 12510 | 12509 | } |
| 12511 | 12510 | |
| 12512 | 12511 | return self::decimal_to_chr($cp); |
@@ -12539,7 +12538,7 @@ discard block |
||
| 12539 | 12538 | public static function to_int(string $str) |
| 12540 | 12539 | { |
| 12541 | 12540 | if (\is_numeric($str)) { |
| 12542 | - return (int) $str; |
|
| 12541 | + return (int)$str; |
|
| 12543 | 12542 | } |
| 12544 | 12543 | |
| 12545 | 12544 | return null; |
@@ -12574,12 +12573,12 @@ discard block |
||
| 12574 | 12573 | || |
| 12575 | 12574 | $input_type === 'double' |
| 12576 | 12575 | ) { |
| 12577 | - return (string) $input; |
|
| 12576 | + return (string)$input; |
|
| 12578 | 12577 | } |
| 12579 | 12578 | |
| 12580 | 12579 | /** @phpstan-ignore-next-line - "gettype": FP? */ |
| 12581 | 12580 | if ($input_type === 'object' && \method_exists($input, '__toString')) { |
| 12582 | - return (string) $input; |
|
| 12581 | + return (string)$input; |
|
| 12583 | 12582 | } |
| 12584 | 12583 | |
| 12585 | 12584 | return null; |
@@ -12618,7 +12617,7 @@ discard block |
||
| 12618 | 12617 | $pattern = '^[\\s]+|[\\s]+$'; |
| 12619 | 12618 | } |
| 12620 | 12619 | |
| 12621 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 12620 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 12622 | 12621 | } |
| 12623 | 12622 | |
| 12624 | 12623 | if ($chars !== null) { |
@@ -12669,15 +12668,15 @@ discard block |
||
| 12669 | 12668 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 12670 | 12669 | |
| 12671 | 12670 | if ($encoding === 'UTF-8') { |
| 12672 | - $str_part_two = (string) \mb_substr($str, 1); |
|
| 12671 | + $str_part_two = (string)\mb_substr($str, 1); |
|
| 12673 | 12672 | |
| 12674 | 12673 | if ($use_mb_functions) { |
| 12675 | 12674 | $str_part_one = \mb_strtoupper( |
| 12676 | - (string) \mb_substr($str, 0, 1) |
|
| 12675 | + (string)\mb_substr($str, 0, 1) |
|
| 12677 | 12676 | ); |
| 12678 | 12677 | } else { |
| 12679 | 12678 | $str_part_one = self::strtoupper( |
| 12680 | - (string) \mb_substr($str, 0, 1), |
|
| 12679 | + (string)\mb_substr($str, 0, 1), |
|
| 12681 | 12680 | $encoding, |
| 12682 | 12681 | false, |
| 12683 | 12682 | $lang, |
@@ -12687,16 +12686,16 @@ discard block |
||
| 12687 | 12686 | } else { |
| 12688 | 12687 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 12689 | 12688 | |
| 12690 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
| 12689 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
| 12691 | 12690 | |
| 12692 | 12691 | if ($use_mb_functions) { |
| 12693 | 12692 | $str_part_one = \mb_strtoupper( |
| 12694 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
| 12693 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
| 12695 | 12694 | $encoding |
| 12696 | 12695 | ); |
| 12697 | 12696 | } else { |
| 12698 | 12697 | $str_part_one = self::strtoupper( |
| 12699 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 12698 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 12700 | 12699 | $encoding, |
| 12701 | 12700 | false, |
| 12702 | 12701 | $lang, |
@@ -12705,7 +12704,7 @@ discard block |
||
| 12705 | 12704 | } |
| 12706 | 12705 | } |
| 12707 | 12706 | |
| 12708 | - return $str_part_one . $str_part_two; |
|
| 12707 | + return $str_part_one.$str_part_two; |
|
| 12709 | 12708 | } |
| 12710 | 12709 | |
| 12711 | 12710 | /** |
@@ -12744,7 +12743,7 @@ discard block |
||
| 12744 | 12743 | $str = self::clean($str); |
| 12745 | 12744 | } |
| 12746 | 12745 | |
| 12747 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
| 12746 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
| 12748 | 12747 | |
| 12749 | 12748 | if ( |
| 12750 | 12749 | $use_php_default_functions |
@@ -12902,7 +12901,7 @@ discard block |
||
| 12902 | 12901 | if ( |
| 12903 | 12902 | $keep_utf8_chars |
| 12904 | 12903 | && |
| 12905 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
| 12904 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
| 12906 | 12905 | ) { |
| 12907 | 12906 | return $str_backup; |
| 12908 | 12907 | } |
@@ -12975,17 +12974,17 @@ discard block |
||
| 12975 | 12974 | return ''; |
| 12976 | 12975 | } |
| 12977 | 12976 | |
| 12978 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
| 12977 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
| 12979 | 12978 | |
| 12980 | 12979 | if ( |
| 12981 | 12980 | !isset($matches[0]) |
| 12982 | 12981 | || |
| 12983 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
| 12982 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
| 12984 | 12983 | ) { |
| 12985 | 12984 | return $str; |
| 12986 | 12985 | } |
| 12987 | 12986 | |
| 12988 | - return \rtrim($matches[0]) . $str_add_on; |
|
| 12987 | + return \rtrim($matches[0]).$str_add_on; |
|
| 12989 | 12988 | } |
| 12990 | 12989 | |
| 12991 | 12990 | /** |
@@ -13078,7 +13077,7 @@ discard block |
||
| 13078 | 13077 | } |
| 13079 | 13078 | } |
| 13080 | 13079 | |
| 13081 | - return $str_return . \implode('', $charsArray); |
|
| 13080 | + return $str_return.\implode('', $charsArray); |
|
| 13082 | 13081 | } |
| 13083 | 13082 | |
| 13084 | 13083 | /** |
@@ -13132,7 +13131,7 @@ discard block |
||
| 13132 | 13131 | $final_break = ''; |
| 13133 | 13132 | } |
| 13134 | 13133 | |
| 13135 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
| 13134 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
| 13136 | 13135 | } |
| 13137 | 13136 | |
| 13138 | 13137 | /** |
@@ -13367,7 +13366,7 @@ discard block |
||
| 13367 | 13366 | /** @noinspection PhpIncludeInspection */ |
| 13368 | 13367 | /** @noinspection UsingInclusionReturnValueInspection */ |
| 13369 | 13368 | /** @psalm-suppress UnresolvableInclude */ |
| 13370 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
| 13369 | + return include __DIR__.'/data/'.$file.'.php'; |
|
| 13371 | 13370 | } |
| 13372 | 13371 | |
| 13373 | 13372 | /** |
@@ -13387,7 +13386,7 @@ discard block |
||
| 13387 | 13386 | */ |
| 13388 | 13387 | \uksort( |
| 13389 | 13388 | self::$EMOJI, |
| 13390 | - static function (string $a, string $b): int { |
|
| 13389 | + static function(string $a, string $b): int { |
|
| 13391 | 13390 | return \strlen($b) <=> \strlen($a); |
| 13392 | 13391 | } |
| 13393 | 13392 | ); |
@@ -13397,7 +13396,7 @@ discard block |
||
| 13397 | 13396 | |
| 13398 | 13397 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
| 13399 | 13398 | $tmp_key = \crc32($key); |
| 13400 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
| 13399 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
| 13401 | 13400 | } |
| 13402 | 13401 | |
| 13403 | 13402 | return true; |
@@ -13424,7 +13423,7 @@ discard block |
||
| 13424 | 13423 | /** @noinspection DeprecatedIniOptionsInspection */ |
| 13425 | 13424 | return \defined('MB_OVERLOAD_STRING') |
| 13426 | 13425 | && |
| 13427 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 13426 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 13428 | 13427 | } |
| 13429 | 13428 | |
| 13430 | 13429 | /** |
@@ -13486,7 +13485,7 @@ discard block |
||
| 13486 | 13485 | */ |
| 13487 | 13486 | static $RX_CLASS_CACHE = []; |
| 13488 | 13487 | |
| 13489 | - $cache_key = $s . '_' . $class; |
|
| 13488 | + $cache_key = $s.'_'.$class; |
|
| 13490 | 13489 | |
| 13491 | 13490 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
| 13492 | 13491 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -13498,7 +13497,7 @@ discard block |
||
| 13498 | 13497 | /** @noinspection AlterInForeachInspection */ |
| 13499 | 13498 | foreach (self::str_split($s) as &$s) { |
| 13500 | 13499 | if ($s === '-') { |
| 13501 | - $class_array[0] = '-' . $class_array[0]; |
|
| 13500 | + $class_array[0] = '-'.$class_array[0]; |
|
| 13502 | 13501 | } elseif (!isset($s[2])) { |
| 13503 | 13502 | $class_array[0] .= \preg_quote($s, '/'); |
| 13504 | 13503 | } elseif (self::strlen($s) === 1) { |
@@ -13509,13 +13508,13 @@ discard block |
||
| 13509 | 13508 | } |
| 13510 | 13509 | |
| 13511 | 13510 | if ($class_array[0]) { |
| 13512 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
| 13511 | + $class_array[0] = '['.$class_array[0].']'; |
|
| 13513 | 13512 | } |
| 13514 | 13513 | |
| 13515 | 13514 | if (\count($class_array) === 1) { |
| 13516 | 13515 | $return = $class_array[0]; |
| 13517 | 13516 | } else { |
| 13518 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
| 13517 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
| 13519 | 13518 | } |
| 13520 | 13519 | |
| 13521 | 13520 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -13593,7 +13592,7 @@ discard block |
||
| 13593 | 13592 | $continue = false; |
| 13594 | 13593 | |
| 13595 | 13594 | if ($delimiter === '-') { |
| 13596 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
| 13595 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
| 13597 | 13596 | if (\strncmp($name, $beginning, \strlen($beginning)) === 0) { |
| 13598 | 13597 | $continue = true; |
| 13599 | 13598 | |
@@ -13603,7 +13602,7 @@ discard block |
||
| 13603 | 13602 | unset($beginning); |
| 13604 | 13603 | } |
| 13605 | 13604 | |
| 13606 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
| 13605 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
| 13607 | 13606 | if (\strncmp($name, $beginning, \strlen($beginning)) === 0) { |
| 13608 | 13607 | $continue = true; |
| 13609 | 13608 | |
@@ -13675,8 +13674,8 @@ discard block |
||
| 13675 | 13674 | } else { |
| 13676 | 13675 | /** @noinspection OffsetOperationsInspection */ |
| 13677 | 13676 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
| 13678 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
| 13679 | - $buf .= $cc1 . $cc2; |
|
| 13677 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
| 13678 | + $buf .= $cc1.$cc2; |
|
| 13680 | 13679 | } |
| 13681 | 13680 | |
| 13682 | 13681 | return $buf; |
@@ -13697,7 +13696,7 @@ discard block |
||
| 13697 | 13696 | |
| 13698 | 13697 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
| 13699 | 13698 | if (\preg_match($pattern, $str)) { |
| 13700 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
| 13699 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
| 13701 | 13700 | } |
| 13702 | 13701 | |
| 13703 | 13702 | return $str; |