@@ -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 => "\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 => "\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 | ]; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | return false; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - $uri = (string) $_SERVER['REQUEST_URI']; |
|
| 73 | + $uri = (string)$_SERVER['REQUEST_URI']; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | $uriOrig = $uri; |
@@ -87,27 +87,27 @@ discard block |
||
| 87 | 87 | // When not, assumes Windows-1252 and redirects to the corresponding UTF-8 encoded URL |
| 88 | 88 | // |
| 89 | 89 | |
| 90 | - $uri = (string) \preg_replace_callback( |
|
| 90 | + $uri = (string)\preg_replace_callback( |
|
| 91 | 91 | '/[\x80-\xFF]+/', |
| 92 | 92 | /** |
| 93 | 93 | * @param array $m |
| 94 | 94 | * |
| 95 | 95 | * @return string |
| 96 | 96 | */ |
| 97 | - static function (array $m): string { |
|
| 97 | + static function(array $m): string { |
|
| 98 | 98 | return \rawurlencode($m[0]); |
| 99 | 99 | }, |
| 100 | 100 | $uri |
| 101 | 101 | ); |
| 102 | 102 | |
| 103 | - $uri = (string) \preg_replace_callback( |
|
| 103 | + $uri = (string)\preg_replace_callback( |
|
| 104 | 104 | '/(?:%[89A-F][0-9A-F])+/i', |
| 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(UTF8::rawurldecode($m[0])); |
| 112 | 112 | }, |
| 113 | 113 | $uri |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | ) { |
| 123 | 123 | // Use ob_start() to buffer content and avoid problem of headers already sent... |
| 124 | 124 | $severProtocol = ($_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'); |
| 125 | - \header($severProtocol . ' 301 Moved Permanently'); |
|
| 126 | - \header('Location: ' . $uri); |
|
| 125 | + \header($severProtocol.' 301 Moved Permanently'); |
|
| 126 | + \header('Location: '.$uri); |
|
| 127 | 127 | exit(); |
| 128 | 128 | } |
| 129 | 129 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | return false; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - $length = (int) $length; |
|
| 163 | + $length = (int)$length; |
|
| 164 | 164 | |
| 165 | 165 | if ($length <= 0) { |
| 166 | 166 | return false; |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | { |
| 192 | 192 | static $_IS_PHP; |
| 193 | 193 | |
| 194 | - $version = (string) $version; |
|
| 194 | + $version = (string)$version; |
|
| 195 | 195 | |
| 196 | 196 | if (!isset($_IS_PHP[$version])) { |
| 197 | 197 | $_IS_PHP[$version] = \version_compare(\PHP_VERSION, $version, '>='); |
@@ -260,10 +260,10 @@ discard block |
||
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | if ($encoding === 'UTF-8') { |
| 263 | - return (string) \mb_substr($str, $pos, 1); |
|
| 263 | + return (string)\mb_substr($str, $pos, 1); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
| 266 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | /** |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | public static function add_bom_to_string(string $str): string |
| 279 | 279 | { |
| 280 | 280 | if (self::string_has_bom($str) === false) { |
| 281 | - $str = self::bom() . $str; |
|
| 281 | + $str = self::bom().$str; |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | return $str; |
@@ -307,8 +307,8 @@ discard block |
||
| 307 | 307 | $return = []; |
| 308 | 308 | foreach ($array as $key => &$value) { |
| 309 | 309 | $key = $case === \CASE_LOWER |
| 310 | - ? self::strtolower((string) $key, $encoding) |
|
| 311 | - : self::strtoupper((string) $key, $encoding); |
|
| 310 | + ? self::strtolower((string)$key, $encoding) |
|
| 311 | + : self::strtoupper((string)$key, $encoding); |
|
| 312 | 312 | |
| 313 | 313 | $return[$key] = $value; |
| 314 | 314 | } |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | return ''; |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - $substrIndex = $posStart + (int) \mb_strlen($start); |
|
| 345 | + $substrIndex = $posStart + (int)\mb_strlen($start); |
|
| 346 | 346 | $posEnd = \mb_strpos($str, $end, $substrIndex); |
| 347 | 347 | if ( |
| 348 | 348 | $posEnd === false |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | return ''; |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | - return (string) \mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
| 355 | + return (string)\mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | return ''; |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | - $substrIndex = $posStart + (int) self::strlen($start, $encoding); |
|
| 365 | + $substrIndex = $posStart + (int)self::strlen($start, $encoding); |
|
| 366 | 366 | $posEnd = self::strpos($str, $end, $substrIndex, $encoding); |
| 367 | 367 | if ( |
| 368 | 368 | $posEnd === false |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | return ''; |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | - return (string) self::substr( |
|
| 375 | + return (string)self::substr( |
|
| 376 | 376 | $str, |
| 377 | 377 | $substrIndex, |
| 378 | 378 | $posEnd - $substrIndex, |
@@ -440,10 +440,10 @@ discard block |
||
| 440 | 440 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
| 441 | 441 | { |
| 442 | 442 | if ($encoding === 'UTF-8') { |
| 443 | - return (string) \mb_substr($str, $index, 1); |
|
| 443 | + return (string)\mb_substr($str, $index, 1); |
|
| 444 | 444 | } |
| 445 | 445 | |
| 446 | - return (string) self::substr($str, $index, 1, $encoding); |
|
| 446 | + return (string)self::substr($str, $index, 1, $encoding); |
|
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | /** |
@@ -542,10 +542,10 @@ discard block |
||
| 542 | 542 | && |
| 543 | 543 | self::$SUPPORT['mbstring'] === false |
| 544 | 544 | ) { |
| 545 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 545 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 546 | 546 | } |
| 547 | 547 | |
| 548 | - $cacheKey = $code_point . $encoding; |
|
| 548 | + $cacheKey = $code_point.$encoding; |
|
| 549 | 549 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
| 550 | 550 | return $CHAR_CACHE[$cacheKey]; |
| 551 | 551 | } |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | if ($code_point <= 127) { // use "simple"-char only until "\x80" |
| 554 | 554 | |
| 555 | 555 | if (self::$CHR === null) { |
| 556 | - self::$CHR = (array) self::getData('chr'); |
|
| 556 | + self::$CHR = (array)self::getData('chr'); |
|
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | /** |
@@ -588,10 +588,10 @@ discard block |
||
| 588 | 588 | // |
| 589 | 589 | |
| 590 | 590 | if (self::$CHR === null) { |
| 591 | - self::$CHR = (array) self::getData('chr'); |
|
| 591 | + self::$CHR = (array)self::getData('chr'); |
|
| 592 | 592 | } |
| 593 | 593 | |
| 594 | - $code_point = (int) $code_point; |
|
| 594 | + $code_point = (int)$code_point; |
|
| 595 | 595 | if ($code_point <= 0x7F) { |
| 596 | 596 | /** |
| 597 | 597 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -601,22 +601,22 @@ discard block |
||
| 601 | 601 | /** |
| 602 | 602 | * @psalm-suppress PossiblyNullArrayAccess |
| 603 | 603 | */ |
| 604 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
| 604 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
| 605 | 605 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 606 | 606 | } elseif ($code_point <= 0xFFFF) { |
| 607 | 607 | /** |
| 608 | 608 | * @psalm-suppress PossiblyNullArrayAccess |
| 609 | 609 | */ |
| 610 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
| 611 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 610 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
| 611 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 612 | 612 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 613 | 613 | } else { |
| 614 | 614 | /** |
| 615 | 615 | * @psalm-suppress PossiblyNullArrayAccess |
| 616 | 616 | */ |
| 617 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
| 618 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 619 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 617 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
| 618 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
| 619 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 620 | 620 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 621 | 621 | } |
| 622 | 622 | |
@@ -663,7 +663,7 @@ discard block |
||
| 663 | 663 | |
| 664 | 664 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
| 665 | 665 | return \array_map( |
| 666 | - static function (string $data): int { |
|
| 666 | + static function(string $data): int { |
|
| 667 | 667 | // "mb_" is available if overload is used, so use it ... |
| 668 | 668 | return \mb_strlen($data, 'CP850'); // 8-BIT |
| 669 | 669 | }, |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | $char = ''; |
| 732 | 732 | } |
| 733 | 733 | |
| 734 | - return self::int_to_hex(self::ord((string) $char), $pfix); |
|
| 734 | + return self::int_to_hex(self::ord((string)$char), $pfix); |
|
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | /** |
@@ -805,7 +805,7 @@ discard block |
||
| 805 | 805 | | ( [\x80-\xBF] ) # invalid byte in range 10000000 - 10111111 |
| 806 | 806 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
| 807 | 807 | /x'; |
| 808 | - $str = (string) \preg_replace($regx, '$1', $str); |
|
| 808 | + $str = (string)\preg_replace($regx, '$1', $str); |
|
| 809 | 809 | |
| 810 | 810 | if ($replace_diamond_question_mark === true) { |
| 811 | 811 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -840,7 +840,7 @@ discard block |
||
| 840 | 840 | public static function cleanup($str): string |
| 841 | 841 | { |
| 842 | 842 | // init |
| 843 | - $str = (string) $str; |
|
| 843 | + $str = (string)$str; |
|
| 844 | 844 | |
| 845 | 845 | if ($str === '') { |
| 846 | 846 | return ''; |
@@ -923,7 +923,7 @@ discard block |
||
| 923 | 923 | { |
| 924 | 924 | if (self::$SUPPORT['mbstring'] === true) { |
| 925 | 925 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 926 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 926 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 927 | 927 | } |
| 928 | 928 | |
| 929 | 929 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -963,7 +963,7 @@ discard block |
||
| 963 | 963 | */ |
| 964 | 964 | public static function css_stripe_media_queries(string $str): string |
| 965 | 965 | { |
| 966 | - return (string) \preg_replace( |
|
| 966 | + return (string)\preg_replace( |
|
| 967 | 967 | '#@media\\s+(?:only\\s)?(?:[\\s{\\(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
| 968 | 968 | '', |
| 969 | 969 | $str |
@@ -990,7 +990,7 @@ discard block |
||
| 990 | 990 | */ |
| 991 | 991 | public static function decimal_to_chr($int): string |
| 992 | 992 | { |
| 993 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
| 993 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
| 994 | 994 | } |
| 995 | 995 | |
| 996 | 996 | /** |
@@ -1069,7 +1069,7 @@ discard block |
||
| 1069 | 1069 | if ($toEncoding === 'JSON') { |
| 1070 | 1070 | $return = self::json_encode($str); |
| 1071 | 1071 | if ($return === false) { |
| 1072 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
| 1072 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
| 1073 | 1073 | } |
| 1074 | 1074 | |
| 1075 | 1075 | return $return; |
@@ -1155,7 +1155,7 @@ discard block |
||
| 1155 | 1155 | && |
| 1156 | 1156 | self::$SUPPORT['mbstring'] === false |
| 1157 | 1157 | ) { |
| 1158 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $toEncoding . '" encoding', \E_USER_WARNING); |
|
| 1158 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$toEncoding.'" encoding', \E_USER_WARNING); |
|
| 1159 | 1159 | } |
| 1160 | 1160 | |
| 1161 | 1161 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1249,31 +1249,31 @@ discard block |
||
| 1249 | 1249 | $trimChars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
| 1250 | 1250 | |
| 1251 | 1251 | if ($length === null) { |
| 1252 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
| 1252 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
| 1253 | 1253 | } |
| 1254 | 1254 | |
| 1255 | 1255 | if ($search === '') { |
| 1256 | 1256 | if ($encoding === 'UTF-8') { |
| 1257 | 1257 | if ($length > 0) { |
| 1258 | - $stringLength = (int) \mb_strlen($str); |
|
| 1258 | + $stringLength = (int)\mb_strlen($str); |
|
| 1259 | 1259 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
| 1260 | 1260 | } else { |
| 1261 | 1261 | $end = 0; |
| 1262 | 1262 | } |
| 1263 | 1263 | |
| 1264 | - $pos = (int) \min( |
|
| 1264 | + $pos = (int)\min( |
|
| 1265 | 1265 | \mb_strpos($str, ' ', $end), |
| 1266 | 1266 | \mb_strpos($str, '.', $end) |
| 1267 | 1267 | ); |
| 1268 | 1268 | } else { |
| 1269 | 1269 | if ($length > 0) { |
| 1270 | - $stringLength = (int) self::strlen($str, $encoding); |
|
| 1270 | + $stringLength = (int)self::strlen($str, $encoding); |
|
| 1271 | 1271 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
| 1272 | 1272 | } else { |
| 1273 | 1273 | $end = 0; |
| 1274 | 1274 | } |
| 1275 | 1275 | |
| 1276 | - $pos = (int) \min( |
|
| 1276 | + $pos = (int)\min( |
|
| 1277 | 1277 | self::strpos($str, ' ', $end, $encoding), |
| 1278 | 1278 | self::strpos($str, '.', $end, $encoding) |
| 1279 | 1279 | ); |
@@ -1290,18 +1290,18 @@ discard block |
||
| 1290 | 1290 | return ''; |
| 1291 | 1291 | } |
| 1292 | 1292 | |
| 1293 | - return \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
| 1293 | + return \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
| 1294 | 1294 | } |
| 1295 | 1295 | |
| 1296 | 1296 | return $str; |
| 1297 | 1297 | } |
| 1298 | 1298 | |
| 1299 | 1299 | if ($encoding === 'UTF-8') { |
| 1300 | - $wordPos = (int) \mb_stripos($str, $search); |
|
| 1301 | - $halfSide = (int) ($wordPos - $length / 2 + (int) \mb_strlen($search) / 2); |
|
| 1300 | + $wordPos = (int)\mb_stripos($str, $search); |
|
| 1301 | + $halfSide = (int)($wordPos - $length / 2 + (int)\mb_strlen($search) / 2); |
|
| 1302 | 1302 | } else { |
| 1303 | - $wordPos = (int) self::stripos($str, $search, 0, $encoding); |
|
| 1304 | - $halfSide = (int) ($wordPos - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
| 1303 | + $wordPos = (int)self::stripos($str, $search, 0, $encoding); |
|
| 1304 | + $halfSide = (int)($wordPos - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
| 1305 | 1305 | } |
| 1306 | 1306 | |
| 1307 | 1307 | $pos_start = 0; |
@@ -1313,12 +1313,12 @@ discard block |
||
| 1313 | 1313 | } |
| 1314 | 1314 | if ($halfText !== false) { |
| 1315 | 1315 | if ($encoding === 'UTF-8') { |
| 1316 | - $pos_start = (int) \max( |
|
| 1316 | + $pos_start = (int)\max( |
|
| 1317 | 1317 | \mb_strrpos($halfText, ' '), |
| 1318 | 1318 | \mb_strrpos($halfText, '.') |
| 1319 | 1319 | ); |
| 1320 | 1320 | } else { |
| 1321 | - $pos_start = (int) \max( |
|
| 1321 | + $pos_start = (int)\max( |
|
| 1322 | 1322 | self::strrpos($halfText, ' ', 0, $encoding), |
| 1323 | 1323 | self::strrpos($halfText, '.', 0, $encoding) |
| 1324 | 1324 | ); |
@@ -1328,19 +1328,19 @@ discard block |
||
| 1328 | 1328 | |
| 1329 | 1329 | if ($wordPos && $halfSide > 0) { |
| 1330 | 1330 | $offset = $pos_start + $length - 1; |
| 1331 | - $realLength = (int) self::strlen($str, $encoding); |
|
| 1331 | + $realLength = (int)self::strlen($str, $encoding); |
|
| 1332 | 1332 | |
| 1333 | 1333 | if ($offset > $realLength) { |
| 1334 | 1334 | $offset = $realLength; |
| 1335 | 1335 | } |
| 1336 | 1336 | |
| 1337 | 1337 | if ($encoding === 'UTF-8') { |
| 1338 | - $pos_end = (int) \min( |
|
| 1338 | + $pos_end = (int)\min( |
|
| 1339 | 1339 | \mb_strpos($str, ' ', $offset), |
| 1340 | 1340 | \mb_strpos($str, '.', $offset) |
| 1341 | 1341 | ) - $pos_start; |
| 1342 | 1342 | } else { |
| 1343 | - $pos_end = (int) \min( |
|
| 1343 | + $pos_end = (int)\min( |
|
| 1344 | 1344 | self::strpos($str, ' ', $offset, $encoding), |
| 1345 | 1345 | self::strpos($str, '.', $offset, $encoding) |
| 1346 | 1346 | ) - $pos_start; |
@@ -1348,12 +1348,12 @@ discard block |
||
| 1348 | 1348 | |
| 1349 | 1349 | if (!$pos_end || $pos_end <= 0) { |
| 1350 | 1350 | if ($encoding === 'UTF-8') { |
| 1351 | - $strSub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
| 1351 | + $strSub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
| 1352 | 1352 | } else { |
| 1353 | - $strSub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
| 1353 | + $strSub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
| 1354 | 1354 | } |
| 1355 | 1355 | if ($strSub !== false) { |
| 1356 | - $extract = $replacerForSkippedText . \ltrim($strSub, $trimChars); |
|
| 1356 | + $extract = $replacerForSkippedText.\ltrim($strSub, $trimChars); |
|
| 1357 | 1357 | } else { |
| 1358 | 1358 | $extract = ''; |
| 1359 | 1359 | } |
@@ -1364,26 +1364,26 @@ discard block |
||
| 1364 | 1364 | $strSub = self::substr($str, $pos_start, $pos_end, $encoding); |
| 1365 | 1365 | } |
| 1366 | 1366 | if ($strSub !== false) { |
| 1367 | - $extract = $replacerForSkippedText . \trim($strSub, $trimChars) . $replacerForSkippedText; |
|
| 1367 | + $extract = $replacerForSkippedText.\trim($strSub, $trimChars).$replacerForSkippedText; |
|
| 1368 | 1368 | } else { |
| 1369 | 1369 | $extract = ''; |
| 1370 | 1370 | } |
| 1371 | 1371 | } |
| 1372 | 1372 | } else { |
| 1373 | 1373 | $offset = $length - 1; |
| 1374 | - $trueLength = (int) self::strlen($str, $encoding); |
|
| 1374 | + $trueLength = (int)self::strlen($str, $encoding); |
|
| 1375 | 1375 | |
| 1376 | 1376 | if ($offset > $trueLength) { |
| 1377 | 1377 | $offset = $trueLength; |
| 1378 | 1378 | } |
| 1379 | 1379 | |
| 1380 | 1380 | if ($encoding === 'UTF-8') { |
| 1381 | - $pos_end = (int) \min( |
|
| 1381 | + $pos_end = (int)\min( |
|
| 1382 | 1382 | \mb_strpos($str, ' ', $offset), |
| 1383 | 1383 | \mb_strpos($str, '.', $offset) |
| 1384 | 1384 | ); |
| 1385 | 1385 | } else { |
| 1386 | - $pos_end = (int) \min( |
|
| 1386 | + $pos_end = (int)\min( |
|
| 1387 | 1387 | self::strpos($str, ' ', $offset, $encoding), |
| 1388 | 1388 | self::strpos($str, '.', $offset, $encoding) |
| 1389 | 1389 | ); |
@@ -1396,7 +1396,7 @@ discard block |
||
| 1396 | 1396 | $strSub = self::substr($str, 0, $pos_end, $encoding); |
| 1397 | 1397 | } |
| 1398 | 1398 | if ($strSub !== false) { |
| 1399 | - $extract = \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
| 1399 | + $extract = \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
| 1400 | 1400 | } else { |
| 1401 | 1401 | $extract = ''; |
| 1402 | 1402 | } |
@@ -1520,7 +1520,7 @@ discard block |
||
| 1520 | 1520 | { |
| 1521 | 1521 | $file_content = \file_get_contents($file_path); |
| 1522 | 1522 | if ($file_content === false) { |
| 1523 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
| 1523 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
| 1524 | 1524 | } |
| 1525 | 1525 | |
| 1526 | 1526 | return self::string_has_bom($file_content); |
@@ -1581,7 +1581,7 @@ discard block |
||
| 1581 | 1581 | ) { |
| 1582 | 1582 | // Prevent leading combining chars |
| 1583 | 1583 | // for NFC-safe concatenations. |
| 1584 | - $var = $leading_combining . $var; |
|
| 1584 | + $var = $leading_combining.$var; |
|
| 1585 | 1585 | } |
| 1586 | 1586 | } |
| 1587 | 1587 | |
@@ -1820,10 +1820,10 @@ discard block |
||
| 1820 | 1820 | } |
| 1821 | 1821 | |
| 1822 | 1822 | if ($encoding === 'UTF-8') { |
| 1823 | - return (string) \mb_substr($str, 0, $n); |
|
| 1823 | + return (string)\mb_substr($str, 0, $n); |
|
| 1824 | 1824 | } |
| 1825 | 1825 | |
| 1826 | - return (string) self::substr($str, 0, $n, $encoding); |
|
| 1826 | + return (string)self::substr($str, 0, $n, $encoding); |
|
| 1827 | 1827 | } |
| 1828 | 1828 | |
| 1829 | 1829 | /** |
@@ -1898,7 +1898,7 @@ discard block |
||
| 1898 | 1898 | return $str; |
| 1899 | 1899 | } |
| 1900 | 1900 | |
| 1901 | - $str = (string) $str; |
|
| 1901 | + $str = (string)$str; |
|
| 1902 | 1902 | $last = ''; |
| 1903 | 1903 | while ($last !== $str) { |
| 1904 | 1904 | $last = $str; |
@@ -2086,7 +2086,7 @@ discard block |
||
| 2086 | 2086 | if ($str_info === false) { |
| 2087 | 2087 | return $fallback; |
| 2088 | 2088 | } |
| 2089 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
| 2089 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
| 2090 | 2090 | |
| 2091 | 2091 | // DEBUG |
| 2092 | 2092 | //var_dump($type_code); |
@@ -2175,7 +2175,7 @@ discard block |
||
| 2175 | 2175 | // |
| 2176 | 2176 | |
| 2177 | 2177 | if ($encoding === 'UTF-8') { |
| 2178 | - $maxlength = (int) \mb_strlen($possibleChars); |
|
| 2178 | + $maxlength = (int)\mb_strlen($possibleChars); |
|
| 2179 | 2179 | if ($maxlength === 0) { |
| 2180 | 2180 | return ''; |
| 2181 | 2181 | } |
@@ -2196,7 +2196,7 @@ discard block |
||
| 2196 | 2196 | } else { |
| 2197 | 2197 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 2198 | 2198 | |
| 2199 | - $maxlength = (int) self::strlen($possibleChars, $encoding); |
|
| 2199 | + $maxlength = (int)self::strlen($possibleChars, $encoding); |
|
| 2200 | 2200 | if ($maxlength === 0) { |
| 2201 | 2201 | return ''; |
| 2202 | 2202 | } |
@@ -2227,16 +2227,16 @@ discard block |
||
| 2227 | 2227 | */ |
| 2228 | 2228 | public static function get_unique_string($entropyExtra = '', bool $md5 = true): string |
| 2229 | 2229 | { |
| 2230 | - $uniqueHelper = \random_int(0, \mt_getrandmax()) . |
|
| 2231 | - \session_id() . |
|
| 2232 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
| 2233 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
| 2230 | + $uniqueHelper = \random_int(0, \mt_getrandmax()). |
|
| 2231 | + \session_id(). |
|
| 2232 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
| 2233 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
| 2234 | 2234 | $entropyExtra; |
| 2235 | 2235 | |
| 2236 | 2236 | $uniqueString = \uniqid($uniqueHelper, true); |
| 2237 | 2237 | |
| 2238 | 2238 | if ($md5) { |
| 2239 | - $uniqueString = \md5($uniqueString . $uniqueHelper); |
|
| 2239 | + $uniqueString = \md5($uniqueString.$uniqueHelper); |
|
| 2240 | 2240 | } |
| 2241 | 2241 | |
| 2242 | 2242 | return $uniqueString; |
@@ -2316,7 +2316,7 @@ discard block |
||
| 2316 | 2316 | public static function hex_to_int($hexDec) |
| 2317 | 2317 | { |
| 2318 | 2318 | // init |
| 2319 | - $hexDec = (string) $hexDec; |
|
| 2319 | + $hexDec = (string)$hexDec; |
|
| 2320 | 2320 | |
| 2321 | 2321 | if ($hexDec === '') { |
| 2322 | 2322 | return false; |
@@ -2394,7 +2394,7 @@ discard block |
||
| 2394 | 2394 | return \implode( |
| 2395 | 2395 | '', |
| 2396 | 2396 | \array_map( |
| 2397 | - static function (string $chr) use ($keepAsciiChars, $encoding): string { |
|
| 2397 | + static function(string $chr) use ($keepAsciiChars, $encoding): string { |
|
| 2398 | 2398 | return self::single_chr_html_encode($chr, $keepAsciiChars, $encoding); |
| 2399 | 2399 | }, |
| 2400 | 2400 | self::str_split($str) |
@@ -2498,7 +2498,7 @@ discard block |
||
| 2498 | 2498 | && |
| 2499 | 2499 | self::$SUPPORT['mbstring'] === false |
| 2500 | 2500 | ) { |
| 2501 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 2501 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 2502 | 2502 | } |
| 2503 | 2503 | |
| 2504 | 2504 | do { |
@@ -2519,14 +2519,14 @@ discard block |
||
| 2519 | 2519 | ); |
| 2520 | 2520 | } |
| 2521 | 2521 | } else { |
| 2522 | - $str = (string) \preg_replace_callback( |
|
| 2522 | + $str = (string)\preg_replace_callback( |
|
| 2523 | 2523 | "/&#\d{2,6};/", |
| 2524 | 2524 | /** |
| 2525 | 2525 | * @param string[] $matches |
| 2526 | 2526 | * |
| 2527 | 2527 | * @return string |
| 2528 | 2528 | */ |
| 2529 | - static function (array $matches) use ($encoding): string { |
|
| 2529 | + static function(array $matches) use ($encoding): string { |
|
| 2530 | 2530 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
| 2531 | 2531 | if ($returnTmp !== '"' && $returnTmp !== "'") { |
| 2532 | 2532 | return $returnTmp; |
@@ -2541,7 +2541,7 @@ discard block |
||
| 2541 | 2541 | if (\strpos($str, '&') !== false) { |
| 2542 | 2542 | if (\strpos($str, '&#') !== false) { |
| 2543 | 2543 | // decode also numeric & UTF16 two byte entities |
| 2544 | - $str = (string) \preg_replace( |
|
| 2544 | + $str = (string)\preg_replace( |
|
| 2545 | 2545 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
| 2546 | 2546 | '$1;', |
| 2547 | 2547 | $str |
@@ -2587,7 +2587,7 @@ discard block |
||
| 2587 | 2587 | */ |
| 2588 | 2588 | public static function html_stripe_empty_tags(string $str): string |
| 2589 | 2589 | { |
| 2590 | - return (string) \preg_replace( |
|
| 2590 | + return (string)\preg_replace( |
|
| 2591 | 2591 | "/<[^\/>]*>(([\s]?)*|)<\/[^>]*>/u", |
| 2592 | 2592 | '', |
| 2593 | 2593 | $str |
@@ -2886,9 +2886,9 @@ discard block |
||
| 2886 | 2886 | { |
| 2887 | 2887 | $hex = \dechex($int); |
| 2888 | 2888 | |
| 2889 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
| 2889 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
| 2890 | 2890 | |
| 2891 | - return $pfix . $hex . ''; |
|
| 2891 | + return $pfix.$hex.''; |
|
| 2892 | 2892 | } |
| 2893 | 2893 | |
| 2894 | 2894 | /** |
@@ -3155,7 +3155,7 @@ discard block |
||
| 3155 | 3155 | */ |
| 3156 | 3156 | public static function is_binary($input, bool $strict = false): bool |
| 3157 | 3157 | { |
| 3158 | - $input = (string) $input; |
|
| 3158 | + $input = (string)$input; |
|
| 3159 | 3159 | if ($input === '') { |
| 3160 | 3160 | return false; |
| 3161 | 3161 | } |
@@ -3414,7 +3414,7 @@ discard block |
||
| 3414 | 3414 | public static function is_utf16($str, $checkIfStringIsBinary = true) |
| 3415 | 3415 | { |
| 3416 | 3416 | // init |
| 3417 | - $str = (string) $str; |
|
| 3417 | + $str = (string)$str; |
|
| 3418 | 3418 | $strChars = []; |
| 3419 | 3419 | |
| 3420 | 3420 | if ( |
@@ -3492,7 +3492,7 @@ discard block |
||
| 3492 | 3492 | public static function is_utf32($str, $checkIfStringIsBinary = true) |
| 3493 | 3493 | { |
| 3494 | 3494 | // init |
| 3495 | - $str = (string) $str; |
|
| 3495 | + $str = (string)$str; |
|
| 3496 | 3496 | $strChars = []; |
| 3497 | 3497 | |
| 3498 | 3498 | if ( |
@@ -3571,16 +3571,16 @@ discard block |
||
| 3571 | 3571 | self::initEmojiData(); |
| 3572 | 3572 | |
| 3573 | 3573 | if ($useReversibleStringMapping === true) { |
| 3574 | - return (string) \str_replace( |
|
| 3575 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 3576 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 3574 | + return (string)\str_replace( |
|
| 3575 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 3576 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 3577 | 3577 | $str |
| 3578 | 3578 | ); |
| 3579 | 3579 | } |
| 3580 | 3580 | |
| 3581 | - return (string) \str_replace( |
|
| 3582 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 3583 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 3581 | + return (string)\str_replace( |
|
| 3582 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 3583 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 3584 | 3584 | $str |
| 3585 | 3585 | ); |
| 3586 | 3586 | } |
@@ -3600,16 +3600,16 @@ discard block |
||
| 3600 | 3600 | self::initEmojiData(); |
| 3601 | 3601 | |
| 3602 | 3602 | if ($useReversibleStringMapping === true) { |
| 3603 | - return (string) \str_replace( |
|
| 3604 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 3605 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 3603 | + return (string)\str_replace( |
|
| 3604 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 3605 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 3606 | 3606 | $str |
| 3607 | 3607 | ); |
| 3608 | 3608 | } |
| 3609 | 3609 | |
| 3610 | - return (string) \str_replace( |
|
| 3611 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 3612 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 3610 | + return (string)\str_replace( |
|
| 3611 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 3612 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 3613 | 3613 | $str |
| 3614 | 3614 | ); |
| 3615 | 3615 | } |
@@ -3670,7 +3670,7 @@ discard block |
||
| 3670 | 3670 | self::$ORD = self::getData('ord'); |
| 3671 | 3671 | } |
| 3672 | 3672 | |
| 3673 | - $len = \strlen((string) $str); |
|
| 3673 | + $len = \strlen((string)$str); |
|
| 3674 | 3674 | /** @noinspection ForeachInvariantsInspection */ |
| 3675 | 3675 | for ($i = 0; $i < $len; ++$i) { |
| 3676 | 3676 | $in = self::$ORD[$str[$i]]; |
@@ -3907,15 +3907,15 @@ discard block |
||
| 3907 | 3907 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
| 3908 | 3908 | |
| 3909 | 3909 | if ($encoding === 'UTF-8') { |
| 3910 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
| 3910 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
| 3911 | 3911 | |
| 3912 | 3912 | if ($useMbFunction === true) { |
| 3913 | 3913 | $strPartOne = \mb_strtolower( |
| 3914 | - (string) \mb_substr($str, 0, 1) |
|
| 3914 | + (string)\mb_substr($str, 0, 1) |
|
| 3915 | 3915 | ); |
| 3916 | 3916 | } else { |
| 3917 | 3917 | $strPartOne = self::strtolower( |
| 3918 | - (string) \mb_substr($str, 0, 1), |
|
| 3918 | + (string)\mb_substr($str, 0, 1), |
|
| 3919 | 3919 | $encoding, |
| 3920 | 3920 | false, |
| 3921 | 3921 | $lang, |
@@ -3925,10 +3925,10 @@ discard block |
||
| 3925 | 3925 | } else { |
| 3926 | 3926 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 3927 | 3927 | |
| 3928 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
| 3928 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
| 3929 | 3929 | |
| 3930 | 3930 | $strPartOne = self::strtolower( |
| 3931 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 3931 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 3932 | 3932 | $encoding, |
| 3933 | 3933 | false, |
| 3934 | 3934 | $lang, |
@@ -3936,7 +3936,7 @@ discard block |
||
| 3936 | 3936 | ); |
| 3937 | 3937 | } |
| 3938 | 3938 | |
| 3939 | - return $strPartOne . $strPartTwo; |
|
| 3939 | + return $strPartOne.$strPartTwo; |
|
| 3940 | 3940 | } |
| 3941 | 3941 | |
| 3942 | 3942 | /** |
@@ -4055,7 +4055,7 @@ discard block |
||
| 4055 | 4055 | |
| 4056 | 4056 | if (self::$SUPPORT['mbstring'] === true) { |
| 4057 | 4057 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4058 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 4058 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 4059 | 4059 | } |
| 4060 | 4060 | |
| 4061 | 4061 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -4096,7 +4096,7 @@ discard block |
||
| 4096 | 4096 | { |
| 4097 | 4097 | $bytes = self::chr_size_list($str); |
| 4098 | 4098 | if (\count($bytes) > 0) { |
| 4099 | - return (int) \max($bytes); |
|
| 4099 | + return (int)\max($bytes); |
|
| 4100 | 4100 | } |
| 4101 | 4101 | |
| 4102 | 4102 | return 0; |
@@ -4166,7 +4166,7 @@ discard block |
||
| 4166 | 4166 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
| 4167 | 4167 | |
| 4168 | 4168 | // init |
| 4169 | - $encoding = (string) $encoding; |
|
| 4169 | + $encoding = (string)$encoding; |
|
| 4170 | 4170 | |
| 4171 | 4171 | if (!$encoding) { |
| 4172 | 4172 | return $fallback; |
@@ -4220,7 +4220,7 @@ discard block |
||
| 4220 | 4220 | |
| 4221 | 4221 | $encodingOrig = $encoding; |
| 4222 | 4222 | $encoding = \strtoupper($encoding); |
| 4223 | - $encodingUpperHelper = (string) \preg_replace('/[^a-zA-Z0-9\s]/u', '', $encoding); |
|
| 4223 | + $encodingUpperHelper = (string)\preg_replace('/[^a-zA-Z0-9\s]/u', '', $encoding); |
|
| 4224 | 4224 | |
| 4225 | 4225 | $equivalences = [ |
| 4226 | 4226 | 'ISO8859' => 'ISO-8859-1', |
@@ -4378,7 +4378,7 @@ discard block |
||
| 4378 | 4378 | } |
| 4379 | 4379 | |
| 4380 | 4380 | static $WHITESPACE_CACHE = []; |
| 4381 | - $cacheKey = (int) $keepNonBreakingSpace; |
|
| 4381 | + $cacheKey = (int)$keepNonBreakingSpace; |
|
| 4382 | 4382 | |
| 4383 | 4383 | if (!isset($WHITESPACE_CACHE[$cacheKey])) { |
| 4384 | 4384 | $WHITESPACE_CACHE[$cacheKey] = self::$WHITESPACE_TABLE; |
@@ -4420,13 +4420,13 @@ discard block |
||
| 4420 | 4420 | static $CHAR_CACHE = []; |
| 4421 | 4421 | |
| 4422 | 4422 | // init |
| 4423 | - $chr = (string) $chr; |
|
| 4423 | + $chr = (string)$chr; |
|
| 4424 | 4424 | |
| 4425 | 4425 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
| 4426 | 4426 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4427 | 4427 | } |
| 4428 | 4428 | |
| 4429 | - $cacheKey = $chr . $encoding; |
|
| 4429 | + $cacheKey = $chr.$encoding; |
|
| 4430 | 4430 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
| 4431 | 4431 | return $CHAR_CACHE[$cacheKey]; |
| 4432 | 4432 | } |
@@ -4461,22 +4461,22 @@ discard block |
||
| 4461 | 4461 | // |
| 4462 | 4462 | |
| 4463 | 4463 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
| 4464 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
| 4464 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
| 4465 | 4465 | $code = $chr ? $chr[1] : 0; |
| 4466 | 4466 | |
| 4467 | 4467 | if ($code >= 0xF0 && isset($chr[4])) { |
| 4468 | 4468 | /** @noinspection UnnecessaryCastingInspection */ |
| 4469 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 4469 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 4470 | 4470 | } |
| 4471 | 4471 | |
| 4472 | 4472 | if ($code >= 0xE0 && isset($chr[3])) { |
| 4473 | 4473 | /** @noinspection UnnecessaryCastingInspection */ |
| 4474 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 4474 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 4475 | 4475 | } |
| 4476 | 4476 | |
| 4477 | 4477 | if ($code >= 0xC0 && isset($chr[2])) { |
| 4478 | 4478 | /** @noinspection UnnecessaryCastingInspection */ |
| 4479 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 4479 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 4480 | 4480 | } |
| 4481 | 4481 | |
| 4482 | 4482 | return $CHAR_CACHE[$cacheKey] = $code; |
@@ -4525,7 +4525,7 @@ discard block |
||
| 4525 | 4525 | public static function pcre_utf8_support(): bool |
| 4526 | 4526 | { |
| 4527 | 4527 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 4528 | - return (bool) @\preg_match('//u', ''); |
|
| 4528 | + return (bool)@\preg_match('//u', ''); |
|
| 4529 | 4529 | } |
| 4530 | 4530 | |
| 4531 | 4531 | /** |
@@ -4547,10 +4547,10 @@ discard block |
||
| 4547 | 4547 | } |
| 4548 | 4548 | |
| 4549 | 4549 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4550 | - if (\ctype_digit((string) $var1)) { |
|
| 4551 | - $start = (int) $var1; |
|
| 4550 | + if (\ctype_digit((string)$var1)) { |
|
| 4551 | + $start = (int)$var1; |
|
| 4552 | 4552 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var1)) { |
| 4553 | - $start = (int) self::hex_to_int($var1); |
|
| 4553 | + $start = (int)self::hex_to_int($var1); |
|
| 4554 | 4554 | } else { |
| 4555 | 4555 | $start = self::ord($var1); |
| 4556 | 4556 | } |
@@ -4560,10 +4560,10 @@ discard block |
||
| 4560 | 4560 | } |
| 4561 | 4561 | |
| 4562 | 4562 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4563 | - if (\ctype_digit((string) $var2)) { |
|
| 4564 | - $end = (int) $var2; |
|
| 4563 | + if (\ctype_digit((string)$var2)) { |
|
| 4564 | + $end = (int)$var2; |
|
| 4565 | 4565 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var2)) { |
| 4566 | - $end = (int) self::hex_to_int($var2); |
|
| 4566 | + $end = (int)self::hex_to_int($var2); |
|
| 4567 | 4567 | } else { |
| 4568 | 4568 | $end = self::ord($var2); |
| 4569 | 4569 | } |
@@ -4573,8 +4573,8 @@ discard block |
||
| 4573 | 4573 | } |
| 4574 | 4574 | |
| 4575 | 4575 | return \array_map( |
| 4576 | - static function (int $i): string { |
|
| 4577 | - return (string) self::chr($i); |
|
| 4576 | + static function(int $i): string { |
|
| 4577 | + return (string)self::chr($i); |
|
| 4578 | 4578 | }, |
| 4579 | 4579 | \range($start, $end) |
| 4580 | 4580 | ); |
@@ -4619,7 +4619,7 @@ discard block |
||
| 4619 | 4619 | |
| 4620 | 4620 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
| 4621 | 4621 | if (\preg_match($pattern, $str)) { |
| 4622 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \rawurldecode($str)); |
|
| 4622 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \rawurldecode($str)); |
|
| 4623 | 4623 | } |
| 4624 | 4624 | |
| 4625 | 4625 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -4672,8 +4672,8 @@ discard block |
||
| 4672 | 4672 | $delimiter = '/'; |
| 4673 | 4673 | } |
| 4674 | 4674 | |
| 4675 | - return (string) \preg_replace( |
|
| 4676 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
| 4675 | + return (string)\preg_replace( |
|
| 4676 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
| 4677 | 4677 | $replacement, |
| 4678 | 4678 | $str |
| 4679 | 4679 | ); |
@@ -4716,9 +4716,9 @@ discard block |
||
| 4716 | 4716 | return ''; |
| 4717 | 4717 | } |
| 4718 | 4718 | |
| 4719 | - $strLength -= (int) $bomByteLength; |
|
| 4719 | + $strLength -= (int)$bomByteLength; |
|
| 4720 | 4720 | |
| 4721 | - $str = (string) $strTmp; |
|
| 4721 | + $str = (string)$strTmp; |
|
| 4722 | 4722 | } |
| 4723 | 4723 | } |
| 4724 | 4724 | |
@@ -4742,7 +4742,7 @@ discard block |
||
| 4742 | 4742 | if (\is_array($what) === true) { |
| 4743 | 4743 | /** @noinspection ForeachSourceInspection */ |
| 4744 | 4744 | foreach ($what as $item) { |
| 4745 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
| 4745 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
| 4746 | 4746 | } |
| 4747 | 4747 | } |
| 4748 | 4748 | |
@@ -4774,7 +4774,7 @@ discard block |
||
| 4774 | 4774 | */ |
| 4775 | 4775 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
| 4776 | 4776 | { |
| 4777 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 4777 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 4778 | 4778 | } |
| 4779 | 4779 | |
| 4780 | 4780 | /** |
@@ -4805,7 +4805,7 @@ discard block |
||
| 4805 | 4805 | $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
| 4806 | 4806 | |
| 4807 | 4807 | do { |
| 4808 | - $str = (string) \preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
| 4808 | + $str = (string)\preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
| 4809 | 4809 | } while ($count !== 0); |
| 4810 | 4810 | |
| 4811 | 4811 | return $str; |
@@ -4824,17 +4824,17 @@ discard block |
||
| 4824 | 4824 | { |
| 4825 | 4825 | if ($substring && \strpos($str, $substring) === 0) { |
| 4826 | 4826 | if ($encoding === 'UTF-8') { |
| 4827 | - return (string) \mb_substr( |
|
| 4827 | + return (string)\mb_substr( |
|
| 4828 | 4828 | $str, |
| 4829 | - (int) \mb_strlen($substring) |
|
| 4829 | + (int)\mb_strlen($substring) |
|
| 4830 | 4830 | ); |
| 4831 | 4831 | } |
| 4832 | 4832 | |
| 4833 | 4833 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4834 | 4834 | |
| 4835 | - return (string) self::substr( |
|
| 4835 | + return (string)self::substr( |
|
| 4836 | 4836 | $str, |
| 4837 | - (int) self::strlen($substring, $encoding), |
|
| 4837 | + (int)self::strlen($substring, $encoding), |
|
| 4838 | 4838 | null, |
| 4839 | 4839 | $encoding |
| 4840 | 4840 | ); |
@@ -4856,19 +4856,19 @@ discard block |
||
| 4856 | 4856 | { |
| 4857 | 4857 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
| 4858 | 4858 | if ($encoding === 'UTF-8') { |
| 4859 | - return (string) \mb_substr( |
|
| 4859 | + return (string)\mb_substr( |
|
| 4860 | 4860 | $str, |
| 4861 | 4861 | 0, |
| 4862 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
| 4862 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
| 4863 | 4863 | ); |
| 4864 | 4864 | } |
| 4865 | 4865 | |
| 4866 | 4866 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4867 | 4867 | |
| 4868 | - return (string) self::substr( |
|
| 4868 | + return (string)self::substr( |
|
| 4869 | 4869 | $str, |
| 4870 | 4870 | 0, |
| 4871 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
| 4871 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
| 4872 | 4872 | $encoding |
| 4873 | 4873 | ); |
| 4874 | 4874 | } |
@@ -4952,7 +4952,7 @@ discard block |
||
| 4952 | 4952 | $save = \mb_substitute_character(); |
| 4953 | 4953 | \mb_substitute_character($replacementCharHelper); |
| 4954 | 4954 | // the polyfill maybe return false, so cast to string |
| 4955 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 4955 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 4956 | 4956 | \mb_substitute_character($save); |
| 4957 | 4957 | } |
| 4958 | 4958 | |
@@ -4992,7 +4992,7 @@ discard block |
||
| 4992 | 4992 | |
| 4993 | 4993 | if (self::$SUPPORT['mbstring'] === true) { |
| 4994 | 4994 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4995 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 4995 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 4996 | 4996 | } |
| 4997 | 4997 | |
| 4998 | 4998 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -5007,7 +5007,7 @@ discard block |
||
| 5007 | 5007 | { |
| 5008 | 5008 | echo '<pre>'; |
| 5009 | 5009 | foreach (self::$SUPPORT as $key => &$value) { |
| 5010 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
| 5010 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
| 5011 | 5011 | } |
| 5012 | 5012 | unset($value); |
| 5013 | 5013 | echo '</pre>'; |
@@ -5036,7 +5036,7 @@ discard block |
||
| 5036 | 5036 | return $char; |
| 5037 | 5037 | } |
| 5038 | 5038 | |
| 5039 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
| 5039 | + return '&#'.self::ord($char, $encoding).';'; |
|
| 5040 | 5040 | } |
| 5041 | 5041 | |
| 5042 | 5042 | /** |
@@ -5095,7 +5095,7 @@ discard block |
||
| 5095 | 5095 | } |
| 5096 | 5096 | |
| 5097 | 5097 | // init |
| 5098 | - $str = (string) $str; |
|
| 5098 | + $str = (string)$str; |
|
| 5099 | 5099 | |
| 5100 | 5100 | if ($str === '') { |
| 5101 | 5101 | return []; |
@@ -5142,7 +5142,7 @@ discard block |
||
| 5142 | 5142 | ($str[$i] & "\xE0") === "\xC0" |
| 5143 | 5143 | ) { |
| 5144 | 5144 | if (($str[$i + 1] & "\xC0") === "\x80") { |
| 5145 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
| 5145 | + $ret[] = $str[$i].$str[$i + 1]; |
|
| 5146 | 5146 | |
| 5147 | 5147 | ++$i; |
| 5148 | 5148 | } |
@@ -5156,7 +5156,7 @@ discard block |
||
| 5156 | 5156 | && |
| 5157 | 5157 | ($str[$i + 2] & "\xC0") === "\x80" |
| 5158 | 5158 | ) { |
| 5159 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
| 5159 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
| 5160 | 5160 | |
| 5161 | 5161 | $i += 2; |
| 5162 | 5162 | } |
@@ -5172,7 +5172,7 @@ discard block |
||
| 5172 | 5172 | && |
| 5173 | 5173 | ($str[$i + 3] & "\xC0") === "\x80" |
| 5174 | 5174 | ) { |
| 5175 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
| 5175 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
| 5176 | 5176 | |
| 5177 | 5177 | $i += 3; |
| 5178 | 5178 | } |
@@ -5184,7 +5184,7 @@ discard block |
||
| 5184 | 5184 | $ret = \array_chunk($ret, $length); |
| 5185 | 5185 | |
| 5186 | 5186 | return \array_map( |
| 5187 | - static function (array &$item): string { |
|
| 5187 | + static function(array &$item): string { |
|
| 5188 | 5188 | return \implode('', $item); |
| 5189 | 5189 | }, |
| 5190 | 5190 | $ret |
@@ -5233,18 +5233,18 @@ discard block |
||
| 5233 | 5233 | $lang, |
| 5234 | 5234 | $tryToKeepStringLength |
| 5235 | 5235 | ); |
| 5236 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
| 5236 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
| 5237 | 5237 | |
| 5238 | 5238 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
| 5239 | 5239 | |
| 5240 | - $str = (string) \preg_replace_callback( |
|
| 5240 | + $str = (string)\preg_replace_callback( |
|
| 5241 | 5241 | '/[-_\s]+(.)?/u', |
| 5242 | 5242 | /** |
| 5243 | 5243 | * @param array $match |
| 5244 | 5244 | * |
| 5245 | 5245 | * @return string |
| 5246 | 5246 | */ |
| 5247 | - static function (array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
| 5247 | + static function(array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
| 5248 | 5248 | if (isset($match[1])) { |
| 5249 | 5249 | if ($useMbFunction === true) { |
| 5250 | 5250 | if ($encoding === 'UTF-8') { |
@@ -5262,14 +5262,14 @@ discard block |
||
| 5262 | 5262 | $str |
| 5263 | 5263 | ); |
| 5264 | 5264 | |
| 5265 | - return (string) \preg_replace_callback( |
|
| 5265 | + return (string)\preg_replace_callback( |
|
| 5266 | 5266 | '/[\d]+(.)?/u', |
| 5267 | 5267 | /** |
| 5268 | 5268 | * @param array $match |
| 5269 | 5269 | * |
| 5270 | 5270 | * @return string |
| 5271 | 5271 | */ |
| 5272 | - static function (array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
| 5272 | + static function(array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
| 5273 | 5273 | if ($useMbFunction === true) { |
| 5274 | 5274 | if ($encoding === 'UTF-8') { |
| 5275 | 5275 | return \mb_strtoupper($match[0]); |
@@ -5441,7 +5441,7 @@ discard block |
||
| 5441 | 5441 | ): string { |
| 5442 | 5442 | if (self::$SUPPORT['mbstring'] === true) { |
| 5443 | 5443 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5444 | - $str = (string) \mb_ereg_replace('\B(\p{Lu})', '-\1', \trim($str)); |
|
| 5444 | + $str = (string)\mb_ereg_replace('\B(\p{Lu})', '-\1', \trim($str)); |
|
| 5445 | 5445 | |
| 5446 | 5446 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
| 5447 | 5447 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5451,10 +5451,10 @@ discard block |
||
| 5451 | 5451 | } |
| 5452 | 5452 | |
| 5453 | 5453 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5454 | - return (string) \mb_ereg_replace('[-_\s]+', $delimiter, $str); |
|
| 5454 | + return (string)\mb_ereg_replace('[-_\s]+', $delimiter, $str); |
|
| 5455 | 5455 | } |
| 5456 | 5456 | |
| 5457 | - $str = (string) \preg_replace('/\B(\p{Lu})/u', '-\1', \trim($str)); |
|
| 5457 | + $str = (string)\preg_replace('/\B(\p{Lu})/u', '-\1', \trim($str)); |
|
| 5458 | 5458 | |
| 5459 | 5459 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
| 5460 | 5460 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5463,7 +5463,7 @@ discard block |
||
| 5463 | 5463 | $str = self::strtolower($str, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
| 5464 | 5464 | } |
| 5465 | 5465 | |
| 5466 | - return (string) \preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
| 5466 | + return (string)\preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
| 5467 | 5467 | } |
| 5468 | 5468 | |
| 5469 | 5469 | /** |
@@ -5478,7 +5478,7 @@ discard block |
||
| 5478 | 5478 | public static function str_detect_encoding($str) |
| 5479 | 5479 | { |
| 5480 | 5480 | // init |
| 5481 | - $str = (string) $str; |
|
| 5481 | + $str = (string)$str; |
|
| 5482 | 5482 | |
| 5483 | 5483 | // |
| 5484 | 5484 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5580,7 +5580,7 @@ discard block |
||
| 5580 | 5580 | foreach (self::$ENCODINGS as $encodingTmp) { |
| 5581 | 5581 | // INFO: //IGNORE but still throw notice |
| 5582 | 5582 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 5583 | - if ((string) @\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str) === $str) { |
|
| 5583 | + if ((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str) === $str) { |
|
| 5584 | 5584 | return $encodingTmp; |
| 5585 | 5585 | } |
| 5586 | 5586 | } |
@@ -5645,7 +5645,7 @@ discard block |
||
| 5645 | 5645 | return $str; |
| 5646 | 5646 | } |
| 5647 | 5647 | |
| 5648 | - return $substring . $str; |
|
| 5648 | + return $substring.$str; |
|
| 5649 | 5649 | } |
| 5650 | 5650 | |
| 5651 | 5651 | /** |
@@ -5865,27 +5865,27 @@ discard block |
||
| 5865 | 5865 | string $encoding = 'UTF-8' |
| 5866 | 5866 | ): string { |
| 5867 | 5867 | if ($encoding === 'UTF-8') { |
| 5868 | - $len = (int) \mb_strlen($str); |
|
| 5868 | + $len = (int)\mb_strlen($str); |
|
| 5869 | 5869 | if ($index > $len) { |
| 5870 | 5870 | return $str; |
| 5871 | 5871 | } |
| 5872 | 5872 | |
| 5873 | 5873 | /** @noinspection UnnecessaryCastingInspection */ |
| 5874 | - return (string) \mb_substr($str, 0, $index) . |
|
| 5875 | - $substring . |
|
| 5876 | - (string) \mb_substr($str, $index, $len); |
|
| 5874 | + return (string)\mb_substr($str, 0, $index). |
|
| 5875 | + $substring. |
|
| 5876 | + (string)\mb_substr($str, $index, $len); |
|
| 5877 | 5877 | } |
| 5878 | 5878 | |
| 5879 | 5879 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5880 | 5880 | |
| 5881 | - $len = (int) self::strlen($str, $encoding); |
|
| 5881 | + $len = (int)self::strlen($str, $encoding); |
|
| 5882 | 5882 | if ($index > $len) { |
| 5883 | 5883 | return $str; |
| 5884 | 5884 | } |
| 5885 | 5885 | |
| 5886 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
| 5887 | - $substring . |
|
| 5888 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
| 5886 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
| 5887 | + $substring. |
|
| 5888 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
| 5889 | 5889 | } |
| 5890 | 5890 | |
| 5891 | 5891 | /** |
@@ -5915,15 +5915,15 @@ discard block |
||
| 5915 | 5915 | */ |
| 5916 | 5916 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
| 5917 | 5917 | { |
| 5918 | - $search = (array) $search; |
|
| 5918 | + $search = (array)$search; |
|
| 5919 | 5919 | |
| 5920 | 5920 | /** @noinspection AlterInForeachInspection */ |
| 5921 | 5921 | foreach ($search as &$s) { |
| 5922 | - $s = (string) $s; |
|
| 5922 | + $s = (string)$s; |
|
| 5923 | 5923 | if ($s === '') { |
| 5924 | 5924 | $s = '/^(?<=.)$/'; |
| 5925 | 5925 | } else { |
| 5926 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
| 5926 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
| 5927 | 5927 | } |
| 5928 | 5928 | } |
| 5929 | 5929 | |
@@ -5955,11 +5955,11 @@ discard block |
||
| 5955 | 5955 | } |
| 5956 | 5956 | |
| 5957 | 5957 | if ($search === '') { |
| 5958 | - return $str . $replacement; |
|
| 5958 | + return $str.$replacement; |
|
| 5959 | 5959 | } |
| 5960 | 5960 | |
| 5961 | 5961 | if (\stripos($str, $search) === 0) { |
| 5962 | - return $replacement . \substr($str, \strlen($search)); |
|
| 5962 | + return $replacement.\substr($str, \strlen($search)); |
|
| 5963 | 5963 | } |
| 5964 | 5964 | |
| 5965 | 5965 | return $str; |
@@ -5987,11 +5987,11 @@ discard block |
||
| 5987 | 5987 | } |
| 5988 | 5988 | |
| 5989 | 5989 | if ($search === '') { |
| 5990 | - return $str . $replacement; |
|
| 5990 | + return $str.$replacement; |
|
| 5991 | 5991 | } |
| 5992 | 5992 | |
| 5993 | 5993 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 5994 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 5994 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 5995 | 5995 | } |
| 5996 | 5996 | |
| 5997 | 5997 | return $str; |
@@ -6064,15 +6064,15 @@ discard block |
||
| 6064 | 6064 | } |
| 6065 | 6065 | |
| 6066 | 6066 | if ($encoding === 'UTF-8') { |
| 6067 | - return (string) \mb_substr( |
|
| 6067 | + return (string)\mb_substr( |
|
| 6068 | 6068 | $str, |
| 6069 | - $offset + (int) \mb_strlen($separator) |
|
| 6069 | + $offset + (int)\mb_strlen($separator) |
|
| 6070 | 6070 | ); |
| 6071 | 6071 | } |
| 6072 | 6072 | |
| 6073 | - return (string) self::substr( |
|
| 6073 | + return (string)self::substr( |
|
| 6074 | 6074 | $str, |
| 6075 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6075 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6076 | 6076 | null, |
| 6077 | 6077 | $encoding |
| 6078 | 6078 | ); |
@@ -6099,15 +6099,15 @@ discard block |
||
| 6099 | 6099 | } |
| 6100 | 6100 | |
| 6101 | 6101 | if ($encoding === 'UTF-8') { |
| 6102 | - return (string) \mb_substr( |
|
| 6102 | + return (string)\mb_substr( |
|
| 6103 | 6103 | $str, |
| 6104 | - $offset + (int) self::strlen($separator) |
|
| 6104 | + $offset + (int)self::strlen($separator) |
|
| 6105 | 6105 | ); |
| 6106 | 6106 | } |
| 6107 | 6107 | |
| 6108 | - return (string) self::substr( |
|
| 6108 | + return (string)self::substr( |
|
| 6109 | 6109 | $str, |
| 6110 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6110 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6111 | 6111 | null, |
| 6112 | 6112 | $encoding |
| 6113 | 6113 | ); |
@@ -6134,10 +6134,10 @@ discard block |
||
| 6134 | 6134 | } |
| 6135 | 6135 | |
| 6136 | 6136 | if ($encoding === 'UTF-8') { |
| 6137 | - return (string) \mb_substr($str, 0, $offset); |
|
| 6137 | + return (string)\mb_substr($str, 0, $offset); |
|
| 6138 | 6138 | } |
| 6139 | 6139 | |
| 6140 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 6140 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 6141 | 6141 | } |
| 6142 | 6142 | |
| 6143 | 6143 | /** |
@@ -6161,7 +6161,7 @@ discard block |
||
| 6161 | 6161 | return ''; |
| 6162 | 6162 | } |
| 6163 | 6163 | |
| 6164 | - return (string) \mb_substr($str, 0, $offset); |
|
| 6164 | + return (string)\mb_substr($str, 0, $offset); |
|
| 6165 | 6165 | } |
| 6166 | 6166 | |
| 6167 | 6167 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6169,7 +6169,7 @@ discard block |
||
| 6169 | 6169 | return ''; |
| 6170 | 6170 | } |
| 6171 | 6171 | |
| 6172 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 6172 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 6173 | 6173 | } |
| 6174 | 6174 | |
| 6175 | 6175 | /** |
@@ -6257,12 +6257,12 @@ discard block |
||
| 6257 | 6257 | } |
| 6258 | 6258 | |
| 6259 | 6259 | if ($encoding === 'UTF-8') { |
| 6260 | - return (string) \mb_substr($str, -$n); |
|
| 6260 | + return (string)\mb_substr($str, -$n); |
|
| 6261 | 6261 | } |
| 6262 | 6262 | |
| 6263 | 6263 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6264 | 6264 | |
| 6265 | - return (string) self::substr($str, -$n, null, $encoding); |
|
| 6265 | + return (string)self::substr($str, -$n, null, $encoding); |
|
| 6266 | 6266 | } |
| 6267 | 6267 | |
| 6268 | 6268 | /** |
@@ -6286,21 +6286,21 @@ discard block |
||
| 6286 | 6286 | } |
| 6287 | 6287 | |
| 6288 | 6288 | if ($encoding === 'UTF-8') { |
| 6289 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 6289 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 6290 | 6290 | return $str; |
| 6291 | 6291 | } |
| 6292 | 6292 | |
| 6293 | 6293 | /** @noinspection UnnecessaryCastingInspection */ |
| 6294 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($strAddOn)) . $strAddOn; |
|
| 6294 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($strAddOn)).$strAddOn; |
|
| 6295 | 6295 | } |
| 6296 | 6296 | |
| 6297 | 6297 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6298 | 6298 | |
| 6299 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 6299 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 6300 | 6300 | return $str; |
| 6301 | 6301 | } |
| 6302 | 6302 | |
| 6303 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($strAddOn), $encoding)) . $strAddOn; |
|
| 6303 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($strAddOn), $encoding)).$strAddOn; |
|
| 6304 | 6304 | } |
| 6305 | 6305 | |
| 6306 | 6306 | /** |
@@ -6325,12 +6325,12 @@ discard block |
||
| 6325 | 6325 | |
| 6326 | 6326 | if ($encoding === 'UTF-8') { |
| 6327 | 6327 | /** @noinspection UnnecessaryCastingInspection */ |
| 6328 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 6328 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 6329 | 6329 | return $str; |
| 6330 | 6330 | } |
| 6331 | 6331 | |
| 6332 | 6332 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
| 6333 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
| 6333 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
| 6334 | 6334 | } |
| 6335 | 6335 | |
| 6336 | 6336 | $str = \mb_substr($str, 0, $length); |
@@ -6340,20 +6340,20 @@ discard block |
||
| 6340 | 6340 | $new_str = \implode(' ', $array); |
| 6341 | 6341 | |
| 6342 | 6342 | if ($new_str === '') { |
| 6343 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
| 6343 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
| 6344 | 6344 | } |
| 6345 | 6345 | } else { |
| 6346 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 6346 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 6347 | 6347 | return $str; |
| 6348 | 6348 | } |
| 6349 | 6349 | |
| 6350 | 6350 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
| 6351 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
| 6351 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
| 6352 | 6352 | } |
| 6353 | 6353 | |
| 6354 | 6354 | $str = self::substr($str, 0, $length, $encoding); |
| 6355 | 6355 | if ($str === false) { |
| 6356 | - return '' . $strAddOn; |
|
| 6356 | + return ''.$strAddOn; |
|
| 6357 | 6357 | } |
| 6358 | 6358 | |
| 6359 | 6359 | $array = \explode(' ', $str); |
@@ -6361,11 +6361,11 @@ discard block |
||
| 6361 | 6361 | $new_str = \implode(' ', $array); |
| 6362 | 6362 | |
| 6363 | 6363 | if ($new_str === '') { |
| 6364 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
| 6364 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
| 6365 | 6365 | } |
| 6366 | 6366 | } |
| 6367 | 6367 | |
| 6368 | - return $new_str . $strAddOn; |
|
| 6368 | + return $new_str.$strAddOn; |
|
| 6369 | 6369 | } |
| 6370 | 6370 | |
| 6371 | 6371 | /** |
@@ -6383,7 +6383,7 @@ discard block |
||
| 6383 | 6383 | $longestCommonPrefix = ''; |
| 6384 | 6384 | |
| 6385 | 6385 | if ($encoding === 'UTF-8') { |
| 6386 | - $maxLength = (int) \min( |
|
| 6386 | + $maxLength = (int)\min( |
|
| 6387 | 6387 | \mb_strlen($str), |
| 6388 | 6388 | \mb_strlen($otherStr) |
| 6389 | 6389 | ); |
@@ -6404,7 +6404,7 @@ discard block |
||
| 6404 | 6404 | } else { |
| 6405 | 6405 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6406 | 6406 | |
| 6407 | - $maxLength = (int) \min( |
|
| 6407 | + $maxLength = (int)\min( |
|
| 6408 | 6408 | self::strlen($str, $encoding), |
| 6409 | 6409 | self::strlen($otherStr, $encoding) |
| 6410 | 6410 | ); |
@@ -6447,13 +6447,13 @@ discard block |
||
| 6447 | 6447 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
| 6448 | 6448 | |
| 6449 | 6449 | if ($encoding === 'UTF-8') { |
| 6450 | - $strLength = (int) \mb_strlen($str); |
|
| 6451 | - $otherLength = (int) \mb_strlen($otherStr); |
|
| 6450 | + $strLength = (int)\mb_strlen($str); |
|
| 6451 | + $otherLength = (int)\mb_strlen($otherStr); |
|
| 6452 | 6452 | } else { |
| 6453 | 6453 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6454 | 6454 | |
| 6455 | - $strLength = (int) self::strlen($str, $encoding); |
|
| 6456 | - $otherLength = (int) self::strlen($otherStr, $encoding); |
|
| 6455 | + $strLength = (int)self::strlen($str, $encoding); |
|
| 6456 | + $otherLength = (int)self::strlen($otherStr, $encoding); |
|
| 6457 | 6457 | } |
| 6458 | 6458 | |
| 6459 | 6459 | // Return if either string is empty |
@@ -6506,10 +6506,10 @@ discard block |
||
| 6506 | 6506 | } |
| 6507 | 6507 | |
| 6508 | 6508 | if ($encoding === 'UTF-8') { |
| 6509 | - return (string) \mb_substr($str, $end - $len, $len); |
|
| 6509 | + return (string)\mb_substr($str, $end - $len, $len); |
|
| 6510 | 6510 | } |
| 6511 | 6511 | |
| 6512 | - return (string) self::substr($str, $end - $len, $len, $encoding); |
|
| 6512 | + return (string)self::substr($str, $end - $len, $len, $encoding); |
|
| 6513 | 6513 | } |
| 6514 | 6514 | |
| 6515 | 6515 | /** |
@@ -6528,7 +6528,7 @@ discard block |
||
| 6528 | 6528 | } |
| 6529 | 6529 | |
| 6530 | 6530 | if ($encoding === 'UTF-8') { |
| 6531 | - $maxLength = (int) \min( |
|
| 6531 | + $maxLength = (int)\min( |
|
| 6532 | 6532 | \mb_strlen($str, $encoding), |
| 6533 | 6533 | \mb_strlen($otherStr, $encoding) |
| 6534 | 6534 | ); |
@@ -6542,7 +6542,7 @@ discard block |
||
| 6542 | 6542 | && |
| 6543 | 6543 | $char === \mb_substr($otherStr, -$i, 1) |
| 6544 | 6544 | ) { |
| 6545 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
| 6545 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
| 6546 | 6546 | } else { |
| 6547 | 6547 | break; |
| 6548 | 6548 | } |
@@ -6550,7 +6550,7 @@ discard block |
||
| 6550 | 6550 | } else { |
| 6551 | 6551 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6552 | 6552 | |
| 6553 | - $maxLength = (int) \min( |
|
| 6553 | + $maxLength = (int)\min( |
|
| 6554 | 6554 | self::strlen($str, $encoding), |
| 6555 | 6555 | self::strlen($otherStr, $encoding) |
| 6556 | 6556 | ); |
@@ -6564,7 +6564,7 @@ discard block |
||
| 6564 | 6564 | && |
| 6565 | 6565 | $char === self::substr($otherStr, -$i, 1, $encoding) |
| 6566 | 6566 | ) { |
| 6567 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
| 6567 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
| 6568 | 6568 | } else { |
| 6569 | 6569 | break; |
| 6570 | 6570 | } |
@@ -6584,7 +6584,7 @@ discard block |
||
| 6584 | 6584 | */ |
| 6585 | 6585 | public static function str_matches_pattern(string $str, string $pattern): bool |
| 6586 | 6586 | { |
| 6587 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
| 6587 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
| 6588 | 6588 | } |
| 6589 | 6589 | |
| 6590 | 6590 | /** |
@@ -6601,7 +6601,7 @@ discard block |
||
| 6601 | 6601 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
| 6602 | 6602 | { |
| 6603 | 6603 | // init |
| 6604 | - $length = (int) self::strlen($str, $encoding); |
|
| 6604 | + $length = (int)self::strlen($str, $encoding); |
|
| 6605 | 6605 | |
| 6606 | 6606 | if ($offset >= 0) { |
| 6607 | 6607 | return $length > $offset; |
@@ -6627,7 +6627,7 @@ discard block |
||
| 6627 | 6627 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
| 6628 | 6628 | { |
| 6629 | 6629 | // init |
| 6630 | - $length = (int) self::strlen($str); |
|
| 6630 | + $length = (int)self::strlen($str); |
|
| 6631 | 6631 | |
| 6632 | 6632 | if ( |
| 6633 | 6633 | ($index >= 0 && $length <= $index) |
@@ -6666,7 +6666,7 @@ discard block |
||
| 6666 | 6666 | return $str; |
| 6667 | 6667 | } |
| 6668 | 6668 | |
| 6669 | - if ($pad_type !== (int) $pad_type) { |
|
| 6669 | + if ($pad_type !== (int)$pad_type) { |
|
| 6670 | 6670 | if ($pad_type === 'left') { |
| 6671 | 6671 | $pad_type = \STR_PAD_LEFT; |
| 6672 | 6672 | } elseif ($pad_type === 'right') { |
@@ -6675,23 +6675,23 @@ discard block |
||
| 6675 | 6675 | $pad_type = \STR_PAD_BOTH; |
| 6676 | 6676 | } else { |
| 6677 | 6677 | throw new \InvalidArgumentException( |
| 6678 | - 'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
| 6678 | + 'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
| 6679 | 6679 | ); |
| 6680 | 6680 | } |
| 6681 | 6681 | } |
| 6682 | 6682 | |
| 6683 | 6683 | if ($encoding === 'UTF-8') { |
| 6684 | - $str_length = (int) \mb_strlen($str); |
|
| 6684 | + $str_length = (int)\mb_strlen($str); |
|
| 6685 | 6685 | |
| 6686 | 6686 | if ($pad_length >= $str_length) { |
| 6687 | 6687 | switch ($pad_type) { |
| 6688 | 6688 | case \STR_PAD_LEFT: |
| 6689 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 6689 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 6690 | 6690 | |
| 6691 | 6691 | $diff = ($pad_length - $str_length); |
| 6692 | 6692 | |
| 6693 | - $pre = (string) \mb_substr( |
|
| 6694 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 6693 | + $pre = (string)\mb_substr( |
|
| 6694 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 6695 | 6695 | 0, |
| 6696 | 6696 | $diff |
| 6697 | 6697 | ); |
@@ -6702,16 +6702,16 @@ discard block |
||
| 6702 | 6702 | case \STR_PAD_BOTH: |
| 6703 | 6703 | $diff = ($pad_length - $str_length); |
| 6704 | 6704 | |
| 6705 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 6705 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 6706 | 6706 | |
| 6707 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 6707 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 6708 | 6708 | |
| 6709 | - $pre = (string) \mb_substr( |
|
| 6709 | + $pre = (string)\mb_substr( |
|
| 6710 | 6710 | \str_repeat($pad_string, $ps_length_left), |
| 6711 | 6711 | 0, |
| 6712 | 6712 | $ps_length_left |
| 6713 | 6713 | ); |
| 6714 | - $post = (string) \mb_substr( |
|
| 6714 | + $post = (string)\mb_substr( |
|
| 6715 | 6715 | \str_repeat($pad_string, $ps_length_right), |
| 6716 | 6716 | 0, |
| 6717 | 6717 | $ps_length_right |
@@ -6721,19 +6721,19 @@ discard block |
||
| 6721 | 6721 | |
| 6722 | 6722 | case \STR_PAD_RIGHT: |
| 6723 | 6723 | default: |
| 6724 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 6724 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 6725 | 6725 | |
| 6726 | 6726 | $diff = ($pad_length - $str_length); |
| 6727 | 6727 | |
| 6728 | - $post = (string) \mb_substr( |
|
| 6729 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 6728 | + $post = (string)\mb_substr( |
|
| 6729 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 6730 | 6730 | 0, |
| 6731 | 6731 | $diff |
| 6732 | 6732 | ); |
| 6733 | 6733 | $pre = ''; |
| 6734 | 6734 | } |
| 6735 | 6735 | |
| 6736 | - return $pre . $str . $post; |
|
| 6736 | + return $pre.$str.$post; |
|
| 6737 | 6737 | } |
| 6738 | 6738 | |
| 6739 | 6739 | return $str; |
@@ -6741,17 +6741,17 @@ discard block |
||
| 6741 | 6741 | |
| 6742 | 6742 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6743 | 6743 | |
| 6744 | - $str_length = (int) self::strlen($str, $encoding); |
|
| 6744 | + $str_length = (int)self::strlen($str, $encoding); |
|
| 6745 | 6745 | |
| 6746 | 6746 | if ($pad_length >= $str_length) { |
| 6747 | 6747 | switch ($pad_type) { |
| 6748 | 6748 | case \STR_PAD_LEFT: |
| 6749 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 6749 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 6750 | 6750 | |
| 6751 | 6751 | $diff = ($pad_length - $str_length); |
| 6752 | 6752 | |
| 6753 | - $pre = (string) self::substr( |
|
| 6754 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 6753 | + $pre = (string)self::substr( |
|
| 6754 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 6755 | 6755 | 0, |
| 6756 | 6756 | $diff, |
| 6757 | 6757 | $encoding |
@@ -6763,17 +6763,17 @@ discard block |
||
| 6763 | 6763 | case \STR_PAD_BOTH: |
| 6764 | 6764 | $diff = ($pad_length - $str_length); |
| 6765 | 6765 | |
| 6766 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 6766 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 6767 | 6767 | |
| 6768 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 6768 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 6769 | 6769 | |
| 6770 | - $pre = (string) self::substr( |
|
| 6770 | + $pre = (string)self::substr( |
|
| 6771 | 6771 | \str_repeat($pad_string, $ps_length_left), |
| 6772 | 6772 | 0, |
| 6773 | 6773 | $ps_length_left, |
| 6774 | 6774 | $encoding |
| 6775 | 6775 | ); |
| 6776 | - $post = (string) self::substr( |
|
| 6776 | + $post = (string)self::substr( |
|
| 6777 | 6777 | \str_repeat($pad_string, $ps_length_right), |
| 6778 | 6778 | 0, |
| 6779 | 6779 | $ps_length_right, |
@@ -6784,12 +6784,12 @@ discard block |
||
| 6784 | 6784 | |
| 6785 | 6785 | case \STR_PAD_RIGHT: |
| 6786 | 6786 | default: |
| 6787 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 6787 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 6788 | 6788 | |
| 6789 | 6789 | $diff = ($pad_length - $str_length); |
| 6790 | 6790 | |
| 6791 | - $post = (string) self::substr( |
|
| 6792 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 6791 | + $post = (string)self::substr( |
|
| 6792 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 6793 | 6793 | 0, |
| 6794 | 6794 | $diff, |
| 6795 | 6795 | $encoding |
@@ -6797,7 +6797,7 @@ discard block |
||
| 6797 | 6797 | $pre = ''; |
| 6798 | 6798 | } |
| 6799 | 6799 | |
| 6800 | - return $pre . $str . $post; |
|
| 6800 | + return $pre.$str.$post; |
|
| 6801 | 6801 | } |
| 6802 | 6802 | |
| 6803 | 6803 | return $str; |
@@ -6956,11 +6956,11 @@ discard block |
||
| 6956 | 6956 | } |
| 6957 | 6957 | |
| 6958 | 6958 | if ($search === '') { |
| 6959 | - return $str . $replacement; |
|
| 6959 | + return $str.$replacement; |
|
| 6960 | 6960 | } |
| 6961 | 6961 | |
| 6962 | 6962 | if (\strpos($str, $search) === 0) { |
| 6963 | - return $replacement . \substr($str, \strlen($search)); |
|
| 6963 | + return $replacement.\substr($str, \strlen($search)); |
|
| 6964 | 6964 | } |
| 6965 | 6965 | |
| 6966 | 6966 | return $str; |
@@ -6988,11 +6988,11 @@ discard block |
||
| 6988 | 6988 | } |
| 6989 | 6989 | |
| 6990 | 6990 | if ($search === '') { |
| 6991 | - return $str . $replacement; |
|
| 6991 | + return $str.$replacement; |
|
| 6992 | 6992 | } |
| 6993 | 6993 | |
| 6994 | 6994 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 6995 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 6995 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 6996 | 6996 | } |
| 6997 | 6997 | |
| 6998 | 6998 | return $str; |
@@ -7021,7 +7021,7 @@ discard block |
||
| 7021 | 7021 | $subject, |
| 7022 | 7022 | $replace, |
| 7023 | 7023 | $pos, |
| 7024 | - (int) self::strlen($search) |
|
| 7024 | + (int)self::strlen($search) |
|
| 7025 | 7025 | ); |
| 7026 | 7026 | } |
| 7027 | 7027 | |
@@ -7053,7 +7053,7 @@ discard block |
||
| 7053 | 7053 | $subject, |
| 7054 | 7054 | $replace, |
| 7055 | 7055 | $pos, |
| 7056 | - (int) self::strlen($search) |
|
| 7056 | + (int)self::strlen($search) |
|
| 7057 | 7057 | ); |
| 7058 | 7058 | } |
| 7059 | 7059 | |
@@ -7073,7 +7073,7 @@ discard block |
||
| 7073 | 7073 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
| 7074 | 7074 | { |
| 7075 | 7075 | if ($encoding === 'UTF-8') { |
| 7076 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
| 7076 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
| 7077 | 7077 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 7078 | 7078 | \shuffle($indexes); |
| 7079 | 7079 | |
@@ -7089,7 +7089,7 @@ discard block |
||
| 7089 | 7089 | } else { |
| 7090 | 7090 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7091 | 7091 | |
| 7092 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
| 7092 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
| 7093 | 7093 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 7094 | 7094 | \shuffle($indexes); |
| 7095 | 7095 | |
@@ -7130,11 +7130,11 @@ discard block |
||
| 7130 | 7130 | ) { |
| 7131 | 7131 | if ($encoding === 'UTF-8') { |
| 7132 | 7132 | if ($end === null) { |
| 7133 | - $length = (int) \mb_strlen($str); |
|
| 7133 | + $length = (int)\mb_strlen($str); |
|
| 7134 | 7134 | } elseif ($end >= 0 && $end <= $start) { |
| 7135 | 7135 | return ''; |
| 7136 | 7136 | } elseif ($end < 0) { |
| 7137 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
| 7137 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
| 7138 | 7138 | } else { |
| 7139 | 7139 | $length = $end - $start; |
| 7140 | 7140 | } |
@@ -7145,11 +7145,11 @@ discard block |
||
| 7145 | 7145 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7146 | 7146 | |
| 7147 | 7147 | if ($end === null) { |
| 7148 | - $length = (int) self::strlen($str, $encoding); |
|
| 7148 | + $length = (int)self::strlen($str, $encoding); |
|
| 7149 | 7149 | } elseif ($end >= 0 && $end <= $start) { |
| 7150 | 7150 | return ''; |
| 7151 | 7151 | } elseif ($end < 0) { |
| 7152 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
| 7152 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
| 7153 | 7153 | } else { |
| 7154 | 7154 | $length = $end - $start; |
| 7155 | 7155 | } |
@@ -7181,35 +7181,35 @@ discard block |
||
| 7181 | 7181 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7182 | 7182 | } |
| 7183 | 7183 | |
| 7184 | - $str = (string) \preg_replace_callback( |
|
| 7184 | + $str = (string)\preg_replace_callback( |
|
| 7185 | 7185 | '/([\d|\p{Lu}])/u', |
| 7186 | 7186 | /** |
| 7187 | 7187 | * @param string[] $matches |
| 7188 | 7188 | * |
| 7189 | 7189 | * @return string |
| 7190 | 7190 | */ |
| 7191 | - static function (array $matches) use ($encoding): string { |
|
| 7191 | + static function(array $matches) use ($encoding): string { |
|
| 7192 | 7192 | $match = $matches[1]; |
| 7193 | - $matchInt = (int) $match; |
|
| 7193 | + $matchInt = (int)$match; |
|
| 7194 | 7194 | |
| 7195 | - if ((string) $matchInt === $match) { |
|
| 7196 | - return '_' . $match . '_'; |
|
| 7195 | + if ((string)$matchInt === $match) { |
|
| 7196 | + return '_'.$match.'_'; |
|
| 7197 | 7197 | } |
| 7198 | 7198 | |
| 7199 | 7199 | if ($encoding === 'UTF-8') { |
| 7200 | - return '_' . \mb_strtolower($match); |
|
| 7200 | + return '_'.\mb_strtolower($match); |
|
| 7201 | 7201 | } |
| 7202 | 7202 | |
| 7203 | - return '_' . self::strtolower($match, $encoding); |
|
| 7203 | + return '_'.self::strtolower($match, $encoding); |
|
| 7204 | 7204 | }, |
| 7205 | 7205 | $str |
| 7206 | 7206 | ); |
| 7207 | 7207 | |
| 7208 | - $str = (string) \preg_replace( |
|
| 7208 | + $str = (string)\preg_replace( |
|
| 7209 | 7209 | [ |
| 7210 | - '/\s+/u', // convert spaces to "_" |
|
| 7211 | - '/^\s+|\s+$/u', // trim leading & trailing spaces |
|
| 7212 | - '/_+/', // remove double "_" |
|
| 7210 | + '/\s+/u', // convert spaces to "_" |
|
| 7211 | + '/^\s+|\s+$/u', // trim leading & trailing spaces |
|
| 7212 | + '/_+/', // remove double "_" |
|
| 7213 | 7213 | ], |
| 7214 | 7214 | [ |
| 7215 | 7215 | '_', |
@@ -7316,7 +7316,7 @@ discard block |
||
| 7316 | 7316 | $limit = -1; |
| 7317 | 7317 | } |
| 7318 | 7318 | |
| 7319 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
| 7319 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
| 7320 | 7320 | |
| 7321 | 7321 | if ($array === false) { |
| 7322 | 7322 | return []; |
@@ -7392,9 +7392,9 @@ discard block |
||
| 7392 | 7392 | return ''; |
| 7393 | 7393 | } |
| 7394 | 7394 | |
| 7395 | - return (string) \mb_substr( |
|
| 7395 | + return (string)\mb_substr( |
|
| 7396 | 7396 | $str, |
| 7397 | - $offset + (int) \mb_strlen($separator) |
|
| 7397 | + $offset + (int)\mb_strlen($separator) |
|
| 7398 | 7398 | ); |
| 7399 | 7399 | } |
| 7400 | 7400 | |
@@ -7403,9 +7403,9 @@ discard block |
||
| 7403 | 7403 | return ''; |
| 7404 | 7404 | } |
| 7405 | 7405 | |
| 7406 | - return (string) \mb_substr( |
|
| 7406 | + return (string)\mb_substr( |
|
| 7407 | 7407 | $str, |
| 7408 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 7408 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 7409 | 7409 | null, |
| 7410 | 7410 | $encoding |
| 7411 | 7411 | ); |
@@ -7432,9 +7432,9 @@ discard block |
||
| 7432 | 7432 | return ''; |
| 7433 | 7433 | } |
| 7434 | 7434 | |
| 7435 | - return (string) \mb_substr( |
|
| 7435 | + return (string)\mb_substr( |
|
| 7436 | 7436 | $str, |
| 7437 | - $offset + (int) \mb_strlen($separator) |
|
| 7437 | + $offset + (int)\mb_strlen($separator) |
|
| 7438 | 7438 | ); |
| 7439 | 7439 | } |
| 7440 | 7440 | |
@@ -7443,9 +7443,9 @@ discard block |
||
| 7443 | 7443 | return ''; |
| 7444 | 7444 | } |
| 7445 | 7445 | |
| 7446 | - return (string) self::substr( |
|
| 7446 | + return (string)self::substr( |
|
| 7447 | 7447 | $str, |
| 7448 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 7448 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 7449 | 7449 | null, |
| 7450 | 7450 | $encoding |
| 7451 | 7451 | ); |
@@ -7475,7 +7475,7 @@ discard block |
||
| 7475 | 7475 | return ''; |
| 7476 | 7476 | } |
| 7477 | 7477 | |
| 7478 | - return (string) \mb_substr( |
|
| 7478 | + return (string)\mb_substr( |
|
| 7479 | 7479 | $str, |
| 7480 | 7480 | 0, |
| 7481 | 7481 | $offset |
@@ -7487,7 +7487,7 @@ discard block |
||
| 7487 | 7487 | return ''; |
| 7488 | 7488 | } |
| 7489 | 7489 | |
| 7490 | - return (string) self::substr( |
|
| 7490 | + return (string)self::substr( |
|
| 7491 | 7491 | $str, |
| 7492 | 7492 | 0, |
| 7493 | 7493 | $offset, |
@@ -7516,7 +7516,7 @@ discard block |
||
| 7516 | 7516 | return ''; |
| 7517 | 7517 | } |
| 7518 | 7518 | |
| 7519 | - return (string) \mb_substr( |
|
| 7519 | + return (string)\mb_substr( |
|
| 7520 | 7520 | $str, |
| 7521 | 7521 | 0, |
| 7522 | 7522 | $offset |
@@ -7530,7 +7530,7 @@ discard block |
||
| 7530 | 7530 | |
| 7531 | 7531 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7532 | 7532 | |
| 7533 | - return (string) self::substr( |
|
| 7533 | + return (string)self::substr( |
|
| 7534 | 7534 | $str, |
| 7535 | 7535 | 0, |
| 7536 | 7536 | $offset, |
@@ -7638,7 +7638,7 @@ discard block |
||
| 7638 | 7638 | */ |
| 7639 | 7639 | public static function str_surround(string $str, string $substring): string |
| 7640 | 7640 | { |
| 7641 | - return $substring . $str . $substring; |
|
| 7641 | + return $substring.$str.$substring; |
|
| 7642 | 7642 | } |
| 7643 | 7643 | |
| 7644 | 7644 | /** |
@@ -7682,9 +7682,9 @@ discard block |
||
| 7682 | 7682 | |
| 7683 | 7683 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
| 7684 | 7684 | |
| 7685 | - return (string) \preg_replace_callback( |
|
| 7685 | + return (string)\preg_replace_callback( |
|
| 7686 | 7686 | '/([\S]+)/u', |
| 7687 | - static function (array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
| 7687 | + static function(array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
| 7688 | 7688 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
| 7689 | 7689 | return $match[0]; |
| 7690 | 7690 | } |
@@ -7770,16 +7770,16 @@ discard block |
||
| 7770 | 7770 | } |
| 7771 | 7771 | |
| 7772 | 7772 | // the main substitutions |
| 7773 | - $str = (string) \preg_replace_callback( |
|
| 7773 | + $str = (string)\preg_replace_callback( |
|
| 7774 | 7774 | '~\b (_*) (?: # 1. Leading underscore and |
| 7775 | 7775 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
| 7776 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) # URL, domain, or email |
|
| 7776 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) # URL, domain, or email |
|
| 7777 | 7777 | | |
| 7778 | - ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' ) # 3. or small word (case-insensitive) |
|
| 7778 | + ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' ) # 3. or small word (case-insensitive) |
|
| 7779 | 7779 | | |
| 7780 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 4. or word w/o internal caps |
|
| 7780 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 4. or word w/o internal caps |
|
| 7781 | 7781 | | |
| 7782 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 5. or some other word |
|
| 7782 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 5. or some other word |
|
| 7783 | 7783 | ) (_*) \b # 6. With trailing underscore |
| 7784 | 7784 | ~ux', |
| 7785 | 7785 | /** |
@@ -7787,7 +7787,7 @@ discard block |
||
| 7787 | 7787 | * |
| 7788 | 7788 | * @return string |
| 7789 | 7789 | */ |
| 7790 | - static function (array $matches) use ($encoding): string { |
|
| 7790 | + static function(array $matches) use ($encoding): string { |
|
| 7791 | 7791 | // preserve leading underscore |
| 7792 | 7792 | $str = $matches[1]; |
| 7793 | 7793 | if ($matches[2]) { |
@@ -7812,26 +7812,26 @@ discard block |
||
| 7812 | 7812 | ); |
| 7813 | 7813 | |
| 7814 | 7814 | // Exceptions for small words: capitalize at start of title... |
| 7815 | - $str = (string) \preg_replace_callback( |
|
| 7815 | + $str = (string)\preg_replace_callback( |
|
| 7816 | 7816 | '~( \A [[:punct:]]* # start of title... |
| 7817 | 7817 | | [:.;?!][ ]+ # or of subsentence... |
| 7818 | 7818 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
| 7819 | - ( ' . $smallWordsRx . ' ) \b # ...followed by small word |
|
| 7819 | + ( ' . $smallWordsRx.' ) \b # ...followed by small word |
|
| 7820 | 7820 | ~uxi', |
| 7821 | 7821 | /** |
| 7822 | 7822 | * @param string[] $matches |
| 7823 | 7823 | * |
| 7824 | 7824 | * @return string |
| 7825 | 7825 | */ |
| 7826 | - static function (array $matches) use ($encoding): string { |
|
| 7827 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
| 7826 | + static function(array $matches) use ($encoding): string { |
|
| 7827 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
| 7828 | 7828 | }, |
| 7829 | 7829 | $str |
| 7830 | 7830 | ); |
| 7831 | 7831 | |
| 7832 | 7832 | // ...and end of title |
| 7833 | - $str = (string) \preg_replace_callback( |
|
| 7834 | - '~\b ( ' . $smallWordsRx . ' ) # small word... |
|
| 7833 | + $str = (string)\preg_replace_callback( |
|
| 7834 | + '~\b ( '.$smallWordsRx.' ) # small word... |
|
| 7835 | 7835 | (?= [[:punct:]]* \Z # ...at the end of the title... |
| 7836 | 7836 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
| 7837 | 7837 | ~uxi', |
@@ -7840,7 +7840,7 @@ discard block |
||
| 7840 | 7840 | * |
| 7841 | 7841 | * @return string |
| 7842 | 7842 | */ |
| 7843 | - static function (array $matches) use ($encoding): string { |
|
| 7843 | + static function(array $matches) use ($encoding): string { |
|
| 7844 | 7844 | return static::str_upper_first($matches[1], $encoding); |
| 7845 | 7845 | }, |
| 7846 | 7846 | $str |
@@ -7848,10 +7848,10 @@ discard block |
||
| 7848 | 7848 | |
| 7849 | 7849 | // Exceptions for small words in hyphenated compound words. |
| 7850 | 7850 | // e.g. "in-flight" -> In-Flight |
| 7851 | - $str = (string) \preg_replace_callback( |
|
| 7851 | + $str = (string)\preg_replace_callback( |
|
| 7852 | 7852 | '~\b |
| 7853 | 7853 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
| 7854 | - ( ' . $smallWordsRx . ' ) |
|
| 7854 | + ( ' . $smallWordsRx.' ) |
|
| 7855 | 7855 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
| 7856 | 7856 | ~uxi', |
| 7857 | 7857 | /** |
@@ -7859,18 +7859,18 @@ discard block |
||
| 7859 | 7859 | * |
| 7860 | 7860 | * @return string |
| 7861 | 7861 | */ |
| 7862 | - static function (array $matches) use ($encoding): string { |
|
| 7862 | + static function(array $matches) use ($encoding): string { |
|
| 7863 | 7863 | return static::str_upper_first($matches[1], $encoding); |
| 7864 | 7864 | }, |
| 7865 | 7865 | $str |
| 7866 | 7866 | ); |
| 7867 | 7867 | |
| 7868 | 7868 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
| 7869 | - $str = (string) \preg_replace_callback( |
|
| 7869 | + $str = (string)\preg_replace_callback( |
|
| 7870 | 7870 | '~\b |
| 7871 | 7871 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
| 7872 | 7872 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
| 7873 | - ( ' . $smallWordsRx . ' ) # ...followed by small word |
|
| 7873 | + ( ' . $smallWordsRx.' ) # ...followed by small word |
|
| 7874 | 7874 | (?! - ) # Negative lookahead for another - |
| 7875 | 7875 | ~uxi', |
| 7876 | 7876 | /** |
@@ -7878,8 +7878,8 @@ discard block |
||
| 7878 | 7878 | * |
| 7879 | 7879 | * @return string |
| 7880 | 7880 | */ |
| 7881 | - static function (array $matches) use ($encoding): string { |
|
| 7882 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
| 7881 | + static function(array $matches) use ($encoding): string { |
|
| 7882 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
| 7883 | 7883 | }, |
| 7884 | 7884 | $str |
| 7885 | 7885 | ); |
@@ -7982,7 +7982,7 @@ discard block |
||
| 7982 | 7982 | ); |
| 7983 | 7983 | |
| 7984 | 7984 | foreach ($tmpReturn as &$item) { |
| 7985 | - $item = (string) $item; |
|
| 7985 | + $item = (string)$item; |
|
| 7986 | 7986 | } |
| 7987 | 7987 | |
| 7988 | 7988 | return $tmpReturn; |
@@ -8027,39 +8027,39 @@ discard block |
||
| 8027 | 8027 | } |
| 8028 | 8028 | |
| 8029 | 8029 | if ($encoding === 'UTF-8') { |
| 8030 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 8030 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 8031 | 8031 | return $str; |
| 8032 | 8032 | } |
| 8033 | 8033 | |
| 8034 | 8034 | if ($substring !== '') { |
| 8035 | - $length -= (int) \mb_strlen($substring); |
|
| 8035 | + $length -= (int)\mb_strlen($substring); |
|
| 8036 | 8036 | |
| 8037 | 8037 | /** @noinspection UnnecessaryCastingInspection */ |
| 8038 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
| 8038 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
| 8039 | 8039 | } |
| 8040 | 8040 | |
| 8041 | 8041 | /** @noinspection UnnecessaryCastingInspection */ |
| 8042 | - return (string) \mb_substr($str, 0, $length); |
|
| 8042 | + return (string)\mb_substr($str, 0, $length); |
|
| 8043 | 8043 | } |
| 8044 | 8044 | |
| 8045 | 8045 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8046 | 8046 | |
| 8047 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 8047 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 8048 | 8048 | return $str; |
| 8049 | 8049 | } |
| 8050 | 8050 | |
| 8051 | 8051 | if ($substring !== '') { |
| 8052 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 8052 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 8053 | 8053 | } |
| 8054 | 8054 | |
| 8055 | 8055 | return ( |
| 8056 | - (string) self::substr( |
|
| 8056 | + (string)self::substr( |
|
| 8057 | 8057 | $str, |
| 8058 | 8058 | 0, |
| 8059 | 8059 | $length, |
| 8060 | 8060 | $encoding |
| 8061 | 8061 | ) |
| 8062 | - ) . $substring; |
|
| 8062 | + ).$substring; |
|
| 8063 | 8063 | } |
| 8064 | 8064 | |
| 8065 | 8065 | /** |
@@ -8089,12 +8089,12 @@ discard block |
||
| 8089 | 8089 | } |
| 8090 | 8090 | |
| 8091 | 8091 | if ($encoding === 'UTF-8') { |
| 8092 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 8092 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 8093 | 8093 | return $str; |
| 8094 | 8094 | } |
| 8095 | 8095 | |
| 8096 | 8096 | // need to further trim the string so we can append the substring |
| 8097 | - $length -= (int) \mb_strlen($substring); |
|
| 8097 | + $length -= (int)\mb_strlen($substring); |
|
| 8098 | 8098 | if ($length <= 0) { |
| 8099 | 8099 | return $substring; |
| 8100 | 8100 | } |
@@ -8116,18 +8116,18 @@ discard block |
||
| 8116 | 8116 | || |
| 8117 | 8117 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
| 8118 | 8118 | ) { |
| 8119 | - $truncated = (string) \mb_substr($truncated, 0, (int) $lastPos); |
|
| 8119 | + $truncated = (string)\mb_substr($truncated, 0, (int)$lastPos); |
|
| 8120 | 8120 | } |
| 8121 | 8121 | } |
| 8122 | 8122 | } else { |
| 8123 | 8123 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8124 | 8124 | |
| 8125 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 8125 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 8126 | 8126 | return $str; |
| 8127 | 8127 | } |
| 8128 | 8128 | |
| 8129 | 8129 | // need to further trim the string so we can append the substring |
| 8130 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 8130 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 8131 | 8131 | if ($length <= 0) { |
| 8132 | 8132 | return $substring; |
| 8133 | 8133 | } |
@@ -8149,12 +8149,12 @@ discard block |
||
| 8149 | 8149 | || |
| 8150 | 8150 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
| 8151 | 8151 | ) { |
| 8152 | - $truncated = (string) self::substr($truncated, 0, (int) $lastPos, $encoding); |
|
| 8152 | + $truncated = (string)self::substr($truncated, 0, (int)$lastPos, $encoding); |
|
| 8153 | 8153 | } |
| 8154 | 8154 | } |
| 8155 | 8155 | } |
| 8156 | 8156 | |
| 8157 | - return $truncated . $substring; |
|
| 8157 | + return $truncated.$substring; |
|
| 8158 | 8158 | } |
| 8159 | 8159 | |
| 8160 | 8160 | /** |
@@ -8244,13 +8244,13 @@ discard block |
||
| 8244 | 8244 | } |
| 8245 | 8245 | } elseif ($format === 2) { |
| 8246 | 8246 | $numberOfWords = []; |
| 8247 | - $offset = (int) self::strlen($strParts[0]); |
|
| 8247 | + $offset = (int)self::strlen($strParts[0]); |
|
| 8248 | 8248 | for ($i = 1; $i < $len; $i += 2) { |
| 8249 | 8249 | $numberOfWords[$offset] = $strParts[$i]; |
| 8250 | - $offset += (int) self::strlen($strParts[$i]) + (int) self::strlen($strParts[$i + 1]); |
|
| 8250 | + $offset += (int)self::strlen($strParts[$i]) + (int)self::strlen($strParts[$i + 1]); |
|
| 8251 | 8251 | } |
| 8252 | 8252 | } else { |
| 8253 | - $numberOfWords = (int) (($len - 1) / 2); |
|
| 8253 | + $numberOfWords = (int)(($len - 1) / 2); |
|
| 8254 | 8254 | } |
| 8255 | 8255 | |
| 8256 | 8256 | return $numberOfWords; |
@@ -8314,7 +8314,7 @@ discard block |
||
| 8314 | 8314 | */ |
| 8315 | 8315 | public static function strcmp(string $str1, string $str2): int |
| 8316 | 8316 | { |
| 8317 | - return $str1 . '' === $str2 . '' ? 0 : \strcmp( |
|
| 8317 | + return $str1.'' === $str2.'' ? 0 : \strcmp( |
|
| 8318 | 8318 | \Normalizer::normalize($str1, \Normalizer::NFD), |
| 8319 | 8319 | \Normalizer::normalize($str2, \Normalizer::NFD) |
| 8320 | 8320 | ); |
@@ -8343,21 +8343,21 @@ discard block |
||
| 8343 | 8343 | } |
| 8344 | 8344 | |
| 8345 | 8345 | if ($charList === '') { |
| 8346 | - return (int) self::strlen($str, $encoding); |
|
| 8346 | + return (int)self::strlen($str, $encoding); |
|
| 8347 | 8347 | } |
| 8348 | 8348 | |
| 8349 | 8349 | if ($offset !== null || $length !== null) { |
| 8350 | 8350 | if ($encoding === 'UTF-8') { |
| 8351 | 8351 | if ($length === null) { |
| 8352 | 8352 | /** @noinspection UnnecessaryCastingInspection */ |
| 8353 | - $strTmp = \mb_substr($str, (int) $offset); |
|
| 8353 | + $strTmp = \mb_substr($str, (int)$offset); |
|
| 8354 | 8354 | } else { |
| 8355 | 8355 | /** @noinspection UnnecessaryCastingInspection */ |
| 8356 | - $strTmp = \mb_substr($str, (int) $offset, $length); |
|
| 8356 | + $strTmp = \mb_substr($str, (int)$offset, $length); |
|
| 8357 | 8357 | } |
| 8358 | 8358 | } else { |
| 8359 | 8359 | /** @noinspection UnnecessaryCastingInspection */ |
| 8360 | - $strTmp = self::substr($str, (int) $offset, $length, $encoding); |
|
| 8360 | + $strTmp = self::substr($str, (int)$offset, $length, $encoding); |
|
| 8361 | 8361 | } |
| 8362 | 8362 | |
| 8363 | 8363 | if ($strTmp === false) { |
@@ -8372,7 +8372,7 @@ discard block |
||
| 8372 | 8372 | } |
| 8373 | 8373 | |
| 8374 | 8374 | $matches = []; |
| 8375 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $matches)) { |
|
| 8375 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $matches)) { |
|
| 8376 | 8376 | $return = self::strlen($matches[1], $encoding); |
| 8377 | 8377 | if ($return === false) { |
| 8378 | 8378 | return 0; |
@@ -8381,7 +8381,7 @@ discard block |
||
| 8381 | 8381 | return $return; |
| 8382 | 8382 | } |
| 8383 | 8383 | |
| 8384 | - return (int) self::strlen($str, $encoding); |
|
| 8384 | + return (int)self::strlen($str, $encoding); |
|
| 8385 | 8385 | } |
| 8386 | 8386 | |
| 8387 | 8387 | /** |
@@ -8503,7 +8503,7 @@ discard block |
||
| 8503 | 8503 | return ''; |
| 8504 | 8504 | } |
| 8505 | 8505 | |
| 8506 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
| 8506 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
| 8507 | 8507 | } |
| 8508 | 8508 | |
| 8509 | 8509 | /** |
@@ -8568,7 +8568,7 @@ discard block |
||
| 8568 | 8568 | // fallback for ascii only |
| 8569 | 8569 | // |
| 8570 | 8570 | |
| 8571 | - if (self::is_ascii($haystack . $needle)) { |
|
| 8571 | + if (self::is_ascii($haystack.$needle)) { |
|
| 8572 | 8572 | return \stripos($haystack, $needle, $offset); |
| 8573 | 8573 | } |
| 8574 | 8574 | |
@@ -8635,7 +8635,7 @@ discard block |
||
| 8635 | 8635 | && |
| 8636 | 8636 | self::$SUPPORT['mbstring'] === false |
| 8637 | 8637 | ) { |
| 8638 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 8638 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 8639 | 8639 | } |
| 8640 | 8640 | |
| 8641 | 8641 | if ( |
@@ -8649,11 +8649,11 @@ discard block |
||
| 8649 | 8649 | } |
| 8650 | 8650 | } |
| 8651 | 8651 | |
| 8652 | - if (self::is_ascii($needle . $haystack)) { |
|
| 8652 | + if (self::is_ascii($needle.$haystack)) { |
|
| 8653 | 8653 | return \stristr($haystack, $needle, $before_needle); |
| 8654 | 8654 | } |
| 8655 | 8655 | |
| 8656 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
| 8656 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
| 8657 | 8657 | |
| 8658 | 8658 | if (!isset($match[1])) { |
| 8659 | 8659 | return false; |
@@ -8663,7 +8663,7 @@ discard block |
||
| 8663 | 8663 | return $match[1]; |
| 8664 | 8664 | } |
| 8665 | 8665 | |
| 8666 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
| 8666 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
| 8667 | 8667 | } |
| 8668 | 8668 | |
| 8669 | 8669 | /** |
@@ -8730,7 +8730,7 @@ discard block |
||
| 8730 | 8730 | && |
| 8731 | 8731 | self::$SUPPORT['iconv'] === false |
| 8732 | 8732 | ) { |
| 8733 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 8733 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 8734 | 8734 | } |
| 8735 | 8735 | |
| 8736 | 8736 | // |
@@ -8841,7 +8841,7 @@ discard block |
||
| 8841 | 8841 | */ |
| 8842 | 8842 | public static function strnatcmp(string $str1, string $str2): int |
| 8843 | 8843 | { |
| 8844 | - return $str1 . '' === $str2 . '' ? 0 : \strnatcmp((string) self::strtonatfold($str1), (string) self::strtonatfold($str2)); |
|
| 8844 | + return $str1.'' === $str2.'' ? 0 : \strnatcmp((string)self::strtonatfold($str1), (string)self::strtonatfold($str2)); |
|
| 8845 | 8845 | } |
| 8846 | 8846 | |
| 8847 | 8847 | /** |
@@ -8898,11 +8898,11 @@ discard block |
||
| 8898 | 8898 | } |
| 8899 | 8899 | |
| 8900 | 8900 | if ($encoding === 'UTF-8') { |
| 8901 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
| 8902 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
| 8901 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
| 8902 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
| 8903 | 8903 | } else { |
| 8904 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
| 8905 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
| 8904 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
| 8905 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
| 8906 | 8906 | } |
| 8907 | 8907 | |
| 8908 | 8908 | return self::strcmp($str1, $str2); |
@@ -8924,8 +8924,8 @@ discard block |
||
| 8924 | 8924 | return false; |
| 8925 | 8925 | } |
| 8926 | 8926 | |
| 8927 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
| 8928 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
| 8927 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
| 8928 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
| 8929 | 8929 | } |
| 8930 | 8930 | |
| 8931 | 8931 | return false; |
@@ -8958,10 +8958,10 @@ discard block |
||
| 8958 | 8958 | } |
| 8959 | 8959 | |
| 8960 | 8960 | // iconv and mbstring do not support integer $needle |
| 8961 | - if ((int) $needle === $needle) { |
|
| 8962 | - $needle = (string) self::chr($needle); |
|
| 8961 | + if ((int)$needle === $needle) { |
|
| 8962 | + $needle = (string)self::chr($needle); |
|
| 8963 | 8963 | } |
| 8964 | - $needle = (string) $needle; |
|
| 8964 | + $needle = (string)$needle; |
|
| 8965 | 8965 | |
| 8966 | 8966 | if ($needle === '') { |
| 8967 | 8967 | return false; |
@@ -9008,7 +9008,7 @@ discard block |
||
| 9008 | 9008 | && |
| 9009 | 9009 | self::$SUPPORT['mbstring'] === false |
| 9010 | 9010 | ) { |
| 9011 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9011 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9012 | 9012 | } |
| 9013 | 9013 | |
| 9014 | 9014 | // |
@@ -9049,7 +9049,7 @@ discard block |
||
| 9049 | 9049 | // fallback for ascii only |
| 9050 | 9050 | // |
| 9051 | 9051 | |
| 9052 | - if (self::is_ascii($haystack . $needle)) { |
|
| 9052 | + if (self::is_ascii($haystack.$needle)) { |
|
| 9053 | 9053 | return \strpos($haystack, $needle, $offset); |
| 9054 | 9054 | } |
| 9055 | 9055 | |
@@ -9061,7 +9061,7 @@ discard block |
||
| 9061 | 9061 | if ($haystackTmp === false) { |
| 9062 | 9062 | $haystackTmp = ''; |
| 9063 | 9063 | } |
| 9064 | - $haystack = (string) $haystackTmp; |
|
| 9064 | + $haystack = (string)$haystackTmp; |
|
| 9065 | 9065 | |
| 9066 | 9066 | if ($offset < 0) { |
| 9067 | 9067 | $offset = 0; |
@@ -9073,7 +9073,7 @@ discard block |
||
| 9073 | 9073 | } |
| 9074 | 9074 | |
| 9075 | 9075 | if ($pos) { |
| 9076 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 9076 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 9077 | 9077 | } |
| 9078 | 9078 | |
| 9079 | 9079 | return $offset + 0; |
@@ -9184,7 +9184,7 @@ discard block |
||
| 9184 | 9184 | && |
| 9185 | 9185 | self::$SUPPORT['mbstring'] === false |
| 9186 | 9186 | ) { |
| 9187 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9187 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9188 | 9188 | } |
| 9189 | 9189 | |
| 9190 | 9190 | // |
@@ -9196,7 +9196,7 @@ discard block |
||
| 9196 | 9196 | if ($needleTmp === false) { |
| 9197 | 9197 | return false; |
| 9198 | 9198 | } |
| 9199 | - $needle = (string) $needleTmp; |
|
| 9199 | + $needle = (string)$needleTmp; |
|
| 9200 | 9200 | |
| 9201 | 9201 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
| 9202 | 9202 | if ($pos === false) { |
@@ -9218,7 +9218,7 @@ discard block |
||
| 9218 | 9218 | if ($needleTmp === false) { |
| 9219 | 9219 | return false; |
| 9220 | 9220 | } |
| 9221 | - $needle = (string) $needleTmp; |
|
| 9221 | + $needle = (string)$needleTmp; |
|
| 9222 | 9222 | |
| 9223 | 9223 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
| 9224 | 9224 | if ($pos === false) { |
@@ -9254,7 +9254,7 @@ discard block |
||
| 9254 | 9254 | if ($encoding === 'UTF-8') { |
| 9255 | 9255 | if (self::$SUPPORT['intl'] === true) { |
| 9256 | 9256 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
| 9257 | - $i = (int) \grapheme_strlen($str); |
|
| 9257 | + $i = (int)\grapheme_strlen($str); |
|
| 9258 | 9258 | while ($i--) { |
| 9259 | 9259 | $reversedTmp = \grapheme_substr($str, $i, 1); |
| 9260 | 9260 | if ($reversedTmp !== false) { |
@@ -9262,7 +9262,7 @@ discard block |
||
| 9262 | 9262 | } |
| 9263 | 9263 | } |
| 9264 | 9264 | } else { |
| 9265 | - $i = (int) \mb_strlen($str); |
|
| 9265 | + $i = (int)\mb_strlen($str); |
|
| 9266 | 9266 | while ($i--) { |
| 9267 | 9267 | $reversedTmp = \mb_substr($str, $i, 1); |
| 9268 | 9268 | if ($reversedTmp !== false) { |
@@ -9273,7 +9273,7 @@ discard block |
||
| 9273 | 9273 | } else { |
| 9274 | 9274 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 9275 | 9275 | |
| 9276 | - $i = (int) self::strlen($str, $encoding); |
|
| 9276 | + $i = (int)self::strlen($str, $encoding); |
|
| 9277 | 9277 | while ($i--) { |
| 9278 | 9278 | $reversedTmp = self::substr($str, $i, 1, $encoding); |
| 9279 | 9279 | if ($reversedTmp !== false) { |
@@ -9347,7 +9347,7 @@ discard block |
||
| 9347 | 9347 | if ($needleTmp === false) { |
| 9348 | 9348 | return false; |
| 9349 | 9349 | } |
| 9350 | - $needle = (string) $needleTmp; |
|
| 9350 | + $needle = (string)$needleTmp; |
|
| 9351 | 9351 | |
| 9352 | 9352 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
| 9353 | 9353 | if ($pos === false) { |
@@ -9386,10 +9386,10 @@ discard block |
||
| 9386 | 9386 | } |
| 9387 | 9387 | |
| 9388 | 9388 | // iconv and mbstring do not support integer $needle |
| 9389 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 9390 | - $needle = (string) self::chr($needle); |
|
| 9389 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 9390 | + $needle = (string)self::chr($needle); |
|
| 9391 | 9391 | } |
| 9392 | - $needle = (string) $needle; |
|
| 9392 | + $needle = (string)$needle; |
|
| 9393 | 9393 | |
| 9394 | 9394 | if ($needle === '') { |
| 9395 | 9395 | return false; |
@@ -9434,7 +9434,7 @@ discard block |
||
| 9434 | 9434 | && |
| 9435 | 9435 | self::$SUPPORT['mbstring'] === false |
| 9436 | 9436 | ) { |
| 9437 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9437 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9438 | 9438 | } |
| 9439 | 9439 | |
| 9440 | 9440 | // |
@@ -9458,7 +9458,7 @@ discard block |
||
| 9458 | 9458 | // fallback for ascii only |
| 9459 | 9459 | // |
| 9460 | 9460 | |
| 9461 | - if (self::is_ascii($haystack . $needle)) { |
|
| 9461 | + if (self::is_ascii($haystack.$needle)) { |
|
| 9462 | 9462 | return \strripos($haystack, $needle, $offset); |
| 9463 | 9463 | } |
| 9464 | 9464 | |
@@ -9534,10 +9534,10 @@ discard block |
||
| 9534 | 9534 | } |
| 9535 | 9535 | |
| 9536 | 9536 | // iconv and mbstring do not support integer $needle |
| 9537 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 9538 | - $needle = (string) self::chr($needle); |
|
| 9537 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 9538 | + $needle = (string)self::chr($needle); |
|
| 9539 | 9539 | } |
| 9540 | - $needle = (string) $needle; |
|
| 9540 | + $needle = (string)$needle; |
|
| 9541 | 9541 | |
| 9542 | 9542 | if ($needle === '') { |
| 9543 | 9543 | return false; |
@@ -9582,7 +9582,7 @@ discard block |
||
| 9582 | 9582 | && |
| 9583 | 9583 | self::$SUPPORT['mbstring'] === false |
| 9584 | 9584 | ) { |
| 9585 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9585 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9586 | 9586 | } |
| 9587 | 9587 | |
| 9588 | 9588 | // |
@@ -9606,7 +9606,7 @@ discard block |
||
| 9606 | 9606 | // fallback for ascii only |
| 9607 | 9607 | // |
| 9608 | 9608 | |
| 9609 | - if (self::is_ascii($haystack . $needle)) { |
|
| 9609 | + if (self::is_ascii($haystack.$needle)) { |
|
| 9610 | 9610 | return \strrpos($haystack, $needle, $offset); |
| 9611 | 9611 | } |
| 9612 | 9612 | |
@@ -9626,7 +9626,7 @@ discard block |
||
| 9626 | 9626 | if ($haystackTmp === false) { |
| 9627 | 9627 | $haystackTmp = ''; |
| 9628 | 9628 | } |
| 9629 | - $haystack = (string) $haystackTmp; |
|
| 9629 | + $haystack = (string)$haystackTmp; |
|
| 9630 | 9630 | } |
| 9631 | 9631 | |
| 9632 | 9632 | $pos = \strrpos($haystack, $needle); |
@@ -9639,7 +9639,7 @@ discard block |
||
| 9639 | 9639 | return false; |
| 9640 | 9640 | } |
| 9641 | 9641 | |
| 9642 | - return $offset + (int) self::strlen($strTmp); |
|
| 9642 | + return $offset + (int)self::strlen($strTmp); |
|
| 9643 | 9643 | } |
| 9644 | 9644 | |
| 9645 | 9645 | /** |
@@ -9699,12 +9699,12 @@ discard block |
||
| 9699 | 9699 | if ($offset || $length !== null) { |
| 9700 | 9700 | if ($encoding === 'UTF-8') { |
| 9701 | 9701 | if ($length === null) { |
| 9702 | - $str = (string) \mb_substr($str, $offset); |
|
| 9702 | + $str = (string)\mb_substr($str, $offset); |
|
| 9703 | 9703 | } else { |
| 9704 | - $str = (string) \mb_substr($str, $offset, $length); |
|
| 9704 | + $str = (string)\mb_substr($str, $offset, $length); |
|
| 9705 | 9705 | } |
| 9706 | 9706 | } else { |
| 9707 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
| 9707 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
| 9708 | 9708 | } |
| 9709 | 9709 | } |
| 9710 | 9710 | |
@@ -9714,7 +9714,7 @@ discard block |
||
| 9714 | 9714 | |
| 9715 | 9715 | $matches = []; |
| 9716 | 9716 | |
| 9717 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
| 9717 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
| 9718 | 9718 | } |
| 9719 | 9719 | |
| 9720 | 9720 | /** |
@@ -9783,7 +9783,7 @@ discard block |
||
| 9783 | 9783 | && |
| 9784 | 9784 | self::$SUPPORT['mbstring'] === false |
| 9785 | 9785 | ) { |
| 9786 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9786 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9787 | 9787 | } |
| 9788 | 9788 | |
| 9789 | 9789 | // |
@@ -9805,7 +9805,7 @@ discard block |
||
| 9805 | 9805 | // fallback for ascii only |
| 9806 | 9806 | // |
| 9807 | 9807 | |
| 9808 | - if (self::is_ascii($haystack . $needle)) { |
|
| 9808 | + if (self::is_ascii($haystack.$needle)) { |
|
| 9809 | 9809 | return \strstr($haystack, $needle, $before_needle); |
| 9810 | 9810 | } |
| 9811 | 9811 | |
@@ -9813,7 +9813,7 @@ discard block |
||
| 9813 | 9813 | // fallback via vanilla php |
| 9814 | 9814 | // |
| 9815 | 9815 | |
| 9816 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
| 9816 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
| 9817 | 9817 | |
| 9818 | 9818 | if (!isset($match[1])) { |
| 9819 | 9819 | return false; |
@@ -9823,7 +9823,7 @@ discard block |
||
| 9823 | 9823 | return $match[1]; |
| 9824 | 9824 | } |
| 9825 | 9825 | |
| 9826 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
| 9826 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
| 9827 | 9827 | } |
| 9828 | 9828 | |
| 9829 | 9829 | /** |
@@ -9937,7 +9937,7 @@ discard block |
||
| 9937 | 9937 | bool $tryToKeepStringLength = false |
| 9938 | 9938 | ): string { |
| 9939 | 9939 | // init |
| 9940 | - $str = (string) $str; |
|
| 9940 | + $str = (string)$str; |
|
| 9941 | 9941 | |
| 9942 | 9942 | if ($str === '') { |
| 9943 | 9943 | return ''; |
@@ -9967,19 +9967,19 @@ discard block |
||
| 9967 | 9967 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 9968 | 9968 | } |
| 9969 | 9969 | |
| 9970 | - $langCode = $lang . '-Lower'; |
|
| 9970 | + $langCode = $lang.'-Lower'; |
|
| 9971 | 9971 | if (!\in_array($langCode, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 9972 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, \E_USER_WARNING); |
|
| 9972 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, \E_USER_WARNING); |
|
| 9973 | 9973 | |
| 9974 | 9974 | $langCode = 'Any-Lower'; |
| 9975 | 9975 | } |
| 9976 | 9976 | |
| 9977 | 9977 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 9978 | 9978 | /** @noinspection UnnecessaryCastingInspection */ |
| 9979 | - return (string) \transliterator_transliterate($langCode, $str); |
|
| 9979 | + return (string)\transliterator_transliterate($langCode, $str); |
|
| 9980 | 9980 | } |
| 9981 | 9981 | |
| 9982 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
| 9982 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
| 9983 | 9983 | } |
| 9984 | 9984 | |
| 9985 | 9985 | // always fallback via symfony polyfill |
@@ -10008,7 +10008,7 @@ discard block |
||
| 10008 | 10008 | bool $tryToKeepStringLength = false |
| 10009 | 10009 | ): string { |
| 10010 | 10010 | // init |
| 10011 | - $str = (string) $str; |
|
| 10011 | + $str = (string)$str; |
|
| 10012 | 10012 | |
| 10013 | 10013 | if ($str === '') { |
| 10014 | 10014 | return ''; |
@@ -10038,19 +10038,19 @@ discard block |
||
| 10038 | 10038 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 10039 | 10039 | } |
| 10040 | 10040 | |
| 10041 | - $langCode = $lang . '-Upper'; |
|
| 10041 | + $langCode = $lang.'-Upper'; |
|
| 10042 | 10042 | if (!\in_array($langCode, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 10043 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
| 10043 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
| 10044 | 10044 | |
| 10045 | 10045 | $langCode = 'Any-Upper'; |
| 10046 | 10046 | } |
| 10047 | 10047 | |
| 10048 | 10048 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 10049 | 10049 | /** @noinspection UnnecessaryCastingInspection */ |
| 10050 | - return (string) \transliterator_transliterate($langCode, $str); |
|
| 10050 | + return (string)\transliterator_transliterate($langCode, $str); |
|
| 10051 | 10051 | } |
| 10052 | 10052 | |
| 10053 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
| 10053 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
| 10054 | 10054 | } |
| 10055 | 10055 | |
| 10056 | 10056 | // always fallback via symfony polyfill |
@@ -10094,7 +10094,7 @@ discard block |
||
| 10094 | 10094 | |
| 10095 | 10095 | $from = \array_combine($from, $to); |
| 10096 | 10096 | if ($from === false) { |
| 10097 | - 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) . ')'); |
|
| 10097 | + 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).')'); |
|
| 10098 | 10098 | } |
| 10099 | 10099 | } |
| 10100 | 10100 | |
@@ -10151,9 +10151,9 @@ discard block |
||
| 10151 | 10151 | } |
| 10152 | 10152 | |
| 10153 | 10153 | $wide = 0; |
| 10154 | - $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); |
|
| 10154 | + $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); |
|
| 10155 | 10155 | |
| 10156 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
| 10156 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
| 10157 | 10157 | } |
| 10158 | 10158 | |
| 10159 | 10159 | /** |
@@ -10253,9 +10253,9 @@ discard block |
||
| 10253 | 10253 | } |
| 10254 | 10254 | |
| 10255 | 10255 | if ($length === null) { |
| 10256 | - $length = (int) $str_length; |
|
| 10256 | + $length = (int)$str_length; |
|
| 10257 | 10257 | } else { |
| 10258 | - $length = (int) $length; |
|
| 10258 | + $length = (int)$length; |
|
| 10259 | 10259 | } |
| 10260 | 10260 | |
| 10261 | 10261 | if ( |
@@ -10263,7 +10263,7 @@ discard block |
||
| 10263 | 10263 | && |
| 10264 | 10264 | self::$SUPPORT['mbstring'] === false |
| 10265 | 10265 | ) { |
| 10266 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10266 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10267 | 10267 | } |
| 10268 | 10268 | |
| 10269 | 10269 | // |
@@ -10351,16 +10351,16 @@ discard block |
||
| 10351 | 10351 | ) { |
| 10352 | 10352 | if ($encoding === 'UTF-8') { |
| 10353 | 10353 | if ($length === null) { |
| 10354 | - $str1 = (string) \mb_substr($str1, $offset); |
|
| 10354 | + $str1 = (string)\mb_substr($str1, $offset); |
|
| 10355 | 10355 | } else { |
| 10356 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
| 10356 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
| 10357 | 10357 | } |
| 10358 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
| 10358 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
| 10359 | 10359 | } else { |
| 10360 | 10360 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 10361 | 10361 | |
| 10362 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
| 10363 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
| 10362 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
| 10363 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
| 10364 | 10364 | } |
| 10365 | 10365 | } |
| 10366 | 10366 | |
@@ -10422,13 +10422,13 @@ discard block |
||
| 10422 | 10422 | if ($lengthTmp === false) { |
| 10423 | 10423 | return false; |
| 10424 | 10424 | } |
| 10425 | - $length = (int) $lengthTmp; |
|
| 10425 | + $length = (int)$lengthTmp; |
|
| 10426 | 10426 | } |
| 10427 | 10427 | |
| 10428 | 10428 | if ($encoding === 'UTF-8') { |
| 10429 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
| 10429 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
| 10430 | 10430 | } else { |
| 10431 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
| 10431 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
| 10432 | 10432 | } |
| 10433 | 10433 | } |
| 10434 | 10434 | |
@@ -10437,7 +10437,7 @@ discard block |
||
| 10437 | 10437 | && |
| 10438 | 10438 | self::$SUPPORT['mbstring'] === false |
| 10439 | 10439 | ) { |
| 10440 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10440 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10441 | 10441 | } |
| 10442 | 10442 | |
| 10443 | 10443 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10448,7 +10448,7 @@ discard block |
||
| 10448 | 10448 | return \mb_substr_count($haystack, $needle, $encoding); |
| 10449 | 10449 | } |
| 10450 | 10450 | |
| 10451 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 10451 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 10452 | 10452 | |
| 10453 | 10453 | return \count($matches); |
| 10454 | 10454 | } |
@@ -10495,7 +10495,7 @@ discard block |
||
| 10495 | 10495 | if ($lengthTmp === false) { |
| 10496 | 10496 | return false; |
| 10497 | 10497 | } |
| 10498 | - $length = (int) $lengthTmp; |
|
| 10498 | + $length = (int)$lengthTmp; |
|
| 10499 | 10499 | } |
| 10500 | 10500 | |
| 10501 | 10501 | if ( |
@@ -10516,7 +10516,7 @@ discard block |
||
| 10516 | 10516 | if ($haystackTmp === false) { |
| 10517 | 10517 | $haystackTmp = ''; |
| 10518 | 10518 | } |
| 10519 | - $haystack = (string) $haystackTmp; |
|
| 10519 | + $haystack = (string)$haystackTmp; |
|
| 10520 | 10520 | } |
| 10521 | 10521 | |
| 10522 | 10522 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10555,10 +10555,10 @@ discard block |
||
| 10555 | 10555 | |
| 10556 | 10556 | if ($encoding === 'UTF-8') { |
| 10557 | 10557 | if ($caseSensitive) { |
| 10558 | - return (int) \mb_substr_count($str, $substring); |
|
| 10558 | + return (int)\mb_substr_count($str, $substring); |
|
| 10559 | 10559 | } |
| 10560 | 10560 | |
| 10561 | - return (int) \mb_substr_count( |
|
| 10561 | + return (int)\mb_substr_count( |
|
| 10562 | 10562 | \mb_strtoupper($str), |
| 10563 | 10563 | \mb_strtoupper($substring) |
| 10564 | 10564 | |
@@ -10568,10 +10568,10 @@ discard block |
||
| 10568 | 10568 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 10569 | 10569 | |
| 10570 | 10570 | if ($caseSensitive) { |
| 10571 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
| 10571 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
| 10572 | 10572 | } |
| 10573 | 10573 | |
| 10574 | - return (int) \mb_substr_count( |
|
| 10574 | + return (int)\mb_substr_count( |
|
| 10575 | 10575 | self::strtocasefold($str, true, false, $encoding, null, false), |
| 10576 | 10576 | self::strtocasefold($substring, true, false, $encoding, null, false), |
| 10577 | 10577 | $encoding |
@@ -10597,7 +10597,7 @@ discard block |
||
| 10597 | 10597 | } |
| 10598 | 10598 | |
| 10599 | 10599 | if (self::str_istarts_with($haystack, $needle) === true) { |
| 10600 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 10600 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 10601 | 10601 | } |
| 10602 | 10602 | |
| 10603 | 10603 | return $haystack; |
@@ -10654,7 +10654,7 @@ discard block |
||
| 10654 | 10654 | } |
| 10655 | 10655 | |
| 10656 | 10656 | if (self::str_iends_with($haystack, $needle) === true) { |
| 10657 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
| 10657 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
| 10658 | 10658 | } |
| 10659 | 10659 | |
| 10660 | 10660 | return $haystack; |
@@ -10679,7 +10679,7 @@ discard block |
||
| 10679 | 10679 | } |
| 10680 | 10680 | |
| 10681 | 10681 | if (self::str_starts_with($haystack, $needle) === true) { |
| 10682 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 10682 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 10683 | 10683 | } |
| 10684 | 10684 | |
| 10685 | 10685 | return $haystack; |
@@ -10731,7 +10731,7 @@ discard block |
||
| 10731 | 10731 | if (\is_array($offset) === true) { |
| 10732 | 10732 | $offset = \array_slice($offset, 0, $num); |
| 10733 | 10733 | foreach ($offset as &$valueTmp) { |
| 10734 | - $valueTmp = (int) $valueTmp === $valueTmp ? $valueTmp : 0; |
|
| 10734 | + $valueTmp = (int)$valueTmp === $valueTmp ? $valueTmp : 0; |
|
| 10735 | 10735 | } |
| 10736 | 10736 | unset($valueTmp); |
| 10737 | 10737 | } else { |
@@ -10744,7 +10744,7 @@ discard block |
||
| 10744 | 10744 | } elseif (\is_array($length) === true) { |
| 10745 | 10745 | $length = \array_slice($length, 0, $num); |
| 10746 | 10746 | foreach ($length as &$valueTmpV2) { |
| 10747 | - $valueTmpV2 = (int) $valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
| 10747 | + $valueTmpV2 = (int)$valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
| 10748 | 10748 | } |
| 10749 | 10749 | unset($valueTmpV2); |
| 10750 | 10750 | } else { |
@@ -10764,8 +10764,8 @@ discard block |
||
| 10764 | 10764 | } |
| 10765 | 10765 | |
| 10766 | 10766 | // init |
| 10767 | - $str = (string) $str; |
|
| 10768 | - $replacement = (string) $replacement; |
|
| 10767 | + $str = (string)$str; |
|
| 10768 | + $replacement = (string)$replacement; |
|
| 10769 | 10769 | |
| 10770 | 10770 | if (\is_array($length) === true) { |
| 10771 | 10771 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -10780,16 +10780,16 @@ discard block |
||
| 10780 | 10780 | } |
| 10781 | 10781 | |
| 10782 | 10782 | if (self::$SUPPORT['mbstring'] === true) { |
| 10783 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 10783 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 10784 | 10784 | |
| 10785 | 10785 | if ($offset < 0) { |
| 10786 | - $offset = (int) \max(0, $string_length + $offset); |
|
| 10786 | + $offset = (int)\max(0, $string_length + $offset); |
|
| 10787 | 10787 | } elseif ($offset > $string_length) { |
| 10788 | 10788 | $offset = $string_length; |
| 10789 | 10789 | } |
| 10790 | 10790 | |
| 10791 | 10791 | if ($length !== null && $length < 0) { |
| 10792 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
| 10792 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
| 10793 | 10793 | } elseif ($length === null || $length > $string_length) { |
| 10794 | 10794 | $length = $string_length; |
| 10795 | 10795 | } |
@@ -10800,9 +10800,9 @@ discard block |
||
| 10800 | 10800 | } |
| 10801 | 10801 | |
| 10802 | 10802 | /** @noinspection AdditionOperationOnArraysInspection */ |
| 10803 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
| 10804 | - $replacement . |
|
| 10805 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 10803 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
| 10804 | + $replacement. |
|
| 10805 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 10806 | 10806 | } |
| 10807 | 10807 | |
| 10808 | 10808 | // |
@@ -10811,8 +10811,7 @@ discard block |
||
| 10811 | 10811 | |
| 10812 | 10812 | if (self::is_ascii($str)) { |
| 10813 | 10813 | return ($length === null) ? |
| 10814 | - \substr_replace($str, $replacement, $offset) : |
|
| 10815 | - \substr_replace($str, $replacement, $offset, $length); |
|
| 10814 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
| 10816 | 10815 | } |
| 10817 | 10816 | |
| 10818 | 10817 | // |
@@ -10828,7 +10827,7 @@ discard block |
||
| 10828 | 10827 | // e.g.: non mbstring support + invalid chars |
| 10829 | 10828 | return ''; |
| 10830 | 10829 | } |
| 10831 | - $length = (int) $lengthTmp; |
|
| 10830 | + $length = (int)$lengthTmp; |
|
| 10832 | 10831 | } |
| 10833 | 10832 | |
| 10834 | 10833 | \array_splice($smatches[0], $offset, $length, $rmatches[0]); |
@@ -10863,14 +10862,14 @@ discard block |
||
| 10863 | 10862 | && |
| 10864 | 10863 | \substr($haystack, -\strlen($needle)) === $needle |
| 10865 | 10864 | ) { |
| 10866 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
| 10865 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
| 10867 | 10866 | } |
| 10868 | 10867 | |
| 10869 | 10868 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
| 10870 | - return (string) self::substr( |
|
| 10869 | + return (string)self::substr( |
|
| 10871 | 10870 | $haystack, |
| 10872 | 10871 | 0, |
| 10873 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
| 10872 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
| 10874 | 10873 | $encoding |
| 10875 | 10874 | ); |
| 10876 | 10875 | } |
@@ -10900,10 +10899,10 @@ discard block |
||
| 10900 | 10899 | } |
| 10901 | 10900 | |
| 10902 | 10901 | if ($encoding === 'UTF-8') { |
| 10903 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 10902 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 10904 | 10903 | } |
| 10905 | 10904 | |
| 10906 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 10905 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 10907 | 10906 | } |
| 10908 | 10907 | |
| 10909 | 10908 | /** |
@@ -11099,7 +11098,7 @@ discard block |
||
| 11099 | 11098 | // INFO: https://unicode.org/cldr/utility/character.jsp?a=%E2%84%8C |
| 11100 | 11099 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 11101 | 11100 | /** @noinspection UnnecessaryCastingInspection */ |
| 11102 | - $str = (string) \transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
| 11101 | + $str = (string)\transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
| 11103 | 11102 | |
| 11104 | 11103 | // check again, if we only have ASCII, now ... |
| 11105 | 11104 | if (self::is_ascii($str) === true) { |
@@ -11222,7 +11221,7 @@ discard block |
||
| 11222 | 11221 | public static function to_boolean($str): bool |
| 11223 | 11222 | { |
| 11224 | 11223 | // init |
| 11225 | - $str = (string) $str; |
|
| 11224 | + $str = (string)$str; |
|
| 11226 | 11225 | |
| 11227 | 11226 | if ($str === '') { |
| 11228 | 11227 | return false; |
@@ -11250,10 +11249,10 @@ discard block |
||
| 11250 | 11249 | } |
| 11251 | 11250 | |
| 11252 | 11251 | if (\is_numeric($str)) { |
| 11253 | - return ((float) $str + 0) > 0; |
|
| 11252 | + return ((float)$str + 0) > 0; |
|
| 11254 | 11253 | } |
| 11255 | 11254 | |
| 11256 | - return (bool) \trim($str); |
|
| 11255 | + return (bool)\trim($str); |
|
| 11257 | 11256 | } |
| 11258 | 11257 | |
| 11259 | 11258 | /** |
@@ -11274,11 +11273,11 @@ discard block |
||
| 11274 | 11273 | |
| 11275 | 11274 | $fallback_char_escaped = \preg_quote($fallback_char, '/'); |
| 11276 | 11275 | |
| 11277 | - $string = (string) \preg_replace( |
|
| 11276 | + $string = (string)\preg_replace( |
|
| 11278 | 11277 | [ |
| 11279 | - '/[^' . $fallback_char_escaped . '\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
| 11280 | - '/[\s]+/u', // 2) convert spaces to $fallback_char |
|
| 11281 | - '/[' . $fallback_char_escaped . ']+/u', // 3) remove double $fallback_char's |
|
| 11278 | + '/[^'.$fallback_char_escaped.'\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
| 11279 | + '/[\s]+/u', // 2) convert spaces to $fallback_char |
|
| 11280 | + '/['.$fallback_char_escaped.']+/u', // 3) remove double $fallback_char's |
|
| 11282 | 11281 | ], |
| 11283 | 11282 | [ |
| 11284 | 11283 | '', |
@@ -11309,7 +11308,7 @@ discard block |
||
| 11309 | 11308 | return $str; |
| 11310 | 11309 | } |
| 11311 | 11310 | |
| 11312 | - $str = (string) $str; |
|
| 11311 | + $str = (string)$str; |
|
| 11313 | 11312 | if ($str === '') { |
| 11314 | 11313 | return ''; |
| 11315 | 11314 | } |
@@ -11356,7 +11355,7 @@ discard block |
||
| 11356 | 11355 | return $str; |
| 11357 | 11356 | } |
| 11358 | 11357 | |
| 11359 | - $str = (string) $str; |
|
| 11358 | + $str = (string)$str; |
|
| 11360 | 11359 | if ($str === '') { |
| 11361 | 11360 | return $str; |
| 11362 | 11361 | } |
@@ -11374,7 +11373,7 @@ discard block |
||
| 11374 | 11373 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
| 11375 | 11374 | |
| 11376 | 11375 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 11377 | - $buf .= $c1 . $c2; |
|
| 11376 | + $buf .= $c1.$c2; |
|
| 11378 | 11377 | ++$i; |
| 11379 | 11378 | } else { // not valid UTF8 - convert it |
| 11380 | 11379 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11385,7 +11384,7 @@ discard block |
||
| 11385 | 11384 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
| 11386 | 11385 | |
| 11387 | 11386 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 11388 | - $buf .= $c1 . $c2 . $c3; |
|
| 11387 | + $buf .= $c1.$c2.$c3; |
|
| 11389 | 11388 | $i += 2; |
| 11390 | 11389 | } else { // not valid UTF8 - convert it |
| 11391 | 11390 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11397,7 +11396,7 @@ discard block |
||
| 11397 | 11396 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
| 11398 | 11397 | |
| 11399 | 11398 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 11400 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
| 11399 | + $buf .= $c1.$c2.$c3.$c4; |
|
| 11401 | 11400 | $i += 3; |
| 11402 | 11401 | } else { // not valid UTF8 - convert it |
| 11403 | 11402 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11423,13 +11422,13 @@ discard block |
||
| 11423 | 11422 | * |
| 11424 | 11423 | * @return string |
| 11425 | 11424 | */ |
| 11426 | - static function (array $matches): string { |
|
| 11425 | + static function(array $matches): string { |
|
| 11427 | 11426 | if (isset($matches[3])) { |
| 11428 | - $cp = (int) \hexdec($matches[3]); |
|
| 11427 | + $cp = (int)\hexdec($matches[3]); |
|
| 11429 | 11428 | } else { |
| 11430 | 11429 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
| 11431 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
| 11432 | - + (int) \hexdec($matches[2]) |
|
| 11430 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
| 11431 | + + (int)\hexdec($matches[2]) |
|
| 11433 | 11432 | + 0x10000 |
| 11434 | 11433 | - (0xD800 << 10) |
| 11435 | 11434 | - 0xDC00; |
@@ -11440,12 +11439,12 @@ discard block |
||
| 11440 | 11439 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
| 11441 | 11440 | |
| 11442 | 11441 | if ($cp < 0x80) { |
| 11443 | - return (string) self::chr($cp); |
|
| 11442 | + return (string)self::chr($cp); |
|
| 11444 | 11443 | } |
| 11445 | 11444 | |
| 11446 | 11445 | if ($cp < 0xA0) { |
| 11447 | 11446 | /** @noinspection UnnecessaryCastingInspection */ |
| 11448 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
| 11447 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
| 11449 | 11448 | } |
| 11450 | 11449 | |
| 11451 | 11450 | return self::decimal_to_chr($cp); |
@@ -11493,7 +11492,7 @@ discard block |
||
| 11493 | 11492 | |
| 11494 | 11493 | if (self::$SUPPORT['mbstring'] === true) { |
| 11495 | 11494 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 11496 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 11495 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 11497 | 11496 | } |
| 11498 | 11497 | |
| 11499 | 11498 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -11530,15 +11529,15 @@ discard block |
||
| 11530 | 11529 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
| 11531 | 11530 | |
| 11532 | 11531 | if ($encoding === 'UTF-8') { |
| 11533 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
| 11532 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
| 11534 | 11533 | |
| 11535 | 11534 | if ($useMbFunction === true) { |
| 11536 | 11535 | $strPartOne = \mb_strtoupper( |
| 11537 | - (string) \mb_substr($str, 0, 1) |
|
| 11536 | + (string)\mb_substr($str, 0, 1) |
|
| 11538 | 11537 | ); |
| 11539 | 11538 | } else { |
| 11540 | 11539 | $strPartOne = self::strtoupper( |
| 11541 | - (string) \mb_substr($str, 0, 1), |
|
| 11540 | + (string)\mb_substr($str, 0, 1), |
|
| 11542 | 11541 | $encoding, |
| 11543 | 11542 | false, |
| 11544 | 11543 | $lang, |
@@ -11548,16 +11547,16 @@ discard block |
||
| 11548 | 11547 | } else { |
| 11549 | 11548 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 11550 | 11549 | |
| 11551 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
| 11550 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
| 11552 | 11551 | |
| 11553 | 11552 | if ($useMbFunction === true) { |
| 11554 | 11553 | $strPartOne = \mb_strtoupper( |
| 11555 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
| 11554 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
| 11556 | 11555 | $encoding |
| 11557 | 11556 | ); |
| 11558 | 11557 | } else { |
| 11559 | 11558 | $strPartOne = self::strtoupper( |
| 11560 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 11559 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 11561 | 11560 | $encoding, |
| 11562 | 11561 | false, |
| 11563 | 11562 | $lang, |
@@ -11566,7 +11565,7 @@ discard block |
||
| 11566 | 11565 | } |
| 11567 | 11566 | } |
| 11568 | 11567 | |
| 11569 | - return $strPartOne . $strPartTwo; |
|
| 11568 | + return $strPartOne.$strPartTwo; |
|
| 11570 | 11569 | } |
| 11571 | 11570 | |
| 11572 | 11571 | /** |
@@ -11617,7 +11616,7 @@ discard block |
||
| 11617 | 11616 | $str = self::clean($str); |
| 11618 | 11617 | } |
| 11619 | 11618 | |
| 11620 | - $usePhpDefaultFunctions = !(bool) ($charlist . \implode('', $exceptions)); |
|
| 11619 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
| 11621 | 11620 | |
| 11622 | 11621 | if ( |
| 11623 | 11622 | $usePhpDefaultFunctions === true |
@@ -11686,7 +11685,7 @@ discard block |
||
| 11686 | 11685 | |
| 11687 | 11686 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
| 11688 | 11687 | if (\preg_match($pattern, $str)) { |
| 11689 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
| 11688 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
| 11690 | 11689 | } |
| 11691 | 11690 | |
| 11692 | 11691 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -12011,7 +12010,7 @@ discard block |
||
| 12011 | 12010 | if ( |
| 12012 | 12011 | $keepUtf8Chars === true |
| 12013 | 12012 | && |
| 12014 | - self::strlen($return) >= (int) self::strlen($str_backup) |
|
| 12013 | + self::strlen($return) >= (int)self::strlen($str_backup) |
|
| 12015 | 12014 | ) { |
| 12016 | 12015 | return $str_backup; |
| 12017 | 12016 | } |
@@ -12089,17 +12088,17 @@ discard block |
||
| 12089 | 12088 | return ''; |
| 12090 | 12089 | } |
| 12091 | 12090 | |
| 12092 | - \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches); |
|
| 12091 | + \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches); |
|
| 12093 | 12092 | |
| 12094 | 12093 | if ( |
| 12095 | 12094 | !isset($matches[0]) |
| 12096 | 12095 | || |
| 12097 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
| 12096 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
| 12098 | 12097 | ) { |
| 12099 | 12098 | return $str; |
| 12100 | 12099 | } |
| 12101 | 12100 | |
| 12102 | - return \rtrim($matches[0]) . $strAddOn; |
|
| 12101 | + return \rtrim($matches[0]).$strAddOn; |
|
| 12103 | 12102 | } |
| 12104 | 12103 | |
| 12105 | 12104 | /** |
@@ -12170,7 +12169,7 @@ discard block |
||
| 12170 | 12169 | $strReturn .= $break; |
| 12171 | 12170 | } |
| 12172 | 12171 | |
| 12173 | - return $strReturn . \implode('', $chars); |
|
| 12172 | + return $strReturn.\implode('', $chars); |
|
| 12174 | 12173 | } |
| 12175 | 12174 | |
| 12176 | 12175 | /** |
@@ -12183,7 +12182,7 @@ discard block |
||
| 12183 | 12182 | */ |
| 12184 | 12183 | public static function wordwrap_per_line(string $str, int $limit): string |
| 12185 | 12184 | { |
| 12186 | - $strings = (array) \preg_split('/\\r\\n|\\r|\\n/', $str); |
|
| 12185 | + $strings = (array)\preg_split('/\\r\\n|\\r|\\n/', $str); |
|
| 12187 | 12186 | |
| 12188 | 12187 | $string = ''; |
| 12189 | 12188 | foreach ($strings as &$value) { |
@@ -12220,7 +12219,7 @@ discard block |
||
| 12220 | 12219 | |
| 12221 | 12220 | \uksort( |
| 12222 | 12221 | self::$EMOJI, |
| 12223 | - static function (string $a, string $b): int { |
|
| 12222 | + static function(string $a, string $b): int { |
|
| 12224 | 12223 | return \strlen($b) <=> \strlen($a); |
| 12225 | 12224 | } |
| 12226 | 12225 | ); |
@@ -12230,7 +12229,7 @@ discard block |
||
| 12230 | 12229 | |
| 12231 | 12230 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
| 12232 | 12231 | $tmpKey = \crc32($key); |
| 12233 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmpKey . '_-_' . \strrev((string) $tmpKey) . '_-_8FTU_ELBATROP_-_'; |
|
| 12232 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmpKey.'_-_'.\strrev((string)$tmpKey).'_-_8FTU_ELBATROP_-_'; |
|
| 12234 | 12233 | } |
| 12235 | 12234 | |
| 12236 | 12235 | return true; |
@@ -12293,7 +12292,7 @@ discard block |
||
| 12293 | 12292 | /** @noinspection PhpIncludeInspection */ |
| 12294 | 12293 | /** @noinspection UsingInclusionReturnValueInspection */ |
| 12295 | 12294 | /** @psalm-suppress UnresolvableInclude */ |
| 12296 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
| 12295 | + return include __DIR__.'/data/'.$file.'.php'; |
|
| 12297 | 12296 | } |
| 12298 | 12297 | |
| 12299 | 12298 | /** |
@@ -12305,7 +12304,7 @@ discard block |
||
| 12305 | 12304 | */ |
| 12306 | 12305 | private static function getDataIfExists(string $file) |
| 12307 | 12306 | { |
| 12308 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
| 12307 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
| 12309 | 12308 | if (\file_exists($file)) { |
| 12310 | 12309 | /** @noinspection PhpIncludeInspection */ |
| 12311 | 12310 | /** @noinspection UsingInclusionReturnValueInspection */ |
@@ -12330,7 +12329,7 @@ discard block |
||
| 12330 | 12329 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 12331 | 12330 | return \defined('MB_OVERLOAD_STRING') |
| 12332 | 12331 | && |
| 12333 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 12332 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 12334 | 12333 | } |
| 12335 | 12334 | |
| 12336 | 12335 | /** |
@@ -12380,7 +12379,7 @@ discard block |
||
| 12380 | 12379 | { |
| 12381 | 12380 | static $RX_CLASS_CACHE = []; |
| 12382 | 12381 | |
| 12383 | - $cacheKey = $s . $class; |
|
| 12382 | + $cacheKey = $s.$class; |
|
| 12384 | 12383 | |
| 12385 | 12384 | if (isset($RX_CLASS_CACHE[$cacheKey])) { |
| 12386 | 12385 | return $RX_CLASS_CACHE[$cacheKey]; |
@@ -12392,7 +12391,7 @@ discard block |
||
| 12392 | 12391 | /** @noinspection AlterInForeachInspection */ |
| 12393 | 12392 | foreach (self::str_split($s) as &$s) { |
| 12394 | 12393 | if ($s === '-') { |
| 12395 | - $classArray[0] = '-' . $classArray[0]; |
|
| 12394 | + $classArray[0] = '-'.$classArray[0]; |
|
| 12396 | 12395 | } elseif (!isset($s[2])) { |
| 12397 | 12396 | $classArray[0] .= \preg_quote($s, '/'); |
| 12398 | 12397 | } elseif (self::strlen($s) === 1) { |
@@ -12403,13 +12402,13 @@ discard block |
||
| 12403 | 12402 | } |
| 12404 | 12403 | |
| 12405 | 12404 | if ($classArray[0]) { |
| 12406 | - $classArray[0] = '[' . $classArray[0] . ']'; |
|
| 12405 | + $classArray[0] = '['.$classArray[0].']'; |
|
| 12407 | 12406 | } |
| 12408 | 12407 | |
| 12409 | 12408 | if (\count($classArray) === 1) { |
| 12410 | 12409 | $return = $classArray[0]; |
| 12411 | 12410 | } else { |
| 12412 | - $return = '(?:' . \implode('|', $classArray) . ')'; |
|
| 12411 | + $return = '(?:'.\implode('|', $classArray).')'; |
|
| 12413 | 12412 | } |
| 12414 | 12413 | |
| 12415 | 12414 | $RX_CLASS_CACHE[$cacheKey] = $return; |
@@ -12483,7 +12482,7 @@ discard block |
||
| 12483 | 12482 | $continue = false; |
| 12484 | 12483 | |
| 12485 | 12484 | if ($delimiter === '-') { |
| 12486 | - foreach ((array) $specialCases['names'] as &$beginning) { |
|
| 12485 | + foreach ((array)$specialCases['names'] as &$beginning) { |
|
| 12487 | 12486 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
| 12488 | 12487 | $continue = true; |
| 12489 | 12488 | } |
@@ -12491,7 +12490,7 @@ discard block |
||
| 12491 | 12490 | unset($beginning); |
| 12492 | 12491 | } |
| 12493 | 12492 | |
| 12494 | - foreach ((array) $specialCases['prefixes'] as &$beginning) { |
|
| 12493 | + foreach ((array)$specialCases['prefixes'] as &$beginning) { |
|
| 12495 | 12494 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
| 12496 | 12495 | $continue = true; |
| 12497 | 12496 | } |
@@ -12551,8 +12550,8 @@ discard block |
||
| 12551 | 12550 | $buf .= self::$WIN1252_TO_UTF8[$ordC1]; |
| 12552 | 12551 | } else { |
| 12553 | 12552 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
| 12554 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
| 12555 | - $buf .= $cc1 . $cc2; |
|
| 12553 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
| 12554 | + $buf .= $cc1.$cc2; |
|
| 12556 | 12555 | } |
| 12557 | 12556 | |
| 12558 | 12557 | return $buf; |