@@ -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 | ]; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | return false; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - $uri = (string) $_SERVER['REQUEST_URI']; |
|
| 86 | + $uri = (string)$_SERVER['REQUEST_URI']; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | $uriOrig = $uri; |
@@ -100,27 +100,27 @@ discard block |
||
| 100 | 100 | // When not, assumes Windows-1252 and redirects to the corresponding UTF-8 encoded URL |
| 101 | 101 | // |
| 102 | 102 | |
| 103 | - $uri = (string) \preg_replace_callback( |
|
| 103 | + $uri = (string)\preg_replace_callback( |
|
| 104 | 104 | '/[\x80-\xFF]+/', |
| 105 | 105 | /** |
| 106 | 106 | * @param array $m |
| 107 | 107 | * |
| 108 | 108 | * @return string |
| 109 | 109 | */ |
| 110 | - static function (array $m): string { |
|
| 110 | + static function(array $m): string { |
|
| 111 | 111 | return \rawurlencode($m[0]); |
| 112 | 112 | }, |
| 113 | 113 | $uri |
| 114 | 114 | ); |
| 115 | 115 | |
| 116 | - $uri = (string) \preg_replace_callback( |
|
| 116 | + $uri = (string)\preg_replace_callback( |
|
| 117 | 117 | '/(?:%[89A-F][0-9A-F])+/i', |
| 118 | 118 | /** |
| 119 | 119 | * @param array $m |
| 120 | 120 | * |
| 121 | 121 | * @return string |
| 122 | 122 | */ |
| 123 | - static function (array $m): string { |
|
| 123 | + static function(array $m): string { |
|
| 124 | 124 | return \rawurlencode(UTF8::rawurldecode($m[0])); |
| 125 | 125 | }, |
| 126 | 126 | $uri |
@@ -134,19 +134,19 @@ discard block |
||
| 134 | 134 | \headers_sent() === false |
| 135 | 135 | ) { |
| 136 | 136 | $severProtocol = ($_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'); |
| 137 | - \header($severProtocol . ' 301 Moved Permanently'); |
|
| 137 | + \header($severProtocol.' 301 Moved Permanently'); |
|
| 138 | 138 | |
| 139 | 139 | if (\strncmp($uri, '/', 1) === 0) { |
| 140 | - \header('Location: /' . \ltrim($uri, '/')); |
|
| 140 | + \header('Location: /'.\ltrim($uri, '/')); |
|
| 141 | 141 | } else { |
| 142 | - \header('Location: ' . $uri); |
|
| 142 | + \header('Location: '.$uri); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | exit(); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | if (\strncmp($uri, '/', 1) === 0) { |
| 149 | - $uri = '/' . \ltrim($uri, '/'); |
|
| 149 | + $uri = '/'.\ltrim($uri, '/'); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | return $uri; |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | return false; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - $length = (int) $length; |
|
| 192 | + $length = (int)$length; |
|
| 193 | 193 | |
| 194 | 194 | if ($length <= 0) { |
| 195 | 195 | return false; |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | static $_IS_PHP; |
| 231 | 231 | |
| 232 | - $version = (string) $version; |
|
| 232 | + $version = (string)$version; |
|
| 233 | 233 | |
| 234 | 234 | if (!isset($_IS_PHP[$version])) { |
| 235 | 235 | $_IS_PHP[$version] = \version_compare(\PHP_VERSION, $version, '>='); |
@@ -629,22 +629,22 @@ discard block |
||
| 629 | 629 | * @psalm-suppress PossiblyNullArrayAccess |
| 630 | 630 | */ |
| 631 | 631 | $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
| 632 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 632 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 633 | 633 | } elseif ($code_point <= 0xFFFF) { |
| 634 | 634 | /** |
| 635 | 635 | * @psalm-suppress PossiblyNullArrayAccess |
| 636 | 636 | */ |
| 637 | 637 | $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
| 638 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 639 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 638 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 639 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 640 | 640 | } else { |
| 641 | 641 | /** |
| 642 | 642 | * @psalm-suppress PossiblyNullArrayAccess |
| 643 | 643 | */ |
| 644 | 644 | $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
| 645 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 646 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 647 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 645 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 646 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 647 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | if ($encoding !== 'UTF-8') { |
@@ -1131,7 +1131,7 @@ discard block |
||
| 1131 | 1131 | $asciiOffset = 0x41; |
| 1132 | 1132 | |
| 1133 | 1133 | return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? '') . |
| 1134 | - (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
|
| 1134 | + (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
|
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | 1137 | /** |
@@ -2484,10 +2484,10 @@ discard block |
||
| 2484 | 2484 | } |
| 2485 | 2485 | |
| 2486 | 2486 | $unique_helper = $rand_int . |
| 2487 | - \session_id() . |
|
| 2488 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
| 2489 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
| 2490 | - $extra_entropy; |
|
| 2487 | + \session_id() . |
|
| 2488 | + ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
| 2489 | + ($_SERVER['SERVER_ADDR'] ?? '') . |
|
| 2490 | + $extra_entropy; |
|
| 2491 | 2491 | |
| 2492 | 2492 | $unique_string = \uniqid($unique_helper, true); |
| 2493 | 2493 | |
@@ -6346,8 +6346,8 @@ discard block |
||
| 6346 | 6346 | |
| 6347 | 6347 | /** @noinspection UnnecessaryCastingInspection */ |
| 6348 | 6348 | return (string) \mb_substr($str, 0, $index) . |
| 6349 | - $substring . |
|
| 6350 | - (string) \mb_substr($str, $index, $len); |
|
| 6349 | + $substring . |
|
| 6350 | + (string) \mb_substr($str, $index, $len); |
|
| 6351 | 6351 | } |
| 6352 | 6352 | |
| 6353 | 6353 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -6358,8 +6358,8 @@ discard block |
||
| 6358 | 6358 | } |
| 6359 | 6359 | |
| 6360 | 6360 | return ((string) self::substr($str, 0, $index, $encoding)) . |
| 6361 | - $substring . |
|
| 6362 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
| 6361 | + $substring . |
|
| 6362 | + ((string) self::substr($str, $index, $len, $encoding)); |
|
| 6363 | 6363 | } |
| 6364 | 6364 | |
| 6365 | 6365 | /** |
@@ -8532,11 +8532,11 @@ discard block |
||
| 8532 | 8532 | if ($use_mb_functions) { |
| 8533 | 8533 | if ($encoding === 'UTF-8') { |
| 8534 | 8534 | return \mb_strtoupper(\mb_substr($match[0], 0, 1)) |
| 8535 | - . \mb_strtolower(\mb_substr($match[0], 1)); |
|
| 8535 | + . \mb_strtolower(\mb_substr($match[0], 1)); |
|
| 8536 | 8536 | } |
| 8537 | 8537 | |
| 8538 | 8538 | return \mb_strtoupper(\mb_substr($match[0], 0, 1, $encoding), $encoding) |
| 8539 | - . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
| 8539 | + . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
| 8540 | 8540 | } |
| 8541 | 8541 | |
| 8542 | 8542 | return self::ucfirst( |
@@ -8938,13 +8938,13 @@ discard block |
||
| 8938 | 8938 | } |
| 8939 | 8939 | |
| 8940 | 8940 | return ( |
| 8941 | - (string) self::substr( |
|
| 8942 | - $str, |
|
| 8943 | - 0, |
|
| 8944 | - $length, |
|
| 8945 | - $encoding |
|
| 8946 | - ) |
|
| 8947 | - ) . $substring; |
|
| 8941 | + (string) self::substr( |
|
| 8942 | + $str, |
|
| 8943 | + 0, |
|
| 8944 | + $length, |
|
| 8945 | + $encoding |
|
| 8946 | + ) |
|
| 8947 | + ) . $substring; |
|
| 8948 | 8948 | } |
| 8949 | 8949 | |
| 8950 | 8950 | /** |
@@ -11979,8 +11979,8 @@ discard block |
||
| 11979 | 11979 | |
| 11980 | 11980 | /** @noinspection AdditionOperationOnArraysInspection */ |
| 11981 | 11981 | return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
| 11982 | - $replacement . |
|
| 11983 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 11982 | + $replacement . |
|
| 11983 | + ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 11984 | 11984 | } |
| 11985 | 11985 | |
| 11986 | 11986 | // |
@@ -271,10 +271,10 @@ discard block |
||
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | if ($encoding === 'UTF-8') { |
| 274 | - return (string) \mb_substr($str, $pos, 1); |
|
| 274 | + return (string)\mb_substr($str, $pos, 1); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
| 277 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | /** |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | public static function add_bom_to_string(string $str): string |
| 295 | 295 | { |
| 296 | 296 | if (!self::string_has_bom($str)) { |
| 297 | - $str = self::bom() . $str; |
|
| 297 | + $str = self::bom().$str; |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | return $str; |
@@ -329,8 +329,8 @@ discard block |
||
| 329 | 329 | $return = []; |
| 330 | 330 | foreach ($array as $key => &$value) { |
| 331 | 331 | $key = $case === \CASE_LOWER |
| 332 | - ? self::strtolower((string) $key, $encoding) |
|
| 333 | - : self::strtoupper((string) $key, $encoding); |
|
| 332 | + ? self::strtolower((string)$key, $encoding) |
|
| 333 | + : self::strtoupper((string)$key, $encoding); |
|
| 334 | 334 | |
| 335 | 335 | $return[$key] = $value; |
| 336 | 336 | } |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | return ''; |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
| 369 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
| 370 | 370 | $end_position = \mb_strpos($str, $end, $substr_index); |
| 371 | 371 | if ( |
| 372 | 372 | $end_position === false |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | return ''; |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
| 379 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | return ''; |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
| 389 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
| 390 | 390 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
| 391 | 391 | if ( |
| 392 | 392 | $end_position === false |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | return ''; |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | - return (string) self::substr( |
|
| 399 | + return (string)self::substr( |
|
| 400 | 400 | $str, |
| 401 | 401 | $substr_index, |
| 402 | 402 | $end_position - $substr_index, |
@@ -480,10 +480,10 @@ discard block |
||
| 480 | 480 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
| 481 | 481 | { |
| 482 | 482 | if ($encoding === 'UTF-8') { |
| 483 | - return (string) \mb_substr($str, $index, 1); |
|
| 483 | + return (string)\mb_substr($str, $index, 1); |
|
| 484 | 484 | } |
| 485 | 485 | |
| 486 | - return (string) self::substr($str, $index, 1, $encoding); |
|
| 486 | + return (string)self::substr($str, $index, 1, $encoding); |
|
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | /** |
@@ -601,14 +601,14 @@ discard block |
||
| 601 | 601 | /** |
| 602 | 602 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 603 | 603 | */ |
| 604 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 604 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 605 | 605 | } |
| 606 | 606 | |
| 607 | 607 | if (!\is_int($code_point) || $code_point <= 0) { |
| 608 | 608 | return null; |
| 609 | 609 | } |
| 610 | 610 | |
| 611 | - $cache_key = $code_point . '_' . $encoding; |
|
| 611 | + $cache_key = $code_point.'_'.$encoding; |
|
| 612 | 612 | if (isset($CHAR_CACHE[$cache_key])) { |
| 613 | 613 | return $CHAR_CACHE[$cache_key]; |
| 614 | 614 | } |
@@ -654,27 +654,27 @@ discard block |
||
| 654 | 654 | self::$CHR = self::getData('chr'); |
| 655 | 655 | } |
| 656 | 656 | |
| 657 | - $code_point = (int) $code_point; |
|
| 657 | + $code_point = (int)$code_point; |
|
| 658 | 658 | if ($code_point <= 0x7FF) { |
| 659 | 659 | /** |
| 660 | 660 | * @psalm-suppress PossiblyNullArrayAccess |
| 661 | 661 | */ |
| 662 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
| 662 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
| 663 | 663 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 664 | 664 | } elseif ($code_point <= 0xFFFF) { |
| 665 | 665 | /** |
| 666 | 666 | * @psalm-suppress PossiblyNullArrayAccess |
| 667 | 667 | */ |
| 668 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
| 669 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 668 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
| 669 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 670 | 670 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 671 | 671 | } else { |
| 672 | 672 | /** |
| 673 | 673 | * @psalm-suppress PossiblyNullArrayAccess |
| 674 | 674 | */ |
| 675 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
| 676 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 677 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 675 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
| 676 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
| 677 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 678 | 678 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 679 | 679 | } |
| 680 | 680 | |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | |
| 732 | 732 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
| 733 | 733 | return \array_map( |
| 734 | - static function (string $data): int { |
|
| 734 | + static function(string $data): int { |
|
| 735 | 735 | // "mb_" is available if overload is used, so use it ... |
| 736 | 736 | return \mb_strlen($data, 'CP850'); // 8-BIT |
| 737 | 737 | }, |
@@ -818,7 +818,7 @@ discard block |
||
| 818 | 818 | $char = ''; |
| 819 | 819 | } |
| 820 | 820 | |
| 821 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
| 821 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
| 822 | 822 | } |
| 823 | 823 | |
| 824 | 824 | /** |
@@ -915,7 +915,7 @@ discard block |
||
| 915 | 915 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
| 916 | 916 | /x'; |
| 917 | 917 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
| 918 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
| 918 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
| 919 | 919 | |
| 920 | 920 | if ($replace_diamond_question_mark) { |
| 921 | 921 | $str = self::replace_diamond_question_mark($str); |
@@ -954,7 +954,7 @@ discard block |
||
| 954 | 954 | public static function cleanup($str): string |
| 955 | 955 | { |
| 956 | 956 | // init |
| 957 | - $str = (string) $str; |
|
| 957 | + $str = (string)$str; |
|
| 958 | 958 | |
| 959 | 959 | if ($str === '') { |
| 960 | 960 | return ''; |
@@ -1056,7 +1056,7 @@ discard block |
||
| 1056 | 1056 | { |
| 1057 | 1057 | if (self::$SUPPORT['mbstring'] === true) { |
| 1058 | 1058 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 1059 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 1059 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 1060 | 1060 | } |
| 1061 | 1061 | |
| 1062 | 1062 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -1161,9 +1161,9 @@ discard block |
||
| 1161 | 1161 | // - 0-9 (U+0061 - U+007A) |
| 1162 | 1162 | // - ISO 10646 characters U+00A1 and higher |
| 1163 | 1163 | // We strip out any character not in the above list. |
| 1164 | - $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); |
|
| 1164 | + $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); |
|
| 1165 | 1165 | // Identifiers cannot start with a digit, two hyphens, or a hyphen followed by a digit. |
| 1166 | - $str = (string) \preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
| 1166 | + $str = (string)\preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
| 1167 | 1167 | |
| 1168 | 1168 | return \trim($str, '-'); |
| 1169 | 1169 | } |
@@ -1179,7 +1179,7 @@ discard block |
||
| 1179 | 1179 | */ |
| 1180 | 1180 | public static function css_stripe_media_queries(string $str): string |
| 1181 | 1181 | { |
| 1182 | - return (string) \preg_replace( |
|
| 1182 | + return (string)\preg_replace( |
|
| 1183 | 1183 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
| 1184 | 1184 | '', |
| 1185 | 1185 | $str |
@@ -1218,7 +1218,7 @@ discard block |
||
| 1218 | 1218 | */ |
| 1219 | 1219 | public static function decimal_to_chr($int): string |
| 1220 | 1220 | { |
| 1221 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
| 1221 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | 1224 | /** |
@@ -1268,7 +1268,7 @@ discard block |
||
| 1268 | 1268 | $flagOffset = 0x1F1E6; |
| 1269 | 1269 | $asciiOffset = 0x41; |
| 1270 | 1270 | |
| 1271 | - return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? '') . |
|
| 1271 | + return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? ''). |
|
| 1272 | 1272 | (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
| 1273 | 1273 | } |
| 1274 | 1274 | |
@@ -1302,16 +1302,16 @@ discard block |
||
| 1302 | 1302 | } |
| 1303 | 1303 | |
| 1304 | 1304 | if ($use_reversible_string_mappings) { |
| 1305 | - return (string) \str_replace( |
|
| 1306 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1307 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1305 | + return (string)\str_replace( |
|
| 1306 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1307 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1308 | 1308 | $str |
| 1309 | 1309 | ); |
| 1310 | 1310 | } |
| 1311 | 1311 | |
| 1312 | - return (string) \str_replace( |
|
| 1313 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 1314 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1312 | + return (string)\str_replace( |
|
| 1313 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 1314 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1315 | 1315 | $str |
| 1316 | 1316 | ); |
| 1317 | 1317 | } |
@@ -1346,16 +1346,16 @@ discard block |
||
| 1346 | 1346 | } |
| 1347 | 1347 | |
| 1348 | 1348 | if ($use_reversible_string_mappings) { |
| 1349 | - return (string) \str_replace( |
|
| 1350 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1351 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1349 | + return (string)\str_replace( |
|
| 1350 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1351 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1352 | 1352 | $str |
| 1353 | 1353 | ); |
| 1354 | 1354 | } |
| 1355 | 1355 | |
| 1356 | - return (string) \str_replace( |
|
| 1357 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1358 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 1356 | + return (string)\str_replace( |
|
| 1357 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1358 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 1359 | 1359 | $str |
| 1360 | 1360 | ); |
| 1361 | 1361 | } |
@@ -1421,7 +1421,7 @@ discard block |
||
| 1421 | 1421 | if ($to_encoding === 'JSON') { |
| 1422 | 1422 | $return = self::json_encode($str); |
| 1423 | 1423 | if ($return === false) { |
| 1424 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
| 1424 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
| 1425 | 1425 | } |
| 1426 | 1426 | |
| 1427 | 1427 | return $return; |
@@ -1512,7 +1512,7 @@ discard block |
||
| 1512 | 1512 | /** |
| 1513 | 1513 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 1514 | 1514 | */ |
| 1515 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
| 1515 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
| 1516 | 1516 | } |
| 1517 | 1517 | |
| 1518 | 1518 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1613,31 +1613,31 @@ discard block |
||
| 1613 | 1613 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
| 1614 | 1614 | |
| 1615 | 1615 | if ($length === null) { |
| 1616 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2); |
|
| 1616 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2); |
|
| 1617 | 1617 | } |
| 1618 | 1618 | |
| 1619 | 1619 | if ($search === '') { |
| 1620 | 1620 | if ($encoding === 'UTF-8') { |
| 1621 | 1621 | if ($length > 0) { |
| 1622 | - $string_length = (int) \mb_strlen($str); |
|
| 1622 | + $string_length = (int)\mb_strlen($str); |
|
| 1623 | 1623 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
| 1624 | 1624 | } else { |
| 1625 | 1625 | $end = 0; |
| 1626 | 1626 | } |
| 1627 | 1627 | |
| 1628 | - $pos = (int) \min( |
|
| 1628 | + $pos = (int)\min( |
|
| 1629 | 1629 | \mb_strpos($str, ' ', $end), |
| 1630 | 1630 | \mb_strpos($str, '.', $end) |
| 1631 | 1631 | ); |
| 1632 | 1632 | } else { |
| 1633 | 1633 | if ($length > 0) { |
| 1634 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 1634 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 1635 | 1635 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
| 1636 | 1636 | } else { |
| 1637 | 1637 | $end = 0; |
| 1638 | 1638 | } |
| 1639 | 1639 | |
| 1640 | - $pos = (int) \min( |
|
| 1640 | + $pos = (int)\min( |
|
| 1641 | 1641 | self::strpos($str, ' ', $end, $encoding), |
| 1642 | 1642 | self::strpos($str, '.', $end, $encoding) |
| 1643 | 1643 | ); |
@@ -1654,18 +1654,18 @@ discard block |
||
| 1654 | 1654 | return ''; |
| 1655 | 1655 | } |
| 1656 | 1656 | |
| 1657 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1657 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1658 | 1658 | } |
| 1659 | 1659 | |
| 1660 | 1660 | return $str; |
| 1661 | 1661 | } |
| 1662 | 1662 | |
| 1663 | 1663 | if ($encoding === 'UTF-8') { |
| 1664 | - $word_position = (int) \mb_stripos($str, $search); |
|
| 1665 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
| 1664 | + $word_position = (int)\mb_stripos($str, $search); |
|
| 1665 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
| 1666 | 1666 | } else { |
| 1667 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
| 1668 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
| 1667 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
| 1668 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
| 1669 | 1669 | } |
| 1670 | 1670 | |
| 1671 | 1671 | $pos_start = 0; |
@@ -1677,12 +1677,12 @@ discard block |
||
| 1677 | 1677 | } |
| 1678 | 1678 | if ($half_text !== false) { |
| 1679 | 1679 | if ($encoding === 'UTF-8') { |
| 1680 | - $pos_start = (int) \max( |
|
| 1680 | + $pos_start = (int)\max( |
|
| 1681 | 1681 | \mb_strrpos($half_text, ' '), |
| 1682 | 1682 | \mb_strrpos($half_text, '.') |
| 1683 | 1683 | ); |
| 1684 | 1684 | } else { |
| 1685 | - $pos_start = (int) \max( |
|
| 1685 | + $pos_start = (int)\max( |
|
| 1686 | 1686 | self::strrpos($half_text, ' ', 0, $encoding), |
| 1687 | 1687 | self::strrpos($half_text, '.', 0, $encoding) |
| 1688 | 1688 | ); |
@@ -1692,19 +1692,19 @@ discard block |
||
| 1692 | 1692 | |
| 1693 | 1693 | if ($word_position && $half_side > 0) { |
| 1694 | 1694 | $offset = $pos_start + $length - 1; |
| 1695 | - $real_length = (int) self::strlen($str, $encoding); |
|
| 1695 | + $real_length = (int)self::strlen($str, $encoding); |
|
| 1696 | 1696 | |
| 1697 | 1697 | if ($offset > $real_length) { |
| 1698 | 1698 | $offset = $real_length; |
| 1699 | 1699 | } |
| 1700 | 1700 | |
| 1701 | 1701 | if ($encoding === 'UTF-8') { |
| 1702 | - $pos_end = (int) \min( |
|
| 1702 | + $pos_end = (int)\min( |
|
| 1703 | 1703 | \mb_strpos($str, ' ', $offset), |
| 1704 | 1704 | \mb_strpos($str, '.', $offset) |
| 1705 | 1705 | ) - $pos_start; |
| 1706 | 1706 | } else { |
| 1707 | - $pos_end = (int) \min( |
|
| 1707 | + $pos_end = (int)\min( |
|
| 1708 | 1708 | self::strpos($str, ' ', $offset, $encoding), |
| 1709 | 1709 | self::strpos($str, '.', $offset, $encoding) |
| 1710 | 1710 | ) - $pos_start; |
@@ -1712,12 +1712,12 @@ discard block |
||
| 1712 | 1712 | |
| 1713 | 1713 | if (!$pos_end || $pos_end <= 0) { |
| 1714 | 1714 | if ($encoding === 'UTF-8') { |
| 1715 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
| 1715 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
| 1716 | 1716 | } else { |
| 1717 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
| 1717 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
| 1718 | 1718 | } |
| 1719 | 1719 | if ($str_sub !== false) { |
| 1720 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
| 1720 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
| 1721 | 1721 | } else { |
| 1722 | 1722 | $extract = ''; |
| 1723 | 1723 | } |
@@ -1728,26 +1728,26 @@ discard block |
||
| 1728 | 1728 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
| 1729 | 1729 | } |
| 1730 | 1730 | if ($str_sub !== false) { |
| 1731 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1731 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1732 | 1732 | } else { |
| 1733 | 1733 | $extract = ''; |
| 1734 | 1734 | } |
| 1735 | 1735 | } |
| 1736 | 1736 | } else { |
| 1737 | 1737 | $offset = $length - 1; |
| 1738 | - $true_length = (int) self::strlen($str, $encoding); |
|
| 1738 | + $true_length = (int)self::strlen($str, $encoding); |
|
| 1739 | 1739 | |
| 1740 | 1740 | if ($offset > $true_length) { |
| 1741 | 1741 | $offset = $true_length; |
| 1742 | 1742 | } |
| 1743 | 1743 | |
| 1744 | 1744 | if ($encoding === 'UTF-8') { |
| 1745 | - $pos_end = (int) \min( |
|
| 1745 | + $pos_end = (int)\min( |
|
| 1746 | 1746 | \mb_strpos($str, ' ', $offset), |
| 1747 | 1747 | \mb_strpos($str, '.', $offset) |
| 1748 | 1748 | ); |
| 1749 | 1749 | } else { |
| 1750 | - $pos_end = (int) \min( |
|
| 1750 | + $pos_end = (int)\min( |
|
| 1751 | 1751 | self::strpos($str, ' ', $offset, $encoding), |
| 1752 | 1752 | self::strpos($str, '.', $offset, $encoding) |
| 1753 | 1753 | ); |
@@ -1760,7 +1760,7 @@ discard block |
||
| 1760 | 1760 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
| 1761 | 1761 | } |
| 1762 | 1762 | if ($str_sub !== false) { |
| 1763 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1763 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1764 | 1764 | } else { |
| 1765 | 1765 | $extract = ''; |
| 1766 | 1766 | } |
@@ -1893,7 +1893,7 @@ discard block |
||
| 1893 | 1893 | { |
| 1894 | 1894 | $file_content = \file_get_contents($file_path); |
| 1895 | 1895 | if ($file_content === false) { |
| 1896 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
| 1896 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
| 1897 | 1897 | } |
| 1898 | 1898 | |
| 1899 | 1899 | return self::string_has_bom($file_content); |
@@ -1961,7 +1961,7 @@ discard block |
||
| 1961 | 1961 | ) { |
| 1962 | 1962 | // Prevent leading combining chars |
| 1963 | 1963 | // for NFC-safe concatenations. |
| 1964 | - $var = $leading_combining . $var; |
|
| 1964 | + $var = $leading_combining.$var; |
|
| 1965 | 1965 | } |
| 1966 | 1966 | } |
| 1967 | 1967 | |
@@ -2282,10 +2282,10 @@ discard block |
||
| 2282 | 2282 | } |
| 2283 | 2283 | |
| 2284 | 2284 | if ($encoding === 'UTF-8') { |
| 2285 | - return (string) \mb_substr($str, 0, $n); |
|
| 2285 | + return (string)\mb_substr($str, 0, $n); |
|
| 2286 | 2286 | } |
| 2287 | 2287 | |
| 2288 | - return (string) self::substr($str, 0, $n, $encoding); |
|
| 2288 | + return (string)self::substr($str, 0, $n, $encoding); |
|
| 2289 | 2289 | } |
| 2290 | 2290 | |
| 2291 | 2291 | /** |
@@ -2303,7 +2303,7 @@ discard block |
||
| 2303 | 2303 | */ |
| 2304 | 2304 | public static function fits_inside(string $str, int $box_size): bool |
| 2305 | 2305 | { |
| 2306 | - return (int) self::strlen($str) <= $box_size; |
|
| 2306 | + return (int)self::strlen($str) <= $box_size; |
|
| 2307 | 2307 | } |
| 2308 | 2308 | |
| 2309 | 2309 | /** |
@@ -2388,7 +2388,7 @@ discard block |
||
| 2388 | 2388 | return $str; |
| 2389 | 2389 | } |
| 2390 | 2390 | |
| 2391 | - $str = (string) $str; |
|
| 2391 | + $str = (string)$str; |
|
| 2392 | 2392 | $last = ''; |
| 2393 | 2393 | while ($last !== $str) { |
| 2394 | 2394 | $last = $str; |
@@ -2597,7 +2597,7 @@ discard block |
||
| 2597 | 2597 | return $fallback; |
| 2598 | 2598 | } |
| 2599 | 2599 | /** @noinspection OffsetOperationsInspection */ |
| 2600 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
| 2600 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
| 2601 | 2601 | |
| 2602 | 2602 | // DEBUG |
| 2603 | 2603 | //var_dump($type_code); |
@@ -2655,7 +2655,7 @@ discard block |
||
| 2655 | 2655 | // |
| 2656 | 2656 | |
| 2657 | 2657 | if ($encoding === 'UTF-8') { |
| 2658 | - $max_length = (int) \mb_strlen($possible_chars); |
|
| 2658 | + $max_length = (int)\mb_strlen($possible_chars); |
|
| 2659 | 2659 | if ($max_length === 0) { |
| 2660 | 2660 | return ''; |
| 2661 | 2661 | } |
@@ -2676,7 +2676,7 @@ discard block |
||
| 2676 | 2676 | } else { |
| 2677 | 2677 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 2678 | 2678 | |
| 2679 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
| 2679 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
| 2680 | 2680 | if ($max_length === 0) { |
| 2681 | 2681 | return ''; |
| 2682 | 2682 | } |
@@ -2714,16 +2714,16 @@ discard block |
||
| 2714 | 2714 | $rand_int = \mt_rand(0, \mt_getrandmax()); |
| 2715 | 2715 | } |
| 2716 | 2716 | |
| 2717 | - $unique_helper = $rand_int . |
|
| 2718 | - \session_id() . |
|
| 2719 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
| 2720 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
| 2717 | + $unique_helper = $rand_int. |
|
| 2718 | + \session_id(). |
|
| 2719 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
| 2720 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
| 2721 | 2721 | $extra_entropy; |
| 2722 | 2722 | |
| 2723 | 2723 | $unique_string = \uniqid($unique_helper, true); |
| 2724 | 2724 | |
| 2725 | 2725 | if ($use_md5) { |
| 2726 | - $unique_string = \md5($unique_string . $unique_helper); |
|
| 2726 | + $unique_string = \md5($unique_string.$unique_helper); |
|
| 2727 | 2727 | } |
| 2728 | 2728 | |
| 2729 | 2729 | return $unique_string; |
@@ -2822,7 +2822,7 @@ discard block |
||
| 2822 | 2822 | public static function hex_to_chr(string $hexdec) |
| 2823 | 2823 | { |
| 2824 | 2824 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Invalid characters passed for attempted conversion, these have been ignored */ |
| 2825 | - return self::decimal_to_chr((int) @\hexdec($hexdec)); |
|
| 2825 | + return self::decimal_to_chr((int)@\hexdec($hexdec)); |
|
| 2826 | 2826 | } |
| 2827 | 2827 | |
| 2828 | 2828 | /** |
@@ -2842,7 +2842,7 @@ discard block |
||
| 2842 | 2842 | public static function hex_to_int($hexdec) |
| 2843 | 2843 | { |
| 2844 | 2844 | // init |
| 2845 | - $hexdec = (string) $hexdec; |
|
| 2845 | + $hexdec = (string)$hexdec; |
|
| 2846 | 2846 | |
| 2847 | 2847 | if ($hexdec === '') { |
| 2848 | 2848 | return false; |
@@ -2942,7 +2942,7 @@ discard block |
||
| 2942 | 2942 | return \implode( |
| 2943 | 2943 | '', |
| 2944 | 2944 | \array_map( |
| 2945 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
| 2945 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
| 2946 | 2946 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
| 2947 | 2947 | }, |
| 2948 | 2948 | self::str_split($str) |
@@ -3057,7 +3057,7 @@ discard block |
||
| 3057 | 3057 | /** |
| 3058 | 3058 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 3059 | 3059 | */ |
| 3060 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 3060 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 3061 | 3061 | } |
| 3062 | 3062 | |
| 3063 | 3063 | do { |
@@ -3066,7 +3066,7 @@ discard block |
||
| 3066 | 3066 | if (\strpos($str, '&') !== false) { |
| 3067 | 3067 | if (\strpos($str, '&#') !== false) { |
| 3068 | 3068 | // decode also numeric & UTF16 two byte entities |
| 3069 | - $str = (string) \preg_replace( |
|
| 3069 | + $str = (string)\preg_replace( |
|
| 3070 | 3070 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
| 3071 | 3071 | '$1;', |
| 3072 | 3072 | $str |
@@ -3116,7 +3116,7 @@ discard block |
||
| 3116 | 3116 | */ |
| 3117 | 3117 | public static function html_stripe_empty_tags(string $str): string |
| 3118 | 3118 | { |
| 3119 | - return (string) \preg_replace( |
|
| 3119 | + return (string)\preg_replace( |
|
| 3120 | 3120 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
| 3121 | 3121 | '', |
| 3122 | 3122 | $str |
@@ -3446,9 +3446,9 @@ discard block |
||
| 3446 | 3446 | { |
| 3447 | 3447 | $hex = \dechex($int); |
| 3448 | 3448 | |
| 3449 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
| 3449 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
| 3450 | 3450 | |
| 3451 | - return $prefix . $hex . ''; |
|
| 3451 | + return $prefix.$hex.''; |
|
| 3452 | 3452 | } |
| 3453 | 3453 | |
| 3454 | 3454 | /** |
@@ -3777,7 +3777,7 @@ discard block |
||
| 3777 | 3777 | */ |
| 3778 | 3778 | public static function is_binary($input, bool $strict = false): bool |
| 3779 | 3779 | { |
| 3780 | - $input = (string) $input; |
|
| 3780 | + $input = (string)$input; |
|
| 3781 | 3781 | if ($input === '') { |
| 3782 | 3782 | return false; |
| 3783 | 3783 | } |
@@ -4137,7 +4137,7 @@ discard block |
||
| 4137 | 4137 | public static function is_utf16($str, bool $check_if_string_is_binary = true) |
| 4138 | 4138 | { |
| 4139 | 4139 | // init |
| 4140 | - $str = (string) $str; |
|
| 4140 | + $str = (string)$str; |
|
| 4141 | 4141 | $str_chars = []; |
| 4142 | 4142 | |
| 4143 | 4143 | if ( |
@@ -4231,7 +4231,7 @@ discard block |
||
| 4231 | 4231 | public static function is_utf32($str, bool $check_if_string_is_binary = true) |
| 4232 | 4232 | { |
| 4233 | 4233 | // init |
| 4234 | - $str = (string) $str; |
|
| 4234 | + $str = (string)$str; |
|
| 4235 | 4235 | $str_chars = []; |
| 4236 | 4236 | |
| 4237 | 4237 | if ( |
@@ -4329,7 +4329,7 @@ discard block |
||
| 4329 | 4329 | return true; |
| 4330 | 4330 | } |
| 4331 | 4331 | |
| 4332 | - return self::is_utf8_string((string) $str, $strict); |
|
| 4332 | + return self::is_utf8_string((string)$str, $strict); |
|
| 4333 | 4333 | } |
| 4334 | 4334 | |
| 4335 | 4335 | /** |
@@ -4487,15 +4487,15 @@ discard block |
||
| 4487 | 4487 | $use_mb_functions = ($lang === null && !$try_to_keep_the_string_length); |
| 4488 | 4488 | |
| 4489 | 4489 | if ($encoding === 'UTF-8') { |
| 4490 | - $str_part_two = (string) \mb_substr($str, 1); |
|
| 4490 | + $str_part_two = (string)\mb_substr($str, 1); |
|
| 4491 | 4491 | |
| 4492 | 4492 | if ($use_mb_functions) { |
| 4493 | 4493 | $str_part_one = \mb_strtolower( |
| 4494 | - (string) \mb_substr($str, 0, 1) |
|
| 4494 | + (string)\mb_substr($str, 0, 1) |
|
| 4495 | 4495 | ); |
| 4496 | 4496 | } else { |
| 4497 | 4497 | $str_part_one = self::strtolower( |
| 4498 | - (string) \mb_substr($str, 0, 1), |
|
| 4498 | + (string)\mb_substr($str, 0, 1), |
|
| 4499 | 4499 | $encoding, |
| 4500 | 4500 | false, |
| 4501 | 4501 | $lang, |
@@ -4505,10 +4505,10 @@ discard block |
||
| 4505 | 4505 | } else { |
| 4506 | 4506 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4507 | 4507 | |
| 4508 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
| 4508 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
| 4509 | 4509 | |
| 4510 | 4510 | $str_part_one = self::strtolower( |
| 4511 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 4511 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 4512 | 4512 | $encoding, |
| 4513 | 4513 | false, |
| 4514 | 4514 | $lang, |
@@ -4516,7 +4516,7 @@ discard block |
||
| 4516 | 4516 | ); |
| 4517 | 4517 | } |
| 4518 | 4518 | |
| 4519 | - return $str_part_one . $str_part_two; |
|
| 4519 | + return $str_part_one.$str_part_two; |
|
| 4520 | 4520 | } |
| 4521 | 4521 | |
| 4522 | 4522 | /** |
@@ -4665,7 +4665,7 @@ discard block |
||
| 4665 | 4665 | } |
| 4666 | 4666 | |
| 4667 | 4667 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4668 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 4668 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 4669 | 4669 | } |
| 4670 | 4670 | |
| 4671 | 4671 | if ($chars !== null) { |
@@ -4702,7 +4702,7 @@ discard block |
||
| 4702 | 4702 | |
| 4703 | 4703 | $codepoint_max = \max($codepoints); |
| 4704 | 4704 | |
| 4705 | - return self::chr((int) $codepoint_max); |
|
| 4705 | + return self::chr((int)$codepoint_max); |
|
| 4706 | 4706 | } |
| 4707 | 4707 | |
| 4708 | 4708 | /** |
@@ -4722,7 +4722,7 @@ discard block |
||
| 4722 | 4722 | { |
| 4723 | 4723 | $bytes = self::chr_size_list($str); |
| 4724 | 4724 | if ($bytes !== []) { |
| 4725 | - return (int) \max($bytes); |
|
| 4725 | + return (int)\max($bytes); |
|
| 4726 | 4726 | } |
| 4727 | 4727 | |
| 4728 | 4728 | return 0; |
@@ -4768,7 +4768,7 @@ discard block |
||
| 4768 | 4768 | |
| 4769 | 4769 | $codepoint_min = \min($codepoints); |
| 4770 | 4770 | |
| 4771 | - return self::chr((int) $codepoint_min); |
|
| 4771 | + return self::chr((int)$codepoint_min); |
|
| 4772 | 4772 | } |
| 4773 | 4773 | |
| 4774 | 4774 | /** |
@@ -4816,7 +4816,7 @@ discard block |
||
| 4816 | 4816 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
| 4817 | 4817 | |
| 4818 | 4818 | // init |
| 4819 | - $encoding = (string) $encoding; |
|
| 4819 | + $encoding = (string)$encoding; |
|
| 4820 | 4820 | |
| 4821 | 4821 | if (!$encoding) { |
| 4822 | 4822 | return $fallback; |
@@ -4878,7 +4878,7 @@ discard block |
||
| 4878 | 4878 | |
| 4879 | 4879 | $encoding_original = $encoding; |
| 4880 | 4880 | $encoding = \strtoupper($encoding); |
| 4881 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
| 4881 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
| 4882 | 4882 | |
| 4883 | 4883 | $equivalences = [ |
| 4884 | 4884 | 'ISO8859' => 'ISO-8859-1', |
@@ -5045,13 +5045,13 @@ discard block |
||
| 5045 | 5045 | static $CHAR_CACHE = []; |
| 5046 | 5046 | |
| 5047 | 5047 | // init |
| 5048 | - $chr = (string) $chr; |
|
| 5048 | + $chr = (string)$chr; |
|
| 5049 | 5049 | |
| 5050 | 5050 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
| 5051 | 5051 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5052 | 5052 | } |
| 5053 | 5053 | |
| 5054 | - $cache_key = $chr . '_' . $encoding; |
|
| 5054 | + $cache_key = $chr.'_'.$encoding; |
|
| 5055 | 5055 | if (isset($CHAR_CACHE[$cache_key])) { |
| 5056 | 5056 | return $CHAR_CACHE[$cache_key]; |
| 5057 | 5057 | } |
@@ -5086,7 +5086,7 @@ discard block |
||
| 5086 | 5086 | // |
| 5087 | 5087 | |
| 5088 | 5088 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 5089 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
| 5089 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
| 5090 | 5090 | /** @noinspection PhpSillyAssignmentInspection - hack for phpstan */ |
| 5091 | 5091 | /** @var int[] $chr - "unpack": only false if the format string contains errors */ |
| 5092 | 5092 | $chr = $chr; |
@@ -5163,7 +5163,7 @@ discard block |
||
| 5163 | 5163 | public static function pcre_utf8_support(): bool |
| 5164 | 5164 | { |
| 5165 | 5165 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 5166 | - return (bool) @\preg_match('//u', ''); |
|
| 5166 | + return (bool)@\preg_match('//u', ''); |
|
| 5167 | 5167 | } |
| 5168 | 5168 | |
| 5169 | 5169 | /** |
@@ -5204,14 +5204,14 @@ discard block |
||
| 5204 | 5204 | * @psalm-suppress DocblockTypeContradiction |
| 5205 | 5205 | */ |
| 5206 | 5206 | if (!\is_numeric($step)) { |
| 5207 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
| 5207 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
| 5208 | 5208 | } |
| 5209 | 5209 | |
| 5210 | 5210 | /** |
| 5211 | 5211 | * @psalm-suppress RedundantConditionGivenDocblockType - false-positive from psalm? |
| 5212 | 5212 | */ |
| 5213 | 5213 | if ($step <= 0) { |
| 5214 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
| 5214 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
| 5215 | 5215 | } |
| 5216 | 5216 | } |
| 5217 | 5217 | |
@@ -5223,16 +5223,16 @@ discard block |
||
| 5223 | 5223 | $is_xdigit = false; |
| 5224 | 5224 | |
| 5225 | 5225 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5226 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
| 5226 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
| 5227 | 5227 | $is_digit = true; |
| 5228 | - $start = (int) $var1; |
|
| 5228 | + $start = (int)$var1; |
|
| 5229 | 5229 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
| 5230 | 5230 | $is_xdigit = true; |
| 5231 | - $start = (int) self::hex_to_int((string) $var1); |
|
| 5231 | + $start = (int)self::hex_to_int((string)$var1); |
|
| 5232 | 5232 | } elseif (!$use_ctype && \is_numeric($var1)) { |
| 5233 | - $start = (int) $var1; |
|
| 5233 | + $start = (int)$var1; |
|
| 5234 | 5234 | } else { |
| 5235 | - $start = self::ord((string) $var1); |
|
| 5235 | + $start = self::ord((string)$var1); |
|
| 5236 | 5236 | } |
| 5237 | 5237 | |
| 5238 | 5238 | if (!$start) { |
@@ -5240,13 +5240,13 @@ discard block |
||
| 5240 | 5240 | } |
| 5241 | 5241 | |
| 5242 | 5242 | if ($is_digit) { |
| 5243 | - $end = (int) $var2; |
|
| 5243 | + $end = (int)$var2; |
|
| 5244 | 5244 | } elseif ($is_xdigit) { |
| 5245 | - $end = (int) self::hex_to_int((string) $var2); |
|
| 5245 | + $end = (int)self::hex_to_int((string)$var2); |
|
| 5246 | 5246 | } elseif (!$use_ctype && \is_numeric($var2)) { |
| 5247 | - $end = (int) $var2; |
|
| 5247 | + $end = (int)$var2; |
|
| 5248 | 5248 | } else { |
| 5249 | - $end = self::ord((string) $var2); |
|
| 5249 | + $end = self::ord((string)$var2); |
|
| 5250 | 5250 | } |
| 5251 | 5251 | |
| 5252 | 5252 | if (!$end) { |
@@ -5255,7 +5255,7 @@ discard block |
||
| 5255 | 5255 | |
| 5256 | 5256 | $array = []; |
| 5257 | 5257 | foreach (\range($start, $end, $step) as $i) { |
| 5258 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
| 5258 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
| 5259 | 5259 | } |
| 5260 | 5260 | |
| 5261 | 5261 | return $array; |
@@ -5351,8 +5351,8 @@ discard block |
||
| 5351 | 5351 | $delimiter = '/'; |
| 5352 | 5352 | } |
| 5353 | 5353 | |
| 5354 | - return (string) \preg_replace( |
|
| 5355 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
| 5354 | + return (string)\preg_replace( |
|
| 5355 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
| 5356 | 5356 | $replacement, |
| 5357 | 5357 | $str |
| 5358 | 5358 | ); |
@@ -5404,7 +5404,7 @@ discard block |
||
| 5404 | 5404 | |
| 5405 | 5405 | $str_length -= $bom_byte_length; |
| 5406 | 5406 | |
| 5407 | - $str = (string) $str_tmp; |
|
| 5407 | + $str = (string)$str_tmp; |
|
| 5408 | 5408 | } |
| 5409 | 5409 | } |
| 5410 | 5410 | |
@@ -5435,7 +5435,7 @@ discard block |
||
| 5435 | 5435 | */ |
| 5436 | 5436 | if (\is_array($what)) { |
| 5437 | 5437 | foreach ($what as $item) { |
| 5438 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
| 5438 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
| 5439 | 5439 | } |
| 5440 | 5440 | } |
| 5441 | 5441 | |
@@ -5473,7 +5473,7 @@ discard block |
||
| 5473 | 5473 | */ |
| 5474 | 5474 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
| 5475 | 5475 | { |
| 5476 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 5476 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 5477 | 5477 | } |
| 5478 | 5478 | |
| 5479 | 5479 | /** |
@@ -5537,17 +5537,17 @@ discard block |
||
| 5537 | 5537 | \strpos($str, $substring) === 0 |
| 5538 | 5538 | ) { |
| 5539 | 5539 | if ($encoding === 'UTF-8') { |
| 5540 | - return (string) \mb_substr( |
|
| 5540 | + return (string)\mb_substr( |
|
| 5541 | 5541 | $str, |
| 5542 | - (int) \mb_strlen($substring) |
|
| 5542 | + (int)\mb_strlen($substring) |
|
| 5543 | 5543 | ); |
| 5544 | 5544 | } |
| 5545 | 5545 | |
| 5546 | 5546 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5547 | 5547 | |
| 5548 | - return (string) self::substr( |
|
| 5548 | + return (string)self::substr( |
|
| 5549 | 5549 | $str, |
| 5550 | - (int) self::strlen($substring, $encoding), |
|
| 5550 | + (int)self::strlen($substring, $encoding), |
|
| 5551 | 5551 | null, |
| 5552 | 5552 | $encoding |
| 5553 | 5553 | ); |
@@ -5575,19 +5575,19 @@ discard block |
||
| 5575 | 5575 | ): string { |
| 5576 | 5576 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
| 5577 | 5577 | if ($encoding === 'UTF-8') { |
| 5578 | - return (string) \mb_substr( |
|
| 5578 | + return (string)\mb_substr( |
|
| 5579 | 5579 | $str, |
| 5580 | 5580 | 0, |
| 5581 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
| 5581 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
| 5582 | 5582 | ); |
| 5583 | 5583 | } |
| 5584 | 5584 | |
| 5585 | 5585 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5586 | 5586 | |
| 5587 | - return (string) self::substr( |
|
| 5587 | + return (string)self::substr( |
|
| 5588 | 5588 | $str, |
| 5589 | 5589 | 0, |
| 5590 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
| 5590 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
| 5591 | 5591 | $encoding |
| 5592 | 5592 | ); |
| 5593 | 5593 | } |
@@ -5690,7 +5690,7 @@ discard block |
||
| 5690 | 5690 | /** @noinspection PhpUsageOfSilenceOperatorInspection - ignore "Unknown character" warnings, it's working anyway */ |
| 5691 | 5691 | @\mb_substitute_character($replacement_char_helper); |
| 5692 | 5692 | // the polyfill maybe return false, so cast to string |
| 5693 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 5693 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 5694 | 5694 | \mb_substitute_character($save); |
| 5695 | 5695 | } |
| 5696 | 5696 | |
@@ -5736,7 +5736,7 @@ discard block |
||
| 5736 | 5736 | } |
| 5737 | 5737 | |
| 5738 | 5738 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5739 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 5739 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 5740 | 5740 | } |
| 5741 | 5741 | |
| 5742 | 5742 | if ($chars !== null) { |
@@ -5766,7 +5766,7 @@ discard block |
||
| 5766 | 5766 | $html .= '<pre>'; |
| 5767 | 5767 | /** @noinspection AlterInForeachInspection */ |
| 5768 | 5768 | foreach (self::$SUPPORT as $key => &$value) { |
| 5769 | - $html .= $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
| 5769 | + $html .= $key.' - '.\print_r($value, true)."\n<br>"; |
|
| 5770 | 5770 | } |
| 5771 | 5771 | $html .= '</pre>'; |
| 5772 | 5772 | |
@@ -5808,7 +5808,7 @@ discard block |
||
| 5808 | 5808 | return $char; |
| 5809 | 5809 | } |
| 5810 | 5810 | |
| 5811 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
| 5811 | + return '&#'.self::ord($char, $encoding).';'; |
|
| 5812 | 5812 | } |
| 5813 | 5813 | |
| 5814 | 5814 | /** |
@@ -5912,11 +5912,11 @@ discard block |
||
| 5912 | 5912 | $lang, |
| 5913 | 5913 | $try_to_keep_the_string_length |
| 5914 | 5914 | ); |
| 5915 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
| 5915 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
| 5916 | 5916 | |
| 5917 | 5917 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 5918 | 5918 | |
| 5919 | - $str = (string) \preg_replace_callback( |
|
| 5919 | + $str = (string)\preg_replace_callback( |
|
| 5920 | 5920 | '/[-_\\s]+(.)?/u', |
| 5921 | 5921 | /** |
| 5922 | 5922 | * @param array $match |
@@ -5925,7 +5925,7 @@ discard block |
||
| 5925 | 5925 | * |
| 5926 | 5926 | * @return string |
| 5927 | 5927 | */ |
| 5928 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
| 5928 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
| 5929 | 5929 | if (isset($match[1])) { |
| 5930 | 5930 | if ($use_mb_functions) { |
| 5931 | 5931 | if ($encoding === 'UTF-8') { |
@@ -5943,7 +5943,7 @@ discard block |
||
| 5943 | 5943 | $str |
| 5944 | 5944 | ); |
| 5945 | 5945 | |
| 5946 | - return (string) \preg_replace_callback( |
|
| 5946 | + return (string)\preg_replace_callback( |
|
| 5947 | 5947 | '/[\\p{N}]+(.)?/u', |
| 5948 | 5948 | /** |
| 5949 | 5949 | * @param array $match |
@@ -5952,7 +5952,7 @@ discard block |
||
| 5952 | 5952 | * |
| 5953 | 5953 | * @return string |
| 5954 | 5954 | */ |
| 5955 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
| 5955 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
| 5956 | 5956 | if ($use_mb_functions) { |
| 5957 | 5957 | if ($encoding === 'UTF-8') { |
| 5958 | 5958 | return \mb_strtoupper($match[0]); |
@@ -6151,7 +6151,7 @@ discard block |
||
| 6151 | 6151 | ): string { |
| 6152 | 6152 | if (self::$SUPPORT['mbstring'] === true) { |
| 6153 | 6153 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 6154 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
| 6154 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
| 6155 | 6155 | |
| 6156 | 6156 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 6157 | 6157 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -6161,10 +6161,10 @@ discard block |
||
| 6161 | 6161 | } |
| 6162 | 6162 | |
| 6163 | 6163 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 6164 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
| 6164 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
| 6165 | 6165 | } |
| 6166 | 6166 | |
| 6167 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
| 6167 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
| 6168 | 6168 | |
| 6169 | 6169 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 6170 | 6170 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -6173,7 +6173,7 @@ discard block |
||
| 6173 | 6173 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
| 6174 | 6174 | } |
| 6175 | 6175 | |
| 6176 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
| 6176 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
| 6177 | 6177 | } |
| 6178 | 6178 | |
| 6179 | 6179 | /** |
@@ -6197,7 +6197,7 @@ discard block |
||
| 6197 | 6197 | public static function str_detect_encoding($str) |
| 6198 | 6198 | { |
| 6199 | 6199 | // init |
| 6200 | - $str = (string) $str; |
|
| 6200 | + $str = (string)$str; |
|
| 6201 | 6201 | |
| 6202 | 6202 | // |
| 6203 | 6203 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -6299,7 +6299,7 @@ discard block |
||
| 6299 | 6299 | foreach (self::$ENCODINGS as $encoding_tmp) { |
| 6300 | 6300 | // INFO: //IGNORE but still throw notice |
| 6301 | 6301 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 6302 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
| 6302 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
| 6303 | 6303 | return $encoding_tmp; |
| 6304 | 6304 | } |
| 6305 | 6305 | } |
@@ -6407,7 +6407,7 @@ discard block |
||
| 6407 | 6407 | return $str; |
| 6408 | 6408 | } |
| 6409 | 6409 | |
| 6410 | - return $substring . $str; |
|
| 6410 | + return $substring.$str; |
|
| 6411 | 6411 | } |
| 6412 | 6412 | |
| 6413 | 6413 | /** |
@@ -6703,27 +6703,27 @@ discard block |
||
| 6703 | 6703 | string $encoding = 'UTF-8' |
| 6704 | 6704 | ): string { |
| 6705 | 6705 | if ($encoding === 'UTF-8') { |
| 6706 | - $len = (int) \mb_strlen($str); |
|
| 6706 | + $len = (int)\mb_strlen($str); |
|
| 6707 | 6707 | if ($index > $len) { |
| 6708 | 6708 | return $str; |
| 6709 | 6709 | } |
| 6710 | 6710 | |
| 6711 | 6711 | /** @noinspection UnnecessaryCastingInspection */ |
| 6712 | - return (string) \mb_substr($str, 0, $index) . |
|
| 6713 | - $substring . |
|
| 6714 | - (string) \mb_substr($str, $index, $len); |
|
| 6712 | + return (string)\mb_substr($str, 0, $index). |
|
| 6713 | + $substring. |
|
| 6714 | + (string)\mb_substr($str, $index, $len); |
|
| 6715 | 6715 | } |
| 6716 | 6716 | |
| 6717 | 6717 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6718 | 6718 | |
| 6719 | - $len = (int) self::strlen($str, $encoding); |
|
| 6719 | + $len = (int)self::strlen($str, $encoding); |
|
| 6720 | 6720 | if ($index > $len) { |
| 6721 | 6721 | return $str; |
| 6722 | 6722 | } |
| 6723 | 6723 | |
| 6724 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
| 6725 | - $substring . |
|
| 6726 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
| 6724 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
| 6725 | + $substring. |
|
| 6726 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
| 6727 | 6727 | } |
| 6728 | 6728 | |
| 6729 | 6729 | /** |
@@ -6763,15 +6763,15 @@ discard block |
||
| 6763 | 6763 | */ |
| 6764 | 6764 | public static function str_ireplace($search, $replacement, $subject, &$count = null) |
| 6765 | 6765 | { |
| 6766 | - $search = (array) $search; |
|
| 6766 | + $search = (array)$search; |
|
| 6767 | 6767 | |
| 6768 | 6768 | /** @noinspection AlterInForeachInspection */ |
| 6769 | 6769 | foreach ($search as &$s) { |
| 6770 | - $s = (string) $s; |
|
| 6770 | + $s = (string)$s; |
|
| 6771 | 6771 | if ($s === '') { |
| 6772 | 6772 | $s = '/^(?<=.)$/'; |
| 6773 | 6773 | } else { |
| 6774 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
| 6774 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
| 6775 | 6775 | } |
| 6776 | 6776 | } |
| 6777 | 6777 | |
@@ -6819,12 +6819,12 @@ discard block |
||
| 6819 | 6819 | } |
| 6820 | 6820 | |
| 6821 | 6821 | if ($search === '') { |
| 6822 | - return $str . $replacement; |
|
| 6822 | + return $str.$replacement; |
|
| 6823 | 6823 | } |
| 6824 | 6824 | |
| 6825 | 6825 | $searchLength = \strlen($search); |
| 6826 | 6826 | if (\strncasecmp($str, $search, $searchLength) === 0) { |
| 6827 | - return $replacement . \substr($str, $searchLength); |
|
| 6827 | + return $replacement.\substr($str, $searchLength); |
|
| 6828 | 6828 | } |
| 6829 | 6829 | |
| 6830 | 6830 | return $str; |
@@ -6855,11 +6855,11 @@ discard block |
||
| 6855 | 6855 | } |
| 6856 | 6856 | |
| 6857 | 6857 | if ($search === '') { |
| 6858 | - return $str . $replacement; |
|
| 6858 | + return $str.$replacement; |
|
| 6859 | 6859 | } |
| 6860 | 6860 | |
| 6861 | 6861 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 6862 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 6862 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 6863 | 6863 | } |
| 6864 | 6864 | |
| 6865 | 6865 | return $str; |
@@ -6951,15 +6951,15 @@ discard block |
||
| 6951 | 6951 | } |
| 6952 | 6952 | |
| 6953 | 6953 | if ($encoding === 'UTF-8') { |
| 6954 | - return (string) \mb_substr( |
|
| 6954 | + return (string)\mb_substr( |
|
| 6955 | 6955 | $str, |
| 6956 | - $offset + (int) \mb_strlen($separator) |
|
| 6956 | + $offset + (int)\mb_strlen($separator) |
|
| 6957 | 6957 | ); |
| 6958 | 6958 | } |
| 6959 | 6959 | |
| 6960 | - return (string) self::substr( |
|
| 6960 | + return (string)self::substr( |
|
| 6961 | 6961 | $str, |
| 6962 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6962 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6963 | 6963 | null, |
| 6964 | 6964 | $encoding |
| 6965 | 6965 | ); |
@@ -6991,15 +6991,15 @@ discard block |
||
| 6991 | 6991 | } |
| 6992 | 6992 | |
| 6993 | 6993 | if ($encoding === 'UTF-8') { |
| 6994 | - return (string) \mb_substr( |
|
| 6994 | + return (string)\mb_substr( |
|
| 6995 | 6995 | $str, |
| 6996 | - $offset + (int) self::strlen($separator) |
|
| 6996 | + $offset + (int)self::strlen($separator) |
|
| 6997 | 6997 | ); |
| 6998 | 6998 | } |
| 6999 | 6999 | |
| 7000 | - return (string) self::substr( |
|
| 7000 | + return (string)self::substr( |
|
| 7001 | 7001 | $str, |
| 7002 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 7002 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 7003 | 7003 | null, |
| 7004 | 7004 | $encoding |
| 7005 | 7005 | ); |
@@ -7031,10 +7031,10 @@ discard block |
||
| 7031 | 7031 | } |
| 7032 | 7032 | |
| 7033 | 7033 | if ($encoding === 'UTF-8') { |
| 7034 | - return (string) \mb_substr($str, 0, $offset); |
|
| 7034 | + return (string)\mb_substr($str, 0, $offset); |
|
| 7035 | 7035 | } |
| 7036 | 7036 | |
| 7037 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 7037 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 7038 | 7038 | } |
| 7039 | 7039 | |
| 7040 | 7040 | /** |
@@ -7063,7 +7063,7 @@ discard block |
||
| 7063 | 7063 | return ''; |
| 7064 | 7064 | } |
| 7065 | 7065 | |
| 7066 | - return (string) \mb_substr($str, 0, $offset); |
|
| 7066 | + return (string)\mb_substr($str, 0, $offset); |
|
| 7067 | 7067 | } |
| 7068 | 7068 | |
| 7069 | 7069 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -7071,7 +7071,7 @@ discard block |
||
| 7071 | 7071 | return ''; |
| 7072 | 7072 | } |
| 7073 | 7073 | |
| 7074 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 7074 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 7075 | 7075 | } |
| 7076 | 7076 | |
| 7077 | 7077 | /** |
@@ -7173,12 +7173,12 @@ discard block |
||
| 7173 | 7173 | } |
| 7174 | 7174 | |
| 7175 | 7175 | if ($encoding === 'UTF-8') { |
| 7176 | - return (string) \mb_substr($str, -$n); |
|
| 7176 | + return (string)\mb_substr($str, -$n); |
|
| 7177 | 7177 | } |
| 7178 | 7178 | |
| 7179 | 7179 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7180 | 7180 | |
| 7181 | - return (string) self::substr($str, -$n, null, $encoding); |
|
| 7181 | + return (string)self::substr($str, -$n, null, $encoding); |
|
| 7182 | 7182 | } |
| 7183 | 7183 | |
| 7184 | 7184 | /** |
@@ -7204,21 +7204,21 @@ discard block |
||
| 7204 | 7204 | } |
| 7205 | 7205 | |
| 7206 | 7206 | if ($encoding === 'UTF-8') { |
| 7207 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 7207 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 7208 | 7208 | return $str; |
| 7209 | 7209 | } |
| 7210 | 7210 | |
| 7211 | 7211 | /** @noinspection UnnecessaryCastingInspection */ |
| 7212 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
| 7212 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
| 7213 | 7213 | } |
| 7214 | 7214 | |
| 7215 | 7215 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7216 | 7216 | |
| 7217 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 7217 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 7218 | 7218 | return $str; |
| 7219 | 7219 | } |
| 7220 | 7220 | |
| 7221 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
| 7221 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
| 7222 | 7222 | } |
| 7223 | 7223 | |
| 7224 | 7224 | /** |
@@ -7247,12 +7247,12 @@ discard block |
||
| 7247 | 7247 | |
| 7248 | 7248 | if ($encoding === 'UTF-8') { |
| 7249 | 7249 | /** @noinspection UnnecessaryCastingInspection */ |
| 7250 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 7250 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 7251 | 7251 | return $str; |
| 7252 | 7252 | } |
| 7253 | 7253 | |
| 7254 | 7254 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
| 7255 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
| 7255 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
| 7256 | 7256 | } |
| 7257 | 7257 | |
| 7258 | 7258 | $str = \mb_substr($str, 0, $length); |
@@ -7261,33 +7261,33 @@ discard block |
||
| 7261 | 7261 | $new_str = \implode(' ', $array); |
| 7262 | 7262 | |
| 7263 | 7263 | if ($new_str === '') { |
| 7264 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
| 7264 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
| 7265 | 7265 | } |
| 7266 | 7266 | } else { |
| 7267 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 7267 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 7268 | 7268 | return $str; |
| 7269 | 7269 | } |
| 7270 | 7270 | |
| 7271 | 7271 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
| 7272 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
| 7272 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
| 7273 | 7273 | } |
| 7274 | 7274 | |
| 7275 | 7275 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 7276 | 7276 | $str = self::substr($str, 0, $length, $encoding); |
| 7277 | 7277 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 7278 | 7278 | if ($str === false) { |
| 7279 | - return '' . $str_add_on; |
|
| 7279 | + return ''.$str_add_on; |
|
| 7280 | 7280 | } |
| 7281 | 7281 | |
| 7282 | 7282 | $array = \explode(' ', $str, -1); |
| 7283 | 7283 | $new_str = \implode(' ', $array); |
| 7284 | 7284 | |
| 7285 | 7285 | if ($new_str === '') { |
| 7286 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
| 7286 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
| 7287 | 7287 | } |
| 7288 | 7288 | } |
| 7289 | 7289 | |
| 7290 | - return $new_str . $str_add_on; |
|
| 7290 | + return $new_str.$str_add_on; |
|
| 7291 | 7291 | } |
| 7292 | 7292 | |
| 7293 | 7293 | /** |
@@ -7310,7 +7310,7 @@ discard block |
||
| 7310 | 7310 | $longest_common_prefix = ''; |
| 7311 | 7311 | |
| 7312 | 7312 | if ($encoding === 'UTF-8') { |
| 7313 | - $max_length = (int) \min( |
|
| 7313 | + $max_length = (int)\min( |
|
| 7314 | 7314 | \mb_strlen($str1), |
| 7315 | 7315 | \mb_strlen($str2) |
| 7316 | 7316 | ); |
@@ -7331,7 +7331,7 @@ discard block |
||
| 7331 | 7331 | } else { |
| 7332 | 7332 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7333 | 7333 | |
| 7334 | - $max_length = (int) \min( |
|
| 7334 | + $max_length = (int)\min( |
|
| 7335 | 7335 | self::strlen($str1, $encoding), |
| 7336 | 7336 | self::strlen($str2, $encoding) |
| 7337 | 7337 | ); |
@@ -7380,13 +7380,13 @@ discard block |
||
| 7380 | 7380 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
| 7381 | 7381 | |
| 7382 | 7382 | if ($encoding === 'UTF-8') { |
| 7383 | - $str_length = (int) \mb_strlen($str1); |
|
| 7384 | - $other_length = (int) \mb_strlen($str2); |
|
| 7383 | + $str_length = (int)\mb_strlen($str1); |
|
| 7384 | + $other_length = (int)\mb_strlen($str2); |
|
| 7385 | 7385 | } else { |
| 7386 | 7386 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7387 | 7387 | |
| 7388 | - $str_length = (int) self::strlen($str1, $encoding); |
|
| 7389 | - $other_length = (int) self::strlen($str2, $encoding); |
|
| 7388 | + $str_length = (int)self::strlen($str1, $encoding); |
|
| 7389 | + $other_length = (int)self::strlen($str2, $encoding); |
|
| 7390 | 7390 | } |
| 7391 | 7391 | |
| 7392 | 7392 | // Return if either string is empty |
@@ -7439,10 +7439,10 @@ discard block |
||
| 7439 | 7439 | } |
| 7440 | 7440 | |
| 7441 | 7441 | if ($encoding === 'UTF-8') { |
| 7442 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
| 7442 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
| 7443 | 7443 | } |
| 7444 | 7444 | |
| 7445 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
| 7445 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
| 7446 | 7446 | } |
| 7447 | 7447 | |
| 7448 | 7448 | /** |
@@ -7466,7 +7466,7 @@ discard block |
||
| 7466 | 7466 | } |
| 7467 | 7467 | |
| 7468 | 7468 | if ($encoding === 'UTF-8') { |
| 7469 | - $max_length = (int) \min( |
|
| 7469 | + $max_length = (int)\min( |
|
| 7470 | 7470 | \mb_strlen($str1, $encoding), |
| 7471 | 7471 | \mb_strlen($str2, $encoding) |
| 7472 | 7472 | ); |
@@ -7480,7 +7480,7 @@ discard block |
||
| 7480 | 7480 | && |
| 7481 | 7481 | $char === \mb_substr($str2, -$i, 1) |
| 7482 | 7482 | ) { |
| 7483 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
| 7483 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
| 7484 | 7484 | } else { |
| 7485 | 7485 | break; |
| 7486 | 7486 | } |
@@ -7488,7 +7488,7 @@ discard block |
||
| 7488 | 7488 | } else { |
| 7489 | 7489 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7490 | 7490 | |
| 7491 | - $max_length = (int) \min( |
|
| 7491 | + $max_length = (int)\min( |
|
| 7492 | 7492 | self::strlen($str1, $encoding), |
| 7493 | 7493 | self::strlen($str2, $encoding) |
| 7494 | 7494 | ); |
@@ -7502,7 +7502,7 @@ discard block |
||
| 7502 | 7502 | && |
| 7503 | 7503 | $char === self::substr($str2, -$i, 1, $encoding) |
| 7504 | 7504 | ) { |
| 7505 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
| 7505 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
| 7506 | 7506 | } else { |
| 7507 | 7507 | break; |
| 7508 | 7508 | } |
@@ -7525,7 +7525,7 @@ discard block |
||
| 7525 | 7525 | */ |
| 7526 | 7526 | public static function str_matches_pattern(string $str, string $pattern): bool |
| 7527 | 7527 | { |
| 7528 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
| 7528 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
| 7529 | 7529 | } |
| 7530 | 7530 | |
| 7531 | 7531 | /** |
@@ -7545,7 +7545,7 @@ discard block |
||
| 7545 | 7545 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
| 7546 | 7546 | { |
| 7547 | 7547 | // init |
| 7548 | - $length = (int) self::strlen($str, $encoding); |
|
| 7548 | + $length = (int)self::strlen($str, $encoding); |
|
| 7549 | 7549 | |
| 7550 | 7550 | if ($offset >= 0) { |
| 7551 | 7551 | return $length > $offset; |
@@ -7574,7 +7574,7 @@ discard block |
||
| 7574 | 7574 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
| 7575 | 7575 | { |
| 7576 | 7576 | // init |
| 7577 | - $length = (int) self::strlen($str); |
|
| 7577 | + $length = (int)self::strlen($str); |
|
| 7578 | 7578 | |
| 7579 | 7579 | if ( |
| 7580 | 7580 | ($index >= 0 && $length <= $index) |
@@ -7618,7 +7618,7 @@ discard block |
||
| 7618 | 7618 | return $str; |
| 7619 | 7619 | } |
| 7620 | 7620 | |
| 7621 | - if ($pad_type !== (int) $pad_type) { |
|
| 7621 | + if ($pad_type !== (int)$pad_type) { |
|
| 7622 | 7622 | if ($pad_type === 'left') { |
| 7623 | 7623 | $pad_type = \STR_PAD_LEFT; |
| 7624 | 7624 | } elseif ($pad_type === 'right') { |
@@ -7627,23 +7627,23 @@ discard block |
||
| 7627 | 7627 | $pad_type = \STR_PAD_BOTH; |
| 7628 | 7628 | } else { |
| 7629 | 7629 | throw new \InvalidArgumentException( |
| 7630 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
| 7630 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
| 7631 | 7631 | ); |
| 7632 | 7632 | } |
| 7633 | 7633 | } |
| 7634 | 7634 | |
| 7635 | 7635 | if ($encoding === 'UTF-8') { |
| 7636 | - $str_length = (int) \mb_strlen($str); |
|
| 7636 | + $str_length = (int)\mb_strlen($str); |
|
| 7637 | 7637 | |
| 7638 | 7638 | if ($pad_length >= $str_length) { |
| 7639 | 7639 | switch ($pad_type) { |
| 7640 | 7640 | case \STR_PAD_LEFT: |
| 7641 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 7641 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 7642 | 7642 | |
| 7643 | 7643 | $diff = ($pad_length - $str_length); |
| 7644 | 7644 | |
| 7645 | - $pre = (string) \mb_substr( |
|
| 7646 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7645 | + $pre = (string)\mb_substr( |
|
| 7646 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7647 | 7647 | 0, |
| 7648 | 7648 | $diff |
| 7649 | 7649 | ); |
@@ -7654,16 +7654,16 @@ discard block |
||
| 7654 | 7654 | case \STR_PAD_BOTH: |
| 7655 | 7655 | $diff = ($pad_length - $str_length); |
| 7656 | 7656 | |
| 7657 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 7657 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 7658 | 7658 | |
| 7659 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 7659 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 7660 | 7660 | |
| 7661 | - $pre = (string) \mb_substr( |
|
| 7661 | + $pre = (string)\mb_substr( |
|
| 7662 | 7662 | \str_repeat($pad_string, $ps_length_left), |
| 7663 | 7663 | 0, |
| 7664 | 7664 | $ps_length_left |
| 7665 | 7665 | ); |
| 7666 | - $post = (string) \mb_substr( |
|
| 7666 | + $post = (string)\mb_substr( |
|
| 7667 | 7667 | \str_repeat($pad_string, $ps_length_right), |
| 7668 | 7668 | 0, |
| 7669 | 7669 | $ps_length_right |
@@ -7673,19 +7673,19 @@ discard block |
||
| 7673 | 7673 | |
| 7674 | 7674 | case \STR_PAD_RIGHT: |
| 7675 | 7675 | default: |
| 7676 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 7676 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 7677 | 7677 | |
| 7678 | 7678 | $diff = ($pad_length - $str_length); |
| 7679 | 7679 | |
| 7680 | - $post = (string) \mb_substr( |
|
| 7681 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7680 | + $post = (string)\mb_substr( |
|
| 7681 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7682 | 7682 | 0, |
| 7683 | 7683 | $diff |
| 7684 | 7684 | ); |
| 7685 | 7685 | $pre = ''; |
| 7686 | 7686 | } |
| 7687 | 7687 | |
| 7688 | - return $pre . $str . $post; |
|
| 7688 | + return $pre.$str.$post; |
|
| 7689 | 7689 | } |
| 7690 | 7690 | |
| 7691 | 7691 | return $str; |
@@ -7693,17 +7693,17 @@ discard block |
||
| 7693 | 7693 | |
| 7694 | 7694 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7695 | 7695 | |
| 7696 | - $str_length = (int) self::strlen($str, $encoding); |
|
| 7696 | + $str_length = (int)self::strlen($str, $encoding); |
|
| 7697 | 7697 | |
| 7698 | 7698 | if ($pad_length >= $str_length) { |
| 7699 | 7699 | switch ($pad_type) { |
| 7700 | 7700 | case \STR_PAD_LEFT: |
| 7701 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 7701 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 7702 | 7702 | |
| 7703 | 7703 | $diff = ($pad_length - $str_length); |
| 7704 | 7704 | |
| 7705 | - $pre = (string) self::substr( |
|
| 7706 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7705 | + $pre = (string)self::substr( |
|
| 7706 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7707 | 7707 | 0, |
| 7708 | 7708 | $diff, |
| 7709 | 7709 | $encoding |
@@ -7715,17 +7715,17 @@ discard block |
||
| 7715 | 7715 | case \STR_PAD_BOTH: |
| 7716 | 7716 | $diff = ($pad_length - $str_length); |
| 7717 | 7717 | |
| 7718 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 7718 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 7719 | 7719 | |
| 7720 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 7720 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 7721 | 7721 | |
| 7722 | - $pre = (string) self::substr( |
|
| 7722 | + $pre = (string)self::substr( |
|
| 7723 | 7723 | \str_repeat($pad_string, $ps_length_left), |
| 7724 | 7724 | 0, |
| 7725 | 7725 | $ps_length_left, |
| 7726 | 7726 | $encoding |
| 7727 | 7727 | ); |
| 7728 | - $post = (string) self::substr( |
|
| 7728 | + $post = (string)self::substr( |
|
| 7729 | 7729 | \str_repeat($pad_string, $ps_length_right), |
| 7730 | 7730 | 0, |
| 7731 | 7731 | $ps_length_right, |
@@ -7736,12 +7736,12 @@ discard block |
||
| 7736 | 7736 | |
| 7737 | 7737 | case \STR_PAD_RIGHT: |
| 7738 | 7738 | default: |
| 7739 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 7739 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 7740 | 7740 | |
| 7741 | 7741 | $diff = ($pad_length - $str_length); |
| 7742 | 7742 | |
| 7743 | - $post = (string) self::substr( |
|
| 7744 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7743 | + $post = (string)self::substr( |
|
| 7744 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7745 | 7745 | 0, |
| 7746 | 7746 | $diff, |
| 7747 | 7747 | $encoding |
@@ -7749,7 +7749,7 @@ discard block |
||
| 7749 | 7749 | $pre = ''; |
| 7750 | 7750 | } |
| 7751 | 7751 | |
| 7752 | - return $pre . $str . $post; |
|
| 7752 | + return $pre.$str.$post; |
|
| 7753 | 7753 | } |
| 7754 | 7754 | |
| 7755 | 7755 | return $str; |
@@ -7960,12 +7960,12 @@ discard block |
||
| 7960 | 7960 | } |
| 7961 | 7961 | |
| 7962 | 7962 | if ($search === '') { |
| 7963 | - return $str . $replacement; |
|
| 7963 | + return $str.$replacement; |
|
| 7964 | 7964 | } |
| 7965 | 7965 | |
| 7966 | 7966 | $searchLength = \strlen($search); |
| 7967 | 7967 | if (\strncmp($str, $search, $searchLength) === 0) { |
| 7968 | - return $replacement . \substr($str, $searchLength); |
|
| 7968 | + return $replacement.\substr($str, $searchLength); |
|
| 7969 | 7969 | } |
| 7970 | 7970 | |
| 7971 | 7971 | return $str; |
@@ -7999,11 +7999,11 @@ discard block |
||
| 7999 | 7999 | } |
| 8000 | 8000 | |
| 8001 | 8001 | if ($search === '') { |
| 8002 | - return $str . $replacement; |
|
| 8002 | + return $str.$replacement; |
|
| 8003 | 8003 | } |
| 8004 | 8004 | |
| 8005 | 8005 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 8006 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 8006 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 8007 | 8007 | } |
| 8008 | 8008 | |
| 8009 | 8009 | return $str; |
@@ -8037,7 +8037,7 @@ discard block |
||
| 8037 | 8037 | $subject, |
| 8038 | 8038 | $replace, |
| 8039 | 8039 | $pos, |
| 8040 | - (int) self::strlen($search) |
|
| 8040 | + (int)self::strlen($search) |
|
| 8041 | 8041 | ); |
| 8042 | 8042 | } |
| 8043 | 8043 | |
@@ -8071,7 +8071,7 @@ discard block |
||
| 8071 | 8071 | $subject, |
| 8072 | 8072 | $replace, |
| 8073 | 8073 | $pos, |
| 8074 | - (int) self::strlen($search) |
|
| 8074 | + (int)self::strlen($search) |
|
| 8075 | 8075 | ); |
| 8076 | 8076 | } |
| 8077 | 8077 | |
@@ -8094,7 +8094,7 @@ discard block |
||
| 8094 | 8094 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
| 8095 | 8095 | { |
| 8096 | 8096 | if ($encoding === 'UTF-8') { |
| 8097 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
| 8097 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
| 8098 | 8098 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 8099 | 8099 | \shuffle($indexes); |
| 8100 | 8100 | |
@@ -8110,7 +8110,7 @@ discard block |
||
| 8110 | 8110 | } else { |
| 8111 | 8111 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8112 | 8112 | |
| 8113 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
| 8113 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
| 8114 | 8114 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 8115 | 8115 | \shuffle($indexes); |
| 8116 | 8116 | |
@@ -8153,11 +8153,11 @@ discard block |
||
| 8153 | 8153 | ) { |
| 8154 | 8154 | if ($encoding === 'UTF-8') { |
| 8155 | 8155 | if ($end === null) { |
| 8156 | - $length = (int) \mb_strlen($str); |
|
| 8156 | + $length = (int)\mb_strlen($str); |
|
| 8157 | 8157 | } elseif ($end >= 0 && $end <= $start) { |
| 8158 | 8158 | return ''; |
| 8159 | 8159 | } elseif ($end < 0) { |
| 8160 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
| 8160 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
| 8161 | 8161 | } else { |
| 8162 | 8162 | $length = $end - $start; |
| 8163 | 8163 | } |
@@ -8168,11 +8168,11 @@ discard block |
||
| 8168 | 8168 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8169 | 8169 | |
| 8170 | 8170 | if ($end === null) { |
| 8171 | - $length = (int) self::strlen($str, $encoding); |
|
| 8171 | + $length = (int)self::strlen($str, $encoding); |
|
| 8172 | 8172 | } elseif ($end >= 0 && $end <= $start) { |
| 8173 | 8173 | return ''; |
| 8174 | 8174 | } elseif ($end < 0) { |
| 8175 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
| 8175 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
| 8176 | 8176 | } else { |
| 8177 | 8177 | $length = $end - $start; |
| 8178 | 8178 | } |
@@ -8207,7 +8207,7 @@ discard block |
||
| 8207 | 8207 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8208 | 8208 | } |
| 8209 | 8209 | |
| 8210 | - $str = (string) \preg_replace_callback( |
|
| 8210 | + $str = (string)\preg_replace_callback( |
|
| 8211 | 8211 | '/([\\p{N}|\\p{Lu}])/u', |
| 8212 | 8212 | /** |
| 8213 | 8213 | * @param string[] $matches |
@@ -8216,28 +8216,28 @@ discard block |
||
| 8216 | 8216 | * |
| 8217 | 8217 | * @return string |
| 8218 | 8218 | */ |
| 8219 | - static function (array $matches) use ($encoding): string { |
|
| 8219 | + static function(array $matches) use ($encoding): string { |
|
| 8220 | 8220 | $match = $matches[1]; |
| 8221 | - $match_int = (int) $match; |
|
| 8221 | + $match_int = (int)$match; |
|
| 8222 | 8222 | |
| 8223 | - if ((string) $match_int === $match) { |
|
| 8224 | - return '_' . $match . '_'; |
|
| 8223 | + if ((string)$match_int === $match) { |
|
| 8224 | + return '_'.$match.'_'; |
|
| 8225 | 8225 | } |
| 8226 | 8226 | |
| 8227 | 8227 | if ($encoding === 'UTF-8') { |
| 8228 | - return '_' . \mb_strtolower($match); |
|
| 8228 | + return '_'.\mb_strtolower($match); |
|
| 8229 | 8229 | } |
| 8230 | 8230 | |
| 8231 | - return '_' . self::strtolower($match, $encoding); |
|
| 8231 | + return '_'.self::strtolower($match, $encoding); |
|
| 8232 | 8232 | }, |
| 8233 | 8233 | $str |
| 8234 | 8234 | ); |
| 8235 | 8235 | |
| 8236 | - $str = (string) \preg_replace( |
|
| 8236 | + $str = (string)\preg_replace( |
|
| 8237 | 8237 | [ |
| 8238 | - '/\\s+/u', // convert spaces to "_" |
|
| 8238 | + '/\\s+/u', // convert spaces to "_" |
|
| 8239 | 8239 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
| 8240 | - '/_+/', // remove double "_" |
|
| 8240 | + '/_+/', // remove double "_" |
|
| 8241 | 8241 | ], |
| 8242 | 8242 | [ |
| 8243 | 8243 | '_', |
@@ -8367,7 +8367,7 @@ discard block |
||
| 8367 | 8367 | } |
| 8368 | 8368 | |
| 8369 | 8369 | // init |
| 8370 | - $input = (string) $input; |
|
| 8370 | + $input = (string)$input; |
|
| 8371 | 8371 | |
| 8372 | 8372 | if ($input === '') { |
| 8373 | 8373 | return []; |
@@ -8424,7 +8424,7 @@ discard block |
||
| 8424 | 8424 | ($input[$i] & "\xE0") === "\xC0" |
| 8425 | 8425 | ) { |
| 8426 | 8426 | if (($input[$i + 1] & "\xC0") === "\x80") { |
| 8427 | - $ret[] = $input[$i] . $input[$i + 1]; |
|
| 8427 | + $ret[] = $input[$i].$input[$i + 1]; |
|
| 8428 | 8428 | |
| 8429 | 8429 | ++$i; |
| 8430 | 8430 | } |
@@ -8438,7 +8438,7 @@ discard block |
||
| 8438 | 8438 | && |
| 8439 | 8439 | ($input[$i + 2] & "\xC0") === "\x80" |
| 8440 | 8440 | ) { |
| 8441 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2]; |
|
| 8441 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2]; |
|
| 8442 | 8442 | |
| 8443 | 8443 | $i += 2; |
| 8444 | 8444 | } |
@@ -8454,7 +8454,7 @@ discard block |
||
| 8454 | 8454 | && |
| 8455 | 8455 | ($input[$i + 3] & "\xC0") === "\x80" |
| 8456 | 8456 | ) { |
| 8457 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2] . $input[$i + 3]; |
|
| 8457 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2].$input[$i + 3]; |
|
| 8458 | 8458 | |
| 8459 | 8459 | $i += 3; |
| 8460 | 8460 | } |
@@ -8464,7 +8464,7 @@ discard block |
||
| 8464 | 8464 | |
| 8465 | 8465 | if ($length > 1) { |
| 8466 | 8466 | return \array_map( |
| 8467 | - static function (array $item): string { |
|
| 8467 | + static function(array $item): string { |
|
| 8468 | 8468 | return \implode('', $item); |
| 8469 | 8469 | }, |
| 8470 | 8470 | \array_chunk($ret, $length) |
@@ -8538,7 +8538,7 @@ discard block |
||
| 8538 | 8538 | $limit = -1; |
| 8539 | 8539 | } |
| 8540 | 8540 | |
| 8541 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
| 8541 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
| 8542 | 8542 | if ($array === false) { |
| 8543 | 8543 | return []; |
| 8544 | 8544 | } |
@@ -8638,9 +8638,9 @@ discard block |
||
| 8638 | 8638 | return ''; |
| 8639 | 8639 | } |
| 8640 | 8640 | |
| 8641 | - return (string) \mb_substr( |
|
| 8641 | + return (string)\mb_substr( |
|
| 8642 | 8642 | $str, |
| 8643 | - $offset + (int) \mb_strlen($separator) |
|
| 8643 | + $offset + (int)\mb_strlen($separator) |
|
| 8644 | 8644 | ); |
| 8645 | 8645 | } |
| 8646 | 8646 | |
@@ -8649,9 +8649,9 @@ discard block |
||
| 8649 | 8649 | return ''; |
| 8650 | 8650 | } |
| 8651 | 8651 | |
| 8652 | - return (string) \mb_substr( |
|
| 8652 | + return (string)\mb_substr( |
|
| 8653 | 8653 | $str, |
| 8654 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 8654 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 8655 | 8655 | null, |
| 8656 | 8656 | $encoding |
| 8657 | 8657 | ); |
@@ -8683,9 +8683,9 @@ discard block |
||
| 8683 | 8683 | return ''; |
| 8684 | 8684 | } |
| 8685 | 8685 | |
| 8686 | - return (string) \mb_substr( |
|
| 8686 | + return (string)\mb_substr( |
|
| 8687 | 8687 | $str, |
| 8688 | - $offset + (int) \mb_strlen($separator) |
|
| 8688 | + $offset + (int)\mb_strlen($separator) |
|
| 8689 | 8689 | ); |
| 8690 | 8690 | } |
| 8691 | 8691 | |
@@ -8694,9 +8694,9 @@ discard block |
||
| 8694 | 8694 | return ''; |
| 8695 | 8695 | } |
| 8696 | 8696 | |
| 8697 | - return (string) self::substr( |
|
| 8697 | + return (string)self::substr( |
|
| 8698 | 8698 | $str, |
| 8699 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 8699 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 8700 | 8700 | null, |
| 8701 | 8701 | $encoding |
| 8702 | 8702 | ); |
@@ -8728,7 +8728,7 @@ discard block |
||
| 8728 | 8728 | return ''; |
| 8729 | 8729 | } |
| 8730 | 8730 | |
| 8731 | - return (string) \mb_substr( |
|
| 8731 | + return (string)\mb_substr( |
|
| 8732 | 8732 | $str, |
| 8733 | 8733 | 0, |
| 8734 | 8734 | $offset |
@@ -8740,7 +8740,7 @@ discard block |
||
| 8740 | 8740 | return ''; |
| 8741 | 8741 | } |
| 8742 | 8742 | |
| 8743 | - return (string) self::substr( |
|
| 8743 | + return (string)self::substr( |
|
| 8744 | 8744 | $str, |
| 8745 | 8745 | 0, |
| 8746 | 8746 | $offset, |
@@ -8771,7 +8771,7 @@ discard block |
||
| 8771 | 8771 | return ''; |
| 8772 | 8772 | } |
| 8773 | 8773 | |
| 8774 | - return (string) \mb_substr( |
|
| 8774 | + return (string)\mb_substr( |
|
| 8775 | 8775 | $str, |
| 8776 | 8776 | 0, |
| 8777 | 8777 | $offset |
@@ -8785,7 +8785,7 @@ discard block |
||
| 8785 | 8785 | |
| 8786 | 8786 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8787 | 8787 | |
| 8788 | - return (string) self::substr( |
|
| 8788 | + return (string)self::substr( |
|
| 8789 | 8789 | $str, |
| 8790 | 8790 | 0, |
| 8791 | 8791 | $offset, |
@@ -8900,7 +8900,7 @@ discard block |
||
| 8900 | 8900 | */ |
| 8901 | 8901 | public static function str_surround(string $str, string $substring): string |
| 8902 | 8902 | { |
| 8903 | - return $substring . $str . $substring; |
|
| 8903 | + return $substring.$str.$substring; |
|
| 8904 | 8904 | } |
| 8905 | 8905 | |
| 8906 | 8906 | /** |
@@ -8964,9 +8964,9 @@ discard block |
||
| 8964 | 8964 | $word_define_chars = ''; |
| 8965 | 8965 | } |
| 8966 | 8966 | |
| 8967 | - $str = (string) \preg_replace_callback( |
|
| 8968 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
| 8969 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
| 8967 | + $str = (string)\preg_replace_callback( |
|
| 8968 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
| 8969 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
| 8970 | 8970 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
| 8971 | 8971 | return $match[0]; |
| 8972 | 8972 | } |
@@ -9133,16 +9133,16 @@ discard block |
||
| 9133 | 9133 | |
| 9134 | 9134 | // the main substitutions |
| 9135 | 9135 | /** @noinspection RegExpDuplicateAlternationBranch - false-positive - https://youtrack.jetbrains.com/issue/WI-51002 */ |
| 9136 | - $str = (string) \preg_replace_callback( |
|
| 9136 | + $str = (string)\preg_replace_callback( |
|
| 9137 | 9137 | '~\\b (_*) (?: # 1. Leading underscore and |
| 9138 | 9138 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
| 9139 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
| 9139 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
| 9140 | 9140 | | |
| 9141 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
| 9141 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
| 9142 | 9142 | | |
| 9143 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
| 9143 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
| 9144 | 9144 | | |
| 9145 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
| 9145 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
| 9146 | 9146 | ) (_*) \\b # 6. With trailing underscore |
| 9147 | 9147 | ~ux', |
| 9148 | 9148 | /** |
@@ -9152,7 +9152,7 @@ discard block |
||
| 9152 | 9152 | * |
| 9153 | 9153 | * @return string |
| 9154 | 9154 | */ |
| 9155 | - static function (array $matches) use ($encoding): string { |
|
| 9155 | + static function(array $matches) use ($encoding): string { |
|
| 9156 | 9156 | // preserve leading underscore |
| 9157 | 9157 | $str = $matches[1]; |
| 9158 | 9158 | if ($matches[2]) { |
@@ -9177,11 +9177,11 @@ discard block |
||
| 9177 | 9177 | ); |
| 9178 | 9178 | |
| 9179 | 9179 | // Exceptions for small words: capitalize at start of title... |
| 9180 | - $str = (string) \preg_replace_callback( |
|
| 9180 | + $str = (string)\preg_replace_callback( |
|
| 9181 | 9181 | '~( \\A [[:punct:]]* # start of title... |
| 9182 | 9182 | | [:.;?!][ ]+ # or of subsentence... |
| 9183 | 9183 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
| 9184 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
| 9184 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
| 9185 | 9185 | ~uxi', |
| 9186 | 9186 | /** |
| 9187 | 9187 | * @param string[] $matches |
@@ -9190,15 +9190,15 @@ discard block |
||
| 9190 | 9190 | * |
| 9191 | 9191 | * @return string |
| 9192 | 9192 | */ |
| 9193 | - static function (array $matches) use ($encoding): string { |
|
| 9194 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
| 9193 | + static function(array $matches) use ($encoding): string { |
|
| 9194 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
| 9195 | 9195 | }, |
| 9196 | 9196 | $str |
| 9197 | 9197 | ); |
| 9198 | 9198 | |
| 9199 | 9199 | // ...and end of title |
| 9200 | - $str = (string) \preg_replace_callback( |
|
| 9201 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
| 9200 | + $str = (string)\preg_replace_callback( |
|
| 9201 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
| 9202 | 9202 | (?= [[:punct:]]* \Z # ...at the end of the title... |
| 9203 | 9203 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
| 9204 | 9204 | ~uxi', |
@@ -9209,7 +9209,7 @@ discard block |
||
| 9209 | 9209 | * |
| 9210 | 9210 | * @return string |
| 9211 | 9211 | */ |
| 9212 | - static function (array $matches) use ($encoding): string { |
|
| 9212 | + static function(array $matches) use ($encoding): string { |
|
| 9213 | 9213 | return static::ucfirst($matches[1], $encoding); |
| 9214 | 9214 | }, |
| 9215 | 9215 | $str |
@@ -9217,10 +9217,10 @@ discard block |
||
| 9217 | 9217 | |
| 9218 | 9218 | // Exceptions for small words in hyphenated compound words. |
| 9219 | 9219 | // e.g. "in-flight" -> In-Flight |
| 9220 | - $str = (string) \preg_replace_callback( |
|
| 9220 | + $str = (string)\preg_replace_callback( |
|
| 9221 | 9221 | '~\\b |
| 9222 | 9222 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
| 9223 | - ( ' . $small_words_rx . ' ) |
|
| 9223 | + ( ' . $small_words_rx.' ) |
|
| 9224 | 9224 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
| 9225 | 9225 | ~uxi', |
| 9226 | 9226 | /** |
@@ -9230,18 +9230,18 @@ discard block |
||
| 9230 | 9230 | * |
| 9231 | 9231 | * @return string |
| 9232 | 9232 | */ |
| 9233 | - static function (array $matches) use ($encoding): string { |
|
| 9233 | + static function(array $matches) use ($encoding): string { |
|
| 9234 | 9234 | return static::ucfirst($matches[1], $encoding); |
| 9235 | 9235 | }, |
| 9236 | 9236 | $str |
| 9237 | 9237 | ); |
| 9238 | 9238 | |
| 9239 | 9239 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
| 9240 | - $str = (string) \preg_replace_callback( |
|
| 9240 | + $str = (string)\preg_replace_callback( |
|
| 9241 | 9241 | '~\\b |
| 9242 | 9242 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
| 9243 | 9243 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
| 9244 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
| 9244 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
| 9245 | 9245 | (?! - ) # Negative lookahead for another - |
| 9246 | 9246 | ~uxi', |
| 9247 | 9247 | /** |
@@ -9251,8 +9251,8 @@ discard block |
||
| 9251 | 9251 | * |
| 9252 | 9252 | * @return string |
| 9253 | 9253 | */ |
| 9254 | - static function (array $matches) use ($encoding): string { |
|
| 9255 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
| 9254 | + static function(array $matches) use ($encoding): string { |
|
| 9255 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
| 9256 | 9256 | }, |
| 9257 | 9257 | $str |
| 9258 | 9258 | ); |
@@ -9371,7 +9371,7 @@ discard block |
||
| 9371 | 9371 | ); |
| 9372 | 9372 | |
| 9373 | 9373 | foreach ($tmp_return as &$item) { |
| 9374 | - $item = (string) $item; |
|
| 9374 | + $item = (string)$item; |
|
| 9375 | 9375 | } |
| 9376 | 9376 | |
| 9377 | 9377 | return $tmp_return; |
@@ -9425,39 +9425,39 @@ discard block |
||
| 9425 | 9425 | } |
| 9426 | 9426 | |
| 9427 | 9427 | if ($encoding === 'UTF-8') { |
| 9428 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 9428 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 9429 | 9429 | return $str; |
| 9430 | 9430 | } |
| 9431 | 9431 | |
| 9432 | 9432 | if ($substring !== '') { |
| 9433 | - $length -= (int) \mb_strlen($substring); |
|
| 9433 | + $length -= (int)\mb_strlen($substring); |
|
| 9434 | 9434 | |
| 9435 | 9435 | /** @noinspection UnnecessaryCastingInspection */ |
| 9436 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
| 9436 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
| 9437 | 9437 | } |
| 9438 | 9438 | |
| 9439 | 9439 | /** @noinspection UnnecessaryCastingInspection */ |
| 9440 | - return (string) \mb_substr($str, 0, $length); |
|
| 9440 | + return (string)\mb_substr($str, 0, $length); |
|
| 9441 | 9441 | } |
| 9442 | 9442 | |
| 9443 | 9443 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 9444 | 9444 | |
| 9445 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 9445 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 9446 | 9446 | return $str; |
| 9447 | 9447 | } |
| 9448 | 9448 | |
| 9449 | 9449 | if ($substring !== '') { |
| 9450 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 9450 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 9451 | 9451 | } |
| 9452 | 9452 | |
| 9453 | 9453 | return ( |
| 9454 | - (string) self::substr( |
|
| 9454 | + (string)self::substr( |
|
| 9455 | 9455 | $str, |
| 9456 | 9456 | 0, |
| 9457 | 9457 | $length, |
| 9458 | 9458 | $encoding |
| 9459 | 9459 | ) |
| 9460 | - ) . $substring; |
|
| 9460 | + ).$substring; |
|
| 9461 | 9461 | } |
| 9462 | 9462 | |
| 9463 | 9463 | /** |
@@ -9491,12 +9491,12 @@ discard block |
||
| 9491 | 9491 | } |
| 9492 | 9492 | |
| 9493 | 9493 | if ($encoding === 'UTF-8') { |
| 9494 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 9494 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 9495 | 9495 | return $str; |
| 9496 | 9496 | } |
| 9497 | 9497 | |
| 9498 | 9498 | // need to further trim the string so we can append the substring |
| 9499 | - $length -= (int) \mb_strlen($substring); |
|
| 9499 | + $length -= (int)\mb_strlen($substring); |
|
| 9500 | 9500 | if ($length <= 0) { |
| 9501 | 9501 | return $substring; |
| 9502 | 9502 | } |
@@ -9522,18 +9522,18 @@ discard block |
||
| 9522 | 9522 | !$ignore_do_not_split_words_for_one_word |
| 9523 | 9523 | ) |
| 9524 | 9524 | ) { |
| 9525 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
| 9525 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
| 9526 | 9526 | } |
| 9527 | 9527 | } |
| 9528 | 9528 | } else { |
| 9529 | 9529 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 9530 | 9530 | |
| 9531 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 9531 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 9532 | 9532 | return $str; |
| 9533 | 9533 | } |
| 9534 | 9534 | |
| 9535 | 9535 | // need to further trim the string so we can append the substring |
| 9536 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 9536 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 9537 | 9537 | if ($length <= 0) { |
| 9538 | 9538 | return $substring; |
| 9539 | 9539 | } |
@@ -9559,12 +9559,12 @@ discard block |
||
| 9559 | 9559 | !$ignore_do_not_split_words_for_one_word |
| 9560 | 9560 | ) |
| 9561 | 9561 | ) { |
| 9562 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
| 9562 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
| 9563 | 9563 | } |
| 9564 | 9564 | } |
| 9565 | 9565 | } |
| 9566 | 9566 | |
| 9567 | - return $truncated . $substring; |
|
| 9567 | + return $truncated.$substring; |
|
| 9568 | 9568 | } |
| 9569 | 9569 | |
| 9570 | 9570 | /** |
@@ -9691,13 +9691,13 @@ discard block |
||
| 9691 | 9691 | } |
| 9692 | 9692 | } elseif ($format === 2) { |
| 9693 | 9693 | $number_of_words = []; |
| 9694 | - $offset = (int) self::strlen($str_parts[0]); |
|
| 9694 | + $offset = (int)self::strlen($str_parts[0]); |
|
| 9695 | 9695 | for ($i = 1; $i < $len; $i += 2) { |
| 9696 | 9696 | $number_of_words[$offset] = $str_parts[$i]; |
| 9697 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
| 9697 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
| 9698 | 9698 | } |
| 9699 | 9699 | } else { |
| 9700 | - $number_of_words = (int) (($len - 1) / 2); |
|
| 9700 | + $number_of_words = (int)(($len - 1) / 2); |
|
| 9701 | 9701 | } |
| 9702 | 9702 | |
| 9703 | 9703 | return $number_of_words; |
@@ -9832,7 +9832,7 @@ discard block |
||
| 9832 | 9832 | } |
| 9833 | 9833 | |
| 9834 | 9834 | if ($char_list === '') { |
| 9835 | - return (int) self::strlen($str, $encoding); |
|
| 9835 | + return (int)self::strlen($str, $encoding); |
|
| 9836 | 9836 | } |
| 9837 | 9837 | |
| 9838 | 9838 | if ($offset || $length !== null) { |
@@ -9859,7 +9859,7 @@ discard block |
||
| 9859 | 9859 | } |
| 9860 | 9860 | |
| 9861 | 9861 | $matches = []; |
| 9862 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
| 9862 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
| 9863 | 9863 | $return = self::strlen($matches[1], $encoding); |
| 9864 | 9864 | if ($return === false) { |
| 9865 | 9865 | return 0; |
@@ -9868,7 +9868,7 @@ discard block |
||
| 9868 | 9868 | return $return; |
| 9869 | 9869 | } |
| 9870 | 9870 | |
| 9871 | - return (int) self::strlen($str, $encoding); |
|
| 9871 | + return (int)self::strlen($str, $encoding); |
|
| 9872 | 9872 | } |
| 9873 | 9873 | |
| 9874 | 9874 | /** |
@@ -9931,7 +9931,7 @@ discard block |
||
| 9931 | 9931 | |
| 9932 | 9932 | $str = ''; |
| 9933 | 9933 | foreach ($intOrHex as $strPart) { |
| 9934 | - $str .= '&#' . (int) $strPart . ';'; |
|
| 9934 | + $str .= '&#'.(int)$strPart.';'; |
|
| 9935 | 9935 | } |
| 9936 | 9936 | |
| 9937 | 9937 | return self::html_entity_decode($str, \ENT_QUOTES | \ENT_HTML5); |
@@ -10028,7 +10028,7 @@ discard block |
||
| 10028 | 10028 | return ''; |
| 10029 | 10029 | } |
| 10030 | 10030 | |
| 10031 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
| 10031 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
| 10032 | 10032 | } |
| 10033 | 10033 | |
| 10034 | 10034 | /** |
@@ -10107,7 +10107,7 @@ discard block |
||
| 10107 | 10107 | // fallback for ascii only |
| 10108 | 10108 | // |
| 10109 | 10109 | |
| 10110 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10110 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10111 | 10111 | return \stripos($haystack, $needle, $offset); |
| 10112 | 10112 | } |
| 10113 | 10113 | |
@@ -10196,7 +10196,7 @@ discard block |
||
| 10196 | 10196 | /** |
| 10197 | 10197 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10198 | 10198 | */ |
| 10199 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10199 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10200 | 10200 | } |
| 10201 | 10201 | |
| 10202 | 10202 | if ( |
@@ -10210,11 +10210,11 @@ discard block |
||
| 10210 | 10210 | } |
| 10211 | 10211 | } |
| 10212 | 10212 | |
| 10213 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
| 10213 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
| 10214 | 10214 | return \stristr($haystack, $needle, $before_needle); |
| 10215 | 10215 | } |
| 10216 | 10216 | |
| 10217 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
| 10217 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
| 10218 | 10218 | |
| 10219 | 10219 | if (!isset($match[1])) { |
| 10220 | 10220 | return false; |
@@ -10224,7 +10224,7 @@ discard block |
||
| 10224 | 10224 | return $match[1]; |
| 10225 | 10225 | } |
| 10226 | 10226 | |
| 10227 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
| 10227 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
| 10228 | 10228 | } |
| 10229 | 10229 | |
| 10230 | 10230 | /** |
@@ -10307,7 +10307,7 @@ discard block |
||
| 10307 | 10307 | /** |
| 10308 | 10308 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10309 | 10309 | */ |
| 10310 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10310 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10311 | 10311 | } |
| 10312 | 10312 | |
| 10313 | 10313 | // |
@@ -10445,8 +10445,8 @@ discard block |
||
| 10445 | 10445 | } |
| 10446 | 10446 | |
| 10447 | 10447 | return \strnatcmp( |
| 10448 | - (string) self::strtonatfold($str1), |
|
| 10449 | - (string) self::strtonatfold($str2) |
|
| 10448 | + (string)self::strtonatfold($str1), |
|
| 10449 | + (string)self::strtonatfold($str2) |
|
| 10450 | 10450 | ); |
| 10451 | 10451 | } |
| 10452 | 10452 | |
@@ -10516,11 +10516,11 @@ discard block |
||
| 10516 | 10516 | } |
| 10517 | 10517 | |
| 10518 | 10518 | if ($encoding === 'UTF-8') { |
| 10519 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
| 10520 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
| 10519 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
| 10520 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
| 10521 | 10521 | } else { |
| 10522 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
| 10523 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
| 10522 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
| 10523 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
| 10524 | 10524 | } |
| 10525 | 10525 | |
| 10526 | 10526 | return self::strcmp($str1, $str2); |
@@ -10547,8 +10547,8 @@ discard block |
||
| 10547 | 10547 | return false; |
| 10548 | 10548 | } |
| 10549 | 10549 | |
| 10550 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
| 10551 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
| 10550 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
| 10551 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
| 10552 | 10552 | } |
| 10553 | 10553 | |
| 10554 | 10554 | return false; |
@@ -10593,10 +10593,10 @@ discard block |
||
| 10593 | 10593 | } |
| 10594 | 10594 | |
| 10595 | 10595 | // iconv and mbstring do not support integer $needle |
| 10596 | - if ((int) $needle === $needle) { |
|
| 10597 | - $needle = (string) self::chr($needle); |
|
| 10596 | + if ((int)$needle === $needle) { |
|
| 10597 | + $needle = (string)self::chr($needle); |
|
| 10598 | 10598 | } |
| 10599 | - $needle = (string) $needle; |
|
| 10599 | + $needle = (string)$needle; |
|
| 10600 | 10600 | |
| 10601 | 10601 | if ($haystack === '') { |
| 10602 | 10602 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -10656,7 +10656,7 @@ discard block |
||
| 10656 | 10656 | /** |
| 10657 | 10657 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10658 | 10658 | */ |
| 10659 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10659 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10660 | 10660 | } |
| 10661 | 10661 | |
| 10662 | 10662 | // |
@@ -10697,7 +10697,7 @@ discard block |
||
| 10697 | 10697 | // fallback for ascii only |
| 10698 | 10698 | // |
| 10699 | 10699 | |
| 10700 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10700 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10701 | 10701 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Offset not contained in string */ |
| 10702 | 10702 | return @\strpos($haystack, $needle, $offset); |
| 10703 | 10703 | } |
@@ -10710,7 +10710,7 @@ discard block |
||
| 10710 | 10710 | if ($haystack_tmp === false) { |
| 10711 | 10711 | $haystack_tmp = ''; |
| 10712 | 10712 | } |
| 10713 | - $haystack = (string) $haystack_tmp; |
|
| 10713 | + $haystack = (string)$haystack_tmp; |
|
| 10714 | 10714 | |
| 10715 | 10715 | if ($offset < 0) { |
| 10716 | 10716 | $offset = 0; |
@@ -10722,7 +10722,7 @@ discard block |
||
| 10722 | 10722 | } |
| 10723 | 10723 | |
| 10724 | 10724 | if ($pos) { |
| 10725 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 10725 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 10726 | 10726 | } |
| 10727 | 10727 | |
| 10728 | 10728 | return $offset + 0; |
@@ -10877,7 +10877,7 @@ discard block |
||
| 10877 | 10877 | /** |
| 10878 | 10878 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10879 | 10879 | */ |
| 10880 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10880 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10881 | 10881 | } |
| 10882 | 10882 | |
| 10883 | 10883 | // |
@@ -10952,7 +10952,7 @@ discard block |
||
| 10952 | 10952 | if ($encoding === 'UTF-8') { |
| 10953 | 10953 | if (self::$SUPPORT['intl'] === true) { |
| 10954 | 10954 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
| 10955 | - $i = (int) \grapheme_strlen($str); |
|
| 10955 | + $i = (int)\grapheme_strlen($str); |
|
| 10956 | 10956 | while ($i--) { |
| 10957 | 10957 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
| 10958 | 10958 | if ($reversed_tmp !== false) { |
@@ -10960,7 +10960,7 @@ discard block |
||
| 10960 | 10960 | } |
| 10961 | 10961 | } |
| 10962 | 10962 | } else { |
| 10963 | - $i = (int) \mb_strlen($str); |
|
| 10963 | + $i = (int)\mb_strlen($str); |
|
| 10964 | 10964 | while ($i--) { |
| 10965 | 10965 | $reversed_tmp = \mb_substr($str, $i, 1); |
| 10966 | 10966 | if ($reversed_tmp !== false) { |
@@ -10971,7 +10971,7 @@ discard block |
||
| 10971 | 10971 | } else { |
| 10972 | 10972 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 10973 | 10973 | |
| 10974 | - $i = (int) self::strlen($str, $encoding); |
|
| 10974 | + $i = (int)self::strlen($str, $encoding); |
|
| 10975 | 10975 | while ($i--) { |
| 10976 | 10976 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
| 10977 | 10977 | if ($reversed_tmp !== false) { |
@@ -11099,10 +11099,10 @@ discard block |
||
| 11099 | 11099 | } |
| 11100 | 11100 | |
| 11101 | 11101 | // iconv and mbstring do not support integer $needle |
| 11102 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 11103 | - $needle = (string) self::chr($needle); |
|
| 11102 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 11103 | + $needle = (string)self::chr($needle); |
|
| 11104 | 11104 | } |
| 11105 | - $needle = (string) $needle; |
|
| 11105 | + $needle = (string)$needle; |
|
| 11106 | 11106 | |
| 11107 | 11107 | if ($haystack === '') { |
| 11108 | 11108 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -11158,7 +11158,7 @@ discard block |
||
| 11158 | 11158 | /** |
| 11159 | 11159 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11160 | 11160 | */ |
| 11161 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11161 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11162 | 11162 | } |
| 11163 | 11163 | |
| 11164 | 11164 | // |
@@ -11182,7 +11182,7 @@ discard block |
||
| 11182 | 11182 | // fallback for ascii only |
| 11183 | 11183 | // |
| 11184 | 11184 | |
| 11185 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 11185 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 11186 | 11186 | return \strripos($haystack, $needle, $offset); |
| 11187 | 11187 | } |
| 11188 | 11188 | |
@@ -11271,10 +11271,10 @@ discard block |
||
| 11271 | 11271 | } |
| 11272 | 11272 | |
| 11273 | 11273 | // iconv and mbstring do not support integer $needle |
| 11274 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 11275 | - $needle = (string) self::chr($needle); |
|
| 11274 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 11275 | + $needle = (string)self::chr($needle); |
|
| 11276 | 11276 | } |
| 11277 | - $needle = (string) $needle; |
|
| 11277 | + $needle = (string)$needle; |
|
| 11278 | 11278 | |
| 11279 | 11279 | if ($haystack === '') { |
| 11280 | 11280 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -11330,7 +11330,7 @@ discard block |
||
| 11330 | 11330 | /** |
| 11331 | 11331 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11332 | 11332 | */ |
| 11333 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11333 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11334 | 11334 | } |
| 11335 | 11335 | |
| 11336 | 11336 | // |
@@ -11354,7 +11354,7 @@ discard block |
||
| 11354 | 11354 | // fallback for ascii only |
| 11355 | 11355 | // |
| 11356 | 11356 | |
| 11357 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 11357 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 11358 | 11358 | return \strrpos($haystack, $needle, $offset); |
| 11359 | 11359 | } |
| 11360 | 11360 | |
@@ -11374,7 +11374,7 @@ discard block |
||
| 11374 | 11374 | if ($haystack_tmp === false) { |
| 11375 | 11375 | $haystack_tmp = ''; |
| 11376 | 11376 | } |
| 11377 | - $haystack = (string) $haystack_tmp; |
|
| 11377 | + $haystack = (string)$haystack_tmp; |
|
| 11378 | 11378 | } |
| 11379 | 11379 | |
| 11380 | 11380 | $pos = \strrpos($haystack, $needle); |
@@ -11388,7 +11388,7 @@ discard block |
||
| 11388 | 11388 | return false; |
| 11389 | 11389 | } |
| 11390 | 11390 | |
| 11391 | - return $offset + (int) self::strlen($str_tmp); |
|
| 11391 | + return $offset + (int)self::strlen($str_tmp); |
|
| 11392 | 11392 | } |
| 11393 | 11393 | |
| 11394 | 11394 | /** |
@@ -11456,12 +11456,12 @@ discard block |
||
| 11456 | 11456 | if ($offset || $length !== null) { |
| 11457 | 11457 | if ($encoding === 'UTF-8') { |
| 11458 | 11458 | if ($length === null) { |
| 11459 | - $str = (string) \mb_substr($str, $offset); |
|
| 11459 | + $str = (string)\mb_substr($str, $offset); |
|
| 11460 | 11460 | } else { |
| 11461 | - $str = (string) \mb_substr($str, $offset, $length); |
|
| 11461 | + $str = (string)\mb_substr($str, $offset, $length); |
|
| 11462 | 11462 | } |
| 11463 | 11463 | } else { |
| 11464 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
| 11464 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
| 11465 | 11465 | } |
| 11466 | 11466 | } |
| 11467 | 11467 | |
@@ -11471,7 +11471,7 @@ discard block |
||
| 11471 | 11471 | |
| 11472 | 11472 | $matches = []; |
| 11473 | 11473 | |
| 11474 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
| 11474 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
| 11475 | 11475 | } |
| 11476 | 11476 | |
| 11477 | 11477 | /** |
@@ -11565,7 +11565,7 @@ discard block |
||
| 11565 | 11565 | /** |
| 11566 | 11566 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11567 | 11567 | */ |
| 11568 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11568 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11569 | 11569 | } |
| 11570 | 11570 | |
| 11571 | 11571 | // |
@@ -11587,7 +11587,7 @@ discard block |
||
| 11587 | 11587 | // fallback for ascii only |
| 11588 | 11588 | // |
| 11589 | 11589 | |
| 11590 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 11590 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 11591 | 11591 | return \strstr($haystack, $needle, $before_needle); |
| 11592 | 11592 | } |
| 11593 | 11593 | |
@@ -11595,7 +11595,7 @@ discard block |
||
| 11595 | 11595 | // fallback via vanilla php |
| 11596 | 11596 | // |
| 11597 | 11597 | |
| 11598 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
| 11598 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
| 11599 | 11599 | |
| 11600 | 11600 | if (!isset($match[1])) { |
| 11601 | 11601 | return false; |
@@ -11605,7 +11605,7 @@ discard block |
||
| 11605 | 11605 | return $match[1]; |
| 11606 | 11606 | } |
| 11607 | 11607 | |
| 11608 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
| 11608 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
| 11609 | 11609 | } |
| 11610 | 11610 | |
| 11611 | 11611 | /** |
@@ -11735,7 +11735,7 @@ discard block |
||
| 11735 | 11735 | bool $try_to_keep_the_string_length = false |
| 11736 | 11736 | ): string { |
| 11737 | 11737 | // init |
| 11738 | - $str = (string) $str; |
|
| 11738 | + $str = (string)$str; |
|
| 11739 | 11739 | |
| 11740 | 11740 | if ($str === '') { |
| 11741 | 11741 | return ''; |
@@ -11764,25 +11764,25 @@ discard block |
||
| 11764 | 11764 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 11765 | 11765 | } |
| 11766 | 11766 | |
| 11767 | - $language_code = $lang . '-Lower'; |
|
| 11767 | + $language_code = $lang.'-Lower'; |
|
| 11768 | 11768 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 11769 | 11769 | /** |
| 11770 | 11770 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11771 | 11771 | */ |
| 11772 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
| 11772 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
| 11773 | 11773 | |
| 11774 | 11774 | $language_code = 'Any-Lower'; |
| 11775 | 11775 | } |
| 11776 | 11776 | |
| 11777 | 11777 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 11778 | 11778 | /** @noinspection UnnecessaryCastingInspection */ |
| 11779 | - return (string) \transliterator_transliterate($language_code, $str); |
|
| 11779 | + return (string)\transliterator_transliterate($language_code, $str); |
|
| 11780 | 11780 | } |
| 11781 | 11781 | |
| 11782 | 11782 | /** |
| 11783 | 11783 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11784 | 11784 | */ |
| 11785 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
| 11785 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
| 11786 | 11786 | } |
| 11787 | 11787 | |
| 11788 | 11788 | // always fallback via symfony polyfill |
@@ -11817,7 +11817,7 @@ discard block |
||
| 11817 | 11817 | bool $try_to_keep_the_string_length = false |
| 11818 | 11818 | ): string { |
| 11819 | 11819 | // init |
| 11820 | - $str = (string) $str; |
|
| 11820 | + $str = (string)$str; |
|
| 11821 | 11821 | |
| 11822 | 11822 | if ($str === '') { |
| 11823 | 11823 | return ''; |
@@ -11846,25 +11846,25 @@ discard block |
||
| 11846 | 11846 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 11847 | 11847 | } |
| 11848 | 11848 | |
| 11849 | - $language_code = $lang . '-Upper'; |
|
| 11849 | + $language_code = $lang.'-Upper'; |
|
| 11850 | 11850 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 11851 | 11851 | /** |
| 11852 | 11852 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11853 | 11853 | */ |
| 11854 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
| 11854 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
| 11855 | 11855 | |
| 11856 | 11856 | $language_code = 'Any-Upper'; |
| 11857 | 11857 | } |
| 11858 | 11858 | |
| 11859 | 11859 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 11860 | 11860 | /** @noinspection UnnecessaryCastingInspection */ |
| 11861 | - return (string) \transliterator_transliterate($language_code, $str); |
|
| 11861 | + return (string)\transliterator_transliterate($language_code, $str); |
|
| 11862 | 11862 | } |
| 11863 | 11863 | |
| 11864 | 11864 | /** |
| 11865 | 11865 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11866 | 11866 | */ |
| 11867 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
| 11867 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
| 11868 | 11868 | } |
| 11869 | 11869 | |
| 11870 | 11870 | // always fallback via symfony polyfill |
@@ -11928,7 +11928,7 @@ discard block |
||
| 11928 | 11928 | $from = \array_combine($from, $to); |
| 11929 | 11929 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 11930 | 11930 | if ($from === false) { |
| 11931 | - 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) . ')'); |
|
| 11931 | + 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).')'); |
|
| 11932 | 11932 | } |
| 11933 | 11933 | } |
| 11934 | 11934 | |
@@ -11994,9 +11994,9 @@ discard block |
||
| 11994 | 11994 | } |
| 11995 | 11995 | |
| 11996 | 11996 | $wide = 0; |
| 11997 | - $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); |
|
| 11997 | + $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); |
|
| 11998 | 11998 | |
| 11999 | - return ($wide << 1) + (int) self::strlen($str); |
|
| 11999 | + return ($wide << 1) + (int)self::strlen($str); |
|
| 12000 | 12000 | } |
| 12001 | 12001 | |
| 12002 | 12002 | /** |
@@ -12105,7 +12105,7 @@ discard block |
||
| 12105 | 12105 | /** |
| 12106 | 12106 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 12107 | 12107 | */ |
| 12108 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 12108 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 12109 | 12109 | } |
| 12110 | 12110 | |
| 12111 | 12111 | // |
@@ -12200,16 +12200,16 @@ discard block |
||
| 12200 | 12200 | ) { |
| 12201 | 12201 | if ($encoding === 'UTF-8') { |
| 12202 | 12202 | if ($length === null) { |
| 12203 | - $str1 = (string) \mb_substr($str1, $offset); |
|
| 12203 | + $str1 = (string)\mb_substr($str1, $offset); |
|
| 12204 | 12204 | } else { |
| 12205 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
| 12205 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
| 12206 | 12206 | } |
| 12207 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
| 12207 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
| 12208 | 12208 | } else { |
| 12209 | 12209 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 12210 | 12210 | |
| 12211 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
| 12212 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
| 12211 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
| 12212 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
| 12213 | 12213 | } |
| 12214 | 12214 | } |
| 12215 | 12215 | |
@@ -12288,9 +12288,9 @@ discard block |
||
| 12288 | 12288 | } |
| 12289 | 12289 | |
| 12290 | 12290 | if ($encoding === 'UTF-8') { |
| 12291 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
| 12291 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
| 12292 | 12292 | } else { |
| 12293 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
| 12293 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
| 12294 | 12294 | } |
| 12295 | 12295 | } |
| 12296 | 12296 | |
@@ -12302,7 +12302,7 @@ discard block |
||
| 12302 | 12302 | /** |
| 12303 | 12303 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 12304 | 12304 | */ |
| 12305 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 12305 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 12306 | 12306 | } |
| 12307 | 12307 | |
| 12308 | 12308 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -12313,7 +12313,7 @@ discard block |
||
| 12313 | 12313 | return \mb_substr_count($haystack, $needle, $encoding); |
| 12314 | 12314 | } |
| 12315 | 12315 | |
| 12316 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 12316 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 12317 | 12317 | |
| 12318 | 12318 | return \count($matches); |
| 12319 | 12319 | } |
@@ -12385,7 +12385,7 @@ discard block |
||
| 12385 | 12385 | if ($haystack_tmp === false) { |
| 12386 | 12386 | $haystack_tmp = ''; |
| 12387 | 12387 | } |
| 12388 | - $haystack = (string) $haystack_tmp; |
|
| 12388 | + $haystack = (string)$haystack_tmp; |
|
| 12389 | 12389 | } |
| 12390 | 12390 | |
| 12391 | 12391 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -12426,10 +12426,10 @@ discard block |
||
| 12426 | 12426 | |
| 12427 | 12427 | if ($encoding === 'UTF-8') { |
| 12428 | 12428 | if ($case_sensitive) { |
| 12429 | - return (int) \mb_substr_count($str, $substring); |
|
| 12429 | + return (int)\mb_substr_count($str, $substring); |
|
| 12430 | 12430 | } |
| 12431 | 12431 | |
| 12432 | - return (int) \mb_substr_count( |
|
| 12432 | + return (int)\mb_substr_count( |
|
| 12433 | 12433 | \mb_strtoupper($str), |
| 12434 | 12434 | \mb_strtoupper($substring) |
| 12435 | 12435 | ); |
@@ -12438,10 +12438,10 @@ discard block |
||
| 12438 | 12438 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 12439 | 12439 | |
| 12440 | 12440 | if ($case_sensitive) { |
| 12441 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
| 12441 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
| 12442 | 12442 | } |
| 12443 | 12443 | |
| 12444 | - return (int) \mb_substr_count( |
|
| 12444 | + return (int)\mb_substr_count( |
|
| 12445 | 12445 | self::strtocasefold($str, true, false, $encoding, null, false), |
| 12446 | 12446 | self::strtocasefold($substring, true, false, $encoding, null, false), |
| 12447 | 12447 | $encoding |
@@ -12475,7 +12475,7 @@ discard block |
||
| 12475 | 12475 | } |
| 12476 | 12476 | |
| 12477 | 12477 | if (self::str_istarts_with($haystack, $needle)) { |
| 12478 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 12478 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 12479 | 12479 | } |
| 12480 | 12480 | |
| 12481 | 12481 | return $haystack; |
@@ -12542,7 +12542,7 @@ discard block |
||
| 12542 | 12542 | } |
| 12543 | 12543 | |
| 12544 | 12544 | if (self::str_iends_with($haystack, $needle)) { |
| 12545 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
| 12545 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
| 12546 | 12546 | } |
| 12547 | 12547 | |
| 12548 | 12548 | return $haystack; |
@@ -12575,7 +12575,7 @@ discard block |
||
| 12575 | 12575 | } |
| 12576 | 12576 | |
| 12577 | 12577 | if (self::str_starts_with($haystack, $needle)) { |
| 12578 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 12578 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 12579 | 12579 | } |
| 12580 | 12580 | |
| 12581 | 12581 | return $haystack; |
@@ -12636,7 +12636,7 @@ discard block |
||
| 12636 | 12636 | if (\is_array($offset)) { |
| 12637 | 12637 | $offset = \array_slice($offset, 0, $num); |
| 12638 | 12638 | foreach ($offset as &$value_tmp) { |
| 12639 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
| 12639 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
| 12640 | 12640 | } |
| 12641 | 12641 | unset($value_tmp); |
| 12642 | 12642 | } else { |
@@ -12649,7 +12649,7 @@ discard block |
||
| 12649 | 12649 | } elseif (\is_array($length)) { |
| 12650 | 12650 | $length = \array_slice($length, 0, $num); |
| 12651 | 12651 | foreach ($length as &$value_tmp_V2) { |
| 12652 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
| 12652 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
| 12653 | 12653 | } |
| 12654 | 12654 | unset($value_tmp_V2); |
| 12655 | 12655 | } else { |
@@ -12670,8 +12670,8 @@ discard block |
||
| 12670 | 12670 | } |
| 12671 | 12671 | |
| 12672 | 12672 | // init |
| 12673 | - $str = (string) $str; |
|
| 12674 | - $replacement = (string) $replacement; |
|
| 12673 | + $str = (string)$str; |
|
| 12674 | + $replacement = (string)$replacement; |
|
| 12675 | 12675 | |
| 12676 | 12676 | if (\is_array($length)) { |
| 12677 | 12677 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -12686,16 +12686,16 @@ discard block |
||
| 12686 | 12686 | } |
| 12687 | 12687 | |
| 12688 | 12688 | if (self::$SUPPORT['mbstring'] === true) { |
| 12689 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 12689 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 12690 | 12690 | |
| 12691 | 12691 | if ($offset < 0) { |
| 12692 | - $offset = (int) \max(0, $string_length + $offset); |
|
| 12692 | + $offset = (int)\max(0, $string_length + $offset); |
|
| 12693 | 12693 | } elseif ($offset > $string_length) { |
| 12694 | 12694 | $offset = $string_length; |
| 12695 | 12695 | } |
| 12696 | 12696 | |
| 12697 | 12697 | if ($length !== null && $length < 0) { |
| 12698 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
| 12698 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
| 12699 | 12699 | } elseif ($length === null || $length > $string_length) { |
| 12700 | 12700 | $length = $string_length; |
| 12701 | 12701 | } |
@@ -12706,9 +12706,9 @@ discard block |
||
| 12706 | 12706 | } |
| 12707 | 12707 | |
| 12708 | 12708 | /** @noinspection AdditionOperationOnArraysInspection */ |
| 12709 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
| 12710 | - $replacement . |
|
| 12711 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 12709 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
| 12710 | + $replacement. |
|
| 12711 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 12712 | 12712 | } |
| 12713 | 12713 | |
| 12714 | 12714 | // |
@@ -12717,8 +12717,7 @@ discard block |
||
| 12717 | 12717 | |
| 12718 | 12718 | if (ASCII::is_ascii($str)) { |
| 12719 | 12719 | return ($length === null) ? |
| 12720 | - \substr_replace($str, $replacement, $offset) : |
|
| 12721 | - \substr_replace($str, $replacement, $offset, $length); |
|
| 12720 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
| 12722 | 12721 | } |
| 12723 | 12722 | |
| 12724 | 12723 | // |
@@ -12777,14 +12776,14 @@ discard block |
||
| 12777 | 12776 | && |
| 12778 | 12777 | \substr($haystack, -\strlen($needle)) === $needle |
| 12779 | 12778 | ) { |
| 12780 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
| 12779 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
| 12781 | 12780 | } |
| 12782 | 12781 | |
| 12783 | 12782 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
| 12784 | - return (string) self::substr( |
|
| 12783 | + return (string)self::substr( |
|
| 12785 | 12784 | $haystack, |
| 12786 | 12785 | 0, |
| 12787 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
| 12786 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
| 12788 | 12787 | $encoding |
| 12789 | 12788 | ); |
| 12790 | 12789 | } |
@@ -12819,10 +12818,10 @@ discard block |
||
| 12819 | 12818 | } |
| 12820 | 12819 | |
| 12821 | 12820 | if ($encoding === 'UTF-8') { |
| 12822 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 12821 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 12823 | 12822 | } |
| 12824 | 12823 | |
| 12825 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 12824 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 12826 | 12825 | } |
| 12827 | 12826 | |
| 12828 | 12827 | /** |
@@ -13034,7 +13033,7 @@ discard block |
||
| 13034 | 13033 | public static function to_boolean($str): bool |
| 13035 | 13034 | { |
| 13036 | 13035 | // init |
| 13037 | - $str = (string) $str; |
|
| 13036 | + $str = (string)$str; |
|
| 13038 | 13037 | |
| 13039 | 13038 | if ($str === '') { |
| 13040 | 13039 | return false; |
@@ -13062,10 +13061,10 @@ discard block |
||
| 13062 | 13061 | } |
| 13063 | 13062 | |
| 13064 | 13063 | if (\is_numeric($str)) { |
| 13065 | - return ((float) $str) > 0; |
|
| 13064 | + return ((float)$str) > 0; |
|
| 13066 | 13065 | } |
| 13067 | 13066 | |
| 13068 | - return (bool) \trim($str); |
|
| 13067 | + return (bool)\trim($str); |
|
| 13069 | 13068 | } |
| 13070 | 13069 | |
| 13071 | 13070 | /** |
@@ -13117,7 +13116,7 @@ discard block |
||
| 13117 | 13116 | return $str; |
| 13118 | 13117 | } |
| 13119 | 13118 | |
| 13120 | - $str = (string) $str; |
|
| 13119 | + $str = (string)$str; |
|
| 13121 | 13120 | if ($str === '') { |
| 13122 | 13121 | return ''; |
| 13123 | 13122 | } |
@@ -13226,7 +13225,7 @@ discard block |
||
| 13226 | 13225 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
| 13227 | 13226 | |
| 13228 | 13227 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 13229 | - $buf .= $c1 . $c2; |
|
| 13228 | + $buf .= $c1.$c2; |
|
| 13230 | 13229 | ++$i; |
| 13231 | 13230 | } else { // not valid UTF8 - convert it |
| 13232 | 13231 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13237,7 +13236,7 @@ discard block |
||
| 13237 | 13236 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
| 13238 | 13237 | |
| 13239 | 13238 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 13240 | - $buf .= $c1 . $c2 . $c3; |
|
| 13239 | + $buf .= $c1.$c2.$c3; |
|
| 13241 | 13240 | $i += 2; |
| 13242 | 13241 | } else { // not valid UTF8 - convert it |
| 13243 | 13242 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13249,7 +13248,7 @@ discard block |
||
| 13249 | 13248 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
| 13250 | 13249 | |
| 13251 | 13250 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 13252 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
| 13251 | + $buf .= $c1.$c2.$c3.$c4; |
|
| 13253 | 13252 | $i += 3; |
| 13254 | 13253 | } else { // not valid UTF8 - convert it |
| 13255 | 13254 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13277,13 +13276,13 @@ discard block |
||
| 13277 | 13276 | * |
| 13278 | 13277 | * @return string |
| 13279 | 13278 | */ |
| 13280 | - static function (array $matches): string { |
|
| 13279 | + static function(array $matches): string { |
|
| 13281 | 13280 | if (isset($matches[3])) { |
| 13282 | - $cp = (int) \hexdec($matches[3]); |
|
| 13281 | + $cp = (int)\hexdec($matches[3]); |
|
| 13283 | 13282 | } else { |
| 13284 | 13283 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
| 13285 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
| 13286 | - + (int) \hexdec($matches[2]) |
|
| 13284 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
| 13285 | + + (int)\hexdec($matches[2]) |
|
| 13287 | 13286 | + 0x10000 |
| 13288 | 13287 | - (0xD800 << 10) |
| 13289 | 13288 | - 0xDC00; |
@@ -13294,12 +13293,12 @@ discard block |
||
| 13294 | 13293 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
| 13295 | 13294 | |
| 13296 | 13295 | if ($cp < 0x80) { |
| 13297 | - return (string) self::chr($cp); |
|
| 13296 | + return (string)self::chr($cp); |
|
| 13298 | 13297 | } |
| 13299 | 13298 | |
| 13300 | 13299 | if ($cp < 0xA0) { |
| 13301 | 13300 | /** @noinspection UnnecessaryCastingInspection */ |
| 13302 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
| 13301 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
| 13303 | 13302 | } |
| 13304 | 13303 | |
| 13305 | 13304 | return self::decimal_to_chr($cp); |
@@ -13332,7 +13331,7 @@ discard block |
||
| 13332 | 13331 | public static function to_int(string $str) |
| 13333 | 13332 | { |
| 13334 | 13333 | if (\is_numeric($str)) { |
| 13335 | - return (int) $str; |
|
| 13334 | + return (int)$str; |
|
| 13336 | 13335 | } |
| 13337 | 13336 | |
| 13338 | 13337 | return null; |
@@ -13367,7 +13366,7 @@ discard block |
||
| 13367 | 13366 | || |
| 13368 | 13367 | $input_type === 'double' |
| 13369 | 13368 | ) { |
| 13370 | - return (string) $input; |
|
| 13369 | + return (string)$input; |
|
| 13371 | 13370 | } |
| 13372 | 13371 | |
| 13373 | 13372 | if ($input_type === 'object') { |
@@ -13377,7 +13376,7 @@ discard block |
||
| 13377 | 13376 | /** @noinspection NestedPositiveIfStatementsInspection */ |
| 13378 | 13377 | /** @noinspection MissingOrEmptyGroupStatementInspection */ |
| 13379 | 13378 | if (\method_exists($input, '__toString')) { |
| 13380 | - return (string) $input; |
|
| 13379 | + return (string)$input; |
|
| 13381 | 13380 | } |
| 13382 | 13381 | } |
| 13383 | 13382 | |
@@ -13418,7 +13417,7 @@ discard block |
||
| 13418 | 13417 | } |
| 13419 | 13418 | |
| 13420 | 13419 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 13421 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 13420 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 13422 | 13421 | } |
| 13423 | 13422 | |
| 13424 | 13423 | if ($chars !== null) { |
@@ -13469,15 +13468,15 @@ discard block |
||
| 13469 | 13468 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 13470 | 13469 | |
| 13471 | 13470 | if ($encoding === 'UTF-8') { |
| 13472 | - $str_part_two = (string) \mb_substr($str, 1); |
|
| 13471 | + $str_part_two = (string)\mb_substr($str, 1); |
|
| 13473 | 13472 | |
| 13474 | 13473 | if ($use_mb_functions) { |
| 13475 | 13474 | $str_part_one = \mb_strtoupper( |
| 13476 | - (string) \mb_substr($str, 0, 1) |
|
| 13475 | + (string)\mb_substr($str, 0, 1) |
|
| 13477 | 13476 | ); |
| 13478 | 13477 | } else { |
| 13479 | 13478 | $str_part_one = self::strtoupper( |
| 13480 | - (string) \mb_substr($str, 0, 1), |
|
| 13479 | + (string)\mb_substr($str, 0, 1), |
|
| 13481 | 13480 | $encoding, |
| 13482 | 13481 | false, |
| 13483 | 13482 | $lang, |
@@ -13487,16 +13486,16 @@ discard block |
||
| 13487 | 13486 | } else { |
| 13488 | 13487 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 13489 | 13488 | |
| 13490 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
| 13489 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
| 13491 | 13490 | |
| 13492 | 13491 | if ($use_mb_functions) { |
| 13493 | 13492 | $str_part_one = \mb_strtoupper( |
| 13494 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
| 13493 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
| 13495 | 13494 | $encoding |
| 13496 | 13495 | ); |
| 13497 | 13496 | } else { |
| 13498 | 13497 | $str_part_one = self::strtoupper( |
| 13499 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 13498 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 13500 | 13499 | $encoding, |
| 13501 | 13500 | false, |
| 13502 | 13501 | $lang, |
@@ -13505,7 +13504,7 @@ discard block |
||
| 13505 | 13504 | } |
| 13506 | 13505 | } |
| 13507 | 13506 | |
| 13508 | - return $str_part_one . $str_part_two; |
|
| 13507 | + return $str_part_one.$str_part_two; |
|
| 13509 | 13508 | } |
| 13510 | 13509 | |
| 13511 | 13510 | /** |
@@ -13566,7 +13565,7 @@ discard block |
||
| 13566 | 13565 | $str = self::clean($str); |
| 13567 | 13566 | } |
| 13568 | 13567 | |
| 13569 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
| 13568 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
| 13570 | 13569 | |
| 13571 | 13570 | if ( |
| 13572 | 13571 | $use_php_default_functions |
@@ -13967,7 +13966,7 @@ discard block |
||
| 13967 | 13966 | if ( |
| 13968 | 13967 | $keep_utf8_chars |
| 13969 | 13968 | && |
| 13970 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
| 13969 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
| 13971 | 13970 | ) { |
| 13972 | 13971 | return $str_backup; |
| 13973 | 13972 | } |
@@ -14058,17 +14057,17 @@ discard block |
||
| 14058 | 14057 | return ''; |
| 14059 | 14058 | } |
| 14060 | 14059 | |
| 14061 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
| 14060 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
| 14062 | 14061 | |
| 14063 | 14062 | if ( |
| 14064 | 14063 | !isset($matches[0]) |
| 14065 | 14064 | || |
| 14066 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
| 14065 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
| 14067 | 14066 | ) { |
| 14068 | 14067 | return $str; |
| 14069 | 14068 | } |
| 14070 | 14069 | |
| 14071 | - return \rtrim($matches[0]) . $str_add_on; |
|
| 14070 | + return \rtrim($matches[0]).$str_add_on; |
|
| 14072 | 14071 | } |
| 14073 | 14072 | |
| 14074 | 14073 | /** |
@@ -14164,7 +14163,7 @@ discard block |
||
| 14164 | 14163 | } |
| 14165 | 14164 | } |
| 14166 | 14165 | |
| 14167 | - return $str_return . \implode('', $charsArray); |
|
| 14166 | + return $str_return.\implode('', $charsArray); |
|
| 14168 | 14167 | } |
| 14169 | 14168 | |
| 14170 | 14169 | /** |
@@ -14218,7 +14217,7 @@ discard block |
||
| 14218 | 14217 | $final_break = ''; |
| 14219 | 14218 | } |
| 14220 | 14219 | |
| 14221 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
| 14220 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
| 14222 | 14221 | } |
| 14223 | 14222 | |
| 14224 | 14223 | /** |
@@ -14460,7 +14459,7 @@ discard block |
||
| 14460 | 14459 | /** @noinspection PhpIncludeInspection */ |
| 14461 | 14460 | /** @noinspection UsingInclusionReturnValueInspection */ |
| 14462 | 14461 | /** @psalm-suppress UnresolvableInclude */ |
| 14463 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
| 14462 | + return include __DIR__.'/data/'.$file.'.php'; |
|
| 14464 | 14463 | } |
| 14465 | 14464 | |
| 14466 | 14465 | /** |
@@ -14480,7 +14479,7 @@ discard block |
||
| 14480 | 14479 | */ |
| 14481 | 14480 | \uksort( |
| 14482 | 14481 | self::$EMOJI, |
| 14483 | - static function (string $a, string $b): int { |
|
| 14482 | + static function(string $a, string $b): int { |
|
| 14484 | 14483 | return \strlen($b) <=> \strlen($a); |
| 14485 | 14484 | } |
| 14486 | 14485 | ); |
@@ -14490,7 +14489,7 @@ discard block |
||
| 14490 | 14489 | |
| 14491 | 14490 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
| 14492 | 14491 | $tmp_key = \crc32($key); |
| 14493 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
| 14492 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
| 14494 | 14493 | } |
| 14495 | 14494 | |
| 14496 | 14495 | return true; |
@@ -14518,7 +14517,7 @@ discard block |
||
| 14518 | 14517 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 14519 | 14518 | return \defined('MB_OVERLOAD_STRING') |
| 14520 | 14519 | && |
| 14521 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 14520 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 14522 | 14521 | } |
| 14523 | 14522 | |
| 14524 | 14523 | /** |
@@ -14584,7 +14583,7 @@ discard block |
||
| 14584 | 14583 | */ |
| 14585 | 14584 | static $RX_CLASS_CACHE = []; |
| 14586 | 14585 | |
| 14587 | - $cache_key = $s . '_' . $class; |
|
| 14586 | + $cache_key = $s.'_'.$class; |
|
| 14588 | 14587 | |
| 14589 | 14588 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
| 14590 | 14589 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -14596,7 +14595,7 @@ discard block |
||
| 14596 | 14595 | /** @noinspection AlterInForeachInspection */ |
| 14597 | 14596 | foreach (self::str_split($s) as &$s) { |
| 14598 | 14597 | if ($s === '-') { |
| 14599 | - $class_array[0] = '-' . $class_array[0]; |
|
| 14598 | + $class_array[0] = '-'.$class_array[0]; |
|
| 14600 | 14599 | } elseif (!isset($s[2])) { |
| 14601 | 14600 | $class_array[0] .= \preg_quote($s, '/'); |
| 14602 | 14601 | } elseif (self::strlen($s) === 1) { |
@@ -14607,13 +14606,13 @@ discard block |
||
| 14607 | 14606 | } |
| 14608 | 14607 | |
| 14609 | 14608 | if ($class_array[0]) { |
| 14610 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
| 14609 | + $class_array[0] = '['.$class_array[0].']'; |
|
| 14611 | 14610 | } |
| 14612 | 14611 | |
| 14613 | 14612 | if (\count($class_array) === 1) { |
| 14614 | 14613 | $return = $class_array[0]; |
| 14615 | 14614 | } else { |
| 14616 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
| 14615 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
| 14617 | 14616 | } |
| 14618 | 14617 | |
| 14619 | 14618 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -14694,7 +14693,7 @@ discard block |
||
| 14694 | 14693 | |
| 14695 | 14694 | if ($delimiter === '-') { |
| 14696 | 14695 | /** @noinspection AlterInForeachInspection */ |
| 14697 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
| 14696 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
| 14698 | 14697 | if (\strncmp($name, $beginning, \strlen($beginning)) === 0) { |
| 14699 | 14698 | $continue = true; |
| 14700 | 14699 | |
@@ -14704,7 +14703,7 @@ discard block |
||
| 14704 | 14703 | } |
| 14705 | 14704 | |
| 14706 | 14705 | /** @noinspection AlterInForeachInspection */ |
| 14707 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
| 14706 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
| 14708 | 14707 | if (\strncmp($name, $beginning, \strlen($beginning)) === 0) { |
| 14709 | 14708 | $continue = true; |
| 14710 | 14709 | |
@@ -14779,8 +14778,8 @@ discard block |
||
| 14779 | 14778 | } else { |
| 14780 | 14779 | /** @noinspection OffsetOperationsInspection */ |
| 14781 | 14780 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
| 14782 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
| 14783 | - $buf .= $cc1 . $cc2; |
|
| 14781 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
| 14782 | + $buf .= $cc1.$cc2; |
|
| 14784 | 14783 | } |
| 14785 | 14784 | |
| 14786 | 14785 | return $buf; |
@@ -14803,7 +14802,7 @@ discard block |
||
| 14803 | 14802 | |
| 14804 | 14803 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
| 14805 | 14804 | if (\preg_match($pattern, $str)) { |
| 14806 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
| 14805 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
| 14807 | 14806 | } |
| 14808 | 14807 | |
| 14809 | 14808 | return $str; |
@@ -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); |
|