@@ -3,17 +3,17 @@ discard block |
||
| 3 | 3 | return [ |
| 4 | 4 | 0x80 => "\xe2\x82\xac", // € |
| 5 | 5 | 0x82 => "\xe2\x80\x9a", // ‚ |
| 6 | - 0x83 => "\xc6\x92", // ƒ |
|
| 6 | + 0x83 => "\xc6\x92", // ƒ |
|
| 7 | 7 | 0x84 => "\xe2\x80\x9e", // „ |
| 8 | 8 | 0x85 => "\xe2\x80\xa6", // … |
| 9 | 9 | 0x86 => "\xe2\x80\xa0", // † |
| 10 | 10 | 0x87 => "\xe2\x80\xa1", // ‡ |
| 11 | - 0x88 => "\xcb\x86", // ˆ |
|
| 11 | + 0x88 => "\xcb\x86", // ˆ |
|
| 12 | 12 | 0x89 => "\xe2\x80\xb0", // ‰ |
| 13 | - 0x8a => "\xc5\xa0", // Š |
|
| 13 | + 0x8a => "\xc5\xa0", // Š |
|
| 14 | 14 | 0x8b => "\xe2\x80\xb9", // ‹ |
| 15 | - 0x8c => "\xc5\x92", // Œ |
|
| 16 | - 0x8e => "\xc5\xbd", // Ž |
|
| 15 | + 0x8c => "\xc5\x92", // Œ |
|
| 16 | + 0x8e => "\xc5\xbd", // Ž |
|
| 17 | 17 | 0x91 => "\xe2\x80\x98", // ‘ |
| 18 | 18 | 0x92 => "\xe2\x80\x99", // ’ |
| 19 | 19 | 0x93 => "\xe2\x80\x9c", // “ |
@@ -21,106 +21,106 @@ discard block |
||
| 21 | 21 | 0x95 => "\xe2\x80\xa2", // • |
| 22 | 22 | 0x96 => "\xe2\x80\x93", // – |
| 23 | 23 | 0x97 => "\xe2\x80\x94", // — |
| 24 | - 0x98 => "\xcb\x9c", // ˜ |
|
| 24 | + 0x98 => "\xcb\x9c", // ˜ |
|
| 25 | 25 | 0x99 => "\xe2\x84\xa2", // ™ |
| 26 | - 0x9a => "\xc5\xa1", // š |
|
| 26 | + 0x9a => "\xc5\xa1", // š |
|
| 27 | 27 | 0x9b => "\xe2\x80\xba", // › |
| 28 | - 0x9c => "\xc5\x93", // œ |
|
| 29 | - 0x9e => "\xc5\xbe", // ž |
|
| 30 | - 0x9f => "\xc5\xb8", // Ÿ |
|
| 28 | + 0x9c => "\xc5\x93", // œ |
|
| 29 | + 0x9e => "\xc5\xbe", // ž |
|
| 30 | + 0x9f => "\xc5\xb8", // Ÿ |
|
| 31 | 31 | 0xa0 => "\xc2\xa0", |
| 32 | - 0xa1 => "\xc2\xa1", // ¡ |
|
| 33 | - 0xa2 => "\xc2\xa2", // ¢ |
|
| 34 | - 0xa3 => "\xc2\xa3", // £ |
|
| 35 | - 0xa4 => "\xc2\xa4", // ¤ |
|
| 36 | - 0xa5 => "\xc2\xa5", // ¥ |
|
| 37 | - 0xa6 => "\xc2\xa6", // ¦ |
|
| 38 | - 0xa7 => "\xc2\xa7", // § |
|
| 39 | - 0xa8 => "\xc2\xa8", // ¨ |
|
| 40 | - 0xa9 => "\xc2\xa9", // © |
|
| 41 | - 0xaa => "\xc2\xaa", // ª |
|
| 42 | - 0xab => "\xc2\xab", // « |
|
| 43 | - 0xac => "\xc2\xac", // ¬ |
|
| 44 | - 0xad => "\xc2\xad", // |
|
| 45 | - 0xae => "\xc2\xae", // ® |
|
| 46 | - 0xaf => "\xc2\xaf", // ¯ |
|
| 47 | - 0xb0 => "\xc2\xb0", // ° |
|
| 48 | - 0xb1 => "\xc2\xb1", // ± |
|
| 49 | - 0xb2 => "\xc2\xb2", // ² |
|
| 50 | - 0xb3 => "\xc2\xb3", // ³ |
|
| 51 | - 0xb4 => "\xc2\xb4", // ´ |
|
| 52 | - 0xb5 => "\xc2\xb5", // µ |
|
| 53 | - 0xb6 => "\xc2\xb6", // ¶ |
|
| 54 | - 0xb7 => "\xc2\xb7", // · |
|
| 55 | - 0xb8 => "\xc2\xb8", // ¸ |
|
| 56 | - 0xb9 => "\xc2\xb9", // ¹ |
|
| 57 | - 0xba => "\xc2\xba", // º |
|
| 58 | - 0xbb => "\xc2\xbb", // » |
|
| 59 | - 0xbc => "\xc2\xbc", // ¼ |
|
| 60 | - 0xbd => "\xc2\xbd", // ½ |
|
| 61 | - 0xbe => "\xc2\xbe", // ¾ |
|
| 62 | - 0xbf => "\xc2\xbf", // ¿ |
|
| 63 | - 0xc0 => "\xc3\x80", // À |
|
| 64 | - 0xc1 => "\xc3\x81", // Á |
|
| 65 | - 0xc2 => "\xc3\x82", // Â |
|
| 66 | - 0xc3 => "\xc3\x83", // Ã |
|
| 67 | - 0xc4 => "\xc3\x84", // Ä |
|
| 68 | - 0xc5 => "\xc3\x85", // Å |
|
| 69 | - 0xc6 => "\xc3\x86", // Æ |
|
| 70 | - 0xc7 => "\xc3\x87", // Ç |
|
| 71 | - 0xc8 => "\xc3\x88", // È |
|
| 72 | - 0xc9 => "\xc3\x89", // É |
|
| 73 | - 0xca => "\xc3\x8a", // Ê |
|
| 74 | - 0xcb => "\xc3\x8b", // Ë |
|
| 75 | - 0xcc => "\xc3\x8c", // Ì |
|
| 76 | - 0xcd => "\xc3\x8d", // Í |
|
| 77 | - 0xce => "\xc3\x8e", // Î |
|
| 78 | - 0xcf => "\xc3\x8f", // Ï |
|
| 79 | - 0xd0 => "\xc3\x90", // Ð |
|
| 80 | - 0xd1 => "\xc3\x91", // Ñ |
|
| 81 | - 0xd2 => "\xc3\x92", // Ò |
|
| 82 | - 0xd3 => "\xc3\x93", // Ó |
|
| 83 | - 0xd4 => "\xc3\x94", // Ô |
|
| 84 | - 0xd5 => "\xc3\x95", // Õ |
|
| 85 | - 0xd6 => "\xc3\x96", // Ö |
|
| 86 | - 0xd7 => "\xc3\x97", // × |
|
| 87 | - 0xd8 => "\xc3\x98", // Ø |
|
| 88 | - 0xd9 => "\xc3\x99", // Ù |
|
| 89 | - 0xda => "\xc3\x9a", // Ú |
|
| 90 | - 0xdb => "\xc3\x9b", // Û |
|
| 91 | - 0xdc => "\xc3\x9c", // Ü |
|
| 92 | - 0xdd => "\xc3\x9d", // Ý |
|
| 93 | - 0xde => "\xc3\x9e", // Þ |
|
| 94 | - 0xdf => "\xc3\x9f", // ß |
|
| 95 | - 0xe0 => "\xc3\xa0", // à |
|
| 96 | - 0xe1 => "\xc3\xa1", // á |
|
| 97 | - 0xe2 => "\xc3\xa2", // â |
|
| 98 | - 0xe3 => "\xc3\xa3", // ã |
|
| 99 | - 0xe4 => "\xc3\xa4", // ä |
|
| 100 | - 0xe5 => "\xc3\xa5", // å |
|
| 101 | - 0xe6 => "\xc3\xa6", // æ |
|
| 102 | - 0xe7 => "\xc3\xa7", // ç |
|
| 103 | - 0xe8 => "\xc3\xa8", // è |
|
| 104 | - 0xe9 => "\xc3\xa9", // é |
|
| 105 | - 0xea => "\xc3\xaa", // ê |
|
| 106 | - 0xeb => "\xc3\xab", // ë |
|
| 107 | - 0xec => "\xc3\xac", // ì |
|
| 108 | - 0xed => "\xc3\xad", // í |
|
| 109 | - 0xee => "\xc3\xae", // î |
|
| 110 | - 0xef => "\xc3\xaf", // ï |
|
| 111 | - 0xf0 => "\xc3\xb0", // ð |
|
| 112 | - 0xf1 => "\xc3\xb1", // ñ |
|
| 113 | - 0xf2 => "\xc3\xb2", // ò |
|
| 114 | - 0xf3 => "\xc3\xb3", // ó |
|
| 115 | - 0xf4 => "\xc3\xb4", // ô |
|
| 116 | - 0xf5 => "\xc3\xb5", // õ |
|
| 117 | - 0xf6 => "\xc3\xb6", // ö |
|
| 118 | - 0xf7 => "\xc3\xb7", // ÷ |
|
| 119 | - 0xf8 => "\xc3\xb8", // ø |
|
| 120 | - 0xf9 => "\xc3\xb9", // ù |
|
| 121 | - 0xfa => "\xc3\xba", // ú |
|
| 122 | - 0xfb => "\xc3\xbb", // û |
|
| 123 | - 0xfc => "\xc3\xbc", // ü |
|
| 124 | - 0xfd => "\xc3\xbd", // ý |
|
| 125 | - 0xfe => "\xc3\xbe", // þ |
|
| 32 | + 0xa1 => "\xc2\xa1", // ¡ |
|
| 33 | + 0xa2 => "\xc2\xa2", // ¢ |
|
| 34 | + 0xa3 => "\xc2\xa3", // £ |
|
| 35 | + 0xa4 => "\xc2\xa4", // ¤ |
|
| 36 | + 0xa5 => "\xc2\xa5", // ¥ |
|
| 37 | + 0xa6 => "\xc2\xa6", // ¦ |
|
| 38 | + 0xa7 => "\xc2\xa7", // § |
|
| 39 | + 0xa8 => "\xc2\xa8", // ¨ |
|
| 40 | + 0xa9 => "\xc2\xa9", // © |
|
| 41 | + 0xaa => "\xc2\xaa", // ª |
|
| 42 | + 0xab => "\xc2\xab", // « |
|
| 43 | + 0xac => "\xc2\xac", // ¬ |
|
| 44 | + 0xad => "\xc2\xad", // |
|
| 45 | + 0xae => "\xc2\xae", // ® |
|
| 46 | + 0xaf => "\xc2\xaf", // ¯ |
|
| 47 | + 0xb0 => "\xc2\xb0", // ° |
|
| 48 | + 0xb1 => "\xc2\xb1", // ± |
|
| 49 | + 0xb2 => "\xc2\xb2", // ² |
|
| 50 | + 0xb3 => "\xc2\xb3", // ³ |
|
| 51 | + 0xb4 => "\xc2\xb4", // ´ |
|
| 52 | + 0xb5 => "\xc2\xb5", // µ |
|
| 53 | + 0xb6 => "\xc2\xb6", // ¶ |
|
| 54 | + 0xb7 => "\xc2\xb7", // · |
|
| 55 | + 0xb8 => "\xc2\xb8", // ¸ |
|
| 56 | + 0xb9 => "\xc2\xb9", // ¹ |
|
| 57 | + 0xba => "\xc2\xba", // º |
|
| 58 | + 0xbb => "\xc2\xbb", // » |
|
| 59 | + 0xbc => "\xc2\xbc", // ¼ |
|
| 60 | + 0xbd => "\xc2\xbd", // ½ |
|
| 61 | + 0xbe => "\xc2\xbe", // ¾ |
|
| 62 | + 0xbf => "\xc2\xbf", // ¿ |
|
| 63 | + 0xc0 => "\xc3\x80", // À |
|
| 64 | + 0xc1 => "\xc3\x81", // Á |
|
| 65 | + 0xc2 => "\xc3\x82", // Â |
|
| 66 | + 0xc3 => "\xc3\x83", // Ã |
|
| 67 | + 0xc4 => "\xc3\x84", // Ä |
|
| 68 | + 0xc5 => "\xc3\x85", // Å |
|
| 69 | + 0xc6 => "\xc3\x86", // Æ |
|
| 70 | + 0xc7 => "\xc3\x87", // Ç |
|
| 71 | + 0xc8 => "\xc3\x88", // È |
|
| 72 | + 0xc9 => "\xc3\x89", // É |
|
| 73 | + 0xca => "\xc3\x8a", // Ê |
|
| 74 | + 0xcb => "\xc3\x8b", // Ë |
|
| 75 | + 0xcc => "\xc3\x8c", // Ì |
|
| 76 | + 0xcd => "\xc3\x8d", // Í |
|
| 77 | + 0xce => "\xc3\x8e", // Î |
|
| 78 | + 0xcf => "\xc3\x8f", // Ï |
|
| 79 | + 0xd0 => "\xc3\x90", // Ð |
|
| 80 | + 0xd1 => "\xc3\x91", // Ñ |
|
| 81 | + 0xd2 => "\xc3\x92", // Ò |
|
| 82 | + 0xd3 => "\xc3\x93", // Ó |
|
| 83 | + 0xd4 => "\xc3\x94", // Ô |
|
| 84 | + 0xd5 => "\xc3\x95", // Õ |
|
| 85 | + 0xd6 => "\xc3\x96", // Ö |
|
| 86 | + 0xd7 => "\xc3\x97", // × |
|
| 87 | + 0xd8 => "\xc3\x98", // Ø |
|
| 88 | + 0xd9 => "\xc3\x99", // Ù |
|
| 89 | + 0xda => "\xc3\x9a", // Ú |
|
| 90 | + 0xdb => "\xc3\x9b", // Û |
|
| 91 | + 0xdc => "\xc3\x9c", // Ü |
|
| 92 | + 0xdd => "\xc3\x9d", // Ý |
|
| 93 | + 0xde => "\xc3\x9e", // Þ |
|
| 94 | + 0xdf => "\xc3\x9f", // ß |
|
| 95 | + 0xe0 => "\xc3\xa0", // à |
|
| 96 | + 0xe1 => "\xc3\xa1", // á |
|
| 97 | + 0xe2 => "\xc3\xa2", // â |
|
| 98 | + 0xe3 => "\xc3\xa3", // ã |
|
| 99 | + 0xe4 => "\xc3\xa4", // ä |
|
| 100 | + 0xe5 => "\xc3\xa5", // å |
|
| 101 | + 0xe6 => "\xc3\xa6", // æ |
|
| 102 | + 0xe7 => "\xc3\xa7", // ç |
|
| 103 | + 0xe8 => "\xc3\xa8", // è |
|
| 104 | + 0xe9 => "\xc3\xa9", // é |
|
| 105 | + 0xea => "\xc3\xaa", // ê |
|
| 106 | + 0xeb => "\xc3\xab", // ë |
|
| 107 | + 0xec => "\xc3\xac", // ì |
|
| 108 | + 0xed => "\xc3\xad", // í |
|
| 109 | + 0xee => "\xc3\xae", // î |
|
| 110 | + 0xef => "\xc3\xaf", // ï |
|
| 111 | + 0xf0 => "\xc3\xb0", // ð |
|
| 112 | + 0xf1 => "\xc3\xb1", // ñ |
|
| 113 | + 0xf2 => "\xc3\xb2", // ò |
|
| 114 | + 0xf3 => "\xc3\xb3", // ó |
|
| 115 | + 0xf4 => "\xc3\xb4", // ô |
|
| 116 | + 0xf5 => "\xc3\xb5", // õ |
|
| 117 | + 0xf6 => "\xc3\xb6", // ö |
|
| 118 | + 0xf7 => "\xc3\xb7", // ÷ |
|
| 119 | + 0xf8 => "\xc3\xb8", // ø |
|
| 120 | + 0xf9 => "\xc3\xb9", // ù |
|
| 121 | + 0xfa => "\xc3\xba", // ú |
|
| 122 | + 0xfb => "\xc3\xbb", // û |
|
| 123 | + 0xfc => "\xc3\xbc", // ü |
|
| 124 | + 0xfd => "\xc3\xbd", // ý |
|
| 125 | + 0xfe => "\xc3\xbe", // þ |
|
| 126 | 126 | ]; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | return false; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - $uri = (string) $_SERVER['REQUEST_URI']; |
|
| 86 | + $uri = (string)$_SERVER['REQUEST_URI']; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | $uriOrig = $uri; |
@@ -100,27 +100,27 @@ discard block |
||
| 100 | 100 | // When not, assumes Windows-1252 and redirects to the corresponding UTF-8 encoded URL |
| 101 | 101 | // |
| 102 | 102 | |
| 103 | - $uri = (string) \preg_replace_callback( |
|
| 103 | + $uri = (string)\preg_replace_callback( |
|
| 104 | 104 | '/[\x80-\xFF]+/', |
| 105 | 105 | /** |
| 106 | 106 | * @param array $m |
| 107 | 107 | * |
| 108 | 108 | * @return string |
| 109 | 109 | */ |
| 110 | - static function (array $m): string { |
|
| 110 | + static function(array $m): string { |
|
| 111 | 111 | return \rawurlencode($m[0]); |
| 112 | 112 | }, |
| 113 | 113 | $uri |
| 114 | 114 | ); |
| 115 | 115 | |
| 116 | - $uri = (string) \preg_replace_callback( |
|
| 116 | + $uri = (string)\preg_replace_callback( |
|
| 117 | 117 | '/(?:%[89A-F][0-9A-F])+/i', |
| 118 | 118 | /** |
| 119 | 119 | * @param array $m |
| 120 | 120 | * |
| 121 | 121 | * @return string |
| 122 | 122 | */ |
| 123 | - static function (array $m): string { |
|
| 123 | + static function(array $m): string { |
|
| 124 | 124 | return \rawurlencode(UTF8::rawurldecode($m[0])); |
| 125 | 125 | }, |
| 126 | 126 | $uri |
@@ -134,19 +134,19 @@ discard block |
||
| 134 | 134 | \headers_sent() === false |
| 135 | 135 | ) { |
| 136 | 136 | $severProtocol = ($_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'); |
| 137 | - \header($severProtocol . ' 301 Moved Permanently'); |
|
| 137 | + \header($severProtocol.' 301 Moved Permanently'); |
|
| 138 | 138 | |
| 139 | 139 | if (\strncmp($uri, '/', 1) === 0) { |
| 140 | - \header('Location: /' . \ltrim($uri, '/')); |
|
| 140 | + \header('Location: /'.\ltrim($uri, '/')); |
|
| 141 | 141 | } else { |
| 142 | - \header('Location: ' . $uri); |
|
| 142 | + \header('Location: '.$uri); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | exit(); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | if (\strncmp($uri, '/', 1) === 0) { |
| 149 | - $uri = '/' . \ltrim($uri, '/'); |
|
| 149 | + $uri = '/'.\ltrim($uri, '/'); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | return $uri; |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | return false; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - $length = (int) $length; |
|
| 192 | + $length = (int)$length; |
|
| 193 | 193 | |
| 194 | 194 | if ($length <= 0) { |
| 195 | 195 | return false; |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | static $_IS_PHP; |
| 231 | 231 | |
| 232 | - $version = (string) $version; |
|
| 232 | + $version = (string)$version; |
|
| 233 | 233 | |
| 234 | 234 | if (!isset($_IS_PHP[$version])) { |
| 235 | 235 | $_IS_PHP[$version] = \version_compare(\PHP_VERSION, $version, '>='); |
@@ -249,10 +249,10 @@ discard block |
||
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | if ($encoding === 'UTF-8') { |
| 252 | - return (string) \mb_substr($str, $pos, 1); |
|
| 252 | + return (string)\mb_substr($str, $pos, 1); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
| 255 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | /** |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | public static function add_bom_to_string(string $str): string |
| 273 | 273 | { |
| 274 | 274 | if (!self::string_has_bom($str)) { |
| 275 | - $str = self::bom() . $str; |
|
| 275 | + $str = self::bom().$str; |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | 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 | } |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | return ''; |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
| 347 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
| 348 | 348 | $end_position = \mb_strpos($str, $end, $substr_index); |
| 349 | 349 | if ( |
| 350 | 350 | $end_position === false |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | return ''; |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
| 357 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | return ''; |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
| 367 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
| 368 | 368 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
| 369 | 369 | if ( |
| 370 | 370 | $end_position === false |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | return ''; |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | - return (string) self::substr( |
|
| 377 | + return (string)self::substr( |
|
| 378 | 378 | $str, |
| 379 | 379 | $substr_index, |
| 380 | 380 | $end_position - $substr_index, |
@@ -458,10 +458,10 @@ discard block |
||
| 458 | 458 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
| 459 | 459 | { |
| 460 | 460 | if ($encoding === 'UTF-8') { |
| 461 | - return (string) \mb_substr($str, $index, 1); |
|
| 461 | + return (string)\mb_substr($str, $index, 1); |
|
| 462 | 462 | } |
| 463 | 463 | |
| 464 | - return (string) self::substr($str, $index, 1, $encoding); |
|
| 464 | + return (string)self::substr($str, $index, 1, $encoding); |
|
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | /** |
@@ -577,14 +577,14 @@ discard block |
||
| 577 | 577 | /** |
| 578 | 578 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 579 | 579 | */ |
| 580 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 580 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | if ($code_point <= 0) { |
| 584 | 584 | return null; |
| 585 | 585 | } |
| 586 | 586 | |
| 587 | - $cache_key = $code_point . '_' . $encoding; |
|
| 587 | + $cache_key = $code_point.'_'.$encoding; |
|
| 588 | 588 | if (isset($CHAR_CACHE[$cache_key])) { |
| 589 | 589 | return $CHAR_CACHE[$cache_key]; |
| 590 | 590 | } |
@@ -630,27 +630,27 @@ discard block |
||
| 630 | 630 | self::$CHR = self::getData('chr'); |
| 631 | 631 | } |
| 632 | 632 | |
| 633 | - $code_point = (int) $code_point; |
|
| 633 | + $code_point = (int)$code_point; |
|
| 634 | 634 | if ($code_point <= 0x7FF) { |
| 635 | 635 | /** |
| 636 | 636 | * @psalm-suppress PossiblyNullArrayAccess |
| 637 | 637 | */ |
| 638 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
| 638 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
| 639 | 639 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 640 | 640 | } elseif ($code_point <= 0xFFFF) { |
| 641 | 641 | /** |
| 642 | 642 | * @psalm-suppress PossiblyNullArrayAccess |
| 643 | 643 | */ |
| 644 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
| 645 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 644 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
| 645 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 646 | 646 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 647 | 647 | } else { |
| 648 | 648 | /** |
| 649 | 649 | * @psalm-suppress PossiblyNullArrayAccess |
| 650 | 650 | */ |
| 651 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
| 652 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 653 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 651 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
| 652 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
| 653 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 654 | 654 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 655 | 655 | } |
| 656 | 656 | |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | |
| 708 | 708 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
| 709 | 709 | return \array_map( |
| 710 | - static function (string $data): int { |
|
| 710 | + static function(string $data): int { |
|
| 711 | 711 | // "mb_" is available if overload is used, so use it ... |
| 712 | 712 | return \mb_strlen($data, 'CP850'); // 8-BIT |
| 713 | 713 | }, |
@@ -794,7 +794,7 @@ discard block |
||
| 794 | 794 | $char = ''; |
| 795 | 795 | } |
| 796 | 796 | |
| 797 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
| 797 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
| 798 | 798 | } |
| 799 | 799 | |
| 800 | 800 | /** |
@@ -891,7 +891,7 @@ discard block |
||
| 891 | 891 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
| 892 | 892 | /x'; |
| 893 | 893 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
| 894 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
| 894 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
| 895 | 895 | |
| 896 | 896 | if ($replace_diamond_question_mark) { |
| 897 | 897 | $str = self::replace_diamond_question_mark($str); |
@@ -930,7 +930,7 @@ discard block |
||
| 930 | 930 | public static function cleanup($str): string |
| 931 | 931 | { |
| 932 | 932 | // init |
| 933 | - $str = (string) $str; |
|
| 933 | + $str = (string)$str; |
|
| 934 | 934 | |
| 935 | 935 | if ($str === '') { |
| 936 | 936 | return ''; |
@@ -1032,7 +1032,7 @@ discard block |
||
| 1032 | 1032 | { |
| 1033 | 1033 | if (self::$SUPPORT['mbstring'] === true) { |
| 1034 | 1034 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 1035 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 1035 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 1036 | 1036 | } |
| 1037 | 1037 | |
| 1038 | 1038 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -1135,9 +1135,9 @@ discard block |
||
| 1135 | 1135 | // - 0-9 (U+0061 - U+007A) |
| 1136 | 1136 | // - ISO 10646 characters U+00A1 and higher |
| 1137 | 1137 | // We strip out any character not in the above list. |
| 1138 | - $str = (string) \preg_replace('/[^\x{002D}\x{0030}-\x{0039}\x{0041}-\x{005A}\x{005F}\x{0061}-\x{007A}\x{00A1}-\x{FFFF}]/u', '', $str); |
|
| 1138 | + $str = (string)\preg_replace('/[^\x{002D}\x{0030}-\x{0039}\x{0041}-\x{005A}\x{005F}\x{0061}-\x{007A}\x{00A1}-\x{FFFF}]/u', '', $str); |
|
| 1139 | 1139 | // Identifiers cannot start with a digit, two hyphens, or a hyphen followed by a digit. |
| 1140 | - $str = (string) \preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
| 1140 | + $str = (string)\preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
| 1141 | 1141 | |
| 1142 | 1142 | return \trim($str, '-'); |
| 1143 | 1143 | } |
@@ -1153,7 +1153,7 @@ discard block |
||
| 1153 | 1153 | */ |
| 1154 | 1154 | public static function css_stripe_media_queries(string $str): string |
| 1155 | 1155 | { |
| 1156 | - return (string) \preg_replace( |
|
| 1156 | + return (string)\preg_replace( |
|
| 1157 | 1157 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
| 1158 | 1158 | '', |
| 1159 | 1159 | $str |
@@ -1190,7 +1190,7 @@ discard block |
||
| 1190 | 1190 | */ |
| 1191 | 1191 | public static function decimal_to_chr($int): string |
| 1192 | 1192 | { |
| 1193 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
| 1193 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
| 1194 | 1194 | } |
| 1195 | 1195 | |
| 1196 | 1196 | /** |
@@ -1240,7 +1240,7 @@ discard block |
||
| 1240 | 1240 | $flagOffset = 0x1F1E6; |
| 1241 | 1241 | $asciiOffset = 0x41; |
| 1242 | 1242 | |
| 1243 | - return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? '') . |
|
| 1243 | + return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? ''). |
|
| 1244 | 1244 | (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
| 1245 | 1245 | } |
| 1246 | 1246 | |
@@ -1271,16 +1271,16 @@ discard block |
||
| 1271 | 1271 | self::initEmojiData(); |
| 1272 | 1272 | |
| 1273 | 1273 | if ($use_reversible_string_mappings) { |
| 1274 | - return (string) \str_replace( |
|
| 1275 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1276 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1274 | + return (string)\str_replace( |
|
| 1275 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1276 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1277 | 1277 | $str |
| 1278 | 1278 | ); |
| 1279 | 1279 | } |
| 1280 | 1280 | |
| 1281 | - return (string) \str_replace( |
|
| 1282 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 1283 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1281 | + return (string)\str_replace( |
|
| 1282 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 1283 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1284 | 1284 | $str |
| 1285 | 1285 | ); |
| 1286 | 1286 | } |
@@ -1312,16 +1312,16 @@ discard block |
||
| 1312 | 1312 | self::initEmojiData(); |
| 1313 | 1313 | |
| 1314 | 1314 | if ($use_reversible_string_mappings) { |
| 1315 | - return (string) \str_replace( |
|
| 1316 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1317 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1315 | + return (string)\str_replace( |
|
| 1316 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1317 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1318 | 1318 | $str |
| 1319 | 1319 | ); |
| 1320 | 1320 | } |
| 1321 | 1321 | |
| 1322 | - return (string) \str_replace( |
|
| 1323 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1324 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 1322 | + return (string)\str_replace( |
|
| 1323 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1324 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 1325 | 1325 | $str |
| 1326 | 1326 | ); |
| 1327 | 1327 | } |
@@ -1387,7 +1387,7 @@ discard block |
||
| 1387 | 1387 | if ($to_encoding === 'JSON') { |
| 1388 | 1388 | $return = self::json_encode($str); |
| 1389 | 1389 | if ($return === false) { |
| 1390 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
| 1390 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
| 1391 | 1391 | } |
| 1392 | 1392 | |
| 1393 | 1393 | return $return; |
@@ -1477,7 +1477,7 @@ discard block |
||
| 1477 | 1477 | /** |
| 1478 | 1478 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 1479 | 1479 | */ |
| 1480 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
| 1480 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
| 1481 | 1481 | } |
| 1482 | 1482 | |
| 1483 | 1483 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1577,31 +1577,31 @@ discard block |
||
| 1577 | 1577 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
| 1578 | 1578 | |
| 1579 | 1579 | if ($length === null) { |
| 1580 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2); |
|
| 1580 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2); |
|
| 1581 | 1581 | } |
| 1582 | 1582 | |
| 1583 | 1583 | if ($search === '') { |
| 1584 | 1584 | if ($encoding === 'UTF-8') { |
| 1585 | 1585 | if ($length > 0) { |
| 1586 | - $string_length = (int) \mb_strlen($str); |
|
| 1586 | + $string_length = (int)\mb_strlen($str); |
|
| 1587 | 1587 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
| 1588 | 1588 | } else { |
| 1589 | 1589 | $end = 0; |
| 1590 | 1590 | } |
| 1591 | 1591 | |
| 1592 | - $pos = (int) \min( |
|
| 1592 | + $pos = (int)\min( |
|
| 1593 | 1593 | \mb_strpos($str, ' ', $end), |
| 1594 | 1594 | \mb_strpos($str, '.', $end) |
| 1595 | 1595 | ); |
| 1596 | 1596 | } else { |
| 1597 | 1597 | if ($length > 0) { |
| 1598 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 1598 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 1599 | 1599 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
| 1600 | 1600 | } else { |
| 1601 | 1601 | $end = 0; |
| 1602 | 1602 | } |
| 1603 | 1603 | |
| 1604 | - $pos = (int) \min( |
|
| 1604 | + $pos = (int)\min( |
|
| 1605 | 1605 | self::strpos($str, ' ', $end, $encoding), |
| 1606 | 1606 | self::strpos($str, '.', $end, $encoding) |
| 1607 | 1607 | ); |
@@ -1618,18 +1618,18 @@ discard block |
||
| 1618 | 1618 | return ''; |
| 1619 | 1619 | } |
| 1620 | 1620 | |
| 1621 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1621 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1622 | 1622 | } |
| 1623 | 1623 | |
| 1624 | 1624 | return $str; |
| 1625 | 1625 | } |
| 1626 | 1626 | |
| 1627 | 1627 | if ($encoding === 'UTF-8') { |
| 1628 | - $word_position = (int) \mb_stripos($str, $search); |
|
| 1629 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
| 1628 | + $word_position = (int)\mb_stripos($str, $search); |
|
| 1629 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
| 1630 | 1630 | } else { |
| 1631 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
| 1632 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
| 1631 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
| 1632 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
| 1633 | 1633 | } |
| 1634 | 1634 | |
| 1635 | 1635 | $pos_start = 0; |
@@ -1641,12 +1641,12 @@ discard block |
||
| 1641 | 1641 | } |
| 1642 | 1642 | if ($half_text !== false) { |
| 1643 | 1643 | if ($encoding === 'UTF-8') { |
| 1644 | - $pos_start = (int) \max( |
|
| 1644 | + $pos_start = (int)\max( |
|
| 1645 | 1645 | \mb_strrpos($half_text, ' '), |
| 1646 | 1646 | \mb_strrpos($half_text, '.') |
| 1647 | 1647 | ); |
| 1648 | 1648 | } else { |
| 1649 | - $pos_start = (int) \max( |
|
| 1649 | + $pos_start = (int)\max( |
|
| 1650 | 1650 | self::strrpos($half_text, ' ', 0, $encoding), |
| 1651 | 1651 | self::strrpos($half_text, '.', 0, $encoding) |
| 1652 | 1652 | ); |
@@ -1656,19 +1656,19 @@ discard block |
||
| 1656 | 1656 | |
| 1657 | 1657 | if ($word_position && $half_side > 0) { |
| 1658 | 1658 | $offset = $pos_start + $length - 1; |
| 1659 | - $real_length = (int) self::strlen($str, $encoding); |
|
| 1659 | + $real_length = (int)self::strlen($str, $encoding); |
|
| 1660 | 1660 | |
| 1661 | 1661 | if ($offset > $real_length) { |
| 1662 | 1662 | $offset = $real_length; |
| 1663 | 1663 | } |
| 1664 | 1664 | |
| 1665 | 1665 | if ($encoding === 'UTF-8') { |
| 1666 | - $pos_end = (int) \min( |
|
| 1666 | + $pos_end = (int)\min( |
|
| 1667 | 1667 | \mb_strpos($str, ' ', $offset), |
| 1668 | 1668 | \mb_strpos($str, '.', $offset) |
| 1669 | 1669 | ) - $pos_start; |
| 1670 | 1670 | } else { |
| 1671 | - $pos_end = (int) \min( |
|
| 1671 | + $pos_end = (int)\min( |
|
| 1672 | 1672 | self::strpos($str, ' ', $offset, $encoding), |
| 1673 | 1673 | self::strpos($str, '.', $offset, $encoding) |
| 1674 | 1674 | ) - $pos_start; |
@@ -1676,12 +1676,12 @@ discard block |
||
| 1676 | 1676 | |
| 1677 | 1677 | if (!$pos_end || $pos_end <= 0) { |
| 1678 | 1678 | if ($encoding === 'UTF-8') { |
| 1679 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
| 1679 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
| 1680 | 1680 | } else { |
| 1681 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
| 1681 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
| 1682 | 1682 | } |
| 1683 | 1683 | if ($str_sub !== false) { |
| 1684 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
| 1684 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
| 1685 | 1685 | } else { |
| 1686 | 1686 | $extract = ''; |
| 1687 | 1687 | } |
@@ -1692,26 +1692,26 @@ discard block |
||
| 1692 | 1692 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
| 1693 | 1693 | } |
| 1694 | 1694 | if ($str_sub !== false) { |
| 1695 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1695 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1696 | 1696 | } else { |
| 1697 | 1697 | $extract = ''; |
| 1698 | 1698 | } |
| 1699 | 1699 | } |
| 1700 | 1700 | } else { |
| 1701 | 1701 | $offset = $length - 1; |
| 1702 | - $true_length = (int) self::strlen($str, $encoding); |
|
| 1702 | + $true_length = (int)self::strlen($str, $encoding); |
|
| 1703 | 1703 | |
| 1704 | 1704 | if ($offset > $true_length) { |
| 1705 | 1705 | $offset = $true_length; |
| 1706 | 1706 | } |
| 1707 | 1707 | |
| 1708 | 1708 | if ($encoding === 'UTF-8') { |
| 1709 | - $pos_end = (int) \min( |
|
| 1709 | + $pos_end = (int)\min( |
|
| 1710 | 1710 | \mb_strpos($str, ' ', $offset), |
| 1711 | 1711 | \mb_strpos($str, '.', $offset) |
| 1712 | 1712 | ); |
| 1713 | 1713 | } else { |
| 1714 | - $pos_end = (int) \min( |
|
| 1714 | + $pos_end = (int)\min( |
|
| 1715 | 1715 | self::strpos($str, ' ', $offset, $encoding), |
| 1716 | 1716 | self::strpos($str, '.', $offset, $encoding) |
| 1717 | 1717 | ); |
@@ -1724,7 +1724,7 @@ discard block |
||
| 1724 | 1724 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
| 1725 | 1725 | } |
| 1726 | 1726 | if ($str_sub !== false) { |
| 1727 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1727 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1728 | 1728 | } else { |
| 1729 | 1729 | $extract = ''; |
| 1730 | 1730 | } |
@@ -1857,7 +1857,7 @@ discard block |
||
| 1857 | 1857 | { |
| 1858 | 1858 | $file_content = \file_get_contents($file_path); |
| 1859 | 1859 | if ($file_content === false) { |
| 1860 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
| 1860 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
| 1861 | 1861 | } |
| 1862 | 1862 | |
| 1863 | 1863 | return self::string_has_bom($file_content); |
@@ -1923,7 +1923,7 @@ discard block |
||
| 1923 | 1923 | ) { |
| 1924 | 1924 | // Prevent leading combining chars |
| 1925 | 1925 | // for NFC-safe concatenations. |
| 1926 | - $var = $leading_combining . $var; |
|
| 1926 | + $var = $leading_combining.$var; |
|
| 1927 | 1927 | } |
| 1928 | 1928 | } |
| 1929 | 1929 | |
@@ -2242,10 +2242,10 @@ discard block |
||
| 2242 | 2242 | } |
| 2243 | 2243 | |
| 2244 | 2244 | if ($encoding === 'UTF-8') { |
| 2245 | - return (string) \mb_substr($str, 0, $n); |
|
| 2245 | + return (string)\mb_substr($str, 0, $n); |
|
| 2246 | 2246 | } |
| 2247 | 2247 | |
| 2248 | - return (string) self::substr($str, 0, $n, $encoding); |
|
| 2248 | + return (string)self::substr($str, 0, $n, $encoding); |
|
| 2249 | 2249 | } |
| 2250 | 2250 | |
| 2251 | 2251 | /** |
@@ -2263,7 +2263,7 @@ discard block |
||
| 2263 | 2263 | */ |
| 2264 | 2264 | public static function fits_inside(string $str, int $box_size): bool |
| 2265 | 2265 | { |
| 2266 | - return (int) self::strlen($str) <= $box_size; |
|
| 2266 | + return (int)self::strlen($str) <= $box_size; |
|
| 2267 | 2267 | } |
| 2268 | 2268 | |
| 2269 | 2269 | /** |
@@ -2346,7 +2346,7 @@ discard block |
||
| 2346 | 2346 | return $str; |
| 2347 | 2347 | } |
| 2348 | 2348 | |
| 2349 | - $str = (string) $str; |
|
| 2349 | + $str = (string)$str; |
|
| 2350 | 2350 | $last = ''; |
| 2351 | 2351 | while ($last !== $str) { |
| 2352 | 2352 | $last = $str; |
@@ -2555,7 +2555,7 @@ discard block |
||
| 2555 | 2555 | return $fallback; |
| 2556 | 2556 | } |
| 2557 | 2557 | /** @noinspection OffsetOperationsInspection */ |
| 2558 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
| 2558 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
| 2559 | 2559 | |
| 2560 | 2560 | // DEBUG |
| 2561 | 2561 | //var_dump($type_code); |
@@ -2613,7 +2613,7 @@ discard block |
||
| 2613 | 2613 | // |
| 2614 | 2614 | |
| 2615 | 2615 | if ($encoding === 'UTF-8') { |
| 2616 | - $max_length = (int) \mb_strlen($possible_chars); |
|
| 2616 | + $max_length = (int)\mb_strlen($possible_chars); |
|
| 2617 | 2617 | if ($max_length === 0) { |
| 2618 | 2618 | return ''; |
| 2619 | 2619 | } |
@@ -2634,7 +2634,7 @@ discard block |
||
| 2634 | 2634 | } else { |
| 2635 | 2635 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 2636 | 2636 | |
| 2637 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
| 2637 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
| 2638 | 2638 | if ($max_length === 0) { |
| 2639 | 2639 | return ''; |
| 2640 | 2640 | } |
@@ -2672,16 +2672,16 @@ discard block |
||
| 2672 | 2672 | $rand_int = \mt_rand(0, \mt_getrandmax()); |
| 2673 | 2673 | } |
| 2674 | 2674 | |
| 2675 | - $unique_helper = $rand_int . |
|
| 2676 | - \session_id() . |
|
| 2677 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
| 2678 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
| 2675 | + $unique_helper = $rand_int. |
|
| 2676 | + \session_id(). |
|
| 2677 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
| 2678 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
| 2679 | 2679 | $extra_entropy; |
| 2680 | 2680 | |
| 2681 | 2681 | $unique_string = \uniqid($unique_helper, true); |
| 2682 | 2682 | |
| 2683 | 2683 | if ($use_md5) { |
| 2684 | - $unique_string = \md5($unique_string . $unique_helper); |
|
| 2684 | + $unique_string = \md5($unique_string.$unique_helper); |
|
| 2685 | 2685 | } |
| 2686 | 2686 | |
| 2687 | 2687 | return $unique_string; |
@@ -2779,7 +2779,7 @@ discard block |
||
| 2779 | 2779 | public static function hex_to_chr(string $hexdec) |
| 2780 | 2780 | { |
| 2781 | 2781 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Invalid characters passed for attempted conversion, these have been ignored */ |
| 2782 | - return self::decimal_to_chr((int) @\hexdec($hexdec)); |
|
| 2782 | + return self::decimal_to_chr((int)@\hexdec($hexdec)); |
|
| 2783 | 2783 | } |
| 2784 | 2784 | |
| 2785 | 2785 | /** |
@@ -2799,7 +2799,7 @@ discard block |
||
| 2799 | 2799 | public static function hex_to_int($hexdec) |
| 2800 | 2800 | { |
| 2801 | 2801 | // init |
| 2802 | - $hexdec = (string) $hexdec; |
|
| 2802 | + $hexdec = (string)$hexdec; |
|
| 2803 | 2803 | |
| 2804 | 2804 | if ($hexdec === '') { |
| 2805 | 2805 | return false; |
@@ -2898,7 +2898,7 @@ discard block |
||
| 2898 | 2898 | return \implode( |
| 2899 | 2899 | '', |
| 2900 | 2900 | \array_map( |
| 2901 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
| 2901 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
| 2902 | 2902 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
| 2903 | 2903 | }, |
| 2904 | 2904 | self::str_split($str) |
@@ -3012,7 +3012,7 @@ discard block |
||
| 3012 | 3012 | /** |
| 3013 | 3013 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 3014 | 3014 | */ |
| 3015 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 3015 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 3016 | 3016 | } |
| 3017 | 3017 | |
| 3018 | 3018 | do { |
@@ -3021,7 +3021,7 @@ discard block |
||
| 3021 | 3021 | if (\strpos($str, '&') !== false) { |
| 3022 | 3022 | if (\strpos($str, '&#') !== false) { |
| 3023 | 3023 | // decode also numeric & UTF16 two byte entities |
| 3024 | - $str = (string) \preg_replace( |
|
| 3024 | + $str = (string)\preg_replace( |
|
| 3025 | 3025 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
| 3026 | 3026 | '$1;', |
| 3027 | 3027 | $str |
@@ -3071,7 +3071,7 @@ discard block |
||
| 3071 | 3071 | */ |
| 3072 | 3072 | public static function html_stripe_empty_tags(string $str): string |
| 3073 | 3073 | { |
| 3074 | - return (string) \preg_replace( |
|
| 3074 | + return (string)\preg_replace( |
|
| 3075 | 3075 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
| 3076 | 3076 | '', |
| 3077 | 3077 | $str |
@@ -3399,9 +3399,9 @@ discard block |
||
| 3399 | 3399 | { |
| 3400 | 3400 | $hex = \dechex($int); |
| 3401 | 3401 | |
| 3402 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
| 3402 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
| 3403 | 3403 | |
| 3404 | - return $prefix . $hex . ''; |
|
| 3404 | + return $prefix.$hex.''; |
|
| 3405 | 3405 | } |
| 3406 | 3406 | |
| 3407 | 3407 | /** |
@@ -3725,7 +3725,7 @@ discard block |
||
| 3725 | 3725 | */ |
| 3726 | 3726 | public static function is_binary($input, bool $strict = false): bool |
| 3727 | 3727 | { |
| 3728 | - $input = (string) $input; |
|
| 3728 | + $input = (string)$input; |
|
| 3729 | 3729 | if ($input === '') { |
| 3730 | 3730 | return false; |
| 3731 | 3731 | } |
@@ -4085,7 +4085,7 @@ discard block |
||
| 4085 | 4085 | public static function is_utf16($str, bool $check_if_string_is_binary = true) |
| 4086 | 4086 | { |
| 4087 | 4087 | // init |
| 4088 | - $str = (string) $str; |
|
| 4088 | + $str = (string)$str; |
|
| 4089 | 4089 | $str_chars = []; |
| 4090 | 4090 | |
| 4091 | 4091 | if ( |
@@ -4179,7 +4179,7 @@ discard block |
||
| 4179 | 4179 | public static function is_utf32($str, bool $check_if_string_is_binary = true) |
| 4180 | 4180 | { |
| 4181 | 4181 | // init |
| 4182 | - $str = (string) $str; |
|
| 4182 | + $str = (string)$str; |
|
| 4183 | 4183 | $str_chars = []; |
| 4184 | 4184 | |
| 4185 | 4185 | if ( |
@@ -4277,7 +4277,7 @@ discard block |
||
| 4277 | 4277 | return true; |
| 4278 | 4278 | } |
| 4279 | 4279 | |
| 4280 | - return self::is_utf8_string((string) $str, $strict); |
|
| 4280 | + return self::is_utf8_string((string)$str, $strict); |
|
| 4281 | 4281 | } |
| 4282 | 4282 | |
| 4283 | 4283 | /** |
@@ -4433,15 +4433,15 @@ discard block |
||
| 4433 | 4433 | $use_mb_functions = ($lang === null && !$try_to_keep_the_string_length); |
| 4434 | 4434 | |
| 4435 | 4435 | if ($encoding === 'UTF-8') { |
| 4436 | - $str_part_two = (string) \mb_substr($str, 1); |
|
| 4436 | + $str_part_two = (string)\mb_substr($str, 1); |
|
| 4437 | 4437 | |
| 4438 | 4438 | if ($use_mb_functions) { |
| 4439 | 4439 | $str_part_one = \mb_strtolower( |
| 4440 | - (string) \mb_substr($str, 0, 1) |
|
| 4440 | + (string)\mb_substr($str, 0, 1) |
|
| 4441 | 4441 | ); |
| 4442 | 4442 | } else { |
| 4443 | 4443 | $str_part_one = self::strtolower( |
| 4444 | - (string) \mb_substr($str, 0, 1), |
|
| 4444 | + (string)\mb_substr($str, 0, 1), |
|
| 4445 | 4445 | $encoding, |
| 4446 | 4446 | false, |
| 4447 | 4447 | $lang, |
@@ -4451,10 +4451,10 @@ discard block |
||
| 4451 | 4451 | } else { |
| 4452 | 4452 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4453 | 4453 | |
| 4454 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
| 4454 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
| 4455 | 4455 | |
| 4456 | 4456 | $str_part_one = self::strtolower( |
| 4457 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 4457 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 4458 | 4458 | $encoding, |
| 4459 | 4459 | false, |
| 4460 | 4460 | $lang, |
@@ -4462,7 +4462,7 @@ discard block |
||
| 4462 | 4462 | ); |
| 4463 | 4463 | } |
| 4464 | 4464 | |
| 4465 | - return $str_part_one . $str_part_two; |
|
| 4465 | + return $str_part_one.$str_part_two; |
|
| 4466 | 4466 | } |
| 4467 | 4467 | |
| 4468 | 4468 | /** |
@@ -4611,7 +4611,7 @@ discard block |
||
| 4611 | 4611 | } |
| 4612 | 4612 | |
| 4613 | 4613 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4614 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 4614 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 4615 | 4615 | } |
| 4616 | 4616 | |
| 4617 | 4617 | if ($chars) { |
@@ -4648,7 +4648,7 @@ discard block |
||
| 4648 | 4648 | |
| 4649 | 4649 | $codepoint_max = \max($codepoints); |
| 4650 | 4650 | |
| 4651 | - return self::chr((int) $codepoint_max); |
|
| 4651 | + return self::chr((int)$codepoint_max); |
|
| 4652 | 4652 | } |
| 4653 | 4653 | |
| 4654 | 4654 | /** |
@@ -4668,7 +4668,7 @@ discard block |
||
| 4668 | 4668 | { |
| 4669 | 4669 | $bytes = self::chr_size_list($str); |
| 4670 | 4670 | if ($bytes !== []) { |
| 4671 | - return (int) \max($bytes); |
|
| 4671 | + return (int)\max($bytes); |
|
| 4672 | 4672 | } |
| 4673 | 4673 | |
| 4674 | 4674 | return 0; |
@@ -4712,7 +4712,7 @@ discard block |
||
| 4712 | 4712 | |
| 4713 | 4713 | $codepoint_min = \min($codepoints); |
| 4714 | 4714 | |
| 4715 | - return self::chr((int) $codepoint_min); |
|
| 4715 | + return self::chr((int)$codepoint_min); |
|
| 4716 | 4716 | } |
| 4717 | 4717 | |
| 4718 | 4718 | /** |
@@ -4760,7 +4760,7 @@ discard block |
||
| 4760 | 4760 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
| 4761 | 4761 | |
| 4762 | 4762 | // init |
| 4763 | - $encoding = (string) $encoding; |
|
| 4763 | + $encoding = (string)$encoding; |
|
| 4764 | 4764 | |
| 4765 | 4765 | if (!$encoding) { |
| 4766 | 4766 | return $fallback; |
@@ -4822,7 +4822,7 @@ discard block |
||
| 4822 | 4822 | |
| 4823 | 4823 | $encoding_original = $encoding; |
| 4824 | 4824 | $encoding = \strtoupper($encoding); |
| 4825 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
| 4825 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
| 4826 | 4826 | |
| 4827 | 4827 | $equivalences = [ |
| 4828 | 4828 | 'ISO8859' => 'ISO-8859-1', |
@@ -4986,13 +4986,13 @@ discard block |
||
| 4986 | 4986 | static $CHAR_CACHE = []; |
| 4987 | 4987 | |
| 4988 | 4988 | // init |
| 4989 | - $chr = (string) $chr; |
|
| 4989 | + $chr = (string)$chr; |
|
| 4990 | 4990 | |
| 4991 | 4991 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
| 4992 | 4992 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4993 | 4993 | } |
| 4994 | 4994 | |
| 4995 | - $cache_key = $chr . '_' . $encoding; |
|
| 4995 | + $cache_key = $chr.'_'.$encoding; |
|
| 4996 | 4996 | if (isset($CHAR_CACHE[$cache_key])) { |
| 4997 | 4997 | return $CHAR_CACHE[$cache_key]; |
| 4998 | 4998 | } |
@@ -5027,7 +5027,7 @@ discard block |
||
| 5027 | 5027 | // |
| 5028 | 5028 | |
| 5029 | 5029 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 5030 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
| 5030 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
| 5031 | 5031 | /** @noinspection OffsetOperationsInspection */ |
| 5032 | 5032 | $code = $chr ? $chr[1] : 0; |
| 5033 | 5033 | |
@@ -5035,21 +5035,21 @@ discard block |
||
| 5035 | 5035 | if ($code >= 0xF0 && isset($chr[4])) { |
| 5036 | 5036 | /** @noinspection UnnecessaryCastingInspection */ |
| 5037 | 5037 | /** @noinspection OffsetOperationsInspection */ |
| 5038 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 5038 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 5039 | 5039 | } |
| 5040 | 5040 | |
| 5041 | 5041 | /** @noinspection OffsetOperationsInspection */ |
| 5042 | 5042 | if ($code >= 0xE0 && isset($chr[3])) { |
| 5043 | 5043 | /** @noinspection UnnecessaryCastingInspection */ |
| 5044 | 5044 | /** @noinspection OffsetOperationsInspection */ |
| 5045 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 5045 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 5046 | 5046 | } |
| 5047 | 5047 | |
| 5048 | 5048 | /** @noinspection OffsetOperationsInspection */ |
| 5049 | 5049 | if ($code >= 0xC0 && isset($chr[2])) { |
| 5050 | 5050 | /** @noinspection UnnecessaryCastingInspection */ |
| 5051 | 5051 | /** @noinspection OffsetOperationsInspection */ |
| 5052 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 5052 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 5053 | 5053 | } |
| 5054 | 5054 | |
| 5055 | 5055 | return $CHAR_CACHE[$cache_key] = $code; |
@@ -5111,7 +5111,7 @@ discard block |
||
| 5111 | 5111 | public static function pcre_utf8_support(): bool |
| 5112 | 5112 | { |
| 5113 | 5113 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 5114 | - return (bool) @\preg_match('//u', ''); |
|
| 5114 | + return (bool)@\preg_match('//u', ''); |
|
| 5115 | 5115 | } |
| 5116 | 5116 | |
| 5117 | 5117 | /** |
@@ -5152,14 +5152,14 @@ discard block |
||
| 5152 | 5152 | * @psalm-suppress DocblockTypeContradiction |
| 5153 | 5153 | */ |
| 5154 | 5154 | if (!\is_numeric($step)) { |
| 5155 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
| 5155 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
| 5156 | 5156 | } |
| 5157 | 5157 | |
| 5158 | 5158 | /** |
| 5159 | 5159 | * @psalm-suppress RedundantConditionGivenDocblockType - false-positive from psalm? |
| 5160 | 5160 | */ |
| 5161 | 5161 | if ($step <= 0) { |
| 5162 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
| 5162 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
| 5163 | 5163 | } |
| 5164 | 5164 | } |
| 5165 | 5165 | |
@@ -5171,16 +5171,16 @@ discard block |
||
| 5171 | 5171 | $is_xdigit = false; |
| 5172 | 5172 | |
| 5173 | 5173 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5174 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
| 5174 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
| 5175 | 5175 | $is_digit = true; |
| 5176 | - $start = (int) $var1; |
|
| 5176 | + $start = (int)$var1; |
|
| 5177 | 5177 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
| 5178 | 5178 | $is_xdigit = true; |
| 5179 | - $start = (int) self::hex_to_int((string) $var1); |
|
| 5179 | + $start = (int)self::hex_to_int((string)$var1); |
|
| 5180 | 5180 | } elseif (!$use_ctype && \is_numeric($var1)) { |
| 5181 | - $start = (int) $var1; |
|
| 5181 | + $start = (int)$var1; |
|
| 5182 | 5182 | } else { |
| 5183 | - $start = self::ord((string) $var1); |
|
| 5183 | + $start = self::ord((string)$var1); |
|
| 5184 | 5184 | } |
| 5185 | 5185 | |
| 5186 | 5186 | if (!$start) { |
@@ -5188,13 +5188,13 @@ discard block |
||
| 5188 | 5188 | } |
| 5189 | 5189 | |
| 5190 | 5190 | if ($is_digit) { |
| 5191 | - $end = (int) $var2; |
|
| 5191 | + $end = (int)$var2; |
|
| 5192 | 5192 | } elseif ($is_xdigit) { |
| 5193 | - $end = (int) self::hex_to_int((string) $var2); |
|
| 5193 | + $end = (int)self::hex_to_int((string)$var2); |
|
| 5194 | 5194 | } elseif (!$use_ctype && \is_numeric($var2)) { |
| 5195 | - $end = (int) $var2; |
|
| 5195 | + $end = (int)$var2; |
|
| 5196 | 5196 | } else { |
| 5197 | - $end = self::ord((string) $var2); |
|
| 5197 | + $end = self::ord((string)$var2); |
|
| 5198 | 5198 | } |
| 5199 | 5199 | |
| 5200 | 5200 | if (!$end) { |
@@ -5203,7 +5203,7 @@ discard block |
||
| 5203 | 5203 | |
| 5204 | 5204 | $array = []; |
| 5205 | 5205 | foreach (\range($start, $end, $step) as $i) { |
| 5206 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
| 5206 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
| 5207 | 5207 | } |
| 5208 | 5208 | |
| 5209 | 5209 | return $array; |
@@ -5315,8 +5315,8 @@ discard block |
||
| 5315 | 5315 | $delimiter = '/'; |
| 5316 | 5316 | } |
| 5317 | 5317 | |
| 5318 | - return (string) \preg_replace( |
|
| 5319 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
| 5318 | + return (string)\preg_replace( |
|
| 5319 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
| 5320 | 5320 | $replacement, |
| 5321 | 5321 | $str |
| 5322 | 5322 | ); |
@@ -5366,9 +5366,9 @@ discard block |
||
| 5366 | 5366 | return ''; |
| 5367 | 5367 | } |
| 5368 | 5368 | |
| 5369 | - $str_length -= (int) $bom_byte_length; |
|
| 5369 | + $str_length -= (int)$bom_byte_length; |
|
| 5370 | 5370 | |
| 5371 | - $str = (string) $str_tmp; |
|
| 5371 | + $str = (string)$str_tmp; |
|
| 5372 | 5372 | } |
| 5373 | 5373 | } |
| 5374 | 5374 | |
@@ -5399,7 +5399,7 @@ discard block |
||
| 5399 | 5399 | */ |
| 5400 | 5400 | if (\is_array($what)) { |
| 5401 | 5401 | foreach ($what as $item) { |
| 5402 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
| 5402 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
| 5403 | 5403 | } |
| 5404 | 5404 | } |
| 5405 | 5405 | |
@@ -5437,7 +5437,7 @@ discard block |
||
| 5437 | 5437 | */ |
| 5438 | 5438 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
| 5439 | 5439 | { |
| 5440 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 5440 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 5441 | 5441 | } |
| 5442 | 5442 | |
| 5443 | 5443 | /** |
@@ -5494,17 +5494,17 @@ discard block |
||
| 5494 | 5494 | ): string { |
| 5495 | 5495 | if ($substring && \strpos($str, $substring) === 0) { |
| 5496 | 5496 | if ($encoding === 'UTF-8') { |
| 5497 | - return (string) \mb_substr( |
|
| 5497 | + return (string)\mb_substr( |
|
| 5498 | 5498 | $str, |
| 5499 | - (int) \mb_strlen($substring) |
|
| 5499 | + (int)\mb_strlen($substring) |
|
| 5500 | 5500 | ); |
| 5501 | 5501 | } |
| 5502 | 5502 | |
| 5503 | 5503 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5504 | 5504 | |
| 5505 | - return (string) self::substr( |
|
| 5505 | + return (string)self::substr( |
|
| 5506 | 5506 | $str, |
| 5507 | - (int) self::strlen($substring, $encoding), |
|
| 5507 | + (int)self::strlen($substring, $encoding), |
|
| 5508 | 5508 | null, |
| 5509 | 5509 | $encoding |
| 5510 | 5510 | ); |
@@ -5532,19 +5532,19 @@ discard block |
||
| 5532 | 5532 | ): string { |
| 5533 | 5533 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
| 5534 | 5534 | if ($encoding === 'UTF-8') { |
| 5535 | - return (string) \mb_substr( |
|
| 5535 | + return (string)\mb_substr( |
|
| 5536 | 5536 | $str, |
| 5537 | 5537 | 0, |
| 5538 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
| 5538 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
| 5539 | 5539 | ); |
| 5540 | 5540 | } |
| 5541 | 5541 | |
| 5542 | 5542 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5543 | 5543 | |
| 5544 | - return (string) self::substr( |
|
| 5544 | + return (string)self::substr( |
|
| 5545 | 5545 | $str, |
| 5546 | 5546 | 0, |
| 5547 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
| 5547 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
| 5548 | 5548 | $encoding |
| 5549 | 5549 | ); |
| 5550 | 5550 | } |
@@ -5646,7 +5646,7 @@ discard block |
||
| 5646 | 5646 | /** @noinspection PhpUsageOfSilenceOperatorInspection - ignore "Unknown character" warnings, it's working anyway */ |
| 5647 | 5647 | @\mb_substitute_character($replacement_char_helper); |
| 5648 | 5648 | // the polyfill maybe return false, so cast to string |
| 5649 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 5649 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 5650 | 5650 | \mb_substitute_character($save); |
| 5651 | 5651 | } |
| 5652 | 5652 | |
@@ -5692,7 +5692,7 @@ discard block |
||
| 5692 | 5692 | } |
| 5693 | 5693 | |
| 5694 | 5694 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5695 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 5695 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 5696 | 5696 | } |
| 5697 | 5697 | |
| 5698 | 5698 | if ($chars) { |
@@ -5722,7 +5722,7 @@ discard block |
||
| 5722 | 5722 | $html .= '<pre>'; |
| 5723 | 5723 | /** @noinspection AlterInForeachInspection */ |
| 5724 | 5724 | foreach (self::$SUPPORT as $key => &$value) { |
| 5725 | - $html .= $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
| 5725 | + $html .= $key.' - '.\print_r($value, true)."\n<br>"; |
|
| 5726 | 5726 | } |
| 5727 | 5727 | $html .= '</pre>'; |
| 5728 | 5728 | |
@@ -5764,7 +5764,7 @@ discard block |
||
| 5764 | 5764 | return $char; |
| 5765 | 5765 | } |
| 5766 | 5766 | |
| 5767 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
| 5767 | + return '&#'.self::ord($char, $encoding).';'; |
|
| 5768 | 5768 | } |
| 5769 | 5769 | |
| 5770 | 5770 | /** |
@@ -5868,11 +5868,11 @@ discard block |
||
| 5868 | 5868 | $lang, |
| 5869 | 5869 | $try_to_keep_the_string_length |
| 5870 | 5870 | ); |
| 5871 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
| 5871 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
| 5872 | 5872 | |
| 5873 | 5873 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 5874 | 5874 | |
| 5875 | - $str = (string) \preg_replace_callback( |
|
| 5875 | + $str = (string)\preg_replace_callback( |
|
| 5876 | 5876 | '/[-_\\s]+(.)?/u', |
| 5877 | 5877 | /** |
| 5878 | 5878 | * @param array $match |
@@ -5881,7 +5881,7 @@ discard block |
||
| 5881 | 5881 | * |
| 5882 | 5882 | * @return string |
| 5883 | 5883 | */ |
| 5884 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
| 5884 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
| 5885 | 5885 | if (isset($match[1])) { |
| 5886 | 5886 | if ($use_mb_functions) { |
| 5887 | 5887 | if ($encoding === 'UTF-8') { |
@@ -5899,7 +5899,7 @@ discard block |
||
| 5899 | 5899 | $str |
| 5900 | 5900 | ); |
| 5901 | 5901 | |
| 5902 | - return (string) \preg_replace_callback( |
|
| 5902 | + return (string)\preg_replace_callback( |
|
| 5903 | 5903 | '/[\\p{N}]+(.)?/u', |
| 5904 | 5904 | /** |
| 5905 | 5905 | * @param array $match |
@@ -5908,7 +5908,7 @@ discard block |
||
| 5908 | 5908 | * |
| 5909 | 5909 | * @return string |
| 5910 | 5910 | */ |
| 5911 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
| 5911 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
| 5912 | 5912 | if ($use_mb_functions) { |
| 5913 | 5913 | if ($encoding === 'UTF-8') { |
| 5914 | 5914 | return \mb_strtoupper($match[0]); |
@@ -6100,7 +6100,7 @@ discard block |
||
| 6100 | 6100 | ): string { |
| 6101 | 6101 | if (self::$SUPPORT['mbstring'] === true) { |
| 6102 | 6102 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 6103 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
| 6103 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
| 6104 | 6104 | |
| 6105 | 6105 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 6106 | 6106 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -6110,10 +6110,10 @@ discard block |
||
| 6110 | 6110 | } |
| 6111 | 6111 | |
| 6112 | 6112 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 6113 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
| 6113 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
| 6114 | 6114 | } |
| 6115 | 6115 | |
| 6116 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
| 6116 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
| 6117 | 6117 | |
| 6118 | 6118 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 6119 | 6119 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -6122,7 +6122,7 @@ discard block |
||
| 6122 | 6122 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
| 6123 | 6123 | } |
| 6124 | 6124 | |
| 6125 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
| 6125 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
| 6126 | 6126 | } |
| 6127 | 6127 | |
| 6128 | 6128 | /** |
@@ -6144,7 +6144,7 @@ discard block |
||
| 6144 | 6144 | public static function str_detect_encoding($str) |
| 6145 | 6145 | { |
| 6146 | 6146 | // init |
| 6147 | - $str = (string) $str; |
|
| 6147 | + $str = (string)$str; |
|
| 6148 | 6148 | |
| 6149 | 6149 | // |
| 6150 | 6150 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -6246,7 +6246,7 @@ discard block |
||
| 6246 | 6246 | foreach (self::$ENCODINGS as $encoding_tmp) { |
| 6247 | 6247 | // INFO: //IGNORE but still throw notice |
| 6248 | 6248 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 6249 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
| 6249 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
| 6250 | 6250 | return $encoding_tmp; |
| 6251 | 6251 | } |
| 6252 | 6252 | } |
@@ -6348,7 +6348,7 @@ discard block |
||
| 6348 | 6348 | return $str; |
| 6349 | 6349 | } |
| 6350 | 6350 | |
| 6351 | - return $substring . $str; |
|
| 6351 | + return $substring.$str; |
|
| 6352 | 6352 | } |
| 6353 | 6353 | |
| 6354 | 6354 | /** |
@@ -6644,27 +6644,27 @@ discard block |
||
| 6644 | 6644 | string $encoding = 'UTF-8' |
| 6645 | 6645 | ): string { |
| 6646 | 6646 | if ($encoding === 'UTF-8') { |
| 6647 | - $len = (int) \mb_strlen($str); |
|
| 6647 | + $len = (int)\mb_strlen($str); |
|
| 6648 | 6648 | if ($index > $len) { |
| 6649 | 6649 | return $str; |
| 6650 | 6650 | } |
| 6651 | 6651 | |
| 6652 | 6652 | /** @noinspection UnnecessaryCastingInspection */ |
| 6653 | - return (string) \mb_substr($str, 0, $index) . |
|
| 6654 | - $substring . |
|
| 6655 | - (string) \mb_substr($str, $index, $len); |
|
| 6653 | + return (string)\mb_substr($str, 0, $index). |
|
| 6654 | + $substring. |
|
| 6655 | + (string)\mb_substr($str, $index, $len); |
|
| 6656 | 6656 | } |
| 6657 | 6657 | |
| 6658 | 6658 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6659 | 6659 | |
| 6660 | - $len = (int) self::strlen($str, $encoding); |
|
| 6660 | + $len = (int)self::strlen($str, $encoding); |
|
| 6661 | 6661 | if ($index > $len) { |
| 6662 | 6662 | return $str; |
| 6663 | 6663 | } |
| 6664 | 6664 | |
| 6665 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
| 6666 | - $substring . |
|
| 6667 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
| 6665 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
| 6666 | + $substring. |
|
| 6667 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
| 6668 | 6668 | } |
| 6669 | 6669 | |
| 6670 | 6670 | /** |
@@ -6703,15 +6703,15 @@ discard block |
||
| 6703 | 6703 | */ |
| 6704 | 6704 | public static function str_ireplace($search, $replacement, $subject, &$count = null) |
| 6705 | 6705 | { |
| 6706 | - $search = (array) $search; |
|
| 6706 | + $search = (array)$search; |
|
| 6707 | 6707 | |
| 6708 | 6708 | /** @noinspection AlterInForeachInspection */ |
| 6709 | 6709 | foreach ($search as &$s) { |
| 6710 | - $s = (string) $s; |
|
| 6710 | + $s = (string)$s; |
|
| 6711 | 6711 | if ($s === '') { |
| 6712 | 6712 | $s = '/^(?<=.)$/'; |
| 6713 | 6713 | } else { |
| 6714 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
| 6714 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
| 6715 | 6715 | } |
| 6716 | 6716 | } |
| 6717 | 6717 | |
@@ -6748,11 +6748,11 @@ discard block |
||
| 6748 | 6748 | } |
| 6749 | 6749 | |
| 6750 | 6750 | if ($search === '') { |
| 6751 | - return $str . $replacement; |
|
| 6751 | + return $str.$replacement; |
|
| 6752 | 6752 | } |
| 6753 | 6753 | |
| 6754 | 6754 | if (\stripos($str, $search) === 0) { |
| 6755 | - return $replacement . \substr($str, \strlen($search)); |
|
| 6755 | + return $replacement.\substr($str, \strlen($search)); |
|
| 6756 | 6756 | } |
| 6757 | 6757 | |
| 6758 | 6758 | return $str; |
@@ -6783,11 +6783,11 @@ discard block |
||
| 6783 | 6783 | } |
| 6784 | 6784 | |
| 6785 | 6785 | if ($search === '') { |
| 6786 | - return $str . $replacement; |
|
| 6786 | + return $str.$replacement; |
|
| 6787 | 6787 | } |
| 6788 | 6788 | |
| 6789 | 6789 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 6790 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 6790 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 6791 | 6791 | } |
| 6792 | 6792 | |
| 6793 | 6793 | return $str; |
@@ -6878,15 +6878,15 @@ discard block |
||
| 6878 | 6878 | } |
| 6879 | 6879 | |
| 6880 | 6880 | if ($encoding === 'UTF-8') { |
| 6881 | - return (string) \mb_substr( |
|
| 6881 | + return (string)\mb_substr( |
|
| 6882 | 6882 | $str, |
| 6883 | - $offset + (int) \mb_strlen($separator) |
|
| 6883 | + $offset + (int)\mb_strlen($separator) |
|
| 6884 | 6884 | ); |
| 6885 | 6885 | } |
| 6886 | 6886 | |
| 6887 | - return (string) self::substr( |
|
| 6887 | + return (string)self::substr( |
|
| 6888 | 6888 | $str, |
| 6889 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6889 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6890 | 6890 | null, |
| 6891 | 6891 | $encoding |
| 6892 | 6892 | ); |
@@ -6918,15 +6918,15 @@ discard block |
||
| 6918 | 6918 | } |
| 6919 | 6919 | |
| 6920 | 6920 | if ($encoding === 'UTF-8') { |
| 6921 | - return (string) \mb_substr( |
|
| 6921 | + return (string)\mb_substr( |
|
| 6922 | 6922 | $str, |
| 6923 | - $offset + (int) self::strlen($separator) |
|
| 6923 | + $offset + (int)self::strlen($separator) |
|
| 6924 | 6924 | ); |
| 6925 | 6925 | } |
| 6926 | 6926 | |
| 6927 | - return (string) self::substr( |
|
| 6927 | + return (string)self::substr( |
|
| 6928 | 6928 | $str, |
| 6929 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6929 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6930 | 6930 | null, |
| 6931 | 6931 | $encoding |
| 6932 | 6932 | ); |
@@ -6958,10 +6958,10 @@ discard block |
||
| 6958 | 6958 | } |
| 6959 | 6959 | |
| 6960 | 6960 | if ($encoding === 'UTF-8') { |
| 6961 | - return (string) \mb_substr($str, 0, $offset); |
|
| 6961 | + return (string)\mb_substr($str, 0, $offset); |
|
| 6962 | 6962 | } |
| 6963 | 6963 | |
| 6964 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 6964 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 6965 | 6965 | } |
| 6966 | 6966 | |
| 6967 | 6967 | /** |
@@ -6990,7 +6990,7 @@ discard block |
||
| 6990 | 6990 | return ''; |
| 6991 | 6991 | } |
| 6992 | 6992 | |
| 6993 | - return (string) \mb_substr($str, 0, $offset); |
|
| 6993 | + return (string)\mb_substr($str, 0, $offset); |
|
| 6994 | 6994 | } |
| 6995 | 6995 | |
| 6996 | 6996 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6998,7 +6998,7 @@ discard block |
||
| 6998 | 6998 | return ''; |
| 6999 | 6999 | } |
| 7000 | 7000 | |
| 7001 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 7001 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 7002 | 7002 | } |
| 7003 | 7003 | |
| 7004 | 7004 | /** |
@@ -7100,12 +7100,12 @@ discard block |
||
| 7100 | 7100 | } |
| 7101 | 7101 | |
| 7102 | 7102 | if ($encoding === 'UTF-8') { |
| 7103 | - return (string) \mb_substr($str, -$n); |
|
| 7103 | + return (string)\mb_substr($str, -$n); |
|
| 7104 | 7104 | } |
| 7105 | 7105 | |
| 7106 | 7106 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7107 | 7107 | |
| 7108 | - return (string) self::substr($str, -$n, null, $encoding); |
|
| 7108 | + return (string)self::substr($str, -$n, null, $encoding); |
|
| 7109 | 7109 | } |
| 7110 | 7110 | |
| 7111 | 7111 | /** |
@@ -7131,21 +7131,21 @@ discard block |
||
| 7131 | 7131 | } |
| 7132 | 7132 | |
| 7133 | 7133 | if ($encoding === 'UTF-8') { |
| 7134 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 7134 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 7135 | 7135 | return $str; |
| 7136 | 7136 | } |
| 7137 | 7137 | |
| 7138 | 7138 | /** @noinspection UnnecessaryCastingInspection */ |
| 7139 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
| 7139 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
| 7140 | 7140 | } |
| 7141 | 7141 | |
| 7142 | 7142 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7143 | 7143 | |
| 7144 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 7144 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 7145 | 7145 | return $str; |
| 7146 | 7146 | } |
| 7147 | 7147 | |
| 7148 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
| 7148 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
| 7149 | 7149 | } |
| 7150 | 7150 | |
| 7151 | 7151 | /** |
@@ -7174,12 +7174,12 @@ discard block |
||
| 7174 | 7174 | |
| 7175 | 7175 | if ($encoding === 'UTF-8') { |
| 7176 | 7176 | /** @noinspection UnnecessaryCastingInspection */ |
| 7177 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 7177 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 7178 | 7178 | return $str; |
| 7179 | 7179 | } |
| 7180 | 7180 | |
| 7181 | 7181 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
| 7182 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
| 7182 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
| 7183 | 7183 | } |
| 7184 | 7184 | |
| 7185 | 7185 | $str = \mb_substr($str, 0, $length); |
@@ -7188,33 +7188,33 @@ discard block |
||
| 7188 | 7188 | $new_str = \implode(' ', $array); |
| 7189 | 7189 | |
| 7190 | 7190 | if ($new_str === '') { |
| 7191 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
| 7191 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
| 7192 | 7192 | } |
| 7193 | 7193 | } else { |
| 7194 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 7194 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 7195 | 7195 | return $str; |
| 7196 | 7196 | } |
| 7197 | 7197 | |
| 7198 | 7198 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
| 7199 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
| 7199 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
| 7200 | 7200 | } |
| 7201 | 7201 | |
| 7202 | 7202 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 7203 | 7203 | $str = self::substr($str, 0, $length, $encoding); |
| 7204 | 7204 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 7205 | 7205 | if ($str === false) { |
| 7206 | - return '' . $str_add_on; |
|
| 7206 | + return ''.$str_add_on; |
|
| 7207 | 7207 | } |
| 7208 | 7208 | |
| 7209 | 7209 | $array = \explode(' ', $str, -1); |
| 7210 | 7210 | $new_str = \implode(' ', $array); |
| 7211 | 7211 | |
| 7212 | 7212 | if ($new_str === '') { |
| 7213 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
| 7213 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
| 7214 | 7214 | } |
| 7215 | 7215 | } |
| 7216 | 7216 | |
| 7217 | - return $new_str . $str_add_on; |
|
| 7217 | + return $new_str.$str_add_on; |
|
| 7218 | 7218 | } |
| 7219 | 7219 | |
| 7220 | 7220 | /** |
@@ -7237,7 +7237,7 @@ discard block |
||
| 7237 | 7237 | $longest_common_prefix = ''; |
| 7238 | 7238 | |
| 7239 | 7239 | if ($encoding === 'UTF-8') { |
| 7240 | - $max_length = (int) \min( |
|
| 7240 | + $max_length = (int)\min( |
|
| 7241 | 7241 | \mb_strlen($str1), |
| 7242 | 7242 | \mb_strlen($str2) |
| 7243 | 7243 | ); |
@@ -7258,7 +7258,7 @@ discard block |
||
| 7258 | 7258 | } else { |
| 7259 | 7259 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7260 | 7260 | |
| 7261 | - $max_length = (int) \min( |
|
| 7261 | + $max_length = (int)\min( |
|
| 7262 | 7262 | self::strlen($str1, $encoding), |
| 7263 | 7263 | self::strlen($str2, $encoding) |
| 7264 | 7264 | ); |
@@ -7307,13 +7307,13 @@ discard block |
||
| 7307 | 7307 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
| 7308 | 7308 | |
| 7309 | 7309 | if ($encoding === 'UTF-8') { |
| 7310 | - $str_length = (int) \mb_strlen($str1); |
|
| 7311 | - $other_length = (int) \mb_strlen($str2); |
|
| 7310 | + $str_length = (int)\mb_strlen($str1); |
|
| 7311 | + $other_length = (int)\mb_strlen($str2); |
|
| 7312 | 7312 | } else { |
| 7313 | 7313 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7314 | 7314 | |
| 7315 | - $str_length = (int) self::strlen($str1, $encoding); |
|
| 7316 | - $other_length = (int) self::strlen($str2, $encoding); |
|
| 7315 | + $str_length = (int)self::strlen($str1, $encoding); |
|
| 7316 | + $other_length = (int)self::strlen($str2, $encoding); |
|
| 7317 | 7317 | } |
| 7318 | 7318 | |
| 7319 | 7319 | // Return if either string is empty |
@@ -7366,10 +7366,10 @@ discard block |
||
| 7366 | 7366 | } |
| 7367 | 7367 | |
| 7368 | 7368 | if ($encoding === 'UTF-8') { |
| 7369 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
| 7369 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
| 7370 | 7370 | } |
| 7371 | 7371 | |
| 7372 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
| 7372 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
| 7373 | 7373 | } |
| 7374 | 7374 | |
| 7375 | 7375 | /** |
@@ -7393,7 +7393,7 @@ discard block |
||
| 7393 | 7393 | } |
| 7394 | 7394 | |
| 7395 | 7395 | if ($encoding === 'UTF-8') { |
| 7396 | - $max_length = (int) \min( |
|
| 7396 | + $max_length = (int)\min( |
|
| 7397 | 7397 | \mb_strlen($str1, $encoding), |
| 7398 | 7398 | \mb_strlen($str2, $encoding) |
| 7399 | 7399 | ); |
@@ -7407,7 +7407,7 @@ discard block |
||
| 7407 | 7407 | && |
| 7408 | 7408 | $char === \mb_substr($str2, -$i, 1) |
| 7409 | 7409 | ) { |
| 7410 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
| 7410 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
| 7411 | 7411 | } else { |
| 7412 | 7412 | break; |
| 7413 | 7413 | } |
@@ -7415,7 +7415,7 @@ discard block |
||
| 7415 | 7415 | } else { |
| 7416 | 7416 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7417 | 7417 | |
| 7418 | - $max_length = (int) \min( |
|
| 7418 | + $max_length = (int)\min( |
|
| 7419 | 7419 | self::strlen($str1, $encoding), |
| 7420 | 7420 | self::strlen($str2, $encoding) |
| 7421 | 7421 | ); |
@@ -7429,7 +7429,7 @@ discard block |
||
| 7429 | 7429 | && |
| 7430 | 7430 | $char === self::substr($str2, -$i, 1, $encoding) |
| 7431 | 7431 | ) { |
| 7432 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
| 7432 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
| 7433 | 7433 | } else { |
| 7434 | 7434 | break; |
| 7435 | 7435 | } |
@@ -7451,7 +7451,7 @@ discard block |
||
| 7451 | 7451 | */ |
| 7452 | 7452 | public static function str_matches_pattern(string $str, string $pattern): bool |
| 7453 | 7453 | { |
| 7454 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
| 7454 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
| 7455 | 7455 | } |
| 7456 | 7456 | |
| 7457 | 7457 | /** |
@@ -7470,7 +7470,7 @@ discard block |
||
| 7470 | 7470 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
| 7471 | 7471 | { |
| 7472 | 7472 | // init |
| 7473 | - $length = (int) self::strlen($str, $encoding); |
|
| 7473 | + $length = (int)self::strlen($str, $encoding); |
|
| 7474 | 7474 | |
| 7475 | 7475 | if ($offset >= 0) { |
| 7476 | 7476 | return $length > $offset; |
@@ -7499,7 +7499,7 @@ discard block |
||
| 7499 | 7499 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
| 7500 | 7500 | { |
| 7501 | 7501 | // init |
| 7502 | - $length = (int) self::strlen($str); |
|
| 7502 | + $length = (int)self::strlen($str); |
|
| 7503 | 7503 | |
| 7504 | 7504 | if ( |
| 7505 | 7505 | ($index >= 0 && $length <= $index) |
@@ -7543,7 +7543,7 @@ discard block |
||
| 7543 | 7543 | return $str; |
| 7544 | 7544 | } |
| 7545 | 7545 | |
| 7546 | - if ($pad_type !== (int) $pad_type) { |
|
| 7546 | + if ($pad_type !== (int)$pad_type) { |
|
| 7547 | 7547 | if ($pad_type === 'left') { |
| 7548 | 7548 | $pad_type = \STR_PAD_LEFT; |
| 7549 | 7549 | } elseif ($pad_type === 'right') { |
@@ -7552,23 +7552,23 @@ discard block |
||
| 7552 | 7552 | $pad_type = \STR_PAD_BOTH; |
| 7553 | 7553 | } else { |
| 7554 | 7554 | throw new \InvalidArgumentException( |
| 7555 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
| 7555 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
| 7556 | 7556 | ); |
| 7557 | 7557 | } |
| 7558 | 7558 | } |
| 7559 | 7559 | |
| 7560 | 7560 | if ($encoding === 'UTF-8') { |
| 7561 | - $str_length = (int) \mb_strlen($str); |
|
| 7561 | + $str_length = (int)\mb_strlen($str); |
|
| 7562 | 7562 | |
| 7563 | 7563 | if ($pad_length >= $str_length) { |
| 7564 | 7564 | switch ($pad_type) { |
| 7565 | 7565 | case \STR_PAD_LEFT: |
| 7566 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 7566 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 7567 | 7567 | |
| 7568 | 7568 | $diff = ($pad_length - $str_length); |
| 7569 | 7569 | |
| 7570 | - $pre = (string) \mb_substr( |
|
| 7571 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7570 | + $pre = (string)\mb_substr( |
|
| 7571 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7572 | 7572 | 0, |
| 7573 | 7573 | $diff |
| 7574 | 7574 | ); |
@@ -7579,16 +7579,16 @@ discard block |
||
| 7579 | 7579 | case \STR_PAD_BOTH: |
| 7580 | 7580 | $diff = ($pad_length - $str_length); |
| 7581 | 7581 | |
| 7582 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 7582 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 7583 | 7583 | |
| 7584 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 7584 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 7585 | 7585 | |
| 7586 | - $pre = (string) \mb_substr( |
|
| 7586 | + $pre = (string)\mb_substr( |
|
| 7587 | 7587 | \str_repeat($pad_string, $ps_length_left), |
| 7588 | 7588 | 0, |
| 7589 | 7589 | $ps_length_left |
| 7590 | 7590 | ); |
| 7591 | - $post = (string) \mb_substr( |
|
| 7591 | + $post = (string)\mb_substr( |
|
| 7592 | 7592 | \str_repeat($pad_string, $ps_length_right), |
| 7593 | 7593 | 0, |
| 7594 | 7594 | $ps_length_right |
@@ -7598,19 +7598,19 @@ discard block |
||
| 7598 | 7598 | |
| 7599 | 7599 | case \STR_PAD_RIGHT: |
| 7600 | 7600 | default: |
| 7601 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 7601 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 7602 | 7602 | |
| 7603 | 7603 | $diff = ($pad_length - $str_length); |
| 7604 | 7604 | |
| 7605 | - $post = (string) \mb_substr( |
|
| 7606 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7605 | + $post = (string)\mb_substr( |
|
| 7606 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7607 | 7607 | 0, |
| 7608 | 7608 | $diff |
| 7609 | 7609 | ); |
| 7610 | 7610 | $pre = ''; |
| 7611 | 7611 | } |
| 7612 | 7612 | |
| 7613 | - return $pre . $str . $post; |
|
| 7613 | + return $pre.$str.$post; |
|
| 7614 | 7614 | } |
| 7615 | 7615 | |
| 7616 | 7616 | return $str; |
@@ -7618,17 +7618,17 @@ discard block |
||
| 7618 | 7618 | |
| 7619 | 7619 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7620 | 7620 | |
| 7621 | - $str_length = (int) self::strlen($str, $encoding); |
|
| 7621 | + $str_length = (int)self::strlen($str, $encoding); |
|
| 7622 | 7622 | |
| 7623 | 7623 | if ($pad_length >= $str_length) { |
| 7624 | 7624 | switch ($pad_type) { |
| 7625 | 7625 | case \STR_PAD_LEFT: |
| 7626 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 7626 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 7627 | 7627 | |
| 7628 | 7628 | $diff = ($pad_length - $str_length); |
| 7629 | 7629 | |
| 7630 | - $pre = (string) self::substr( |
|
| 7631 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7630 | + $pre = (string)self::substr( |
|
| 7631 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7632 | 7632 | 0, |
| 7633 | 7633 | $diff, |
| 7634 | 7634 | $encoding |
@@ -7640,17 +7640,17 @@ discard block |
||
| 7640 | 7640 | case \STR_PAD_BOTH: |
| 7641 | 7641 | $diff = ($pad_length - $str_length); |
| 7642 | 7642 | |
| 7643 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 7643 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 7644 | 7644 | |
| 7645 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 7645 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 7646 | 7646 | |
| 7647 | - $pre = (string) self::substr( |
|
| 7647 | + $pre = (string)self::substr( |
|
| 7648 | 7648 | \str_repeat($pad_string, $ps_length_left), |
| 7649 | 7649 | 0, |
| 7650 | 7650 | $ps_length_left, |
| 7651 | 7651 | $encoding |
| 7652 | 7652 | ); |
| 7653 | - $post = (string) self::substr( |
|
| 7653 | + $post = (string)self::substr( |
|
| 7654 | 7654 | \str_repeat($pad_string, $ps_length_right), |
| 7655 | 7655 | 0, |
| 7656 | 7656 | $ps_length_right, |
@@ -7661,12 +7661,12 @@ discard block |
||
| 7661 | 7661 | |
| 7662 | 7662 | case \STR_PAD_RIGHT: |
| 7663 | 7663 | default: |
| 7664 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 7664 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 7665 | 7665 | |
| 7666 | 7666 | $diff = ($pad_length - $str_length); |
| 7667 | 7667 | |
| 7668 | - $post = (string) self::substr( |
|
| 7669 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7668 | + $post = (string)self::substr( |
|
| 7669 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7670 | 7670 | 0, |
| 7671 | 7671 | $diff, |
| 7672 | 7672 | $encoding |
@@ -7674,7 +7674,7 @@ discard block |
||
| 7674 | 7674 | $pre = ''; |
| 7675 | 7675 | } |
| 7676 | 7676 | |
| 7677 | - return $pre . $str . $post; |
|
| 7677 | + return $pre.$str.$post; |
|
| 7678 | 7678 | } |
| 7679 | 7679 | |
| 7680 | 7680 | return $str; |
@@ -7882,11 +7882,11 @@ discard block |
||
| 7882 | 7882 | } |
| 7883 | 7883 | |
| 7884 | 7884 | if ($search === '') { |
| 7885 | - return $str . $replacement; |
|
| 7885 | + return $str.$replacement; |
|
| 7886 | 7886 | } |
| 7887 | 7887 | |
| 7888 | 7888 | if (\strpos($str, $search) === 0) { |
| 7889 | - return $replacement . \substr($str, \strlen($search)); |
|
| 7889 | + return $replacement.\substr($str, \strlen($search)); |
|
| 7890 | 7890 | } |
| 7891 | 7891 | |
| 7892 | 7892 | return $str; |
@@ -7920,11 +7920,11 @@ discard block |
||
| 7920 | 7920 | } |
| 7921 | 7921 | |
| 7922 | 7922 | if ($search === '') { |
| 7923 | - return $str . $replacement; |
|
| 7923 | + return $str.$replacement; |
|
| 7924 | 7924 | } |
| 7925 | 7925 | |
| 7926 | 7926 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 7927 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 7927 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 7928 | 7928 | } |
| 7929 | 7929 | |
| 7930 | 7930 | return $str; |
@@ -7958,7 +7958,7 @@ discard block |
||
| 7958 | 7958 | $subject, |
| 7959 | 7959 | $replace, |
| 7960 | 7960 | $pos, |
| 7961 | - (int) self::strlen($search) |
|
| 7961 | + (int)self::strlen($search) |
|
| 7962 | 7962 | ); |
| 7963 | 7963 | } |
| 7964 | 7964 | |
@@ -7992,7 +7992,7 @@ discard block |
||
| 7992 | 7992 | $subject, |
| 7993 | 7993 | $replace, |
| 7994 | 7994 | $pos, |
| 7995 | - (int) self::strlen($search) |
|
| 7995 | + (int)self::strlen($search) |
|
| 7996 | 7996 | ); |
| 7997 | 7997 | } |
| 7998 | 7998 | |
@@ -8015,7 +8015,7 @@ discard block |
||
| 8015 | 8015 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
| 8016 | 8016 | { |
| 8017 | 8017 | if ($encoding === 'UTF-8') { |
| 8018 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
| 8018 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
| 8019 | 8019 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 8020 | 8020 | \shuffle($indexes); |
| 8021 | 8021 | |
@@ -8031,7 +8031,7 @@ discard block |
||
| 8031 | 8031 | } else { |
| 8032 | 8032 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8033 | 8033 | |
| 8034 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
| 8034 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
| 8035 | 8035 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 8036 | 8036 | \shuffle($indexes); |
| 8037 | 8037 | |
@@ -8074,11 +8074,11 @@ discard block |
||
| 8074 | 8074 | ) { |
| 8075 | 8075 | if ($encoding === 'UTF-8') { |
| 8076 | 8076 | if ($end === null) { |
| 8077 | - $length = (int) \mb_strlen($str); |
|
| 8077 | + $length = (int)\mb_strlen($str); |
|
| 8078 | 8078 | } elseif ($end >= 0 && $end <= $start) { |
| 8079 | 8079 | return ''; |
| 8080 | 8080 | } elseif ($end < 0) { |
| 8081 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
| 8081 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
| 8082 | 8082 | } else { |
| 8083 | 8083 | $length = $end - $start; |
| 8084 | 8084 | } |
@@ -8089,11 +8089,11 @@ discard block |
||
| 8089 | 8089 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8090 | 8090 | |
| 8091 | 8091 | if ($end === null) { |
| 8092 | - $length = (int) self::strlen($str, $encoding); |
|
| 8092 | + $length = (int)self::strlen($str, $encoding); |
|
| 8093 | 8093 | } elseif ($end >= 0 && $end <= $start) { |
| 8094 | 8094 | return ''; |
| 8095 | 8095 | } elseif ($end < 0) { |
| 8096 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
| 8096 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
| 8097 | 8097 | } else { |
| 8098 | 8098 | $length = $end - $start; |
| 8099 | 8099 | } |
@@ -8128,7 +8128,7 @@ discard block |
||
| 8128 | 8128 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8129 | 8129 | } |
| 8130 | 8130 | |
| 8131 | - $str = (string) \preg_replace_callback( |
|
| 8131 | + $str = (string)\preg_replace_callback( |
|
| 8132 | 8132 | '/([\\p{N}|\\p{Lu}])/u', |
| 8133 | 8133 | /** |
| 8134 | 8134 | * @param string[] $matches |
@@ -8137,28 +8137,28 @@ discard block |
||
| 8137 | 8137 | * |
| 8138 | 8138 | * @return string |
| 8139 | 8139 | */ |
| 8140 | - static function (array $matches) use ($encoding): string { |
|
| 8140 | + static function(array $matches) use ($encoding): string { |
|
| 8141 | 8141 | $match = $matches[1]; |
| 8142 | - $match_int = (int) $match; |
|
| 8142 | + $match_int = (int)$match; |
|
| 8143 | 8143 | |
| 8144 | - if ((string) $match_int === $match) { |
|
| 8145 | - return '_' . $match . '_'; |
|
| 8144 | + if ((string)$match_int === $match) { |
|
| 8145 | + return '_'.$match.'_'; |
|
| 8146 | 8146 | } |
| 8147 | 8147 | |
| 8148 | 8148 | if ($encoding === 'UTF-8') { |
| 8149 | - return '_' . \mb_strtolower($match); |
|
| 8149 | + return '_'.\mb_strtolower($match); |
|
| 8150 | 8150 | } |
| 8151 | 8151 | |
| 8152 | - return '_' . self::strtolower($match, $encoding); |
|
| 8152 | + return '_'.self::strtolower($match, $encoding); |
|
| 8153 | 8153 | }, |
| 8154 | 8154 | $str |
| 8155 | 8155 | ); |
| 8156 | 8156 | |
| 8157 | - $str = (string) \preg_replace( |
|
| 8157 | + $str = (string)\preg_replace( |
|
| 8158 | 8158 | [ |
| 8159 | - '/\\s+/u', // convert spaces to "_" |
|
| 8159 | + '/\\s+/u', // convert spaces to "_" |
|
| 8160 | 8160 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
| 8161 | - '/_+/', // remove double "_" |
|
| 8161 | + '/_+/', // remove double "_" |
|
| 8162 | 8162 | ], |
| 8163 | 8163 | [ |
| 8164 | 8164 | '_', |
@@ -8289,7 +8289,7 @@ discard block |
||
| 8289 | 8289 | } |
| 8290 | 8290 | |
| 8291 | 8291 | // init |
| 8292 | - $input = (string) $input; |
|
| 8292 | + $input = (string)$input; |
|
| 8293 | 8293 | |
| 8294 | 8294 | if ($input === '') { |
| 8295 | 8295 | return []; |
@@ -8346,7 +8346,7 @@ discard block |
||
| 8346 | 8346 | ($input[$i] & "\xE0") === "\xC0" |
| 8347 | 8347 | ) { |
| 8348 | 8348 | if (($input[$i + 1] & "\xC0") === "\x80") { |
| 8349 | - $ret[] = $input[$i] . $input[$i + 1]; |
|
| 8349 | + $ret[] = $input[$i].$input[$i + 1]; |
|
| 8350 | 8350 | |
| 8351 | 8351 | ++$i; |
| 8352 | 8352 | } |
@@ -8360,7 +8360,7 @@ discard block |
||
| 8360 | 8360 | && |
| 8361 | 8361 | ($input[$i + 2] & "\xC0") === "\x80" |
| 8362 | 8362 | ) { |
| 8363 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2]; |
|
| 8363 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2]; |
|
| 8364 | 8364 | |
| 8365 | 8365 | $i += 2; |
| 8366 | 8366 | } |
@@ -8376,7 +8376,7 @@ discard block |
||
| 8376 | 8376 | && |
| 8377 | 8377 | ($input[$i + 3] & "\xC0") === "\x80" |
| 8378 | 8378 | ) { |
| 8379 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2] . $input[$i + 3]; |
|
| 8379 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2].$input[$i + 3]; |
|
| 8380 | 8380 | |
| 8381 | 8381 | $i += 3; |
| 8382 | 8382 | } |
@@ -8388,7 +8388,7 @@ discard block |
||
| 8388 | 8388 | $ret = \array_chunk($ret, $length); |
| 8389 | 8389 | |
| 8390 | 8390 | return \array_map( |
| 8391 | - static function (array &$item): string { |
|
| 8391 | + static function(array &$item): string { |
|
| 8392 | 8392 | return \implode('', $item); |
| 8393 | 8393 | }, |
| 8394 | 8394 | $ret |
@@ -8454,7 +8454,7 @@ discard block |
||
| 8454 | 8454 | $limit = -1; |
| 8455 | 8455 | } |
| 8456 | 8456 | |
| 8457 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
| 8457 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
| 8458 | 8458 | |
| 8459 | 8459 | if ($array === false) { |
| 8460 | 8460 | return []; |
@@ -8549,9 +8549,9 @@ discard block |
||
| 8549 | 8549 | return ''; |
| 8550 | 8550 | } |
| 8551 | 8551 | |
| 8552 | - return (string) \mb_substr( |
|
| 8552 | + return (string)\mb_substr( |
|
| 8553 | 8553 | $str, |
| 8554 | - $offset + (int) \mb_strlen($separator) |
|
| 8554 | + $offset + (int)\mb_strlen($separator) |
|
| 8555 | 8555 | ); |
| 8556 | 8556 | } |
| 8557 | 8557 | |
@@ -8560,9 +8560,9 @@ discard block |
||
| 8560 | 8560 | return ''; |
| 8561 | 8561 | } |
| 8562 | 8562 | |
| 8563 | - return (string) \mb_substr( |
|
| 8563 | + return (string)\mb_substr( |
|
| 8564 | 8564 | $str, |
| 8565 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 8565 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 8566 | 8566 | null, |
| 8567 | 8567 | $encoding |
| 8568 | 8568 | ); |
@@ -8591,9 +8591,9 @@ discard block |
||
| 8591 | 8591 | return ''; |
| 8592 | 8592 | } |
| 8593 | 8593 | |
| 8594 | - return (string) \mb_substr( |
|
| 8594 | + return (string)\mb_substr( |
|
| 8595 | 8595 | $str, |
| 8596 | - $offset + (int) \mb_strlen($separator) |
|
| 8596 | + $offset + (int)\mb_strlen($separator) |
|
| 8597 | 8597 | ); |
| 8598 | 8598 | } |
| 8599 | 8599 | |
@@ -8602,9 +8602,9 @@ discard block |
||
| 8602 | 8602 | return ''; |
| 8603 | 8603 | } |
| 8604 | 8604 | |
| 8605 | - return (string) self::substr( |
|
| 8605 | + return (string)self::substr( |
|
| 8606 | 8606 | $str, |
| 8607 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 8607 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 8608 | 8608 | null, |
| 8609 | 8609 | $encoding |
| 8610 | 8610 | ); |
@@ -8636,7 +8636,7 @@ discard block |
||
| 8636 | 8636 | return ''; |
| 8637 | 8637 | } |
| 8638 | 8638 | |
| 8639 | - return (string) \mb_substr( |
|
| 8639 | + return (string)\mb_substr( |
|
| 8640 | 8640 | $str, |
| 8641 | 8641 | 0, |
| 8642 | 8642 | $offset |
@@ -8648,7 +8648,7 @@ discard block |
||
| 8648 | 8648 | return ''; |
| 8649 | 8649 | } |
| 8650 | 8650 | |
| 8651 | - return (string) self::substr( |
|
| 8651 | + return (string)self::substr( |
|
| 8652 | 8652 | $str, |
| 8653 | 8653 | 0, |
| 8654 | 8654 | $offset, |
@@ -8679,7 +8679,7 @@ discard block |
||
| 8679 | 8679 | return ''; |
| 8680 | 8680 | } |
| 8681 | 8681 | |
| 8682 | - return (string) \mb_substr( |
|
| 8682 | + return (string)\mb_substr( |
|
| 8683 | 8683 | $str, |
| 8684 | 8684 | 0, |
| 8685 | 8685 | $offset |
@@ -8693,7 +8693,7 @@ discard block |
||
| 8693 | 8693 | |
| 8694 | 8694 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8695 | 8695 | |
| 8696 | - return (string) self::substr( |
|
| 8696 | + return (string)self::substr( |
|
| 8697 | 8697 | $str, |
| 8698 | 8698 | 0, |
| 8699 | 8699 | $offset, |
@@ -8808,7 +8808,7 @@ discard block |
||
| 8808 | 8808 | */ |
| 8809 | 8809 | public static function str_surround(string $str, string $substring): string |
| 8810 | 8810 | { |
| 8811 | - return $substring . $str . $substring; |
|
| 8811 | + return $substring.$str.$substring; |
|
| 8812 | 8812 | } |
| 8813 | 8813 | |
| 8814 | 8814 | /** |
@@ -8872,9 +8872,9 @@ discard block |
||
| 8872 | 8872 | $word_define_chars = ''; |
| 8873 | 8873 | } |
| 8874 | 8874 | |
| 8875 | - $str = (string) \preg_replace_callback( |
|
| 8876 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
| 8877 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
| 8875 | + $str = (string)\preg_replace_callback( |
|
| 8876 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
| 8877 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
| 8878 | 8878 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
| 8879 | 8879 | return $match[0]; |
| 8880 | 8880 | } |
@@ -8974,16 +8974,16 @@ discard block |
||
| 8974 | 8974 | |
| 8975 | 8975 | // the main substitutions |
| 8976 | 8976 | /** @noinspection RegExpDuplicateAlternationBranch - false-positive - https://youtrack.jetbrains.com/issue/WI-51002 */ |
| 8977 | - $str = (string) \preg_replace_callback( |
|
| 8977 | + $str = (string)\preg_replace_callback( |
|
| 8978 | 8978 | '~\\b (_*) (?: # 1. Leading underscore and |
| 8979 | 8979 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
| 8980 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
| 8980 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
| 8981 | 8981 | | |
| 8982 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
| 8982 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
| 8983 | 8983 | | |
| 8984 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
| 8984 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
| 8985 | 8985 | | |
| 8986 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
| 8986 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
| 8987 | 8987 | ) (_*) \\b # 6. With trailing underscore |
| 8988 | 8988 | ~ux', |
| 8989 | 8989 | /** |
@@ -8993,7 +8993,7 @@ discard block |
||
| 8993 | 8993 | * |
| 8994 | 8994 | * @return string |
| 8995 | 8995 | */ |
| 8996 | - static function (array $matches) use ($encoding): string { |
|
| 8996 | + static function(array $matches) use ($encoding): string { |
|
| 8997 | 8997 | // preserve leading underscore |
| 8998 | 8998 | $str = $matches[1]; |
| 8999 | 8999 | if ($matches[2]) { |
@@ -9018,11 +9018,11 @@ discard block |
||
| 9018 | 9018 | ); |
| 9019 | 9019 | |
| 9020 | 9020 | // Exceptions for small words: capitalize at start of title... |
| 9021 | - $str = (string) \preg_replace_callback( |
|
| 9021 | + $str = (string)\preg_replace_callback( |
|
| 9022 | 9022 | '~( \\A [[:punct:]]* # start of title... |
| 9023 | 9023 | | [:.;?!][ ]+ # or of subsentence... |
| 9024 | 9024 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
| 9025 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
| 9025 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
| 9026 | 9026 | ~uxi', |
| 9027 | 9027 | /** |
| 9028 | 9028 | * @param string[] $matches |
@@ -9031,15 +9031,15 @@ discard block |
||
| 9031 | 9031 | * |
| 9032 | 9032 | * @return string |
| 9033 | 9033 | */ |
| 9034 | - static function (array $matches) use ($encoding): string { |
|
| 9035 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
| 9034 | + static function(array $matches) use ($encoding): string { |
|
| 9035 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
| 9036 | 9036 | }, |
| 9037 | 9037 | $str |
| 9038 | 9038 | ); |
| 9039 | 9039 | |
| 9040 | 9040 | // ...and end of title |
| 9041 | - $str = (string) \preg_replace_callback( |
|
| 9042 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
| 9041 | + $str = (string)\preg_replace_callback( |
|
| 9042 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
| 9043 | 9043 | (?= [[:punct:]]* \Z # ...at the end of the title... |
| 9044 | 9044 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
| 9045 | 9045 | ~uxi', |
@@ -9050,7 +9050,7 @@ discard block |
||
| 9050 | 9050 | * |
| 9051 | 9051 | * @return string |
| 9052 | 9052 | */ |
| 9053 | - static function (array $matches) use ($encoding): string { |
|
| 9053 | + static function(array $matches) use ($encoding): string { |
|
| 9054 | 9054 | return static::ucfirst($matches[1], $encoding); |
| 9055 | 9055 | }, |
| 9056 | 9056 | $str |
@@ -9058,10 +9058,10 @@ discard block |
||
| 9058 | 9058 | |
| 9059 | 9059 | // Exceptions for small words in hyphenated compound words. |
| 9060 | 9060 | // e.g. "in-flight" -> In-Flight |
| 9061 | - $str = (string) \preg_replace_callback( |
|
| 9061 | + $str = (string)\preg_replace_callback( |
|
| 9062 | 9062 | '~\\b |
| 9063 | 9063 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
| 9064 | - ( ' . $small_words_rx . ' ) |
|
| 9064 | + ( ' . $small_words_rx.' ) |
|
| 9065 | 9065 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
| 9066 | 9066 | ~uxi', |
| 9067 | 9067 | /** |
@@ -9071,18 +9071,18 @@ discard block |
||
| 9071 | 9071 | * |
| 9072 | 9072 | * @return string |
| 9073 | 9073 | */ |
| 9074 | - static function (array $matches) use ($encoding): string { |
|
| 9074 | + static function(array $matches) use ($encoding): string { |
|
| 9075 | 9075 | return static::ucfirst($matches[1], $encoding); |
| 9076 | 9076 | }, |
| 9077 | 9077 | $str |
| 9078 | 9078 | ); |
| 9079 | 9079 | |
| 9080 | 9080 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
| 9081 | - $str = (string) \preg_replace_callback( |
|
| 9081 | + $str = (string)\preg_replace_callback( |
|
| 9082 | 9082 | '~\\b |
| 9083 | 9083 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
| 9084 | 9084 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
| 9085 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
| 9085 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
| 9086 | 9086 | (?! - ) # Negative lookahead for another - |
| 9087 | 9087 | ~uxi', |
| 9088 | 9088 | /** |
@@ -9092,8 +9092,8 @@ discard block |
||
| 9092 | 9092 | * |
| 9093 | 9093 | * @return string |
| 9094 | 9094 | */ |
| 9095 | - static function (array $matches) use ($encoding): string { |
|
| 9096 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
| 9095 | + static function(array $matches) use ($encoding): string { |
|
| 9096 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
| 9097 | 9097 | }, |
| 9098 | 9098 | $str |
| 9099 | 9099 | ); |
@@ -9212,7 +9212,7 @@ discard block |
||
| 9212 | 9212 | ); |
| 9213 | 9213 | |
| 9214 | 9214 | foreach ($tmp_return as &$item) { |
| 9215 | - $item = (string) $item; |
|
| 9215 | + $item = (string)$item; |
|
| 9216 | 9216 | } |
| 9217 | 9217 | |
| 9218 | 9218 | return $tmp_return; |
@@ -9266,39 +9266,39 @@ discard block |
||
| 9266 | 9266 | } |
| 9267 | 9267 | |
| 9268 | 9268 | if ($encoding === 'UTF-8') { |
| 9269 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 9269 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 9270 | 9270 | return $str; |
| 9271 | 9271 | } |
| 9272 | 9272 | |
| 9273 | 9273 | if ($substring !== '') { |
| 9274 | - $length -= (int) \mb_strlen($substring); |
|
| 9274 | + $length -= (int)\mb_strlen($substring); |
|
| 9275 | 9275 | |
| 9276 | 9276 | /** @noinspection UnnecessaryCastingInspection */ |
| 9277 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
| 9277 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
| 9278 | 9278 | } |
| 9279 | 9279 | |
| 9280 | 9280 | /** @noinspection UnnecessaryCastingInspection */ |
| 9281 | - return (string) \mb_substr($str, 0, $length); |
|
| 9281 | + return (string)\mb_substr($str, 0, $length); |
|
| 9282 | 9282 | } |
| 9283 | 9283 | |
| 9284 | 9284 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 9285 | 9285 | |
| 9286 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 9286 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 9287 | 9287 | return $str; |
| 9288 | 9288 | } |
| 9289 | 9289 | |
| 9290 | 9290 | if ($substring !== '') { |
| 9291 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 9291 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 9292 | 9292 | } |
| 9293 | 9293 | |
| 9294 | 9294 | return ( |
| 9295 | - (string) self::substr( |
|
| 9295 | + (string)self::substr( |
|
| 9296 | 9296 | $str, |
| 9297 | 9297 | 0, |
| 9298 | 9298 | $length, |
| 9299 | 9299 | $encoding |
| 9300 | 9300 | ) |
| 9301 | - ) . $substring; |
|
| 9301 | + ).$substring; |
|
| 9302 | 9302 | } |
| 9303 | 9303 | |
| 9304 | 9304 | /** |
@@ -9332,12 +9332,12 @@ discard block |
||
| 9332 | 9332 | } |
| 9333 | 9333 | |
| 9334 | 9334 | if ($encoding === 'UTF-8') { |
| 9335 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 9335 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 9336 | 9336 | return $str; |
| 9337 | 9337 | } |
| 9338 | 9338 | |
| 9339 | 9339 | // need to further trim the string so we can append the substring |
| 9340 | - $length -= (int) \mb_strlen($substring); |
|
| 9340 | + $length -= (int)\mb_strlen($substring); |
|
| 9341 | 9341 | if ($length <= 0) { |
| 9342 | 9342 | return $substring; |
| 9343 | 9343 | } |
@@ -9363,18 +9363,18 @@ discard block |
||
| 9363 | 9363 | !$ignore_do_not_split_words_for_one_word |
| 9364 | 9364 | ) |
| 9365 | 9365 | ) { |
| 9366 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
| 9366 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
| 9367 | 9367 | } |
| 9368 | 9368 | } |
| 9369 | 9369 | } else { |
| 9370 | 9370 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 9371 | 9371 | |
| 9372 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 9372 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 9373 | 9373 | return $str; |
| 9374 | 9374 | } |
| 9375 | 9375 | |
| 9376 | 9376 | // need to further trim the string so we can append the substring |
| 9377 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 9377 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 9378 | 9378 | if ($length <= 0) { |
| 9379 | 9379 | return $substring; |
| 9380 | 9380 | } |
@@ -9400,12 +9400,12 @@ discard block |
||
| 9400 | 9400 | !$ignore_do_not_split_words_for_one_word |
| 9401 | 9401 | ) |
| 9402 | 9402 | ) { |
| 9403 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
| 9403 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
| 9404 | 9404 | } |
| 9405 | 9405 | } |
| 9406 | 9406 | } |
| 9407 | 9407 | |
| 9408 | - return $truncated . $substring; |
|
| 9408 | + return $truncated.$substring; |
|
| 9409 | 9409 | } |
| 9410 | 9410 | |
| 9411 | 9411 | /** |
@@ -9532,13 +9532,13 @@ discard block |
||
| 9532 | 9532 | } |
| 9533 | 9533 | } elseif ($format === 2) { |
| 9534 | 9534 | $number_of_words = []; |
| 9535 | - $offset = (int) self::strlen($str_parts[0]); |
|
| 9535 | + $offset = (int)self::strlen($str_parts[0]); |
|
| 9536 | 9536 | for ($i = 1; $i < $len; $i += 2) { |
| 9537 | 9537 | $number_of_words[$offset] = $str_parts[$i]; |
| 9538 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
| 9538 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
| 9539 | 9539 | } |
| 9540 | 9540 | } else { |
| 9541 | - $number_of_words = (int) (($len - 1) / 2); |
|
| 9541 | + $number_of_words = (int)(($len - 1) / 2); |
|
| 9542 | 9542 | } |
| 9543 | 9543 | |
| 9544 | 9544 | return $number_of_words; |
@@ -9671,21 +9671,21 @@ discard block |
||
| 9671 | 9671 | } |
| 9672 | 9672 | |
| 9673 | 9673 | if ($char_list === '') { |
| 9674 | - return (int) self::strlen($str, $encoding); |
|
| 9674 | + return (int)self::strlen($str, $encoding); |
|
| 9675 | 9675 | } |
| 9676 | 9676 | |
| 9677 | 9677 | if ($offset !== null || $length !== null) { |
| 9678 | 9678 | if ($encoding === 'UTF-8') { |
| 9679 | 9679 | if ($length === null) { |
| 9680 | 9680 | /** @noinspection UnnecessaryCastingInspection */ |
| 9681 | - $str_tmp = \mb_substr($str, (int) $offset); |
|
| 9681 | + $str_tmp = \mb_substr($str, (int)$offset); |
|
| 9682 | 9682 | } else { |
| 9683 | 9683 | /** @noinspection UnnecessaryCastingInspection */ |
| 9684 | - $str_tmp = \mb_substr($str, (int) $offset, $length); |
|
| 9684 | + $str_tmp = \mb_substr($str, (int)$offset, $length); |
|
| 9685 | 9685 | } |
| 9686 | 9686 | } else { |
| 9687 | 9687 | /** @noinspection UnnecessaryCastingInspection */ |
| 9688 | - $str_tmp = self::substr($str, (int) $offset, $length, $encoding); |
|
| 9688 | + $str_tmp = self::substr($str, (int)$offset, $length, $encoding); |
|
| 9689 | 9689 | } |
| 9690 | 9690 | |
| 9691 | 9691 | if ($str_tmp === false) { |
@@ -9701,7 +9701,7 @@ discard block |
||
| 9701 | 9701 | } |
| 9702 | 9702 | |
| 9703 | 9703 | $matches = []; |
| 9704 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
| 9704 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
| 9705 | 9705 | $return = self::strlen($matches[1], $encoding); |
| 9706 | 9706 | if ($return === false) { |
| 9707 | 9707 | return 0; |
@@ -9710,7 +9710,7 @@ discard block |
||
| 9710 | 9710 | return $return; |
| 9711 | 9711 | } |
| 9712 | 9712 | |
| 9713 | - return (int) self::strlen($str, $encoding); |
|
| 9713 | + return (int)self::strlen($str, $encoding); |
|
| 9714 | 9714 | } |
| 9715 | 9715 | |
| 9716 | 9716 | /** |
@@ -9773,7 +9773,7 @@ discard block |
||
| 9773 | 9773 | |
| 9774 | 9774 | $str = ''; |
| 9775 | 9775 | foreach ($intOrHex as $strPart) { |
| 9776 | - $str .= '&#' . (int) $strPart . ';'; |
|
| 9776 | + $str .= '&#'.(int)$strPart.';'; |
|
| 9777 | 9777 | } |
| 9778 | 9778 | |
| 9779 | 9779 | return self::html_entity_decode($str, \ENT_QUOTES | \ENT_HTML5); |
@@ -9868,7 +9868,7 @@ discard block |
||
| 9868 | 9868 | return ''; |
| 9869 | 9869 | } |
| 9870 | 9870 | |
| 9871 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
| 9871 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
| 9872 | 9872 | } |
| 9873 | 9873 | |
| 9874 | 9874 | /** |
@@ -9939,7 +9939,7 @@ discard block |
||
| 9939 | 9939 | // fallback for ascii only |
| 9940 | 9940 | // |
| 9941 | 9941 | |
| 9942 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 9942 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 9943 | 9943 | return \stripos($haystack, $needle, $offset); |
| 9944 | 9944 | } |
| 9945 | 9945 | |
@@ -10020,7 +10020,7 @@ discard block |
||
| 10020 | 10020 | /** |
| 10021 | 10021 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10022 | 10022 | */ |
| 10023 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10023 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10024 | 10024 | } |
| 10025 | 10025 | |
| 10026 | 10026 | if ( |
@@ -10034,11 +10034,11 @@ discard block |
||
| 10034 | 10034 | } |
| 10035 | 10035 | } |
| 10036 | 10036 | |
| 10037 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
| 10037 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
| 10038 | 10038 | return \stristr($haystack, $needle, $before_needle); |
| 10039 | 10039 | } |
| 10040 | 10040 | |
| 10041 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
| 10041 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
| 10042 | 10042 | |
| 10043 | 10043 | if (!isset($match[1])) { |
| 10044 | 10044 | return false; |
@@ -10048,7 +10048,7 @@ discard block |
||
| 10048 | 10048 | return $match[1]; |
| 10049 | 10049 | } |
| 10050 | 10050 | |
| 10051 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
| 10051 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
| 10052 | 10052 | } |
| 10053 | 10053 | |
| 10054 | 10054 | /** |
@@ -10131,7 +10131,7 @@ discard block |
||
| 10131 | 10131 | /** |
| 10132 | 10132 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10133 | 10133 | */ |
| 10134 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10134 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10135 | 10135 | } |
| 10136 | 10136 | |
| 10137 | 10137 | // |
@@ -10269,8 +10269,8 @@ discard block |
||
| 10269 | 10269 | } |
| 10270 | 10270 | |
| 10271 | 10271 | return \strnatcmp( |
| 10272 | - (string) self::strtonatfold($str1), |
|
| 10273 | - (string) self::strtonatfold($str2) |
|
| 10272 | + (string)self::strtonatfold($str1), |
|
| 10273 | + (string)self::strtonatfold($str2) |
|
| 10274 | 10274 | ); |
| 10275 | 10275 | } |
| 10276 | 10276 | |
@@ -10340,11 +10340,11 @@ discard block |
||
| 10340 | 10340 | } |
| 10341 | 10341 | |
| 10342 | 10342 | if ($encoding === 'UTF-8') { |
| 10343 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
| 10344 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
| 10343 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
| 10344 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
| 10345 | 10345 | } else { |
| 10346 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
| 10347 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
| 10346 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
| 10347 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
| 10348 | 10348 | } |
| 10349 | 10349 | |
| 10350 | 10350 | return self::strcmp($str1, $str2); |
@@ -10371,8 +10371,8 @@ discard block |
||
| 10371 | 10371 | return false; |
| 10372 | 10372 | } |
| 10373 | 10373 | |
| 10374 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
| 10375 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
| 10374 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
| 10375 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
| 10376 | 10376 | } |
| 10377 | 10377 | |
| 10378 | 10378 | return false; |
@@ -10411,10 +10411,10 @@ discard block |
||
| 10411 | 10411 | } |
| 10412 | 10412 | |
| 10413 | 10413 | // iconv and mbstring do not support integer $needle |
| 10414 | - if ((int) $needle === $needle) { |
|
| 10415 | - $needle = (string) self::chr($needle); |
|
| 10414 | + if ((int)$needle === $needle) { |
|
| 10415 | + $needle = (string)self::chr($needle); |
|
| 10416 | 10416 | } |
| 10417 | - $needle = (string) $needle; |
|
| 10417 | + $needle = (string)$needle; |
|
| 10418 | 10418 | |
| 10419 | 10419 | if ($needle === '') { |
| 10420 | 10420 | return false; |
@@ -10466,7 +10466,7 @@ discard block |
||
| 10466 | 10466 | /** |
| 10467 | 10467 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10468 | 10468 | */ |
| 10469 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10469 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10470 | 10470 | } |
| 10471 | 10471 | |
| 10472 | 10472 | // |
@@ -10507,7 +10507,7 @@ discard block |
||
| 10507 | 10507 | // fallback for ascii only |
| 10508 | 10508 | // |
| 10509 | 10509 | |
| 10510 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10510 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10511 | 10511 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Offset not contained in string */ |
| 10512 | 10512 | return @\strpos($haystack, $needle, $offset); |
| 10513 | 10513 | } |
@@ -10520,7 +10520,7 @@ discard block |
||
| 10520 | 10520 | if ($haystack_tmp === false) { |
| 10521 | 10521 | $haystack_tmp = ''; |
| 10522 | 10522 | } |
| 10523 | - $haystack = (string) $haystack_tmp; |
|
| 10523 | + $haystack = (string)$haystack_tmp; |
|
| 10524 | 10524 | |
| 10525 | 10525 | if ($offset < 0) { |
| 10526 | 10526 | $offset = 0; |
@@ -10532,7 +10532,7 @@ discard block |
||
| 10532 | 10532 | } |
| 10533 | 10533 | |
| 10534 | 10534 | if ($pos) { |
| 10535 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 10535 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 10536 | 10536 | } |
| 10537 | 10537 | |
| 10538 | 10538 | return $offset + 0; |
@@ -10687,7 +10687,7 @@ discard block |
||
| 10687 | 10687 | /** |
| 10688 | 10688 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10689 | 10689 | */ |
| 10690 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10690 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10691 | 10691 | } |
| 10692 | 10692 | |
| 10693 | 10693 | // |
@@ -10699,7 +10699,7 @@ discard block |
||
| 10699 | 10699 | if ($needle_tmp === false) { |
| 10700 | 10700 | return false; |
| 10701 | 10701 | } |
| 10702 | - $needle = (string) $needle_tmp; |
|
| 10702 | + $needle = (string)$needle_tmp; |
|
| 10703 | 10703 | |
| 10704 | 10704 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
| 10705 | 10705 | if ($pos === false) { |
@@ -10721,7 +10721,7 @@ discard block |
||
| 10721 | 10721 | if ($needle_tmp === false) { |
| 10722 | 10722 | return false; |
| 10723 | 10723 | } |
| 10724 | - $needle = (string) $needle_tmp; |
|
| 10724 | + $needle = (string)$needle_tmp; |
|
| 10725 | 10725 | |
| 10726 | 10726 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
| 10727 | 10727 | if ($pos === false) { |
@@ -10762,7 +10762,7 @@ discard block |
||
| 10762 | 10762 | if ($encoding === 'UTF-8') { |
| 10763 | 10763 | if (self::$SUPPORT['intl'] === true) { |
| 10764 | 10764 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
| 10765 | - $i = (int) \grapheme_strlen($str); |
|
| 10765 | + $i = (int)\grapheme_strlen($str); |
|
| 10766 | 10766 | while ($i--) { |
| 10767 | 10767 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
| 10768 | 10768 | if ($reversed_tmp !== false) { |
@@ -10770,7 +10770,7 @@ discard block |
||
| 10770 | 10770 | } |
| 10771 | 10771 | } |
| 10772 | 10772 | } else { |
| 10773 | - $i = (int) \mb_strlen($str); |
|
| 10773 | + $i = (int)\mb_strlen($str); |
|
| 10774 | 10774 | while ($i--) { |
| 10775 | 10775 | $reversed_tmp = \mb_substr($str, $i, 1); |
| 10776 | 10776 | if ($reversed_tmp !== false) { |
@@ -10781,7 +10781,7 @@ discard block |
||
| 10781 | 10781 | } else { |
| 10782 | 10782 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 10783 | 10783 | |
| 10784 | - $i = (int) self::strlen($str, $encoding); |
|
| 10784 | + $i = (int)self::strlen($str, $encoding); |
|
| 10785 | 10785 | while ($i--) { |
| 10786 | 10786 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
| 10787 | 10787 | if ($reversed_tmp !== false) { |
@@ -10860,7 +10860,7 @@ discard block |
||
| 10860 | 10860 | if ($needle_tmp === false) { |
| 10861 | 10861 | return false; |
| 10862 | 10862 | } |
| 10863 | - $needle = (string) $needle_tmp; |
|
| 10863 | + $needle = (string)$needle_tmp; |
|
| 10864 | 10864 | |
| 10865 | 10865 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
| 10866 | 10866 | if ($pos === false) { |
@@ -10903,10 +10903,10 @@ discard block |
||
| 10903 | 10903 | } |
| 10904 | 10904 | |
| 10905 | 10905 | // iconv and mbstring do not support integer $needle |
| 10906 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 10907 | - $needle = (string) self::chr($needle); |
|
| 10906 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 10907 | + $needle = (string)self::chr($needle); |
|
| 10908 | 10908 | } |
| 10909 | - $needle = (string) $needle; |
|
| 10909 | + $needle = (string)$needle; |
|
| 10910 | 10910 | |
| 10911 | 10911 | if ($needle === '') { |
| 10912 | 10912 | return false; |
@@ -10954,7 +10954,7 @@ discard block |
||
| 10954 | 10954 | /** |
| 10955 | 10955 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10956 | 10956 | */ |
| 10957 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10957 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10958 | 10958 | } |
| 10959 | 10959 | |
| 10960 | 10960 | // |
@@ -10978,7 +10978,7 @@ discard block |
||
| 10978 | 10978 | // fallback for ascii only |
| 10979 | 10979 | // |
| 10980 | 10980 | |
| 10981 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10981 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10982 | 10982 | return \strripos($haystack, $needle, $offset); |
| 10983 | 10983 | } |
| 10984 | 10984 | |
@@ -11061,10 +11061,10 @@ discard block |
||
| 11061 | 11061 | } |
| 11062 | 11062 | |
| 11063 | 11063 | // iconv and mbstring do not support integer $needle |
| 11064 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 11065 | - $needle = (string) self::chr($needle); |
|
| 11064 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 11065 | + $needle = (string)self::chr($needle); |
|
| 11066 | 11066 | } |
| 11067 | - $needle = (string) $needle; |
|
| 11067 | + $needle = (string)$needle; |
|
| 11068 | 11068 | |
| 11069 | 11069 | if ($needle === '') { |
| 11070 | 11070 | return false; |
@@ -11112,7 +11112,7 @@ discard block |
||
| 11112 | 11112 | /** |
| 11113 | 11113 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11114 | 11114 | */ |
| 11115 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11115 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11116 | 11116 | } |
| 11117 | 11117 | |
| 11118 | 11118 | // |
@@ -11136,7 +11136,7 @@ discard block |
||
| 11136 | 11136 | // fallback for ascii only |
| 11137 | 11137 | // |
| 11138 | 11138 | |
| 11139 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 11139 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 11140 | 11140 | return \strrpos($haystack, $needle, $offset); |
| 11141 | 11141 | } |
| 11142 | 11142 | |
@@ -11156,7 +11156,7 @@ discard block |
||
| 11156 | 11156 | if ($haystack_tmp === false) { |
| 11157 | 11157 | $haystack_tmp = ''; |
| 11158 | 11158 | } |
| 11159 | - $haystack = (string) $haystack_tmp; |
|
| 11159 | + $haystack = (string)$haystack_tmp; |
|
| 11160 | 11160 | } |
| 11161 | 11161 | |
| 11162 | 11162 | $pos = \strrpos($haystack, $needle); |
@@ -11170,7 +11170,7 @@ discard block |
||
| 11170 | 11170 | return false; |
| 11171 | 11171 | } |
| 11172 | 11172 | |
| 11173 | - return $offset + (int) self::strlen($str_tmp); |
|
| 11173 | + return $offset + (int)self::strlen($str_tmp); |
|
| 11174 | 11174 | } |
| 11175 | 11175 | |
| 11176 | 11176 | /** |
@@ -11238,12 +11238,12 @@ discard block |
||
| 11238 | 11238 | if ($offset || $length !== null) { |
| 11239 | 11239 | if ($encoding === 'UTF-8') { |
| 11240 | 11240 | if ($length === null) { |
| 11241 | - $str = (string) \mb_substr($str, $offset); |
|
| 11241 | + $str = (string)\mb_substr($str, $offset); |
|
| 11242 | 11242 | } else { |
| 11243 | - $str = (string) \mb_substr($str, $offset, $length); |
|
| 11243 | + $str = (string)\mb_substr($str, $offset, $length); |
|
| 11244 | 11244 | } |
| 11245 | 11245 | } else { |
| 11246 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
| 11246 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
| 11247 | 11247 | } |
| 11248 | 11248 | } |
| 11249 | 11249 | |
@@ -11253,7 +11253,7 @@ discard block |
||
| 11253 | 11253 | |
| 11254 | 11254 | $matches = []; |
| 11255 | 11255 | |
| 11256 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
| 11256 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
| 11257 | 11257 | } |
| 11258 | 11258 | |
| 11259 | 11259 | /** |
@@ -11335,7 +11335,7 @@ discard block |
||
| 11335 | 11335 | /** |
| 11336 | 11336 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11337 | 11337 | */ |
| 11338 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11338 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11339 | 11339 | } |
| 11340 | 11340 | |
| 11341 | 11341 | // |
@@ -11357,7 +11357,7 @@ discard block |
||
| 11357 | 11357 | // fallback for ascii only |
| 11358 | 11358 | // |
| 11359 | 11359 | |
| 11360 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 11360 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 11361 | 11361 | return \strstr($haystack, $needle, $before_needle); |
| 11362 | 11362 | } |
| 11363 | 11363 | |
@@ -11365,7 +11365,7 @@ discard block |
||
| 11365 | 11365 | // fallback via vanilla php |
| 11366 | 11366 | // |
| 11367 | 11367 | |
| 11368 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
| 11368 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
| 11369 | 11369 | |
| 11370 | 11370 | if (!isset($match[1])) { |
| 11371 | 11371 | return false; |
@@ -11375,7 +11375,7 @@ discard block |
||
| 11375 | 11375 | return $match[1]; |
| 11376 | 11376 | } |
| 11377 | 11377 | |
| 11378 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
| 11378 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
| 11379 | 11379 | } |
| 11380 | 11380 | |
| 11381 | 11381 | /** |
@@ -11505,7 +11505,7 @@ discard block |
||
| 11505 | 11505 | bool $try_to_keep_the_string_length = false |
| 11506 | 11506 | ): string { |
| 11507 | 11507 | // init |
| 11508 | - $str = (string) $str; |
|
| 11508 | + $str = (string)$str; |
|
| 11509 | 11509 | |
| 11510 | 11510 | if ($str === '') { |
| 11511 | 11511 | return ''; |
@@ -11534,25 +11534,25 @@ discard block |
||
| 11534 | 11534 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 11535 | 11535 | } |
| 11536 | 11536 | |
| 11537 | - $language_code = $lang . '-Lower'; |
|
| 11537 | + $language_code = $lang.'-Lower'; |
|
| 11538 | 11538 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 11539 | 11539 | /** |
| 11540 | 11540 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11541 | 11541 | */ |
| 11542 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
| 11542 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
| 11543 | 11543 | |
| 11544 | 11544 | $language_code = 'Any-Lower'; |
| 11545 | 11545 | } |
| 11546 | 11546 | |
| 11547 | 11547 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 11548 | 11548 | /** @noinspection UnnecessaryCastingInspection */ |
| 11549 | - return (string) \transliterator_transliterate($language_code, $str); |
|
| 11549 | + return (string)\transliterator_transliterate($language_code, $str); |
|
| 11550 | 11550 | } |
| 11551 | 11551 | |
| 11552 | 11552 | /** |
| 11553 | 11553 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11554 | 11554 | */ |
| 11555 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
| 11555 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
| 11556 | 11556 | } |
| 11557 | 11557 | |
| 11558 | 11558 | // always fallback via symfony polyfill |
@@ -11587,7 +11587,7 @@ discard block |
||
| 11587 | 11587 | bool $try_to_keep_the_string_length = false |
| 11588 | 11588 | ): string { |
| 11589 | 11589 | // init |
| 11590 | - $str = (string) $str; |
|
| 11590 | + $str = (string)$str; |
|
| 11591 | 11591 | |
| 11592 | 11592 | if ($str === '') { |
| 11593 | 11593 | return ''; |
@@ -11616,25 +11616,25 @@ discard block |
||
| 11616 | 11616 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 11617 | 11617 | } |
| 11618 | 11618 | |
| 11619 | - $language_code = $lang . '-Upper'; |
|
| 11619 | + $language_code = $lang.'-Upper'; |
|
| 11620 | 11620 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 11621 | 11621 | /** |
| 11622 | 11622 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11623 | 11623 | */ |
| 11624 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
| 11624 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
| 11625 | 11625 | |
| 11626 | 11626 | $language_code = 'Any-Upper'; |
| 11627 | 11627 | } |
| 11628 | 11628 | |
| 11629 | 11629 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 11630 | 11630 | /** @noinspection UnnecessaryCastingInspection */ |
| 11631 | - return (string) \transliterator_transliterate($language_code, $str); |
|
| 11631 | + return (string)\transliterator_transliterate($language_code, $str); |
|
| 11632 | 11632 | } |
| 11633 | 11633 | |
| 11634 | 11634 | /** |
| 11635 | 11635 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11636 | 11636 | */ |
| 11637 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
| 11637 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
| 11638 | 11638 | } |
| 11639 | 11639 | |
| 11640 | 11640 | // always fallback via symfony polyfill |
@@ -11698,7 +11698,7 @@ discard block |
||
| 11698 | 11698 | $from = \array_combine($from, $to); |
| 11699 | 11699 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 11700 | 11700 | if ($from === false) { |
| 11701 | - 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) . ')'); |
|
| 11701 | + 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).')'); |
|
| 11702 | 11702 | } |
| 11703 | 11703 | } |
| 11704 | 11704 | |
@@ -11764,9 +11764,9 @@ discard block |
||
| 11764 | 11764 | } |
| 11765 | 11765 | |
| 11766 | 11766 | $wide = 0; |
| 11767 | - $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); |
|
| 11767 | + $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); |
|
| 11768 | 11768 | |
| 11769 | - return ($wide << 1) + (int) self::strlen($str); |
|
| 11769 | + return ($wide << 1) + (int)self::strlen($str); |
|
| 11770 | 11770 | } |
| 11771 | 11771 | |
| 11772 | 11772 | /** |
@@ -11866,9 +11866,9 @@ discard block |
||
| 11866 | 11866 | } |
| 11867 | 11867 | |
| 11868 | 11868 | if ($length === null) { |
| 11869 | - $length = (int) $str_length; |
|
| 11869 | + $length = (int)$str_length; |
|
| 11870 | 11870 | } else { |
| 11871 | - $length = (int) $length; |
|
| 11871 | + $length = (int)$length; |
|
| 11872 | 11872 | } |
| 11873 | 11873 | |
| 11874 | 11874 | if ( |
@@ -11879,7 +11879,7 @@ discard block |
||
| 11879 | 11879 | /** |
| 11880 | 11880 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11881 | 11881 | */ |
| 11882 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11882 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11883 | 11883 | } |
| 11884 | 11884 | |
| 11885 | 11885 | // |
@@ -11975,16 +11975,16 @@ discard block |
||
| 11975 | 11975 | ) { |
| 11976 | 11976 | if ($encoding === 'UTF-8') { |
| 11977 | 11977 | if ($length === null) { |
| 11978 | - $str1 = (string) \mb_substr($str1, $offset); |
|
| 11978 | + $str1 = (string)\mb_substr($str1, $offset); |
|
| 11979 | 11979 | } else { |
| 11980 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
| 11980 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
| 11981 | 11981 | } |
| 11982 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
| 11982 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
| 11983 | 11983 | } else { |
| 11984 | 11984 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 11985 | 11985 | |
| 11986 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
| 11987 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
| 11986 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
| 11987 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
| 11988 | 11988 | } |
| 11989 | 11989 | } |
| 11990 | 11990 | |
@@ -12051,13 +12051,13 @@ discard block |
||
| 12051 | 12051 | if ($length_tmp === false) { |
| 12052 | 12052 | return false; |
| 12053 | 12053 | } |
| 12054 | - $length = (int) $length_tmp; |
|
| 12054 | + $length = (int)$length_tmp; |
|
| 12055 | 12055 | } |
| 12056 | 12056 | |
| 12057 | 12057 | if ($encoding === 'UTF-8') { |
| 12058 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
| 12058 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
| 12059 | 12059 | } else { |
| 12060 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
| 12060 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
| 12061 | 12061 | } |
| 12062 | 12062 | } |
| 12063 | 12063 | |
@@ -12069,7 +12069,7 @@ discard block |
||
| 12069 | 12069 | /** |
| 12070 | 12070 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 12071 | 12071 | */ |
| 12072 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 12072 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 12073 | 12073 | } |
| 12074 | 12074 | |
| 12075 | 12075 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -12080,7 +12080,7 @@ discard block |
||
| 12080 | 12080 | return \mb_substr_count($haystack, $needle, $encoding); |
| 12081 | 12081 | } |
| 12082 | 12082 | |
| 12083 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 12083 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 12084 | 12084 | |
| 12085 | 12085 | return \count($matches); |
| 12086 | 12086 | } |
@@ -12130,7 +12130,7 @@ discard block |
||
| 12130 | 12130 | if ($length_tmp === false) { |
| 12131 | 12131 | return false; |
| 12132 | 12132 | } |
| 12133 | - $length = (int) $length_tmp; |
|
| 12133 | + $length = (int)$length_tmp; |
|
| 12134 | 12134 | } |
| 12135 | 12135 | |
| 12136 | 12136 | if ( |
@@ -12152,7 +12152,7 @@ discard block |
||
| 12152 | 12152 | if ($haystack_tmp === false) { |
| 12153 | 12153 | $haystack_tmp = ''; |
| 12154 | 12154 | } |
| 12155 | - $haystack = (string) $haystack_tmp; |
|
| 12155 | + $haystack = (string)$haystack_tmp; |
|
| 12156 | 12156 | } |
| 12157 | 12157 | |
| 12158 | 12158 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -12193,10 +12193,10 @@ discard block |
||
| 12193 | 12193 | |
| 12194 | 12194 | if ($encoding === 'UTF-8') { |
| 12195 | 12195 | if ($case_sensitive) { |
| 12196 | - return (int) \mb_substr_count($str, $substring); |
|
| 12196 | + return (int)\mb_substr_count($str, $substring); |
|
| 12197 | 12197 | } |
| 12198 | 12198 | |
| 12199 | - return (int) \mb_substr_count( |
|
| 12199 | + return (int)\mb_substr_count( |
|
| 12200 | 12200 | \mb_strtoupper($str), |
| 12201 | 12201 | \mb_strtoupper($substring) |
| 12202 | 12202 | ); |
@@ -12205,10 +12205,10 @@ discard block |
||
| 12205 | 12205 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 12206 | 12206 | |
| 12207 | 12207 | if ($case_sensitive) { |
| 12208 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
| 12208 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
| 12209 | 12209 | } |
| 12210 | 12210 | |
| 12211 | - return (int) \mb_substr_count( |
|
| 12211 | + return (int)\mb_substr_count( |
|
| 12212 | 12212 | self::strtocasefold($str, true, false, $encoding, null, false), |
| 12213 | 12213 | self::strtocasefold($substring, true, false, $encoding, null, false), |
| 12214 | 12214 | $encoding |
@@ -12242,7 +12242,7 @@ discard block |
||
| 12242 | 12242 | } |
| 12243 | 12243 | |
| 12244 | 12244 | if (self::str_istarts_with($haystack, $needle)) { |
| 12245 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 12245 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 12246 | 12246 | } |
| 12247 | 12247 | |
| 12248 | 12248 | return $haystack; |
@@ -12309,7 +12309,7 @@ discard block |
||
| 12309 | 12309 | } |
| 12310 | 12310 | |
| 12311 | 12311 | if (self::str_iends_with($haystack, $needle)) { |
| 12312 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
| 12312 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
| 12313 | 12313 | } |
| 12314 | 12314 | |
| 12315 | 12315 | return $haystack; |
@@ -12342,7 +12342,7 @@ discard block |
||
| 12342 | 12342 | } |
| 12343 | 12343 | |
| 12344 | 12344 | if (self::str_starts_with($haystack, $needle)) { |
| 12345 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 12345 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 12346 | 12346 | } |
| 12347 | 12347 | |
| 12348 | 12348 | return $haystack; |
@@ -12399,7 +12399,7 @@ discard block |
||
| 12399 | 12399 | if (\is_array($offset)) { |
| 12400 | 12400 | $offset = \array_slice($offset, 0, $num); |
| 12401 | 12401 | foreach ($offset as &$value_tmp) { |
| 12402 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
| 12402 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
| 12403 | 12403 | } |
| 12404 | 12404 | unset($value_tmp); |
| 12405 | 12405 | } else { |
@@ -12412,7 +12412,7 @@ discard block |
||
| 12412 | 12412 | } elseif (\is_array($length)) { |
| 12413 | 12413 | $length = \array_slice($length, 0, $num); |
| 12414 | 12414 | foreach ($length as &$value_tmp_V2) { |
| 12415 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
| 12415 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
| 12416 | 12416 | } |
| 12417 | 12417 | unset($value_tmp_V2); |
| 12418 | 12418 | } else { |
@@ -12432,8 +12432,8 @@ discard block |
||
| 12432 | 12432 | } |
| 12433 | 12433 | |
| 12434 | 12434 | // init |
| 12435 | - $str = (string) $str; |
|
| 12436 | - $replacement = (string) $replacement; |
|
| 12435 | + $str = (string)$str; |
|
| 12436 | + $replacement = (string)$replacement; |
|
| 12437 | 12437 | |
| 12438 | 12438 | if (\is_array($length)) { |
| 12439 | 12439 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -12448,16 +12448,16 @@ discard block |
||
| 12448 | 12448 | } |
| 12449 | 12449 | |
| 12450 | 12450 | if (self::$SUPPORT['mbstring'] === true) { |
| 12451 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 12451 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 12452 | 12452 | |
| 12453 | 12453 | if ($offset < 0) { |
| 12454 | - $offset = (int) \max(0, $string_length + $offset); |
|
| 12454 | + $offset = (int)\max(0, $string_length + $offset); |
|
| 12455 | 12455 | } elseif ($offset > $string_length) { |
| 12456 | 12456 | $offset = $string_length; |
| 12457 | 12457 | } |
| 12458 | 12458 | |
| 12459 | 12459 | if ($length !== null && $length < 0) { |
| 12460 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
| 12460 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
| 12461 | 12461 | } elseif ($length === null || $length > $string_length) { |
| 12462 | 12462 | $length = $string_length; |
| 12463 | 12463 | } |
@@ -12468,9 +12468,9 @@ discard block |
||
| 12468 | 12468 | } |
| 12469 | 12469 | |
| 12470 | 12470 | /** @noinspection AdditionOperationOnArraysInspection */ |
| 12471 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
| 12472 | - $replacement . |
|
| 12473 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 12471 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
| 12472 | + $replacement. |
|
| 12473 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 12474 | 12474 | } |
| 12475 | 12475 | |
| 12476 | 12476 | // |
@@ -12479,8 +12479,7 @@ discard block |
||
| 12479 | 12479 | |
| 12480 | 12480 | if (ASCII::is_ascii($str)) { |
| 12481 | 12481 | return ($length === null) ? |
| 12482 | - \substr_replace($str, $replacement, $offset) : |
|
| 12483 | - \substr_replace($str, $replacement, $offset, $length); |
|
| 12482 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
| 12484 | 12483 | } |
| 12485 | 12484 | |
| 12486 | 12485 | // |
@@ -12496,7 +12495,7 @@ discard block |
||
| 12496 | 12495 | // e.g.: non mbstring support + invalid chars |
| 12497 | 12496 | return ''; |
| 12498 | 12497 | } |
| 12499 | - $length = (int) $length_tmp; |
|
| 12498 | + $length = (int)$length_tmp; |
|
| 12500 | 12499 | } |
| 12501 | 12500 | |
| 12502 | 12501 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -12539,14 +12538,14 @@ discard block |
||
| 12539 | 12538 | && |
| 12540 | 12539 | \substr($haystack, -\strlen($needle)) === $needle |
| 12541 | 12540 | ) { |
| 12542 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
| 12541 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
| 12543 | 12542 | } |
| 12544 | 12543 | |
| 12545 | 12544 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
| 12546 | - return (string) self::substr( |
|
| 12545 | + return (string)self::substr( |
|
| 12547 | 12546 | $haystack, |
| 12548 | 12547 | 0, |
| 12549 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
| 12548 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
| 12550 | 12549 | $encoding |
| 12551 | 12550 | ); |
| 12552 | 12551 | } |
@@ -12581,10 +12580,10 @@ discard block |
||
| 12581 | 12580 | } |
| 12582 | 12581 | |
| 12583 | 12582 | if ($encoding === 'UTF-8') { |
| 12584 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 12583 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 12585 | 12584 | } |
| 12586 | 12585 | |
| 12587 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 12586 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 12588 | 12587 | } |
| 12589 | 12588 | |
| 12590 | 12589 | /** |
@@ -12796,7 +12795,7 @@ discard block |
||
| 12796 | 12795 | public static function to_boolean($str): bool |
| 12797 | 12796 | { |
| 12798 | 12797 | // init |
| 12799 | - $str = (string) $str; |
|
| 12798 | + $str = (string)$str; |
|
| 12800 | 12799 | |
| 12801 | 12800 | if ($str === '') { |
| 12802 | 12801 | return false; |
@@ -12824,10 +12823,10 @@ discard block |
||
| 12824 | 12823 | } |
| 12825 | 12824 | |
| 12826 | 12825 | if (\is_numeric($str)) { |
| 12827 | - return ((float) $str + 0) > 0; |
|
| 12826 | + return ((float)$str + 0) > 0; |
|
| 12828 | 12827 | } |
| 12829 | 12828 | |
| 12830 | - return (bool) \trim($str); |
|
| 12829 | + return (bool)\trim($str); |
|
| 12831 | 12830 | } |
| 12832 | 12831 | |
| 12833 | 12832 | /** |
@@ -12875,7 +12874,7 @@ discard block |
||
| 12875 | 12874 | return $str; |
| 12876 | 12875 | } |
| 12877 | 12876 | |
| 12878 | - $str = (string) $str; |
|
| 12877 | + $str = (string)$str; |
|
| 12879 | 12878 | if ($str === '') { |
| 12880 | 12879 | return ''; |
| 12881 | 12880 | } |
@@ -12983,7 +12982,7 @@ discard block |
||
| 12983 | 12982 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
| 12984 | 12983 | |
| 12985 | 12984 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 12986 | - $buf .= $c1 . $c2; |
|
| 12985 | + $buf .= $c1.$c2; |
|
| 12987 | 12986 | ++$i; |
| 12988 | 12987 | } else { // not valid UTF8 - convert it |
| 12989 | 12988 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12994,7 +12993,7 @@ discard block |
||
| 12994 | 12993 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
| 12995 | 12994 | |
| 12996 | 12995 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 12997 | - $buf .= $c1 . $c2 . $c3; |
|
| 12996 | + $buf .= $c1.$c2.$c3; |
|
| 12998 | 12997 | $i += 2; |
| 12999 | 12998 | } else { // not valid UTF8 - convert it |
| 13000 | 12999 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13006,7 +13005,7 @@ discard block |
||
| 13006 | 13005 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
| 13007 | 13006 | |
| 13008 | 13007 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 13009 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
| 13008 | + $buf .= $c1.$c2.$c3.$c4; |
|
| 13010 | 13009 | $i += 3; |
| 13011 | 13010 | } else { // not valid UTF8 - convert it |
| 13012 | 13011 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13034,13 +13033,13 @@ discard block |
||
| 13034 | 13033 | * |
| 13035 | 13034 | * @return string |
| 13036 | 13035 | */ |
| 13037 | - static function (array $matches): string { |
|
| 13036 | + static function(array $matches): string { |
|
| 13038 | 13037 | if (isset($matches[3])) { |
| 13039 | - $cp = (int) \hexdec($matches[3]); |
|
| 13038 | + $cp = (int)\hexdec($matches[3]); |
|
| 13040 | 13039 | } else { |
| 13041 | 13040 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
| 13042 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
| 13043 | - + (int) \hexdec($matches[2]) |
|
| 13041 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
| 13042 | + + (int)\hexdec($matches[2]) |
|
| 13044 | 13043 | + 0x10000 |
| 13045 | 13044 | - (0xD800 << 10) |
| 13046 | 13045 | - 0xDC00; |
@@ -13051,12 +13050,12 @@ discard block |
||
| 13051 | 13050 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
| 13052 | 13051 | |
| 13053 | 13052 | if ($cp < 0x80) { |
| 13054 | - return (string) self::chr($cp); |
|
| 13053 | + return (string)self::chr($cp); |
|
| 13055 | 13054 | } |
| 13056 | 13055 | |
| 13057 | 13056 | if ($cp < 0xA0) { |
| 13058 | 13057 | /** @noinspection UnnecessaryCastingInspection */ |
| 13059 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
| 13058 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
| 13060 | 13059 | } |
| 13061 | 13060 | |
| 13062 | 13061 | return self::decimal_to_chr($cp); |
@@ -13089,7 +13088,7 @@ discard block |
||
| 13089 | 13088 | public static function to_int(string $str) |
| 13090 | 13089 | { |
| 13091 | 13090 | if (\is_numeric($str)) { |
| 13092 | - return (int) $str; |
|
| 13091 | + return (int)$str; |
|
| 13093 | 13092 | } |
| 13094 | 13093 | |
| 13095 | 13094 | return null; |
@@ -13124,7 +13123,7 @@ discard block |
||
| 13124 | 13123 | || |
| 13125 | 13124 | $input_type === 'double' |
| 13126 | 13125 | ) { |
| 13127 | - return (string) $input; |
|
| 13126 | + return (string)$input; |
|
| 13128 | 13127 | } |
| 13129 | 13128 | |
| 13130 | 13129 | if ($input_type === 'object') { |
@@ -13134,7 +13133,7 @@ discard block |
||
| 13134 | 13133 | /** @noinspection NestedPositiveIfStatementsInspection */ |
| 13135 | 13134 | /** @noinspection MissingOrEmptyGroupStatementInspection */ |
| 13136 | 13135 | if (\method_exists($input, '__toString')) { |
| 13137 | - return (string) $input; |
|
| 13136 | + return (string)$input; |
|
| 13138 | 13137 | } |
| 13139 | 13138 | } |
| 13140 | 13139 | |
@@ -13175,7 +13174,7 @@ discard block |
||
| 13175 | 13174 | } |
| 13176 | 13175 | |
| 13177 | 13176 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 13178 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 13177 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 13179 | 13178 | } |
| 13180 | 13179 | |
| 13181 | 13180 | if ($chars) { |
@@ -13226,15 +13225,15 @@ discard block |
||
| 13226 | 13225 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 13227 | 13226 | |
| 13228 | 13227 | if ($encoding === 'UTF-8') { |
| 13229 | - $str_part_two = (string) \mb_substr($str, 1); |
|
| 13228 | + $str_part_two = (string)\mb_substr($str, 1); |
|
| 13230 | 13229 | |
| 13231 | 13230 | if ($use_mb_functions) { |
| 13232 | 13231 | $str_part_one = \mb_strtoupper( |
| 13233 | - (string) \mb_substr($str, 0, 1) |
|
| 13232 | + (string)\mb_substr($str, 0, 1) |
|
| 13234 | 13233 | ); |
| 13235 | 13234 | } else { |
| 13236 | 13235 | $str_part_one = self::strtoupper( |
| 13237 | - (string) \mb_substr($str, 0, 1), |
|
| 13236 | + (string)\mb_substr($str, 0, 1), |
|
| 13238 | 13237 | $encoding, |
| 13239 | 13238 | false, |
| 13240 | 13239 | $lang, |
@@ -13244,16 +13243,16 @@ discard block |
||
| 13244 | 13243 | } else { |
| 13245 | 13244 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 13246 | 13245 | |
| 13247 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
| 13246 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
| 13248 | 13247 | |
| 13249 | 13248 | if ($use_mb_functions) { |
| 13250 | 13249 | $str_part_one = \mb_strtoupper( |
| 13251 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
| 13250 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
| 13252 | 13251 | $encoding |
| 13253 | 13252 | ); |
| 13254 | 13253 | } else { |
| 13255 | 13254 | $str_part_one = self::strtoupper( |
| 13256 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 13255 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 13257 | 13256 | $encoding, |
| 13258 | 13257 | false, |
| 13259 | 13258 | $lang, |
@@ -13262,7 +13261,7 @@ discard block |
||
| 13262 | 13261 | } |
| 13263 | 13262 | } |
| 13264 | 13263 | |
| 13265 | - return $str_part_one . $str_part_two; |
|
| 13264 | + return $str_part_one.$str_part_two; |
|
| 13266 | 13265 | } |
| 13267 | 13266 | |
| 13268 | 13267 | /** |
@@ -13323,7 +13322,7 @@ discard block |
||
| 13323 | 13322 | $str = self::clean($str); |
| 13324 | 13323 | } |
| 13325 | 13324 | |
| 13326 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
| 13325 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
| 13327 | 13326 | |
| 13328 | 13327 | if ( |
| 13329 | 13328 | $use_php_default_functions |
@@ -13740,7 +13739,7 @@ discard block |
||
| 13740 | 13739 | if ( |
| 13741 | 13740 | $keep_utf8_chars |
| 13742 | 13741 | && |
| 13743 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
| 13742 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
| 13744 | 13743 | ) { |
| 13745 | 13744 | return $str_backup; |
| 13746 | 13745 | } |
@@ -13831,17 +13830,17 @@ discard block |
||
| 13831 | 13830 | return ''; |
| 13832 | 13831 | } |
| 13833 | 13832 | |
| 13834 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
| 13833 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
| 13835 | 13834 | |
| 13836 | 13835 | if ( |
| 13837 | 13836 | !isset($matches[0]) |
| 13838 | 13837 | || |
| 13839 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
| 13838 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
| 13840 | 13839 | ) { |
| 13841 | 13840 | return $str; |
| 13842 | 13841 | } |
| 13843 | 13842 | |
| 13844 | - return \rtrim($matches[0]) . $str_add_on; |
|
| 13843 | + return \rtrim($matches[0]).$str_add_on; |
|
| 13845 | 13844 | } |
| 13846 | 13845 | |
| 13847 | 13846 | /** |
@@ -13936,7 +13935,7 @@ discard block |
||
| 13936 | 13935 | } |
| 13937 | 13936 | } |
| 13938 | 13937 | |
| 13939 | - return $str_return . \implode('', $charsArray); |
|
| 13938 | + return $str_return.\implode('', $charsArray); |
|
| 13940 | 13939 | } |
| 13941 | 13940 | |
| 13942 | 13941 | /** |
@@ -13990,7 +13989,7 @@ discard block |
||
| 13990 | 13989 | $final_break = ''; |
| 13991 | 13990 | } |
| 13992 | 13991 | |
| 13993 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
| 13992 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
| 13994 | 13993 | } |
| 13995 | 13994 | |
| 13996 | 13995 | /** |
@@ -14232,7 +14231,7 @@ discard block |
||
| 14232 | 14231 | /** @noinspection PhpIncludeInspection */ |
| 14233 | 14232 | /** @noinspection UsingInclusionReturnValueInspection */ |
| 14234 | 14233 | /** @psalm-suppress UnresolvableInclude */ |
| 14235 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
| 14234 | + return include __DIR__.'/data/'.$file.'.php'; |
|
| 14236 | 14235 | } |
| 14237 | 14236 | |
| 14238 | 14237 | /** |
@@ -14252,7 +14251,7 @@ discard block |
||
| 14252 | 14251 | */ |
| 14253 | 14252 | \uksort( |
| 14254 | 14253 | self::$EMOJI, |
| 14255 | - static function (string $a, string $b): int { |
|
| 14254 | + static function(string $a, string $b): int { |
|
| 14256 | 14255 | return \strlen($b) <=> \strlen($a); |
| 14257 | 14256 | } |
| 14258 | 14257 | ); |
@@ -14262,7 +14261,7 @@ discard block |
||
| 14262 | 14261 | |
| 14263 | 14262 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
| 14264 | 14263 | $tmp_key = \crc32($key); |
| 14265 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
| 14264 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
| 14266 | 14265 | } |
| 14267 | 14266 | |
| 14268 | 14267 | return true; |
@@ -14290,7 +14289,7 @@ discard block |
||
| 14290 | 14289 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 14291 | 14290 | return \defined('MB_OVERLOAD_STRING') |
| 14292 | 14291 | && |
| 14293 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 14292 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 14294 | 14293 | } |
| 14295 | 14294 | |
| 14296 | 14295 | /** |
@@ -14356,7 +14355,7 @@ discard block |
||
| 14356 | 14355 | */ |
| 14357 | 14356 | static $RX_CLASS_CACHE = []; |
| 14358 | 14357 | |
| 14359 | - $cache_key = $s . '_' . $class; |
|
| 14358 | + $cache_key = $s.'_'.$class; |
|
| 14360 | 14359 | |
| 14361 | 14360 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
| 14362 | 14361 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -14369,7 +14368,7 @@ discard block |
||
| 14369 | 14368 | /** @noinspection AlterInForeachInspection */ |
| 14370 | 14369 | foreach (self::str_split($s) as &$s) { |
| 14371 | 14370 | if ($s === '-') { |
| 14372 | - $class_array[0] = '-' . $class_array[0]; |
|
| 14371 | + $class_array[0] = '-'.$class_array[0]; |
|
| 14373 | 14372 | } elseif (!isset($s[2])) { |
| 14374 | 14373 | $class_array[0] .= \preg_quote($s, '/'); |
| 14375 | 14374 | } elseif (self::strlen($s) === 1) { |
@@ -14380,13 +14379,13 @@ discard block |
||
| 14380 | 14379 | } |
| 14381 | 14380 | |
| 14382 | 14381 | if ($class_array[0]) { |
| 14383 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
| 14382 | + $class_array[0] = '['.$class_array[0].']'; |
|
| 14384 | 14383 | } |
| 14385 | 14384 | |
| 14386 | 14385 | if (\count($class_array) === 1) { |
| 14387 | 14386 | $return = $class_array[0]; |
| 14388 | 14387 | } else { |
| 14389 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
| 14388 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
| 14390 | 14389 | } |
| 14391 | 14390 | |
| 14392 | 14391 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -14467,7 +14466,7 @@ discard block |
||
| 14467 | 14466 | |
| 14468 | 14467 | if ($delimiter === '-') { |
| 14469 | 14468 | /** @noinspection AlterInForeachInspection */ |
| 14470 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
| 14469 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
| 14471 | 14470 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
| 14472 | 14471 | $continue = true; |
| 14473 | 14472 | |
@@ -14477,7 +14476,7 @@ discard block |
||
| 14477 | 14476 | } |
| 14478 | 14477 | |
| 14479 | 14478 | /** @noinspection AlterInForeachInspection */ |
| 14480 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
| 14479 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
| 14481 | 14480 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
| 14482 | 14481 | $continue = true; |
| 14483 | 14482 | |
@@ -14547,8 +14546,8 @@ discard block |
||
| 14547 | 14546 | } else { |
| 14548 | 14547 | /** @noinspection OffsetOperationsInspection */ |
| 14549 | 14548 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
| 14550 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
| 14551 | - $buf .= $cc1 . $cc2; |
|
| 14549 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
| 14550 | + $buf .= $cc1.$cc2; |
|
| 14552 | 14551 | } |
| 14553 | 14552 | |
| 14554 | 14553 | return $buf; |
@@ -14567,7 +14566,7 @@ discard block |
||
| 14567 | 14566 | { |
| 14568 | 14567 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
| 14569 | 14568 | if (\preg_match($pattern, $str)) { |
| 14570 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
| 14569 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
| 14571 | 14570 | } |
| 14572 | 14571 | |
| 14573 | 14572 | return $str; |
@@ -2,14 +2,14 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | use voku\helper\UTF8; |
| 4 | 4 | |
| 5 | -require __DIR__ . '/../vendor/autoload.php'; |
|
| 5 | +require __DIR__.'/../vendor/autoload.php'; |
|
| 6 | 6 | |
| 7 | 7 | $factory = \phpDocumentor\Reflection\DocBlockFactory::createInstance(); |
| 8 | 8 | $reflection = new ReflectionClass(UTF8::class); |
| 9 | 9 | |
| 10 | 10 | // ------------------------------------- |
| 11 | 11 | |
| 12 | -$templateDocument = file_get_contents(__DIR__ . '/docs/base.md'); |
|
| 12 | +$templateDocument = file_get_contents(__DIR__.'/docs/base.md'); |
|
| 13 | 13 | |
| 14 | 14 | $templateMethodParam = <<<RAW |
| 15 | 15 | - %param% |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $paramsTemplate = new TemplateFormatter($templateMethodParam); |
| 113 | 113 | $paramsTemplate->set('param', (string)$tagParam); |
| 114 | 114 | $params[] = $paramsTemplate->format(); |
| 115 | - $paramsTypes[] = $tagParam->getType() . ' ' . '$' . $tagParam->getVariableName(); |
|
| 115 | + $paramsTypes[] = $tagParam->getType().' '.'$'.$tagParam->getVariableName(); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (count($params) !== 0) { |
@@ -138,16 +138,16 @@ discard block |
||
| 138 | 138 | $methodTemplate->set('return', '__void__'); |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - $methodWithType = $method->getShortName() . '(' . implode(', ', $paramsTypes) . '): ' . implode('|', $returnsTypes); |
|
| 141 | + $methodWithType = $method->getShortName().'('.implode(', ', $paramsTypes).'): '.implode('|', $returnsTypes); |
|
| 142 | 142 | |
| 143 | - $description = trim($doc->getSummary() . "\n\n" . $doc->getDescription()); |
|
| 143 | + $description = trim($doc->getSummary()."\n\n".$doc->getDescription()); |
|
| 144 | 144 | |
| 145 | 145 | $methodTemplate->set('name', $methodWithType); |
| 146 | 146 | $methodTemplate->set('description', $description); |
| 147 | 147 | $methodTemplate->set('code', '```php echo ```'); |
| 148 | 148 | |
| 149 | 149 | $methodIndexTemplate->set('title', $method->getShortName()); |
| 150 | - $methodIndexTemplate->set('href', '#' . UTF8::css_identifier($methodWithType)); |
|
| 150 | + $methodIndexTemplate->set('href', '#'.UTF8::css_identifier($methodWithType)); |
|
| 151 | 151 | |
| 152 | 152 | $functionsDocumentation[$method->getShortName()] = $methodTemplate->format(); |
| 153 | 153 | $functionsIndex[$method->getShortName()] = $methodIndexTemplate->format(); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | $indexStrResult .= '<tr>'; |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - $indexStrResult .= '<td>' . sprintf("%s\n", $_template) . '</td>'; |
|
| 176 | + $indexStrResult .= '<td>'.sprintf("%s\n", $_template).'</td>'; |
|
| 177 | 177 | |
| 178 | 178 | if ($counterTmp === 4) { |
| 179 | 179 | $counterTmp = 0; |
@@ -185,10 +185,10 @@ discard block |
||
| 185 | 185 | } |
| 186 | 186 | $indexStrResult = ' |
| 187 | 187 | <table> |
| 188 | - ' . $indexStrResult . ' |
|
| 188 | + ' . $indexStrResult.' |
|
| 189 | 189 | </table> |
| 190 | 190 | '; |
| 191 | 191 | |
| 192 | 192 | $documentTemplate->set('__functions_index__', $indexStrResult); |
| 193 | 193 | |
| 194 | -file_put_contents(__DIR__ . '/../README.md', $documentTemplate->format()); |
|
| 194 | +file_put_contents(__DIR__.'/../README.md', $documentTemplate->format()); |
|