@@ -3,17 +3,17 @@ discard block |
||
| 3 | 3 | return [ |
| 4 | 4 | 0x80 => "\xe2\x82\xac", // € |
| 5 | 5 | 0x82 => "\xe2\x80\x9a", // ‚ |
| 6 | - 0x83 => "\xc6\x92", // ƒ |
|
| 6 | + 0x83 => "\xc6\x92", // ƒ |
|
| 7 | 7 | 0x84 => "\xe2\x80\x9e", // „ |
| 8 | 8 | 0x85 => "\xe2\x80\xa6", // … |
| 9 | 9 | 0x86 => "\xe2\x80\xa0", // † |
| 10 | 10 | 0x87 => "\xe2\x80\xa1", // ‡ |
| 11 | - 0x88 => "\xcb\x86", // ˆ |
|
| 11 | + 0x88 => "\xcb\x86", // ˆ |
|
| 12 | 12 | 0x89 => "\xe2\x80\xb0", // ‰ |
| 13 | - 0x8a => "\xc5\xa0", // Š |
|
| 13 | + 0x8a => "\xc5\xa0", // Š |
|
| 14 | 14 | 0x8b => "\xe2\x80\xb9", // ‹ |
| 15 | - 0x8c => "\xc5\x92", // Œ |
|
| 16 | - 0x8e => "\xc5\xbd", // Ž |
|
| 15 | + 0x8c => "\xc5\x92", // Œ |
|
| 16 | + 0x8e => "\xc5\xbd", // Ž |
|
| 17 | 17 | 0x91 => "\xe2\x80\x98", // ‘ |
| 18 | 18 | 0x92 => "\xe2\x80\x99", // ’ |
| 19 | 19 | 0x93 => "\xe2\x80\x9c", // “ |
@@ -21,106 +21,106 @@ discard block |
||
| 21 | 21 | 0x95 => "\xe2\x80\xa2", // • |
| 22 | 22 | 0x96 => "\xe2\x80\x93", // – |
| 23 | 23 | 0x97 => "\xe2\x80\x94", // — |
| 24 | - 0x98 => "\xcb\x9c", // ˜ |
|
| 24 | + 0x98 => "\xcb\x9c", // ˜ |
|
| 25 | 25 | 0x99 => "\xe2\x84\xa2", // ™ |
| 26 | - 0x9a => "\xc5\xa1", // š |
|
| 26 | + 0x9a => "\xc5\xa1", // š |
|
| 27 | 27 | 0x9b => "\xe2\x80\xba", // › |
| 28 | - 0x9c => "\xc5\x93", // œ |
|
| 29 | - 0x9e => "\xc5\xbe", // ž |
|
| 30 | - 0x9f => "\xc5\xb8", // Ÿ |
|
| 28 | + 0x9c => "\xc5\x93", // œ |
|
| 29 | + 0x9e => "\xc5\xbe", // ž |
|
| 30 | + 0x9f => "\xc5\xb8", // Ÿ |
|
| 31 | 31 | 0xa0 => "\xc2\xa0", |
| 32 | - 0xa1 => "\xc2\xa1", // ¡ |
|
| 33 | - 0xa2 => "\xc2\xa2", // ¢ |
|
| 34 | - 0xa3 => "\xc2\xa3", // £ |
|
| 35 | - 0xa4 => "\xc2\xa4", // ¤ |
|
| 36 | - 0xa5 => "\xc2\xa5", // ¥ |
|
| 37 | - 0xa6 => "\xc2\xa6", // ¦ |
|
| 38 | - 0xa7 => "\xc2\xa7", // § |
|
| 39 | - 0xa8 => "\xc2\xa8", // ¨ |
|
| 40 | - 0xa9 => "\xc2\xa9", // © |
|
| 41 | - 0xaa => "\xc2\xaa", // ª |
|
| 42 | - 0xab => "\xc2\xab", // « |
|
| 43 | - 0xac => "\xc2\xac", // ¬ |
|
| 44 | - 0xad => "\xc2\xad", // |
|
| 45 | - 0xae => "\xc2\xae", // ® |
|
| 46 | - 0xaf => "\xc2\xaf", // ¯ |
|
| 47 | - 0xb0 => "\xc2\xb0", // ° |
|
| 48 | - 0xb1 => "\xc2\xb1", // ± |
|
| 49 | - 0xb2 => "\xc2\xb2", // ² |
|
| 50 | - 0xb3 => "\xc2\xb3", // ³ |
|
| 51 | - 0xb4 => "\xc2\xb4", // ´ |
|
| 52 | - 0xb5 => "\xc2\xb5", // µ |
|
| 53 | - 0xb6 => "\xc2\xb6", // ¶ |
|
| 54 | - 0xb7 => "\xc2\xb7", // · |
|
| 55 | - 0xb8 => "\xc2\xb8", // ¸ |
|
| 56 | - 0xb9 => "\xc2\xb9", // ¹ |
|
| 57 | - 0xba => "\xc2\xba", // º |
|
| 58 | - 0xbb => "\xc2\xbb", // » |
|
| 59 | - 0xbc => "\xc2\xbc", // ¼ |
|
| 60 | - 0xbd => "\xc2\xbd", // ½ |
|
| 61 | - 0xbe => "\xc2\xbe", // ¾ |
|
| 62 | - 0xbf => "\xc2\xbf", // ¿ |
|
| 63 | - 0xc0 => "\xc3\x80", // À |
|
| 64 | - 0xc1 => "\xc3\x81", // Á |
|
| 65 | - 0xc2 => "\xc3\x82", // Â |
|
| 66 | - 0xc3 => "\xc3\x83", // Ã |
|
| 67 | - 0xc4 => "\xc3\x84", // Ä |
|
| 68 | - 0xc5 => "\xc3\x85", // Å |
|
| 69 | - 0xc6 => "\xc3\x86", // Æ |
|
| 70 | - 0xc7 => "\xc3\x87", // Ç |
|
| 71 | - 0xc8 => "\xc3\x88", // È |
|
| 72 | - 0xc9 => "\xc3\x89", // É |
|
| 73 | - 0xca => "\xc3\x8a", // Ê |
|
| 74 | - 0xcb => "\xc3\x8b", // Ë |
|
| 75 | - 0xcc => "\xc3\x8c", // Ì |
|
| 76 | - 0xcd => "\xc3\x8d", // Í |
|
| 77 | - 0xce => "\xc3\x8e", // Î |
|
| 78 | - 0xcf => "\xc3\x8f", // Ï |
|
| 79 | - 0xd0 => "\xc3\x90", // Ð |
|
| 80 | - 0xd1 => "\xc3\x91", // Ñ |
|
| 81 | - 0xd2 => "\xc3\x92", // Ò |
|
| 82 | - 0xd3 => "\xc3\x93", // Ó |
|
| 83 | - 0xd4 => "\xc3\x94", // Ô |
|
| 84 | - 0xd5 => "\xc3\x95", // Õ |
|
| 85 | - 0xd6 => "\xc3\x96", // Ö |
|
| 86 | - 0xd7 => "\xc3\x97", // × |
|
| 87 | - 0xd8 => "\xc3\x98", // Ø |
|
| 88 | - 0xd9 => "\xc3\x99", // Ù |
|
| 89 | - 0xda => "\xc3\x9a", // Ú |
|
| 90 | - 0xdb => "\xc3\x9b", // Û |
|
| 91 | - 0xdc => "\xc3\x9c", // Ü |
|
| 92 | - 0xdd => "\xc3\x9d", // Ý |
|
| 93 | - 0xde => "\xc3\x9e", // Þ |
|
| 94 | - 0xdf => "\xc3\x9f", // ß |
|
| 95 | - 0xe0 => "\xc3\xa0", // à |
|
| 96 | - 0xe1 => "\xc3\xa1", // á |
|
| 97 | - 0xe2 => "\xc3\xa2", // â |
|
| 98 | - 0xe3 => "\xc3\xa3", // ã |
|
| 99 | - 0xe4 => "\xc3\xa4", // ä |
|
| 100 | - 0xe5 => "\xc3\xa5", // å |
|
| 101 | - 0xe6 => "\xc3\xa6", // æ |
|
| 102 | - 0xe7 => "\xc3\xa7", // ç |
|
| 103 | - 0xe8 => "\xc3\xa8", // è |
|
| 104 | - 0xe9 => "\xc3\xa9", // é |
|
| 105 | - 0xea => "\xc3\xaa", // ê |
|
| 106 | - 0xeb => "\xc3\xab", // ë |
|
| 107 | - 0xec => "\xc3\xac", // ì |
|
| 108 | - 0xed => "\xc3\xad", // í |
|
| 109 | - 0xee => "\xc3\xae", // î |
|
| 110 | - 0xef => "\xc3\xaf", // ï |
|
| 111 | - 0xf0 => "\xc3\xb0", // ð |
|
| 112 | - 0xf1 => "\xc3\xb1", // ñ |
|
| 113 | - 0xf2 => "\xc3\xb2", // ò |
|
| 114 | - 0xf3 => "\xc3\xb3", // ó |
|
| 115 | - 0xf4 => "\xc3\xb4", // ô |
|
| 116 | - 0xf5 => "\xc3\xb5", // õ |
|
| 117 | - 0xf6 => "\xc3\xb6", // ö |
|
| 118 | - 0xf7 => "\xc3\xb7", // ÷ |
|
| 119 | - 0xf8 => "\xc3\xb8", // ø |
|
| 120 | - 0xf9 => "\xc3\xb9", // ù |
|
| 121 | - 0xfa => "\xc3\xba", // ú |
|
| 122 | - 0xfb => "\xc3\xbb", // û |
|
| 123 | - 0xfc => "\xc3\xbc", // ü |
|
| 124 | - 0xfd => "\xc3\xbd", // ý |
|
| 125 | - 0xfe => "\xc3\xbe", // þ |
|
| 32 | + 0xa1 => "\xc2\xa1", // ¡ |
|
| 33 | + 0xa2 => "\xc2\xa2", // ¢ |
|
| 34 | + 0xa3 => "\xc2\xa3", // £ |
|
| 35 | + 0xa4 => "\xc2\xa4", // ¤ |
|
| 36 | + 0xa5 => "\xc2\xa5", // ¥ |
|
| 37 | + 0xa6 => "\xc2\xa6", // ¦ |
|
| 38 | + 0xa7 => "\xc2\xa7", // § |
|
| 39 | + 0xa8 => "\xc2\xa8", // ¨ |
|
| 40 | + 0xa9 => "\xc2\xa9", // © |
|
| 41 | + 0xaa => "\xc2\xaa", // ª |
|
| 42 | + 0xab => "\xc2\xab", // « |
|
| 43 | + 0xac => "\xc2\xac", // ¬ |
|
| 44 | + 0xad => "\xc2\xad", // |
|
| 45 | + 0xae => "\xc2\xae", // ® |
|
| 46 | + 0xaf => "\xc2\xaf", // ¯ |
|
| 47 | + 0xb0 => "\xc2\xb0", // ° |
|
| 48 | + 0xb1 => "\xc2\xb1", // ± |
|
| 49 | + 0xb2 => "\xc2\xb2", // ² |
|
| 50 | + 0xb3 => "\xc2\xb3", // ³ |
|
| 51 | + 0xb4 => "\xc2\xb4", // ´ |
|
| 52 | + 0xb5 => "\xc2\xb5", // µ |
|
| 53 | + 0xb6 => "\xc2\xb6", // ¶ |
|
| 54 | + 0xb7 => "\xc2\xb7", // · |
|
| 55 | + 0xb8 => "\xc2\xb8", // ¸ |
|
| 56 | + 0xb9 => "\xc2\xb9", // ¹ |
|
| 57 | + 0xba => "\xc2\xba", // º |
|
| 58 | + 0xbb => "\xc2\xbb", // » |
|
| 59 | + 0xbc => "\xc2\xbc", // ¼ |
|
| 60 | + 0xbd => "\xc2\xbd", // ½ |
|
| 61 | + 0xbe => "\xc2\xbe", // ¾ |
|
| 62 | + 0xbf => "\xc2\xbf", // ¿ |
|
| 63 | + 0xc0 => "\xc3\x80", // À |
|
| 64 | + 0xc1 => "\xc3\x81", // Á |
|
| 65 | + 0xc2 => "\xc3\x82", // Â |
|
| 66 | + 0xc3 => "\xc3\x83", // Ã |
|
| 67 | + 0xc4 => "\xc3\x84", // Ä |
|
| 68 | + 0xc5 => "\xc3\x85", // Å |
|
| 69 | + 0xc6 => "\xc3\x86", // Æ |
|
| 70 | + 0xc7 => "\xc3\x87", // Ç |
|
| 71 | + 0xc8 => "\xc3\x88", // È |
|
| 72 | + 0xc9 => "\xc3\x89", // É |
|
| 73 | + 0xca => "\xc3\x8a", // Ê |
|
| 74 | + 0xcb => "\xc3\x8b", // Ë |
|
| 75 | + 0xcc => "\xc3\x8c", // Ì |
|
| 76 | + 0xcd => "\xc3\x8d", // Í |
|
| 77 | + 0xce => "\xc3\x8e", // Î |
|
| 78 | + 0xcf => "\xc3\x8f", // Ï |
|
| 79 | + 0xd0 => "\xc3\x90", // Ð |
|
| 80 | + 0xd1 => "\xc3\x91", // Ñ |
|
| 81 | + 0xd2 => "\xc3\x92", // Ò |
|
| 82 | + 0xd3 => "\xc3\x93", // Ó |
|
| 83 | + 0xd4 => "\xc3\x94", // Ô |
|
| 84 | + 0xd5 => "\xc3\x95", // Õ |
|
| 85 | + 0xd6 => "\xc3\x96", // Ö |
|
| 86 | + 0xd7 => "\xc3\x97", // × |
|
| 87 | + 0xd8 => "\xc3\x98", // Ø |
|
| 88 | + 0xd9 => "\xc3\x99", // Ù |
|
| 89 | + 0xda => "\xc3\x9a", // Ú |
|
| 90 | + 0xdb => "\xc3\x9b", // Û |
|
| 91 | + 0xdc => "\xc3\x9c", // Ü |
|
| 92 | + 0xdd => "\xc3\x9d", // Ý |
|
| 93 | + 0xde => "\xc3\x9e", // Þ |
|
| 94 | + 0xdf => "\xc3\x9f", // ß |
|
| 95 | + 0xe0 => "\xc3\xa0", // à |
|
| 96 | + 0xe1 => "\xc3\xa1", // á |
|
| 97 | + 0xe2 => "\xc3\xa2", // â |
|
| 98 | + 0xe3 => "\xc3\xa3", // ã |
|
| 99 | + 0xe4 => "\xc3\xa4", // ä |
|
| 100 | + 0xe5 => "\xc3\xa5", // å |
|
| 101 | + 0xe6 => "\xc3\xa6", // æ |
|
| 102 | + 0xe7 => "\xc3\xa7", // ç |
|
| 103 | + 0xe8 => "\xc3\xa8", // è |
|
| 104 | + 0xe9 => "\xc3\xa9", // é |
|
| 105 | + 0xea => "\xc3\xaa", // ê |
|
| 106 | + 0xeb => "\xc3\xab", // ë |
|
| 107 | + 0xec => "\xc3\xac", // ì |
|
| 108 | + 0xed => "\xc3\xad", // í |
|
| 109 | + 0xee => "\xc3\xae", // î |
|
| 110 | + 0xef => "\xc3\xaf", // ï |
|
| 111 | + 0xf0 => "\xc3\xb0", // ð |
|
| 112 | + 0xf1 => "\xc3\xb1", // ñ |
|
| 113 | + 0xf2 => "\xc3\xb2", // ò |
|
| 114 | + 0xf3 => "\xc3\xb3", // ó |
|
| 115 | + 0xf4 => "\xc3\xb4", // ô |
|
| 116 | + 0xf5 => "\xc3\xb5", // õ |
|
| 117 | + 0xf6 => "\xc3\xb6", // ö |
|
| 118 | + 0xf7 => "\xc3\xb7", // ÷ |
|
| 119 | + 0xf8 => "\xc3\xb8", // ø |
|
| 120 | + 0xf9 => "\xc3\xb9", // ù |
|
| 121 | + 0xfa => "\xc3\xba", // ú |
|
| 122 | + 0xfb => "\xc3\xbb", // û |
|
| 123 | + 0xfc => "\xc3\xbc", // ü |
|
| 124 | + 0xfd => "\xc3\xbd", // ý |
|
| 125 | + 0xfe => "\xc3\xbe", // þ |
|
| 126 | 126 | ]; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | return false; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - $uri = (string) $_SERVER['REQUEST_URI']; |
|
| 86 | + $uri = (string)$_SERVER['REQUEST_URI']; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | $uriOrig = $uri; |
@@ -100,27 +100,27 @@ discard block |
||
| 100 | 100 | // When not, assumes Windows-1252 and redirects to the corresponding UTF-8 encoded URL |
| 101 | 101 | // |
| 102 | 102 | |
| 103 | - $uri = (string) \preg_replace_callback( |
|
| 103 | + $uri = (string)\preg_replace_callback( |
|
| 104 | 104 | '/[\x80-\xFF]+/', |
| 105 | 105 | /** |
| 106 | 106 | * @param array $m |
| 107 | 107 | * |
| 108 | 108 | * @return string |
| 109 | 109 | */ |
| 110 | - static function (array $m): string { |
|
| 110 | + static function(array $m): string { |
|
| 111 | 111 | return \rawurlencode($m[0]); |
| 112 | 112 | }, |
| 113 | 113 | $uri |
| 114 | 114 | ); |
| 115 | 115 | |
| 116 | - $uri = (string) \preg_replace_callback( |
|
| 116 | + $uri = (string)\preg_replace_callback( |
|
| 117 | 117 | '/(?:%[89A-F][0-9A-F])+/i', |
| 118 | 118 | /** |
| 119 | 119 | * @param array $m |
| 120 | 120 | * |
| 121 | 121 | * @return string |
| 122 | 122 | */ |
| 123 | - static function (array $m): string { |
|
| 123 | + static function(array $m): string { |
|
| 124 | 124 | return \rawurlencode(UTF8::rawurldecode($m[0])); |
| 125 | 125 | }, |
| 126 | 126 | $uri |
@@ -134,19 +134,19 @@ discard block |
||
| 134 | 134 | \headers_sent() === false |
| 135 | 135 | ) { |
| 136 | 136 | $severProtocol = ($_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'); |
| 137 | - \header($severProtocol . ' 301 Moved Permanently'); |
|
| 137 | + \header($severProtocol.' 301 Moved Permanently'); |
|
| 138 | 138 | |
| 139 | 139 | if (\strncmp($uri, '/', 1) === 0) { |
| 140 | - \header('Location: /' . \ltrim($uri, '/')); |
|
| 140 | + \header('Location: /'.\ltrim($uri, '/')); |
|
| 141 | 141 | } else { |
| 142 | - \header('Location: ' . $uri); |
|
| 142 | + \header('Location: '.$uri); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | exit(); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | if (\strncmp($uri, '/', 1) === 0) { |
| 149 | - $uri = '/' . \ltrim($uri, '/'); |
|
| 149 | + $uri = '/'.\ltrim($uri, '/'); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | return $uri; |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | return false; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - $length = (int) $length; |
|
| 192 | + $length = (int)$length; |
|
| 193 | 193 | |
| 194 | 194 | if ($length <= 0) { |
| 195 | 195 | return false; |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | static $_IS_PHP; |
| 231 | 231 | |
| 232 | - $version = (string) $version; |
|
| 232 | + $version = (string)$version; |
|
| 233 | 233 | |
| 234 | 234 | if (!isset($_IS_PHP[$version])) { |
| 235 | 235 | $_IS_PHP[$version] = \version_compare(\PHP_VERSION, $version, '>='); |
@@ -629,22 +629,22 @@ discard block |
||
| 629 | 629 | * @psalm-suppress PossiblyNullArrayAccess |
| 630 | 630 | */ |
| 631 | 631 | $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
| 632 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 632 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 633 | 633 | } elseif ($code_point <= 0xFFFF) { |
| 634 | 634 | /** |
| 635 | 635 | * @psalm-suppress PossiblyNullArrayAccess |
| 636 | 636 | */ |
| 637 | 637 | $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
| 638 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 639 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 638 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 639 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 640 | 640 | } else { |
| 641 | 641 | /** |
| 642 | 642 | * @psalm-suppress PossiblyNullArrayAccess |
| 643 | 643 | */ |
| 644 | 644 | $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
| 645 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 646 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 647 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 645 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 646 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 647 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | if ($encoding !== 'UTF-8') { |
@@ -1131,7 +1131,7 @@ discard block |
||
| 1131 | 1131 | $asciiOffset = 0x41; |
| 1132 | 1132 | |
| 1133 | 1133 | return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? '') . |
| 1134 | - (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
|
| 1134 | + (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
|
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | 1137 | /** |
@@ -2484,10 +2484,10 @@ discard block |
||
| 2484 | 2484 | } |
| 2485 | 2485 | |
| 2486 | 2486 | $unique_helper = $rand_int . |
| 2487 | - \session_id() . |
|
| 2488 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
| 2489 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
| 2490 | - $extra_entropy; |
|
| 2487 | + \session_id() . |
|
| 2488 | + ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
| 2489 | + ($_SERVER['SERVER_ADDR'] ?? '') . |
|
| 2490 | + $extra_entropy; |
|
| 2491 | 2491 | |
| 2492 | 2492 | $unique_string = \uniqid($unique_helper, true); |
| 2493 | 2493 | |
@@ -6346,8 +6346,8 @@ discard block |
||
| 6346 | 6346 | |
| 6347 | 6347 | /** @noinspection UnnecessaryCastingInspection */ |
| 6348 | 6348 | return (string) \mb_substr($str, 0, $index) . |
| 6349 | - $substring . |
|
| 6350 | - (string) \mb_substr($str, $index, $len); |
|
| 6349 | + $substring . |
|
| 6350 | + (string) \mb_substr($str, $index, $len); |
|
| 6351 | 6351 | } |
| 6352 | 6352 | |
| 6353 | 6353 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -6358,8 +6358,8 @@ discard block |
||
| 6358 | 6358 | } |
| 6359 | 6359 | |
| 6360 | 6360 | return ((string) self::substr($str, 0, $index, $encoding)) . |
| 6361 | - $substring . |
|
| 6362 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
| 6361 | + $substring . |
|
| 6362 | + ((string) self::substr($str, $index, $len, $encoding)); |
|
| 6363 | 6363 | } |
| 6364 | 6364 | |
| 6365 | 6365 | /** |
@@ -8532,11 +8532,11 @@ discard block |
||
| 8532 | 8532 | if ($use_mb_functions) { |
| 8533 | 8533 | if ($encoding === 'UTF-8') { |
| 8534 | 8534 | return \mb_strtoupper(\mb_substr($match[0], 0, 1)) |
| 8535 | - . \mb_strtolower(\mb_substr($match[0], 1)); |
|
| 8535 | + . \mb_strtolower(\mb_substr($match[0], 1)); |
|
| 8536 | 8536 | } |
| 8537 | 8537 | |
| 8538 | 8538 | return \mb_strtoupper(\mb_substr($match[0], 0, 1, $encoding), $encoding) |
| 8539 | - . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
| 8539 | + . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
| 8540 | 8540 | } |
| 8541 | 8541 | |
| 8542 | 8542 | return self::ucfirst( |
@@ -8938,13 +8938,13 @@ discard block |
||
| 8938 | 8938 | } |
| 8939 | 8939 | |
| 8940 | 8940 | return ( |
| 8941 | - (string) self::substr( |
|
| 8942 | - $str, |
|
| 8943 | - 0, |
|
| 8944 | - $length, |
|
| 8945 | - $encoding |
|
| 8946 | - ) |
|
| 8947 | - ) . $substring; |
|
| 8941 | + (string) self::substr( |
|
| 8942 | + $str, |
|
| 8943 | + 0, |
|
| 8944 | + $length, |
|
| 8945 | + $encoding |
|
| 8946 | + ) |
|
| 8947 | + ) . $substring; |
|
| 8948 | 8948 | } |
| 8949 | 8949 | |
| 8950 | 8950 | /** |
@@ -11979,8 +11979,8 @@ discard block |
||
| 11979 | 11979 | |
| 11980 | 11980 | /** @noinspection AdditionOperationOnArraysInspection */ |
| 11981 | 11981 | return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
| 11982 | - $replacement . |
|
| 11983 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 11982 | + $replacement . |
|
| 11983 | + ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 11984 | 11984 | } |
| 11985 | 11985 | |
| 11986 | 11986 | // |
@@ -271,10 +271,10 @@ discard block |
||
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | if ($encoding === 'UTF-8') { |
| 274 | - return (string) \mb_substr($str, $pos, 1); |
|
| 274 | + return (string)\mb_substr($str, $pos, 1); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
| 277 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | /** |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | public static function add_bom_to_string(string $str): string |
| 295 | 295 | { |
| 296 | 296 | if (!self::string_has_bom($str)) { |
| 297 | - $str = self::bom() . $str; |
|
| 297 | + $str = self::bom().$str; |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | return $str; |
@@ -329,8 +329,8 @@ discard block |
||
| 329 | 329 | $return = []; |
| 330 | 330 | foreach ($array as $key => &$value) { |
| 331 | 331 | $key = $case === \CASE_LOWER |
| 332 | - ? self::strtolower((string) $key, $encoding) |
|
| 333 | - : self::strtoupper((string) $key, $encoding); |
|
| 332 | + ? self::strtolower((string)$key, $encoding) |
|
| 333 | + : self::strtoupper((string)$key, $encoding); |
|
| 334 | 334 | |
| 335 | 335 | $return[$key] = $value; |
| 336 | 336 | } |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | return ''; |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
| 369 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
| 370 | 370 | $end_position = \mb_strpos($str, $end, $substr_index); |
| 371 | 371 | if ( |
| 372 | 372 | $end_position === false |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | return ''; |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
| 379 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | return ''; |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
| 389 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
| 390 | 390 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
| 391 | 391 | if ( |
| 392 | 392 | $end_position === false |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | return ''; |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | - return (string) self::substr( |
|
| 399 | + return (string)self::substr( |
|
| 400 | 400 | $str, |
| 401 | 401 | $substr_index, |
| 402 | 402 | $end_position - $substr_index, |
@@ -480,10 +480,10 @@ discard block |
||
| 480 | 480 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
| 481 | 481 | { |
| 482 | 482 | if ($encoding === 'UTF-8') { |
| 483 | - return (string) \mb_substr($str, $index, 1); |
|
| 483 | + return (string)\mb_substr($str, $index, 1); |
|
| 484 | 484 | } |
| 485 | 485 | |
| 486 | - return (string) self::substr($str, $index, 1, $encoding); |
|
| 486 | + return (string)self::substr($str, $index, 1, $encoding); |
|
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | /** |
@@ -600,14 +600,14 @@ discard block |
||
| 600 | 600 | /** |
| 601 | 601 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 602 | 602 | */ |
| 603 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 603 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | if ($code_point <= 0) { |
| 607 | 607 | return null; |
| 608 | 608 | } |
| 609 | 609 | |
| 610 | - $cache_key = $code_point . '_' . $encoding; |
|
| 610 | + $cache_key = $code_point.'_'.$encoding; |
|
| 611 | 611 | if (isset($CHAR_CACHE[$cache_key])) { |
| 612 | 612 | return $CHAR_CACHE[$cache_key]; |
| 613 | 613 | } |
@@ -653,27 +653,27 @@ discard block |
||
| 653 | 653 | self::$CHR = self::getData('chr'); |
| 654 | 654 | } |
| 655 | 655 | |
| 656 | - $code_point = (int) $code_point; |
|
| 656 | + $code_point = (int)$code_point; |
|
| 657 | 657 | if ($code_point <= 0x7FF) { |
| 658 | 658 | /** |
| 659 | 659 | * @psalm-suppress PossiblyNullArrayAccess |
| 660 | 660 | */ |
| 661 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
| 661 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
| 662 | 662 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 663 | 663 | } elseif ($code_point <= 0xFFFF) { |
| 664 | 664 | /** |
| 665 | 665 | * @psalm-suppress PossiblyNullArrayAccess |
| 666 | 666 | */ |
| 667 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
| 668 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 667 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
| 668 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 669 | 669 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 670 | 670 | } else { |
| 671 | 671 | /** |
| 672 | 672 | * @psalm-suppress PossiblyNullArrayAccess |
| 673 | 673 | */ |
| 674 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
| 675 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 676 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 674 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
| 675 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
| 676 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 677 | 677 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 678 | 678 | } |
| 679 | 679 | |
@@ -730,7 +730,7 @@ discard block |
||
| 730 | 730 | |
| 731 | 731 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
| 732 | 732 | return \array_map( |
| 733 | - static function (string $data): int { |
|
| 733 | + static function(string $data): int { |
|
| 734 | 734 | // "mb_" is available if overload is used, so use it ... |
| 735 | 735 | return \mb_strlen($data, 'CP850'); // 8-BIT |
| 736 | 736 | }, |
@@ -817,7 +817,7 @@ discard block |
||
| 817 | 817 | $char = ''; |
| 818 | 818 | } |
| 819 | 819 | |
| 820 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
| 820 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
| 821 | 821 | } |
| 822 | 822 | |
| 823 | 823 | /** |
@@ -914,7 +914,7 @@ discard block |
||
| 914 | 914 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
| 915 | 915 | /x'; |
| 916 | 916 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
| 917 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
| 917 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
| 918 | 918 | |
| 919 | 919 | if ($replace_diamond_question_mark) { |
| 920 | 920 | $str = self::replace_diamond_question_mark($str); |
@@ -953,7 +953,7 @@ discard block |
||
| 953 | 953 | public static function cleanup($str): string |
| 954 | 954 | { |
| 955 | 955 | // init |
| 956 | - $str = (string) $str; |
|
| 956 | + $str = (string)$str; |
|
| 957 | 957 | |
| 958 | 958 | if ($str === '') { |
| 959 | 959 | return ''; |
@@ -1055,7 +1055,7 @@ discard block |
||
| 1055 | 1055 | { |
| 1056 | 1056 | if (self::$SUPPORT['mbstring'] === true) { |
| 1057 | 1057 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 1058 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 1058 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 1059 | 1059 | } |
| 1060 | 1060 | |
| 1061 | 1061 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -1160,9 +1160,9 @@ discard block |
||
| 1160 | 1160 | // - 0-9 (U+0061 - U+007A) |
| 1161 | 1161 | // - ISO 10646 characters U+00A1 and higher |
| 1162 | 1162 | // We strip out any character not in the above list. |
| 1163 | - $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); |
|
| 1163 | + $str = (string)\preg_replace('/[^\x{002D}\x{0030}-\x{0039}\x{0041}-\x{005A}\x{005F}\x{0061}-\x{007A}\x{00A1}-\x{FFFF}]/u', '', $str); |
|
| 1164 | 1164 | // Identifiers cannot start with a digit, two hyphens, or a hyphen followed by a digit. |
| 1165 | - $str = (string) \preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
| 1165 | + $str = (string)\preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
| 1166 | 1166 | |
| 1167 | 1167 | return \trim($str, '-'); |
| 1168 | 1168 | } |
@@ -1178,7 +1178,7 @@ discard block |
||
| 1178 | 1178 | */ |
| 1179 | 1179 | public static function css_stripe_media_queries(string $str): string |
| 1180 | 1180 | { |
| 1181 | - return (string) \preg_replace( |
|
| 1181 | + return (string)\preg_replace( |
|
| 1182 | 1182 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
| 1183 | 1183 | '', |
| 1184 | 1184 | $str |
@@ -1217,7 +1217,7 @@ discard block |
||
| 1217 | 1217 | */ |
| 1218 | 1218 | public static function decimal_to_chr($int): string |
| 1219 | 1219 | { |
| 1220 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
| 1220 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
| 1221 | 1221 | } |
| 1222 | 1222 | |
| 1223 | 1223 | /** |
@@ -1267,7 +1267,7 @@ discard block |
||
| 1267 | 1267 | $flagOffset = 0x1F1E6; |
| 1268 | 1268 | $asciiOffset = 0x41; |
| 1269 | 1269 | |
| 1270 | - return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? '') . |
|
| 1270 | + return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? ''). |
|
| 1271 | 1271 | (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
| 1272 | 1272 | } |
| 1273 | 1273 | |
@@ -1298,16 +1298,16 @@ discard block |
||
| 1298 | 1298 | self::initEmojiData(); |
| 1299 | 1299 | |
| 1300 | 1300 | if ($use_reversible_string_mappings) { |
| 1301 | - return (string) \str_replace( |
|
| 1302 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1303 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1301 | + return (string)\str_replace( |
|
| 1302 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1303 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1304 | 1304 | $str |
| 1305 | 1305 | ); |
| 1306 | 1306 | } |
| 1307 | 1307 | |
| 1308 | - return (string) \str_replace( |
|
| 1309 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 1310 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1308 | + return (string)\str_replace( |
|
| 1309 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 1310 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1311 | 1311 | $str |
| 1312 | 1312 | ); |
| 1313 | 1313 | } |
@@ -1339,16 +1339,16 @@ discard block |
||
| 1339 | 1339 | self::initEmojiData(); |
| 1340 | 1340 | |
| 1341 | 1341 | if ($use_reversible_string_mappings) { |
| 1342 | - return (string) \str_replace( |
|
| 1343 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1344 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1342 | + return (string)\str_replace( |
|
| 1343 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1344 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1345 | 1345 | $str |
| 1346 | 1346 | ); |
| 1347 | 1347 | } |
| 1348 | 1348 | |
| 1349 | - return (string) \str_replace( |
|
| 1350 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1351 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 1349 | + return (string)\str_replace( |
|
| 1350 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1351 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 1352 | 1352 | $str |
| 1353 | 1353 | ); |
| 1354 | 1354 | } |
@@ -1414,7 +1414,7 @@ discard block |
||
| 1414 | 1414 | if ($to_encoding === 'JSON') { |
| 1415 | 1415 | $return = self::json_encode($str); |
| 1416 | 1416 | if ($return === false) { |
| 1417 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
| 1417 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
| 1418 | 1418 | } |
| 1419 | 1419 | |
| 1420 | 1420 | return $return; |
@@ -1505,7 +1505,7 @@ discard block |
||
| 1505 | 1505 | /** |
| 1506 | 1506 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 1507 | 1507 | */ |
| 1508 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
| 1508 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
| 1509 | 1509 | } |
| 1510 | 1510 | |
| 1511 | 1511 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1607,31 +1607,31 @@ discard block |
||
| 1607 | 1607 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
| 1608 | 1608 | |
| 1609 | 1609 | if ($length === null) { |
| 1610 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2); |
|
| 1610 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2); |
|
| 1611 | 1611 | } |
| 1612 | 1612 | |
| 1613 | 1613 | if ($search === '') { |
| 1614 | 1614 | if ($encoding === 'UTF-8') { |
| 1615 | 1615 | if ($length > 0) { |
| 1616 | - $string_length = (int) \mb_strlen($str); |
|
| 1616 | + $string_length = (int)\mb_strlen($str); |
|
| 1617 | 1617 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
| 1618 | 1618 | } else { |
| 1619 | 1619 | $end = 0; |
| 1620 | 1620 | } |
| 1621 | 1621 | |
| 1622 | - $pos = (int) \min( |
|
| 1622 | + $pos = (int)\min( |
|
| 1623 | 1623 | \mb_strpos($str, ' ', $end), |
| 1624 | 1624 | \mb_strpos($str, '.', $end) |
| 1625 | 1625 | ); |
| 1626 | 1626 | } else { |
| 1627 | 1627 | if ($length > 0) { |
| 1628 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 1628 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 1629 | 1629 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
| 1630 | 1630 | } else { |
| 1631 | 1631 | $end = 0; |
| 1632 | 1632 | } |
| 1633 | 1633 | |
| 1634 | - $pos = (int) \min( |
|
| 1634 | + $pos = (int)\min( |
|
| 1635 | 1635 | self::strpos($str, ' ', $end, $encoding), |
| 1636 | 1636 | self::strpos($str, '.', $end, $encoding) |
| 1637 | 1637 | ); |
@@ -1648,18 +1648,18 @@ discard block |
||
| 1648 | 1648 | return ''; |
| 1649 | 1649 | } |
| 1650 | 1650 | |
| 1651 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1651 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1652 | 1652 | } |
| 1653 | 1653 | |
| 1654 | 1654 | return $str; |
| 1655 | 1655 | } |
| 1656 | 1656 | |
| 1657 | 1657 | if ($encoding === 'UTF-8') { |
| 1658 | - $word_position = (int) \mb_stripos($str, $search); |
|
| 1659 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
| 1658 | + $word_position = (int)\mb_stripos($str, $search); |
|
| 1659 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
| 1660 | 1660 | } else { |
| 1661 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
| 1662 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
| 1661 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
| 1662 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
| 1663 | 1663 | } |
| 1664 | 1664 | |
| 1665 | 1665 | $pos_start = 0; |
@@ -1671,12 +1671,12 @@ discard block |
||
| 1671 | 1671 | } |
| 1672 | 1672 | if ($half_text !== false) { |
| 1673 | 1673 | if ($encoding === 'UTF-8') { |
| 1674 | - $pos_start = (int) \max( |
|
| 1674 | + $pos_start = (int)\max( |
|
| 1675 | 1675 | \mb_strrpos($half_text, ' '), |
| 1676 | 1676 | \mb_strrpos($half_text, '.') |
| 1677 | 1677 | ); |
| 1678 | 1678 | } else { |
| 1679 | - $pos_start = (int) \max( |
|
| 1679 | + $pos_start = (int)\max( |
|
| 1680 | 1680 | self::strrpos($half_text, ' ', 0, $encoding), |
| 1681 | 1681 | self::strrpos($half_text, '.', 0, $encoding) |
| 1682 | 1682 | ); |
@@ -1686,19 +1686,19 @@ discard block |
||
| 1686 | 1686 | |
| 1687 | 1687 | if ($word_position && $half_side > 0) { |
| 1688 | 1688 | $offset = $pos_start + $length - 1; |
| 1689 | - $real_length = (int) self::strlen($str, $encoding); |
|
| 1689 | + $real_length = (int)self::strlen($str, $encoding); |
|
| 1690 | 1690 | |
| 1691 | 1691 | if ($offset > $real_length) { |
| 1692 | 1692 | $offset = $real_length; |
| 1693 | 1693 | } |
| 1694 | 1694 | |
| 1695 | 1695 | if ($encoding === 'UTF-8') { |
| 1696 | - $pos_end = (int) \min( |
|
| 1696 | + $pos_end = (int)\min( |
|
| 1697 | 1697 | \mb_strpos($str, ' ', $offset), |
| 1698 | 1698 | \mb_strpos($str, '.', $offset) |
| 1699 | 1699 | ) - $pos_start; |
| 1700 | 1700 | } else { |
| 1701 | - $pos_end = (int) \min( |
|
| 1701 | + $pos_end = (int)\min( |
|
| 1702 | 1702 | self::strpos($str, ' ', $offset, $encoding), |
| 1703 | 1703 | self::strpos($str, '.', $offset, $encoding) |
| 1704 | 1704 | ) - $pos_start; |
@@ -1706,12 +1706,12 @@ discard block |
||
| 1706 | 1706 | |
| 1707 | 1707 | if (!$pos_end || $pos_end <= 0) { |
| 1708 | 1708 | if ($encoding === 'UTF-8') { |
| 1709 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
| 1709 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
| 1710 | 1710 | } else { |
| 1711 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
| 1711 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
| 1712 | 1712 | } |
| 1713 | 1713 | if ($str_sub !== false) { |
| 1714 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
| 1714 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
| 1715 | 1715 | } else { |
| 1716 | 1716 | $extract = ''; |
| 1717 | 1717 | } |
@@ -1722,26 +1722,26 @@ discard block |
||
| 1722 | 1722 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
| 1723 | 1723 | } |
| 1724 | 1724 | if ($str_sub !== false) { |
| 1725 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1725 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1726 | 1726 | } else { |
| 1727 | 1727 | $extract = ''; |
| 1728 | 1728 | } |
| 1729 | 1729 | } |
| 1730 | 1730 | } else { |
| 1731 | 1731 | $offset = $length - 1; |
| 1732 | - $true_length = (int) self::strlen($str, $encoding); |
|
| 1732 | + $true_length = (int)self::strlen($str, $encoding); |
|
| 1733 | 1733 | |
| 1734 | 1734 | if ($offset > $true_length) { |
| 1735 | 1735 | $offset = $true_length; |
| 1736 | 1736 | } |
| 1737 | 1737 | |
| 1738 | 1738 | if ($encoding === 'UTF-8') { |
| 1739 | - $pos_end = (int) \min( |
|
| 1739 | + $pos_end = (int)\min( |
|
| 1740 | 1740 | \mb_strpos($str, ' ', $offset), |
| 1741 | 1741 | \mb_strpos($str, '.', $offset) |
| 1742 | 1742 | ); |
| 1743 | 1743 | } else { |
| 1744 | - $pos_end = (int) \min( |
|
| 1744 | + $pos_end = (int)\min( |
|
| 1745 | 1745 | self::strpos($str, ' ', $offset, $encoding), |
| 1746 | 1746 | self::strpos($str, '.', $offset, $encoding) |
| 1747 | 1747 | ); |
@@ -1754,7 +1754,7 @@ discard block |
||
| 1754 | 1754 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
| 1755 | 1755 | } |
| 1756 | 1756 | if ($str_sub !== false) { |
| 1757 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1757 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1758 | 1758 | } else { |
| 1759 | 1759 | $extract = ''; |
| 1760 | 1760 | } |
@@ -1887,7 +1887,7 @@ discard block |
||
| 1887 | 1887 | { |
| 1888 | 1888 | $file_content = \file_get_contents($file_path); |
| 1889 | 1889 | if ($file_content === false) { |
| 1890 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
| 1890 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
| 1891 | 1891 | } |
| 1892 | 1892 | |
| 1893 | 1893 | return self::string_has_bom($file_content); |
@@ -1953,7 +1953,7 @@ discard block |
||
| 1953 | 1953 | ) { |
| 1954 | 1954 | // Prevent leading combining chars |
| 1955 | 1955 | // for NFC-safe concatenations. |
| 1956 | - $var = $leading_combining . $var; |
|
| 1956 | + $var = $leading_combining.$var; |
|
| 1957 | 1957 | } |
| 1958 | 1958 | } |
| 1959 | 1959 | |
@@ -2274,10 +2274,10 @@ discard block |
||
| 2274 | 2274 | } |
| 2275 | 2275 | |
| 2276 | 2276 | if ($encoding === 'UTF-8') { |
| 2277 | - return (string) \mb_substr($str, 0, $n); |
|
| 2277 | + return (string)\mb_substr($str, 0, $n); |
|
| 2278 | 2278 | } |
| 2279 | 2279 | |
| 2280 | - return (string) self::substr($str, 0, $n, $encoding); |
|
| 2280 | + return (string)self::substr($str, 0, $n, $encoding); |
|
| 2281 | 2281 | } |
| 2282 | 2282 | |
| 2283 | 2283 | /** |
@@ -2295,7 +2295,7 @@ discard block |
||
| 2295 | 2295 | */ |
| 2296 | 2296 | public static function fits_inside(string $str, int $box_size): bool |
| 2297 | 2297 | { |
| 2298 | - return (int) self::strlen($str) <= $box_size; |
|
| 2298 | + return (int)self::strlen($str) <= $box_size; |
|
| 2299 | 2299 | } |
| 2300 | 2300 | |
| 2301 | 2301 | /** |
@@ -2378,7 +2378,7 @@ discard block |
||
| 2378 | 2378 | return $str; |
| 2379 | 2379 | } |
| 2380 | 2380 | |
| 2381 | - $str = (string) $str; |
|
| 2381 | + $str = (string)$str; |
|
| 2382 | 2382 | $last = ''; |
| 2383 | 2383 | while ($last !== $str) { |
| 2384 | 2384 | $last = $str; |
@@ -2587,7 +2587,7 @@ discard block |
||
| 2587 | 2587 | return $fallback; |
| 2588 | 2588 | } |
| 2589 | 2589 | /** @noinspection OffsetOperationsInspection */ |
| 2590 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
| 2590 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
| 2591 | 2591 | |
| 2592 | 2592 | // DEBUG |
| 2593 | 2593 | //var_dump($type_code); |
@@ -2645,7 +2645,7 @@ discard block |
||
| 2645 | 2645 | // |
| 2646 | 2646 | |
| 2647 | 2647 | if ($encoding === 'UTF-8') { |
| 2648 | - $max_length = (int) \mb_strlen($possible_chars); |
|
| 2648 | + $max_length = (int)\mb_strlen($possible_chars); |
|
| 2649 | 2649 | if ($max_length === 0) { |
| 2650 | 2650 | return ''; |
| 2651 | 2651 | } |
@@ -2666,7 +2666,7 @@ discard block |
||
| 2666 | 2666 | } else { |
| 2667 | 2667 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 2668 | 2668 | |
| 2669 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
| 2669 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
| 2670 | 2670 | if ($max_length === 0) { |
| 2671 | 2671 | return ''; |
| 2672 | 2672 | } |
@@ -2704,16 +2704,16 @@ discard block |
||
| 2704 | 2704 | $rand_int = \mt_rand(0, \mt_getrandmax()); |
| 2705 | 2705 | } |
| 2706 | 2706 | |
| 2707 | - $unique_helper = $rand_int . |
|
| 2708 | - \session_id() . |
|
| 2709 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
| 2710 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
| 2707 | + $unique_helper = $rand_int. |
|
| 2708 | + \session_id(). |
|
| 2709 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
| 2710 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
| 2711 | 2711 | $extra_entropy; |
| 2712 | 2712 | |
| 2713 | 2713 | $unique_string = \uniqid($unique_helper, true); |
| 2714 | 2714 | |
| 2715 | 2715 | if ($use_md5) { |
| 2716 | - $unique_string = \md5($unique_string . $unique_helper); |
|
| 2716 | + $unique_string = \md5($unique_string.$unique_helper); |
|
| 2717 | 2717 | } |
| 2718 | 2718 | |
| 2719 | 2719 | return $unique_string; |
@@ -2812,7 +2812,7 @@ discard block |
||
| 2812 | 2812 | public static function hex_to_chr(string $hexdec) |
| 2813 | 2813 | { |
| 2814 | 2814 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Invalid characters passed for attempted conversion, these have been ignored */ |
| 2815 | - return self::decimal_to_chr((int) @\hexdec($hexdec)); |
|
| 2815 | + return self::decimal_to_chr((int)@\hexdec($hexdec)); |
|
| 2816 | 2816 | } |
| 2817 | 2817 | |
| 2818 | 2818 | /** |
@@ -2832,7 +2832,7 @@ discard block |
||
| 2832 | 2832 | public static function hex_to_int($hexdec) |
| 2833 | 2833 | { |
| 2834 | 2834 | // init |
| 2835 | - $hexdec = (string) $hexdec; |
|
| 2835 | + $hexdec = (string)$hexdec; |
|
| 2836 | 2836 | |
| 2837 | 2837 | if ($hexdec === '') { |
| 2838 | 2838 | return false; |
@@ -2931,7 +2931,7 @@ discard block |
||
| 2931 | 2931 | return \implode( |
| 2932 | 2932 | '', |
| 2933 | 2933 | \array_map( |
| 2934 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
| 2934 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
| 2935 | 2935 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
| 2936 | 2936 | }, |
| 2937 | 2937 | self::str_split($str) |
@@ -3046,7 +3046,7 @@ discard block |
||
| 3046 | 3046 | /** |
| 3047 | 3047 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 3048 | 3048 | */ |
| 3049 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 3049 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 3050 | 3050 | } |
| 3051 | 3051 | |
| 3052 | 3052 | do { |
@@ -3055,7 +3055,7 @@ discard block |
||
| 3055 | 3055 | if (\strpos($str, '&') !== false) { |
| 3056 | 3056 | if (\strpos($str, '&#') !== false) { |
| 3057 | 3057 | // decode also numeric & UTF16 two byte entities |
| 3058 | - $str = (string) \preg_replace( |
|
| 3058 | + $str = (string)\preg_replace( |
|
| 3059 | 3059 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
| 3060 | 3060 | '$1;', |
| 3061 | 3061 | $str |
@@ -3105,7 +3105,7 @@ discard block |
||
| 3105 | 3105 | */ |
| 3106 | 3106 | public static function html_stripe_empty_tags(string $str): string |
| 3107 | 3107 | { |
| 3108 | - return (string) \preg_replace( |
|
| 3108 | + return (string)\preg_replace( |
|
| 3109 | 3109 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
| 3110 | 3110 | '', |
| 3111 | 3111 | $str |
@@ -3435,9 +3435,9 @@ discard block |
||
| 3435 | 3435 | { |
| 3436 | 3436 | $hex = \dechex($int); |
| 3437 | 3437 | |
| 3438 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
| 3438 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
| 3439 | 3439 | |
| 3440 | - return $prefix . $hex . ''; |
|
| 3440 | + return $prefix.$hex.''; |
|
| 3441 | 3441 | } |
| 3442 | 3442 | |
| 3443 | 3443 | /** |
@@ -3765,7 +3765,7 @@ discard block |
||
| 3765 | 3765 | */ |
| 3766 | 3766 | public static function is_binary($input, bool $strict = false): bool |
| 3767 | 3767 | { |
| 3768 | - $input = (string) $input; |
|
| 3768 | + $input = (string)$input; |
|
| 3769 | 3769 | if ($input === '') { |
| 3770 | 3770 | return false; |
| 3771 | 3771 | } |
@@ -4125,7 +4125,7 @@ discard block |
||
| 4125 | 4125 | public static function is_utf16($str, bool $check_if_string_is_binary = true) |
| 4126 | 4126 | { |
| 4127 | 4127 | // init |
| 4128 | - $str = (string) $str; |
|
| 4128 | + $str = (string)$str; |
|
| 4129 | 4129 | $str_chars = []; |
| 4130 | 4130 | |
| 4131 | 4131 | if ( |
@@ -4219,7 +4219,7 @@ discard block |
||
| 4219 | 4219 | public static function is_utf32($str, bool $check_if_string_is_binary = true) |
| 4220 | 4220 | { |
| 4221 | 4221 | // init |
| 4222 | - $str = (string) $str; |
|
| 4222 | + $str = (string)$str; |
|
| 4223 | 4223 | $str_chars = []; |
| 4224 | 4224 | |
| 4225 | 4225 | if ( |
@@ -4317,7 +4317,7 @@ discard block |
||
| 4317 | 4317 | return true; |
| 4318 | 4318 | } |
| 4319 | 4319 | |
| 4320 | - return self::is_utf8_string((string) $str, $strict); |
|
| 4320 | + return self::is_utf8_string((string)$str, $strict); |
|
| 4321 | 4321 | } |
| 4322 | 4322 | |
| 4323 | 4323 | /** |
@@ -4475,15 +4475,15 @@ discard block |
||
| 4475 | 4475 | $use_mb_functions = ($lang === null && !$try_to_keep_the_string_length); |
| 4476 | 4476 | |
| 4477 | 4477 | if ($encoding === 'UTF-8') { |
| 4478 | - $str_part_two = (string) \mb_substr($str, 1); |
|
| 4478 | + $str_part_two = (string)\mb_substr($str, 1); |
|
| 4479 | 4479 | |
| 4480 | 4480 | if ($use_mb_functions) { |
| 4481 | 4481 | $str_part_one = \mb_strtolower( |
| 4482 | - (string) \mb_substr($str, 0, 1) |
|
| 4482 | + (string)\mb_substr($str, 0, 1) |
|
| 4483 | 4483 | ); |
| 4484 | 4484 | } else { |
| 4485 | 4485 | $str_part_one = self::strtolower( |
| 4486 | - (string) \mb_substr($str, 0, 1), |
|
| 4486 | + (string)\mb_substr($str, 0, 1), |
|
| 4487 | 4487 | $encoding, |
| 4488 | 4488 | false, |
| 4489 | 4489 | $lang, |
@@ -4493,10 +4493,10 @@ discard block |
||
| 4493 | 4493 | } else { |
| 4494 | 4494 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4495 | 4495 | |
| 4496 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
| 4496 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
| 4497 | 4497 | |
| 4498 | 4498 | $str_part_one = self::strtolower( |
| 4499 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 4499 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 4500 | 4500 | $encoding, |
| 4501 | 4501 | false, |
| 4502 | 4502 | $lang, |
@@ -4504,7 +4504,7 @@ discard block |
||
| 4504 | 4504 | ); |
| 4505 | 4505 | } |
| 4506 | 4506 | |
| 4507 | - return $str_part_one . $str_part_two; |
|
| 4507 | + return $str_part_one.$str_part_two; |
|
| 4508 | 4508 | } |
| 4509 | 4509 | |
| 4510 | 4510 | /** |
@@ -4653,7 +4653,7 @@ discard block |
||
| 4653 | 4653 | } |
| 4654 | 4654 | |
| 4655 | 4655 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4656 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 4656 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 4657 | 4657 | } |
| 4658 | 4658 | |
| 4659 | 4659 | if ($chars !== null) { |
@@ -4690,7 +4690,7 @@ discard block |
||
| 4690 | 4690 | |
| 4691 | 4691 | $codepoint_max = \max($codepoints); |
| 4692 | 4692 | |
| 4693 | - return self::chr((int) $codepoint_max); |
|
| 4693 | + return self::chr((int)$codepoint_max); |
|
| 4694 | 4694 | } |
| 4695 | 4695 | |
| 4696 | 4696 | /** |
@@ -4710,7 +4710,7 @@ discard block |
||
| 4710 | 4710 | { |
| 4711 | 4711 | $bytes = self::chr_size_list($str); |
| 4712 | 4712 | if ($bytes !== []) { |
| 4713 | - return (int) \max($bytes); |
|
| 4713 | + return (int)\max($bytes); |
|
| 4714 | 4714 | } |
| 4715 | 4715 | |
| 4716 | 4716 | return 0; |
@@ -4756,7 +4756,7 @@ discard block |
||
| 4756 | 4756 | |
| 4757 | 4757 | $codepoint_min = \min($codepoints); |
| 4758 | 4758 | |
| 4759 | - return self::chr((int) $codepoint_min); |
|
| 4759 | + return self::chr((int)$codepoint_min); |
|
| 4760 | 4760 | } |
| 4761 | 4761 | |
| 4762 | 4762 | /** |
@@ -4804,7 +4804,7 @@ discard block |
||
| 4804 | 4804 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
| 4805 | 4805 | |
| 4806 | 4806 | // init |
| 4807 | - $encoding = (string) $encoding; |
|
| 4807 | + $encoding = (string)$encoding; |
|
| 4808 | 4808 | |
| 4809 | 4809 | if (!$encoding) { |
| 4810 | 4810 | return $fallback; |
@@ -4866,7 +4866,7 @@ discard block |
||
| 4866 | 4866 | |
| 4867 | 4867 | $encoding_original = $encoding; |
| 4868 | 4868 | $encoding = \strtoupper($encoding); |
| 4869 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
| 4869 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
| 4870 | 4870 | |
| 4871 | 4871 | $equivalences = [ |
| 4872 | 4872 | 'ISO8859' => 'ISO-8859-1', |
@@ -5030,13 +5030,13 @@ discard block |
||
| 5030 | 5030 | static $CHAR_CACHE = []; |
| 5031 | 5031 | |
| 5032 | 5032 | // init |
| 5033 | - $chr = (string) $chr; |
|
| 5033 | + $chr = (string)$chr; |
|
| 5034 | 5034 | |
| 5035 | 5035 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
| 5036 | 5036 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5037 | 5037 | } |
| 5038 | 5038 | |
| 5039 | - $cache_key = $chr . '_' . $encoding; |
|
| 5039 | + $cache_key = $chr.'_'.$encoding; |
|
| 5040 | 5040 | if (isset($CHAR_CACHE[$cache_key])) { |
| 5041 | 5041 | return $CHAR_CACHE[$cache_key]; |
| 5042 | 5042 | } |
@@ -5071,7 +5071,7 @@ discard block |
||
| 5071 | 5071 | // |
| 5072 | 5072 | |
| 5073 | 5073 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 5074 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
| 5074 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
| 5075 | 5075 | /** @noinspection OffsetOperationsInspection */ |
| 5076 | 5076 | $code = $chr ? $chr[1] : 0; |
| 5077 | 5077 | |
@@ -5079,21 +5079,21 @@ discard block |
||
| 5079 | 5079 | if ($code >= 0xF0 && isset($chr[4])) { |
| 5080 | 5080 | /** @noinspection UnnecessaryCastingInspection */ |
| 5081 | 5081 | /** @noinspection OffsetOperationsInspection */ |
| 5082 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 5082 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 5083 | 5083 | } |
| 5084 | 5084 | |
| 5085 | 5085 | /** @noinspection OffsetOperationsInspection */ |
| 5086 | 5086 | if ($code >= 0xE0 && isset($chr[3])) { |
| 5087 | 5087 | /** @noinspection UnnecessaryCastingInspection */ |
| 5088 | 5088 | /** @noinspection OffsetOperationsInspection */ |
| 5089 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 5089 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 5090 | 5090 | } |
| 5091 | 5091 | |
| 5092 | 5092 | /** @noinspection OffsetOperationsInspection */ |
| 5093 | 5093 | if ($code >= 0xC0 && isset($chr[2])) { |
| 5094 | 5094 | /** @noinspection UnnecessaryCastingInspection */ |
| 5095 | 5095 | /** @noinspection OffsetOperationsInspection */ |
| 5096 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 5096 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 5097 | 5097 | } |
| 5098 | 5098 | |
| 5099 | 5099 | return $CHAR_CACHE[$cache_key] = $code; |
@@ -5155,7 +5155,7 @@ discard block |
||
| 5155 | 5155 | public static function pcre_utf8_support(): bool |
| 5156 | 5156 | { |
| 5157 | 5157 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 5158 | - return (bool) @\preg_match('//u', ''); |
|
| 5158 | + return (bool)@\preg_match('//u', ''); |
|
| 5159 | 5159 | } |
| 5160 | 5160 | |
| 5161 | 5161 | /** |
@@ -5196,14 +5196,14 @@ discard block |
||
| 5196 | 5196 | * @psalm-suppress DocblockTypeContradiction |
| 5197 | 5197 | */ |
| 5198 | 5198 | if (!\is_numeric($step)) { |
| 5199 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
| 5199 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
| 5200 | 5200 | } |
| 5201 | 5201 | |
| 5202 | 5202 | /** |
| 5203 | 5203 | * @psalm-suppress RedundantConditionGivenDocblockType - false-positive from psalm? |
| 5204 | 5204 | */ |
| 5205 | 5205 | if ($step <= 0) { |
| 5206 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
| 5206 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
| 5207 | 5207 | } |
| 5208 | 5208 | } |
| 5209 | 5209 | |
@@ -5215,16 +5215,16 @@ discard block |
||
| 5215 | 5215 | $is_xdigit = false; |
| 5216 | 5216 | |
| 5217 | 5217 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5218 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
| 5218 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
| 5219 | 5219 | $is_digit = true; |
| 5220 | - $start = (int) $var1; |
|
| 5220 | + $start = (int)$var1; |
|
| 5221 | 5221 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
| 5222 | 5222 | $is_xdigit = true; |
| 5223 | - $start = (int) self::hex_to_int((string) $var1); |
|
| 5223 | + $start = (int)self::hex_to_int((string)$var1); |
|
| 5224 | 5224 | } elseif (!$use_ctype && \is_numeric($var1)) { |
| 5225 | - $start = (int) $var1; |
|
| 5225 | + $start = (int)$var1; |
|
| 5226 | 5226 | } else { |
| 5227 | - $start = self::ord((string) $var1); |
|
| 5227 | + $start = self::ord((string)$var1); |
|
| 5228 | 5228 | } |
| 5229 | 5229 | |
| 5230 | 5230 | if (!$start) { |
@@ -5232,13 +5232,13 @@ discard block |
||
| 5232 | 5232 | } |
| 5233 | 5233 | |
| 5234 | 5234 | if ($is_digit) { |
| 5235 | - $end = (int) $var2; |
|
| 5235 | + $end = (int)$var2; |
|
| 5236 | 5236 | } elseif ($is_xdigit) { |
| 5237 | - $end = (int) self::hex_to_int((string) $var2); |
|
| 5237 | + $end = (int)self::hex_to_int((string)$var2); |
|
| 5238 | 5238 | } elseif (!$use_ctype && \is_numeric($var2)) { |
| 5239 | - $end = (int) $var2; |
|
| 5239 | + $end = (int)$var2; |
|
| 5240 | 5240 | } else { |
| 5241 | - $end = self::ord((string) $var2); |
|
| 5241 | + $end = self::ord((string)$var2); |
|
| 5242 | 5242 | } |
| 5243 | 5243 | |
| 5244 | 5244 | if (!$end) { |
@@ -5247,7 +5247,7 @@ discard block |
||
| 5247 | 5247 | |
| 5248 | 5248 | $array = []; |
| 5249 | 5249 | foreach (\range($start, $end, $step) as $i) { |
| 5250 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
| 5250 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
| 5251 | 5251 | } |
| 5252 | 5252 | |
| 5253 | 5253 | return $array; |
@@ -5359,8 +5359,8 @@ discard block |
||
| 5359 | 5359 | $delimiter = '/'; |
| 5360 | 5360 | } |
| 5361 | 5361 | |
| 5362 | - return (string) \preg_replace( |
|
| 5363 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
| 5362 | + return (string)\preg_replace( |
|
| 5363 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
| 5364 | 5364 | $replacement, |
| 5365 | 5365 | $str |
| 5366 | 5366 | ); |
@@ -5410,9 +5410,9 @@ discard block |
||
| 5410 | 5410 | return ''; |
| 5411 | 5411 | } |
| 5412 | 5412 | |
| 5413 | - $str_length -= (int) $bom_byte_length; |
|
| 5413 | + $str_length -= (int)$bom_byte_length; |
|
| 5414 | 5414 | |
| 5415 | - $str = (string) $str_tmp; |
|
| 5415 | + $str = (string)$str_tmp; |
|
| 5416 | 5416 | } |
| 5417 | 5417 | } |
| 5418 | 5418 | |
@@ -5443,7 +5443,7 @@ discard block |
||
| 5443 | 5443 | */ |
| 5444 | 5444 | if (\is_array($what)) { |
| 5445 | 5445 | foreach ($what as $item) { |
| 5446 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
| 5446 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
| 5447 | 5447 | } |
| 5448 | 5448 | } |
| 5449 | 5449 | |
@@ -5481,7 +5481,7 @@ discard block |
||
| 5481 | 5481 | */ |
| 5482 | 5482 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
| 5483 | 5483 | { |
| 5484 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 5484 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 5485 | 5485 | } |
| 5486 | 5486 | |
| 5487 | 5487 | /** |
@@ -5538,17 +5538,17 @@ discard block |
||
| 5538 | 5538 | ): string { |
| 5539 | 5539 | if ($substring && \strpos($str, $substring) === 0) { |
| 5540 | 5540 | if ($encoding === 'UTF-8') { |
| 5541 | - return (string) \mb_substr( |
|
| 5541 | + return (string)\mb_substr( |
|
| 5542 | 5542 | $str, |
| 5543 | - (int) \mb_strlen($substring) |
|
| 5543 | + (int)\mb_strlen($substring) |
|
| 5544 | 5544 | ); |
| 5545 | 5545 | } |
| 5546 | 5546 | |
| 5547 | 5547 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5548 | 5548 | |
| 5549 | - return (string) self::substr( |
|
| 5549 | + return (string)self::substr( |
|
| 5550 | 5550 | $str, |
| 5551 | - (int) self::strlen($substring, $encoding), |
|
| 5551 | + (int)self::strlen($substring, $encoding), |
|
| 5552 | 5552 | null, |
| 5553 | 5553 | $encoding |
| 5554 | 5554 | ); |
@@ -5576,19 +5576,19 @@ discard block |
||
| 5576 | 5576 | ): string { |
| 5577 | 5577 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
| 5578 | 5578 | if ($encoding === 'UTF-8') { |
| 5579 | - return (string) \mb_substr( |
|
| 5579 | + return (string)\mb_substr( |
|
| 5580 | 5580 | $str, |
| 5581 | 5581 | 0, |
| 5582 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
| 5582 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
| 5583 | 5583 | ); |
| 5584 | 5584 | } |
| 5585 | 5585 | |
| 5586 | 5586 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5587 | 5587 | |
| 5588 | - return (string) self::substr( |
|
| 5588 | + return (string)self::substr( |
|
| 5589 | 5589 | $str, |
| 5590 | 5590 | 0, |
| 5591 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
| 5591 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
| 5592 | 5592 | $encoding |
| 5593 | 5593 | ); |
| 5594 | 5594 | } |
@@ -5690,7 +5690,7 @@ discard block |
||
| 5690 | 5690 | /** @noinspection PhpUsageOfSilenceOperatorInspection - ignore "Unknown character" warnings, it's working anyway */ |
| 5691 | 5691 | @\mb_substitute_character($replacement_char_helper); |
| 5692 | 5692 | // the polyfill maybe return false, so cast to string |
| 5693 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 5693 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 5694 | 5694 | \mb_substitute_character($save); |
| 5695 | 5695 | } |
| 5696 | 5696 | |
@@ -5736,7 +5736,7 @@ discard block |
||
| 5736 | 5736 | } |
| 5737 | 5737 | |
| 5738 | 5738 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5739 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 5739 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 5740 | 5740 | } |
| 5741 | 5741 | |
| 5742 | 5742 | if ($chars !== null) { |
@@ -5766,7 +5766,7 @@ discard block |
||
| 5766 | 5766 | $html .= '<pre>'; |
| 5767 | 5767 | /** @noinspection AlterInForeachInspection */ |
| 5768 | 5768 | foreach (self::$SUPPORT as $key => &$value) { |
| 5769 | - $html .= $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
| 5769 | + $html .= $key.' - '.\print_r($value, true)."\n<br>"; |
|
| 5770 | 5770 | } |
| 5771 | 5771 | $html .= '</pre>'; |
| 5772 | 5772 | |
@@ -5808,7 +5808,7 @@ discard block |
||
| 5808 | 5808 | return $char; |
| 5809 | 5809 | } |
| 5810 | 5810 | |
| 5811 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
| 5811 | + return '&#'.self::ord($char, $encoding).';'; |
|
| 5812 | 5812 | } |
| 5813 | 5813 | |
| 5814 | 5814 | /** |
@@ -5912,11 +5912,11 @@ discard block |
||
| 5912 | 5912 | $lang, |
| 5913 | 5913 | $try_to_keep_the_string_length |
| 5914 | 5914 | ); |
| 5915 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
| 5915 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
| 5916 | 5916 | |
| 5917 | 5917 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 5918 | 5918 | |
| 5919 | - $str = (string) \preg_replace_callback( |
|
| 5919 | + $str = (string)\preg_replace_callback( |
|
| 5920 | 5920 | '/[-_\\s]+(.)?/u', |
| 5921 | 5921 | /** |
| 5922 | 5922 | * @param array $match |
@@ -5925,7 +5925,7 @@ discard block |
||
| 5925 | 5925 | * |
| 5926 | 5926 | * @return string |
| 5927 | 5927 | */ |
| 5928 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
| 5928 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
| 5929 | 5929 | if (isset($match[1])) { |
| 5930 | 5930 | if ($use_mb_functions) { |
| 5931 | 5931 | if ($encoding === 'UTF-8') { |
@@ -5943,7 +5943,7 @@ discard block |
||
| 5943 | 5943 | $str |
| 5944 | 5944 | ); |
| 5945 | 5945 | |
| 5946 | - return (string) \preg_replace_callback( |
|
| 5946 | + return (string)\preg_replace_callback( |
|
| 5947 | 5947 | '/[\\p{N}]+(.)?/u', |
| 5948 | 5948 | /** |
| 5949 | 5949 | * @param array $match |
@@ -5952,7 +5952,7 @@ discard block |
||
| 5952 | 5952 | * |
| 5953 | 5953 | * @return string |
| 5954 | 5954 | */ |
| 5955 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
| 5955 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
| 5956 | 5956 | if ($use_mb_functions) { |
| 5957 | 5957 | if ($encoding === 'UTF-8') { |
| 5958 | 5958 | return \mb_strtoupper($match[0]); |
@@ -6146,7 +6146,7 @@ discard block |
||
| 6146 | 6146 | ): string { |
| 6147 | 6147 | if (self::$SUPPORT['mbstring'] === true) { |
| 6148 | 6148 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 6149 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
| 6149 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
| 6150 | 6150 | |
| 6151 | 6151 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 6152 | 6152 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -6156,10 +6156,10 @@ discard block |
||
| 6156 | 6156 | } |
| 6157 | 6157 | |
| 6158 | 6158 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 6159 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
| 6159 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
| 6160 | 6160 | } |
| 6161 | 6161 | |
| 6162 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
| 6162 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
| 6163 | 6163 | |
| 6164 | 6164 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 6165 | 6165 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -6168,7 +6168,7 @@ discard block |
||
| 6168 | 6168 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
| 6169 | 6169 | } |
| 6170 | 6170 | |
| 6171 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
| 6171 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
| 6172 | 6172 | } |
| 6173 | 6173 | |
| 6174 | 6174 | /** |
@@ -6192,7 +6192,7 @@ discard block |
||
| 6192 | 6192 | public static function str_detect_encoding($str) |
| 6193 | 6193 | { |
| 6194 | 6194 | // init |
| 6195 | - $str = (string) $str; |
|
| 6195 | + $str = (string)$str; |
|
| 6196 | 6196 | |
| 6197 | 6197 | // |
| 6198 | 6198 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -6294,7 +6294,7 @@ discard block |
||
| 6294 | 6294 | foreach (self::$ENCODINGS as $encoding_tmp) { |
| 6295 | 6295 | // INFO: //IGNORE but still throw notice |
| 6296 | 6296 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 6297 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
| 6297 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
| 6298 | 6298 | return $encoding_tmp; |
| 6299 | 6299 | } |
| 6300 | 6300 | } |
@@ -6397,7 +6397,7 @@ discard block |
||
| 6397 | 6397 | return $str; |
| 6398 | 6398 | } |
| 6399 | 6399 | |
| 6400 | - return $substring . $str; |
|
| 6400 | + return $substring.$str; |
|
| 6401 | 6401 | } |
| 6402 | 6402 | |
| 6403 | 6403 | /** |
@@ -6693,27 +6693,27 @@ discard block |
||
| 6693 | 6693 | string $encoding = 'UTF-8' |
| 6694 | 6694 | ): string { |
| 6695 | 6695 | if ($encoding === 'UTF-8') { |
| 6696 | - $len = (int) \mb_strlen($str); |
|
| 6696 | + $len = (int)\mb_strlen($str); |
|
| 6697 | 6697 | if ($index > $len) { |
| 6698 | 6698 | return $str; |
| 6699 | 6699 | } |
| 6700 | 6700 | |
| 6701 | 6701 | /** @noinspection UnnecessaryCastingInspection */ |
| 6702 | - return (string) \mb_substr($str, 0, $index) . |
|
| 6703 | - $substring . |
|
| 6704 | - (string) \mb_substr($str, $index, $len); |
|
| 6702 | + return (string)\mb_substr($str, 0, $index). |
|
| 6703 | + $substring. |
|
| 6704 | + (string)\mb_substr($str, $index, $len); |
|
| 6705 | 6705 | } |
| 6706 | 6706 | |
| 6707 | 6707 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6708 | 6708 | |
| 6709 | - $len = (int) self::strlen($str, $encoding); |
|
| 6709 | + $len = (int)self::strlen($str, $encoding); |
|
| 6710 | 6710 | if ($index > $len) { |
| 6711 | 6711 | return $str; |
| 6712 | 6712 | } |
| 6713 | 6713 | |
| 6714 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
| 6715 | - $substring . |
|
| 6716 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
| 6714 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
| 6715 | + $substring. |
|
| 6716 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
| 6717 | 6717 | } |
| 6718 | 6718 | |
| 6719 | 6719 | /** |
@@ -6753,15 +6753,15 @@ discard block |
||
| 6753 | 6753 | */ |
| 6754 | 6754 | public static function str_ireplace($search, $replacement, $subject, &$count = null) |
| 6755 | 6755 | { |
| 6756 | - $search = (array) $search; |
|
| 6756 | + $search = (array)$search; |
|
| 6757 | 6757 | |
| 6758 | 6758 | /** @noinspection AlterInForeachInspection */ |
| 6759 | 6759 | foreach ($search as &$s) { |
| 6760 | - $s = (string) $s; |
|
| 6760 | + $s = (string)$s; |
|
| 6761 | 6761 | if ($s === '') { |
| 6762 | 6762 | $s = '/^(?<=.)$/'; |
| 6763 | 6763 | } else { |
| 6764 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
| 6764 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
| 6765 | 6765 | } |
| 6766 | 6766 | } |
| 6767 | 6767 | |
@@ -6799,11 +6799,11 @@ discard block |
||
| 6799 | 6799 | } |
| 6800 | 6800 | |
| 6801 | 6801 | if ($search === '') { |
| 6802 | - return $str . $replacement; |
|
| 6802 | + return $str.$replacement; |
|
| 6803 | 6803 | } |
| 6804 | 6804 | |
| 6805 | 6805 | if (\stripos($str, $search) === 0) { |
| 6806 | - return $replacement . \substr($str, \strlen($search)); |
|
| 6806 | + return $replacement.\substr($str, \strlen($search)); |
|
| 6807 | 6807 | } |
| 6808 | 6808 | |
| 6809 | 6809 | return $str; |
@@ -6834,11 +6834,11 @@ discard block |
||
| 6834 | 6834 | } |
| 6835 | 6835 | |
| 6836 | 6836 | if ($search === '') { |
| 6837 | - return $str . $replacement; |
|
| 6837 | + return $str.$replacement; |
|
| 6838 | 6838 | } |
| 6839 | 6839 | |
| 6840 | 6840 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 6841 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 6841 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 6842 | 6842 | } |
| 6843 | 6843 | |
| 6844 | 6844 | return $str; |
@@ -6930,15 +6930,15 @@ discard block |
||
| 6930 | 6930 | } |
| 6931 | 6931 | |
| 6932 | 6932 | if ($encoding === 'UTF-8') { |
| 6933 | - return (string) \mb_substr( |
|
| 6933 | + return (string)\mb_substr( |
|
| 6934 | 6934 | $str, |
| 6935 | - $offset + (int) \mb_strlen($separator) |
|
| 6935 | + $offset + (int)\mb_strlen($separator) |
|
| 6936 | 6936 | ); |
| 6937 | 6937 | } |
| 6938 | 6938 | |
| 6939 | - return (string) self::substr( |
|
| 6939 | + return (string)self::substr( |
|
| 6940 | 6940 | $str, |
| 6941 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6941 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6942 | 6942 | null, |
| 6943 | 6943 | $encoding |
| 6944 | 6944 | ); |
@@ -6970,15 +6970,15 @@ discard block |
||
| 6970 | 6970 | } |
| 6971 | 6971 | |
| 6972 | 6972 | if ($encoding === 'UTF-8') { |
| 6973 | - return (string) \mb_substr( |
|
| 6973 | + return (string)\mb_substr( |
|
| 6974 | 6974 | $str, |
| 6975 | - $offset + (int) self::strlen($separator) |
|
| 6975 | + $offset + (int)self::strlen($separator) |
|
| 6976 | 6976 | ); |
| 6977 | 6977 | } |
| 6978 | 6978 | |
| 6979 | - return (string) self::substr( |
|
| 6979 | + return (string)self::substr( |
|
| 6980 | 6980 | $str, |
| 6981 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6981 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6982 | 6982 | null, |
| 6983 | 6983 | $encoding |
| 6984 | 6984 | ); |
@@ -7010,10 +7010,10 @@ discard block |
||
| 7010 | 7010 | } |
| 7011 | 7011 | |
| 7012 | 7012 | if ($encoding === 'UTF-8') { |
| 7013 | - return (string) \mb_substr($str, 0, $offset); |
|
| 7013 | + return (string)\mb_substr($str, 0, $offset); |
|
| 7014 | 7014 | } |
| 7015 | 7015 | |
| 7016 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 7016 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 7017 | 7017 | } |
| 7018 | 7018 | |
| 7019 | 7019 | /** |
@@ -7042,7 +7042,7 @@ discard block |
||
| 7042 | 7042 | return ''; |
| 7043 | 7043 | } |
| 7044 | 7044 | |
| 7045 | - return (string) \mb_substr($str, 0, $offset); |
|
| 7045 | + return (string)\mb_substr($str, 0, $offset); |
|
| 7046 | 7046 | } |
| 7047 | 7047 | |
| 7048 | 7048 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -7050,7 +7050,7 @@ discard block |
||
| 7050 | 7050 | return ''; |
| 7051 | 7051 | } |
| 7052 | 7052 | |
| 7053 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 7053 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 7054 | 7054 | } |
| 7055 | 7055 | |
| 7056 | 7056 | /** |
@@ -7152,12 +7152,12 @@ discard block |
||
| 7152 | 7152 | } |
| 7153 | 7153 | |
| 7154 | 7154 | if ($encoding === 'UTF-8') { |
| 7155 | - return (string) \mb_substr($str, -$n); |
|
| 7155 | + return (string)\mb_substr($str, -$n); |
|
| 7156 | 7156 | } |
| 7157 | 7157 | |
| 7158 | 7158 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7159 | 7159 | |
| 7160 | - return (string) self::substr($str, -$n, null, $encoding); |
|
| 7160 | + return (string)self::substr($str, -$n, null, $encoding); |
|
| 7161 | 7161 | } |
| 7162 | 7162 | |
| 7163 | 7163 | /** |
@@ -7183,21 +7183,21 @@ discard block |
||
| 7183 | 7183 | } |
| 7184 | 7184 | |
| 7185 | 7185 | if ($encoding === 'UTF-8') { |
| 7186 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 7186 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 7187 | 7187 | return $str; |
| 7188 | 7188 | } |
| 7189 | 7189 | |
| 7190 | 7190 | /** @noinspection UnnecessaryCastingInspection */ |
| 7191 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
| 7191 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
| 7192 | 7192 | } |
| 7193 | 7193 | |
| 7194 | 7194 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7195 | 7195 | |
| 7196 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 7196 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 7197 | 7197 | return $str; |
| 7198 | 7198 | } |
| 7199 | 7199 | |
| 7200 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
| 7200 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
| 7201 | 7201 | } |
| 7202 | 7202 | |
| 7203 | 7203 | /** |
@@ -7226,12 +7226,12 @@ discard block |
||
| 7226 | 7226 | |
| 7227 | 7227 | if ($encoding === 'UTF-8') { |
| 7228 | 7228 | /** @noinspection UnnecessaryCastingInspection */ |
| 7229 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 7229 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 7230 | 7230 | return $str; |
| 7231 | 7231 | } |
| 7232 | 7232 | |
| 7233 | 7233 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
| 7234 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
| 7234 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
| 7235 | 7235 | } |
| 7236 | 7236 | |
| 7237 | 7237 | $str = \mb_substr($str, 0, $length); |
@@ -7240,33 +7240,33 @@ discard block |
||
| 7240 | 7240 | $new_str = \implode(' ', $array); |
| 7241 | 7241 | |
| 7242 | 7242 | if ($new_str === '') { |
| 7243 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
| 7243 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
| 7244 | 7244 | } |
| 7245 | 7245 | } else { |
| 7246 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 7246 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 7247 | 7247 | return $str; |
| 7248 | 7248 | } |
| 7249 | 7249 | |
| 7250 | 7250 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
| 7251 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
| 7251 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
| 7252 | 7252 | } |
| 7253 | 7253 | |
| 7254 | 7254 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 7255 | 7255 | $str = self::substr($str, 0, $length, $encoding); |
| 7256 | 7256 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 7257 | 7257 | if ($str === false) { |
| 7258 | - return '' . $str_add_on; |
|
| 7258 | + return ''.$str_add_on; |
|
| 7259 | 7259 | } |
| 7260 | 7260 | |
| 7261 | 7261 | $array = \explode(' ', $str, -1); |
| 7262 | 7262 | $new_str = \implode(' ', $array); |
| 7263 | 7263 | |
| 7264 | 7264 | if ($new_str === '') { |
| 7265 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
| 7265 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
| 7266 | 7266 | } |
| 7267 | 7267 | } |
| 7268 | 7268 | |
| 7269 | - return $new_str . $str_add_on; |
|
| 7269 | + return $new_str.$str_add_on; |
|
| 7270 | 7270 | } |
| 7271 | 7271 | |
| 7272 | 7272 | /** |
@@ -7289,7 +7289,7 @@ discard block |
||
| 7289 | 7289 | $longest_common_prefix = ''; |
| 7290 | 7290 | |
| 7291 | 7291 | if ($encoding === 'UTF-8') { |
| 7292 | - $max_length = (int) \min( |
|
| 7292 | + $max_length = (int)\min( |
|
| 7293 | 7293 | \mb_strlen($str1), |
| 7294 | 7294 | \mb_strlen($str2) |
| 7295 | 7295 | ); |
@@ -7310,7 +7310,7 @@ discard block |
||
| 7310 | 7310 | } else { |
| 7311 | 7311 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7312 | 7312 | |
| 7313 | - $max_length = (int) \min( |
|
| 7313 | + $max_length = (int)\min( |
|
| 7314 | 7314 | self::strlen($str1, $encoding), |
| 7315 | 7315 | self::strlen($str2, $encoding) |
| 7316 | 7316 | ); |
@@ -7359,13 +7359,13 @@ discard block |
||
| 7359 | 7359 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
| 7360 | 7360 | |
| 7361 | 7361 | if ($encoding === 'UTF-8') { |
| 7362 | - $str_length = (int) \mb_strlen($str1); |
|
| 7363 | - $other_length = (int) \mb_strlen($str2); |
|
| 7362 | + $str_length = (int)\mb_strlen($str1); |
|
| 7363 | + $other_length = (int)\mb_strlen($str2); |
|
| 7364 | 7364 | } else { |
| 7365 | 7365 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7366 | 7366 | |
| 7367 | - $str_length = (int) self::strlen($str1, $encoding); |
|
| 7368 | - $other_length = (int) self::strlen($str2, $encoding); |
|
| 7367 | + $str_length = (int)self::strlen($str1, $encoding); |
|
| 7368 | + $other_length = (int)self::strlen($str2, $encoding); |
|
| 7369 | 7369 | } |
| 7370 | 7370 | |
| 7371 | 7371 | // Return if either string is empty |
@@ -7418,10 +7418,10 @@ discard block |
||
| 7418 | 7418 | } |
| 7419 | 7419 | |
| 7420 | 7420 | if ($encoding === 'UTF-8') { |
| 7421 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
| 7421 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
| 7422 | 7422 | } |
| 7423 | 7423 | |
| 7424 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
| 7424 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
| 7425 | 7425 | } |
| 7426 | 7426 | |
| 7427 | 7427 | /** |
@@ -7445,7 +7445,7 @@ discard block |
||
| 7445 | 7445 | } |
| 7446 | 7446 | |
| 7447 | 7447 | if ($encoding === 'UTF-8') { |
| 7448 | - $max_length = (int) \min( |
|
| 7448 | + $max_length = (int)\min( |
|
| 7449 | 7449 | \mb_strlen($str1, $encoding), |
| 7450 | 7450 | \mb_strlen($str2, $encoding) |
| 7451 | 7451 | ); |
@@ -7459,7 +7459,7 @@ discard block |
||
| 7459 | 7459 | && |
| 7460 | 7460 | $char === \mb_substr($str2, -$i, 1) |
| 7461 | 7461 | ) { |
| 7462 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
| 7462 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
| 7463 | 7463 | } else { |
| 7464 | 7464 | break; |
| 7465 | 7465 | } |
@@ -7467,7 +7467,7 @@ discard block |
||
| 7467 | 7467 | } else { |
| 7468 | 7468 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7469 | 7469 | |
| 7470 | - $max_length = (int) \min( |
|
| 7470 | + $max_length = (int)\min( |
|
| 7471 | 7471 | self::strlen($str1, $encoding), |
| 7472 | 7472 | self::strlen($str2, $encoding) |
| 7473 | 7473 | ); |
@@ -7481,7 +7481,7 @@ discard block |
||
| 7481 | 7481 | && |
| 7482 | 7482 | $char === self::substr($str2, -$i, 1, $encoding) |
| 7483 | 7483 | ) { |
| 7484 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
| 7484 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
| 7485 | 7485 | } else { |
| 7486 | 7486 | break; |
| 7487 | 7487 | } |
@@ -7504,7 +7504,7 @@ discard block |
||
| 7504 | 7504 | */ |
| 7505 | 7505 | public static function str_matches_pattern(string $str, string $pattern): bool |
| 7506 | 7506 | { |
| 7507 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
| 7507 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
| 7508 | 7508 | } |
| 7509 | 7509 | |
| 7510 | 7510 | /** |
@@ -7524,7 +7524,7 @@ discard block |
||
| 7524 | 7524 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
| 7525 | 7525 | { |
| 7526 | 7526 | // init |
| 7527 | - $length = (int) self::strlen($str, $encoding); |
|
| 7527 | + $length = (int)self::strlen($str, $encoding); |
|
| 7528 | 7528 | |
| 7529 | 7529 | if ($offset >= 0) { |
| 7530 | 7530 | return $length > $offset; |
@@ -7553,7 +7553,7 @@ discard block |
||
| 7553 | 7553 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
| 7554 | 7554 | { |
| 7555 | 7555 | // init |
| 7556 | - $length = (int) self::strlen($str); |
|
| 7556 | + $length = (int)self::strlen($str); |
|
| 7557 | 7557 | |
| 7558 | 7558 | if ( |
| 7559 | 7559 | ($index >= 0 && $length <= $index) |
@@ -7597,7 +7597,7 @@ discard block |
||
| 7597 | 7597 | return $str; |
| 7598 | 7598 | } |
| 7599 | 7599 | |
| 7600 | - if ($pad_type !== (int) $pad_type) { |
|
| 7600 | + if ($pad_type !== (int)$pad_type) { |
|
| 7601 | 7601 | if ($pad_type === 'left') { |
| 7602 | 7602 | $pad_type = \STR_PAD_LEFT; |
| 7603 | 7603 | } elseif ($pad_type === 'right') { |
@@ -7606,23 +7606,23 @@ discard block |
||
| 7606 | 7606 | $pad_type = \STR_PAD_BOTH; |
| 7607 | 7607 | } else { |
| 7608 | 7608 | throw new \InvalidArgumentException( |
| 7609 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
| 7609 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
| 7610 | 7610 | ); |
| 7611 | 7611 | } |
| 7612 | 7612 | } |
| 7613 | 7613 | |
| 7614 | 7614 | if ($encoding === 'UTF-8') { |
| 7615 | - $str_length = (int) \mb_strlen($str); |
|
| 7615 | + $str_length = (int)\mb_strlen($str); |
|
| 7616 | 7616 | |
| 7617 | 7617 | if ($pad_length >= $str_length) { |
| 7618 | 7618 | switch ($pad_type) { |
| 7619 | 7619 | case \STR_PAD_LEFT: |
| 7620 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 7620 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 7621 | 7621 | |
| 7622 | 7622 | $diff = ($pad_length - $str_length); |
| 7623 | 7623 | |
| 7624 | - $pre = (string) \mb_substr( |
|
| 7625 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7624 | + $pre = (string)\mb_substr( |
|
| 7625 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7626 | 7626 | 0, |
| 7627 | 7627 | $diff |
| 7628 | 7628 | ); |
@@ -7633,16 +7633,16 @@ discard block |
||
| 7633 | 7633 | case \STR_PAD_BOTH: |
| 7634 | 7634 | $diff = ($pad_length - $str_length); |
| 7635 | 7635 | |
| 7636 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 7636 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 7637 | 7637 | |
| 7638 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 7638 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 7639 | 7639 | |
| 7640 | - $pre = (string) \mb_substr( |
|
| 7640 | + $pre = (string)\mb_substr( |
|
| 7641 | 7641 | \str_repeat($pad_string, $ps_length_left), |
| 7642 | 7642 | 0, |
| 7643 | 7643 | $ps_length_left |
| 7644 | 7644 | ); |
| 7645 | - $post = (string) \mb_substr( |
|
| 7645 | + $post = (string)\mb_substr( |
|
| 7646 | 7646 | \str_repeat($pad_string, $ps_length_right), |
| 7647 | 7647 | 0, |
| 7648 | 7648 | $ps_length_right |
@@ -7652,19 +7652,19 @@ discard block |
||
| 7652 | 7652 | |
| 7653 | 7653 | case \STR_PAD_RIGHT: |
| 7654 | 7654 | default: |
| 7655 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 7655 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 7656 | 7656 | |
| 7657 | 7657 | $diff = ($pad_length - $str_length); |
| 7658 | 7658 | |
| 7659 | - $post = (string) \mb_substr( |
|
| 7660 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7659 | + $post = (string)\mb_substr( |
|
| 7660 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7661 | 7661 | 0, |
| 7662 | 7662 | $diff |
| 7663 | 7663 | ); |
| 7664 | 7664 | $pre = ''; |
| 7665 | 7665 | } |
| 7666 | 7666 | |
| 7667 | - return $pre . $str . $post; |
|
| 7667 | + return $pre.$str.$post; |
|
| 7668 | 7668 | } |
| 7669 | 7669 | |
| 7670 | 7670 | return $str; |
@@ -7672,17 +7672,17 @@ discard block |
||
| 7672 | 7672 | |
| 7673 | 7673 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7674 | 7674 | |
| 7675 | - $str_length = (int) self::strlen($str, $encoding); |
|
| 7675 | + $str_length = (int)self::strlen($str, $encoding); |
|
| 7676 | 7676 | |
| 7677 | 7677 | if ($pad_length >= $str_length) { |
| 7678 | 7678 | switch ($pad_type) { |
| 7679 | 7679 | case \STR_PAD_LEFT: |
| 7680 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 7680 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 7681 | 7681 | |
| 7682 | 7682 | $diff = ($pad_length - $str_length); |
| 7683 | 7683 | |
| 7684 | - $pre = (string) self::substr( |
|
| 7685 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7684 | + $pre = (string)self::substr( |
|
| 7685 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7686 | 7686 | 0, |
| 7687 | 7687 | $diff, |
| 7688 | 7688 | $encoding |
@@ -7694,17 +7694,17 @@ discard block |
||
| 7694 | 7694 | case \STR_PAD_BOTH: |
| 7695 | 7695 | $diff = ($pad_length - $str_length); |
| 7696 | 7696 | |
| 7697 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 7697 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 7698 | 7698 | |
| 7699 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 7699 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 7700 | 7700 | |
| 7701 | - $pre = (string) self::substr( |
|
| 7701 | + $pre = (string)self::substr( |
|
| 7702 | 7702 | \str_repeat($pad_string, $ps_length_left), |
| 7703 | 7703 | 0, |
| 7704 | 7704 | $ps_length_left, |
| 7705 | 7705 | $encoding |
| 7706 | 7706 | ); |
| 7707 | - $post = (string) self::substr( |
|
| 7707 | + $post = (string)self::substr( |
|
| 7708 | 7708 | \str_repeat($pad_string, $ps_length_right), |
| 7709 | 7709 | 0, |
| 7710 | 7710 | $ps_length_right, |
@@ -7715,12 +7715,12 @@ discard block |
||
| 7715 | 7715 | |
| 7716 | 7716 | case \STR_PAD_RIGHT: |
| 7717 | 7717 | default: |
| 7718 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 7718 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 7719 | 7719 | |
| 7720 | 7720 | $diff = ($pad_length - $str_length); |
| 7721 | 7721 | |
| 7722 | - $post = (string) self::substr( |
|
| 7723 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7722 | + $post = (string)self::substr( |
|
| 7723 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7724 | 7724 | 0, |
| 7725 | 7725 | $diff, |
| 7726 | 7726 | $encoding |
@@ -7728,7 +7728,7 @@ discard block |
||
| 7728 | 7728 | $pre = ''; |
| 7729 | 7729 | } |
| 7730 | 7730 | |
| 7731 | - return $pre . $str . $post; |
|
| 7731 | + return $pre.$str.$post; |
|
| 7732 | 7732 | } |
| 7733 | 7733 | |
| 7734 | 7734 | return $str; |
@@ -7939,11 +7939,11 @@ discard block |
||
| 7939 | 7939 | } |
| 7940 | 7940 | |
| 7941 | 7941 | if ($search === '') { |
| 7942 | - return $str . $replacement; |
|
| 7942 | + return $str.$replacement; |
|
| 7943 | 7943 | } |
| 7944 | 7944 | |
| 7945 | 7945 | if (\strpos($str, $search) === 0) { |
| 7946 | - return $replacement . \substr($str, \strlen($search)); |
|
| 7946 | + return $replacement.\substr($str, \strlen($search)); |
|
| 7947 | 7947 | } |
| 7948 | 7948 | |
| 7949 | 7949 | return $str; |
@@ -7977,11 +7977,11 @@ discard block |
||
| 7977 | 7977 | } |
| 7978 | 7978 | |
| 7979 | 7979 | if ($search === '') { |
| 7980 | - return $str . $replacement; |
|
| 7980 | + return $str.$replacement; |
|
| 7981 | 7981 | } |
| 7982 | 7982 | |
| 7983 | 7983 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 7984 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 7984 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 7985 | 7985 | } |
| 7986 | 7986 | |
| 7987 | 7987 | return $str; |
@@ -8015,7 +8015,7 @@ discard block |
||
| 8015 | 8015 | $subject, |
| 8016 | 8016 | $replace, |
| 8017 | 8017 | $pos, |
| 8018 | - (int) self::strlen($search) |
|
| 8018 | + (int)self::strlen($search) |
|
| 8019 | 8019 | ); |
| 8020 | 8020 | } |
| 8021 | 8021 | |
@@ -8049,7 +8049,7 @@ discard block |
||
| 8049 | 8049 | $subject, |
| 8050 | 8050 | $replace, |
| 8051 | 8051 | $pos, |
| 8052 | - (int) self::strlen($search) |
|
| 8052 | + (int)self::strlen($search) |
|
| 8053 | 8053 | ); |
| 8054 | 8054 | } |
| 8055 | 8055 | |
@@ -8072,7 +8072,7 @@ discard block |
||
| 8072 | 8072 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
| 8073 | 8073 | { |
| 8074 | 8074 | if ($encoding === 'UTF-8') { |
| 8075 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
| 8075 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
| 8076 | 8076 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 8077 | 8077 | \shuffle($indexes); |
| 8078 | 8078 | |
@@ -8088,7 +8088,7 @@ discard block |
||
| 8088 | 8088 | } else { |
| 8089 | 8089 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8090 | 8090 | |
| 8091 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
| 8091 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
| 8092 | 8092 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 8093 | 8093 | \shuffle($indexes); |
| 8094 | 8094 | |
@@ -8131,11 +8131,11 @@ discard block |
||
| 8131 | 8131 | ) { |
| 8132 | 8132 | if ($encoding === 'UTF-8') { |
| 8133 | 8133 | if ($end === null) { |
| 8134 | - $length = (int) \mb_strlen($str); |
|
| 8134 | + $length = (int)\mb_strlen($str); |
|
| 8135 | 8135 | } elseif ($end >= 0 && $end <= $start) { |
| 8136 | 8136 | return ''; |
| 8137 | 8137 | } elseif ($end < 0) { |
| 8138 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
| 8138 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
| 8139 | 8139 | } else { |
| 8140 | 8140 | $length = $end - $start; |
| 8141 | 8141 | } |
@@ -8146,11 +8146,11 @@ discard block |
||
| 8146 | 8146 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8147 | 8147 | |
| 8148 | 8148 | if ($end === null) { |
| 8149 | - $length = (int) self::strlen($str, $encoding); |
|
| 8149 | + $length = (int)self::strlen($str, $encoding); |
|
| 8150 | 8150 | } elseif ($end >= 0 && $end <= $start) { |
| 8151 | 8151 | return ''; |
| 8152 | 8152 | } elseif ($end < 0) { |
| 8153 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
| 8153 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
| 8154 | 8154 | } else { |
| 8155 | 8155 | $length = $end - $start; |
| 8156 | 8156 | } |
@@ -8185,7 +8185,7 @@ discard block |
||
| 8185 | 8185 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8186 | 8186 | } |
| 8187 | 8187 | |
| 8188 | - $str = (string) \preg_replace_callback( |
|
| 8188 | + $str = (string)\preg_replace_callback( |
|
| 8189 | 8189 | '/([\\p{N}|\\p{Lu}])/u', |
| 8190 | 8190 | /** |
| 8191 | 8191 | * @param string[] $matches |
@@ -8194,28 +8194,28 @@ discard block |
||
| 8194 | 8194 | * |
| 8195 | 8195 | * @return string |
| 8196 | 8196 | */ |
| 8197 | - static function (array $matches) use ($encoding): string { |
|
| 8197 | + static function(array $matches) use ($encoding): string { |
|
| 8198 | 8198 | $match = $matches[1]; |
| 8199 | - $match_int = (int) $match; |
|
| 8199 | + $match_int = (int)$match; |
|
| 8200 | 8200 | |
| 8201 | - if ((string) $match_int === $match) { |
|
| 8202 | - return '_' . $match . '_'; |
|
| 8201 | + if ((string)$match_int === $match) { |
|
| 8202 | + return '_'.$match.'_'; |
|
| 8203 | 8203 | } |
| 8204 | 8204 | |
| 8205 | 8205 | if ($encoding === 'UTF-8') { |
| 8206 | - return '_' . \mb_strtolower($match); |
|
| 8206 | + return '_'.\mb_strtolower($match); |
|
| 8207 | 8207 | } |
| 8208 | 8208 | |
| 8209 | - return '_' . self::strtolower($match, $encoding); |
|
| 8209 | + return '_'.self::strtolower($match, $encoding); |
|
| 8210 | 8210 | }, |
| 8211 | 8211 | $str |
| 8212 | 8212 | ); |
| 8213 | 8213 | |
| 8214 | - $str = (string) \preg_replace( |
|
| 8214 | + $str = (string)\preg_replace( |
|
| 8215 | 8215 | [ |
| 8216 | - '/\\s+/u', // convert spaces to "_" |
|
| 8216 | + '/\\s+/u', // convert spaces to "_" |
|
| 8217 | 8217 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
| 8218 | - '/_+/', // remove double "_" |
|
| 8218 | + '/_+/', // remove double "_" |
|
| 8219 | 8219 | ], |
| 8220 | 8220 | [ |
| 8221 | 8221 | '_', |
@@ -8346,7 +8346,7 @@ discard block |
||
| 8346 | 8346 | } |
| 8347 | 8347 | |
| 8348 | 8348 | // init |
| 8349 | - $input = (string) $input; |
|
| 8349 | + $input = (string)$input; |
|
| 8350 | 8350 | |
| 8351 | 8351 | if ($input === '') { |
| 8352 | 8352 | return []; |
@@ -8403,7 +8403,7 @@ discard block |
||
| 8403 | 8403 | ($input[$i] & "\xE0") === "\xC0" |
| 8404 | 8404 | ) { |
| 8405 | 8405 | if (($input[$i + 1] & "\xC0") === "\x80") { |
| 8406 | - $ret[] = $input[$i] . $input[$i + 1]; |
|
| 8406 | + $ret[] = $input[$i].$input[$i + 1]; |
|
| 8407 | 8407 | |
| 8408 | 8408 | ++$i; |
| 8409 | 8409 | } |
@@ -8417,7 +8417,7 @@ discard block |
||
| 8417 | 8417 | && |
| 8418 | 8418 | ($input[$i + 2] & "\xC0") === "\x80" |
| 8419 | 8419 | ) { |
| 8420 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2]; |
|
| 8420 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2]; |
|
| 8421 | 8421 | |
| 8422 | 8422 | $i += 2; |
| 8423 | 8423 | } |
@@ -8433,7 +8433,7 @@ discard block |
||
| 8433 | 8433 | && |
| 8434 | 8434 | ($input[$i + 3] & "\xC0") === "\x80" |
| 8435 | 8435 | ) { |
| 8436 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2] . $input[$i + 3]; |
|
| 8436 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2].$input[$i + 3]; |
|
| 8437 | 8437 | |
| 8438 | 8438 | $i += 3; |
| 8439 | 8439 | } |
@@ -8445,7 +8445,7 @@ discard block |
||
| 8445 | 8445 | $ret = \array_chunk($ret, $length); |
| 8446 | 8446 | |
| 8447 | 8447 | return \array_map( |
| 8448 | - static function (array &$item): string { |
|
| 8448 | + static function(array &$item): string { |
|
| 8449 | 8449 | return \implode('', $item); |
| 8450 | 8450 | }, |
| 8451 | 8451 | $ret |
@@ -8511,7 +8511,7 @@ discard block |
||
| 8511 | 8511 | $limit = -1; |
| 8512 | 8512 | } |
| 8513 | 8513 | |
| 8514 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
| 8514 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
| 8515 | 8515 | |
| 8516 | 8516 | if ($array === false) { |
| 8517 | 8517 | return []; |
@@ -8607,9 +8607,9 @@ discard block |
||
| 8607 | 8607 | return ''; |
| 8608 | 8608 | } |
| 8609 | 8609 | |
| 8610 | - return (string) \mb_substr( |
|
| 8610 | + return (string)\mb_substr( |
|
| 8611 | 8611 | $str, |
| 8612 | - $offset + (int) \mb_strlen($separator) |
|
| 8612 | + $offset + (int)\mb_strlen($separator) |
|
| 8613 | 8613 | ); |
| 8614 | 8614 | } |
| 8615 | 8615 | |
@@ -8618,9 +8618,9 @@ discard block |
||
| 8618 | 8618 | return ''; |
| 8619 | 8619 | } |
| 8620 | 8620 | |
| 8621 | - return (string) \mb_substr( |
|
| 8621 | + return (string)\mb_substr( |
|
| 8622 | 8622 | $str, |
| 8623 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 8623 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 8624 | 8624 | null, |
| 8625 | 8625 | $encoding |
| 8626 | 8626 | ); |
@@ -8652,9 +8652,9 @@ discard block |
||
| 8652 | 8652 | return ''; |
| 8653 | 8653 | } |
| 8654 | 8654 | |
| 8655 | - return (string) \mb_substr( |
|
| 8655 | + return (string)\mb_substr( |
|
| 8656 | 8656 | $str, |
| 8657 | - $offset + (int) \mb_strlen($separator) |
|
| 8657 | + $offset + (int)\mb_strlen($separator) |
|
| 8658 | 8658 | ); |
| 8659 | 8659 | } |
| 8660 | 8660 | |
@@ -8663,9 +8663,9 @@ discard block |
||
| 8663 | 8663 | return ''; |
| 8664 | 8664 | } |
| 8665 | 8665 | |
| 8666 | - return (string) self::substr( |
|
| 8666 | + return (string)self::substr( |
|
| 8667 | 8667 | $str, |
| 8668 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 8668 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 8669 | 8669 | null, |
| 8670 | 8670 | $encoding |
| 8671 | 8671 | ); |
@@ -8697,7 +8697,7 @@ discard block |
||
| 8697 | 8697 | return ''; |
| 8698 | 8698 | } |
| 8699 | 8699 | |
| 8700 | - return (string) \mb_substr( |
|
| 8700 | + return (string)\mb_substr( |
|
| 8701 | 8701 | $str, |
| 8702 | 8702 | 0, |
| 8703 | 8703 | $offset |
@@ -8709,7 +8709,7 @@ discard block |
||
| 8709 | 8709 | return ''; |
| 8710 | 8710 | } |
| 8711 | 8711 | |
| 8712 | - return (string) self::substr( |
|
| 8712 | + return (string)self::substr( |
|
| 8713 | 8713 | $str, |
| 8714 | 8714 | 0, |
| 8715 | 8715 | $offset, |
@@ -8740,7 +8740,7 @@ discard block |
||
| 8740 | 8740 | return ''; |
| 8741 | 8741 | } |
| 8742 | 8742 | |
| 8743 | - return (string) \mb_substr( |
|
| 8743 | + return (string)\mb_substr( |
|
| 8744 | 8744 | $str, |
| 8745 | 8745 | 0, |
| 8746 | 8746 | $offset |
@@ -8754,7 +8754,7 @@ discard block |
||
| 8754 | 8754 | |
| 8755 | 8755 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8756 | 8756 | |
| 8757 | - return (string) self::substr( |
|
| 8757 | + return (string)self::substr( |
|
| 8758 | 8758 | $str, |
| 8759 | 8759 | 0, |
| 8760 | 8760 | $offset, |
@@ -8869,7 +8869,7 @@ discard block |
||
| 8869 | 8869 | */ |
| 8870 | 8870 | public static function str_surround(string $str, string $substring): string |
| 8871 | 8871 | { |
| 8872 | - return $substring . $str . $substring; |
|
| 8872 | + return $substring.$str.$substring; |
|
| 8873 | 8873 | } |
| 8874 | 8874 | |
| 8875 | 8875 | /** |
@@ -8933,9 +8933,9 @@ discard block |
||
| 8933 | 8933 | $word_define_chars = ''; |
| 8934 | 8934 | } |
| 8935 | 8935 | |
| 8936 | - $str = (string) \preg_replace_callback( |
|
| 8937 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
| 8938 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
| 8936 | + $str = (string)\preg_replace_callback( |
|
| 8937 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
| 8938 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
| 8939 | 8939 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
| 8940 | 8940 | return $match[0]; |
| 8941 | 8941 | } |
@@ -9035,16 +9035,16 @@ discard block |
||
| 9035 | 9035 | |
| 9036 | 9036 | // the main substitutions |
| 9037 | 9037 | /** @noinspection RegExpDuplicateAlternationBranch - false-positive - https://youtrack.jetbrains.com/issue/WI-51002 */ |
| 9038 | - $str = (string) \preg_replace_callback( |
|
| 9038 | + $str = (string)\preg_replace_callback( |
|
| 9039 | 9039 | '~\\b (_*) (?: # 1. Leading underscore and |
| 9040 | 9040 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
| 9041 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
| 9041 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
| 9042 | 9042 | | |
| 9043 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
| 9043 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
| 9044 | 9044 | | |
| 9045 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
| 9045 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
| 9046 | 9046 | | |
| 9047 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
| 9047 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
| 9048 | 9048 | ) (_*) \\b # 6. With trailing underscore |
| 9049 | 9049 | ~ux', |
| 9050 | 9050 | /** |
@@ -9054,7 +9054,7 @@ discard block |
||
| 9054 | 9054 | * |
| 9055 | 9055 | * @return string |
| 9056 | 9056 | */ |
| 9057 | - static function (array $matches) use ($encoding): string { |
|
| 9057 | + static function(array $matches) use ($encoding): string { |
|
| 9058 | 9058 | // preserve leading underscore |
| 9059 | 9059 | $str = $matches[1]; |
| 9060 | 9060 | if ($matches[2]) { |
@@ -9079,11 +9079,11 @@ discard block |
||
| 9079 | 9079 | ); |
| 9080 | 9080 | |
| 9081 | 9081 | // Exceptions for small words: capitalize at start of title... |
| 9082 | - $str = (string) \preg_replace_callback( |
|
| 9082 | + $str = (string)\preg_replace_callback( |
|
| 9083 | 9083 | '~( \\A [[:punct:]]* # start of title... |
| 9084 | 9084 | | [:.;?!][ ]+ # or of subsentence... |
| 9085 | 9085 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
| 9086 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
| 9086 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
| 9087 | 9087 | ~uxi', |
| 9088 | 9088 | /** |
| 9089 | 9089 | * @param string[] $matches |
@@ -9092,15 +9092,15 @@ 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 | ); |
| 9100 | 9100 | |
| 9101 | 9101 | // ...and end of title |
| 9102 | - $str = (string) \preg_replace_callback( |
|
| 9103 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
| 9102 | + $str = (string)\preg_replace_callback( |
|
| 9103 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
| 9104 | 9104 | (?= [[:punct:]]* \Z # ...at the end of the title... |
| 9105 | 9105 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
| 9106 | 9106 | ~uxi', |
@@ -9111,7 +9111,7 @@ discard block |
||
| 9111 | 9111 | * |
| 9112 | 9112 | * @return string |
| 9113 | 9113 | */ |
| 9114 | - static function (array $matches) use ($encoding): string { |
|
| 9114 | + static function(array $matches) use ($encoding): string { |
|
| 9115 | 9115 | return static::ucfirst($matches[1], $encoding); |
| 9116 | 9116 | }, |
| 9117 | 9117 | $str |
@@ -9119,10 +9119,10 @@ discard block |
||
| 9119 | 9119 | |
| 9120 | 9120 | // Exceptions for small words in hyphenated compound words. |
| 9121 | 9121 | // e.g. "in-flight" -> In-Flight |
| 9122 | - $str = (string) \preg_replace_callback( |
|
| 9122 | + $str = (string)\preg_replace_callback( |
|
| 9123 | 9123 | '~\\b |
| 9124 | 9124 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
| 9125 | - ( ' . $small_words_rx . ' ) |
|
| 9125 | + ( ' . $small_words_rx.' ) |
|
| 9126 | 9126 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
| 9127 | 9127 | ~uxi', |
| 9128 | 9128 | /** |
@@ -9132,18 +9132,18 @@ discard block |
||
| 9132 | 9132 | * |
| 9133 | 9133 | * @return string |
| 9134 | 9134 | */ |
| 9135 | - static function (array $matches) use ($encoding): string { |
|
| 9135 | + static function(array $matches) use ($encoding): string { |
|
| 9136 | 9136 | return static::ucfirst($matches[1], $encoding); |
| 9137 | 9137 | }, |
| 9138 | 9138 | $str |
| 9139 | 9139 | ); |
| 9140 | 9140 | |
| 9141 | 9141 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
| 9142 | - $str = (string) \preg_replace_callback( |
|
| 9142 | + $str = (string)\preg_replace_callback( |
|
| 9143 | 9143 | '~\\b |
| 9144 | 9144 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
| 9145 | 9145 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
| 9146 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
| 9146 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
| 9147 | 9147 | (?! - ) # Negative lookahead for another - |
| 9148 | 9148 | ~uxi', |
| 9149 | 9149 | /** |
@@ -9153,8 +9153,8 @@ discard block |
||
| 9153 | 9153 | * |
| 9154 | 9154 | * @return string |
| 9155 | 9155 | */ |
| 9156 | - static function (array $matches) use ($encoding): string { |
|
| 9157 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
| 9156 | + static function(array $matches) use ($encoding): string { |
|
| 9157 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
| 9158 | 9158 | }, |
| 9159 | 9159 | $str |
| 9160 | 9160 | ); |
@@ -9273,7 +9273,7 @@ discard block |
||
| 9273 | 9273 | ); |
| 9274 | 9274 | |
| 9275 | 9275 | foreach ($tmp_return as &$item) { |
| 9276 | - $item = (string) $item; |
|
| 9276 | + $item = (string)$item; |
|
| 9277 | 9277 | } |
| 9278 | 9278 | |
| 9279 | 9279 | return $tmp_return; |
@@ -9327,39 +9327,39 @@ discard block |
||
| 9327 | 9327 | } |
| 9328 | 9328 | |
| 9329 | 9329 | if ($encoding === 'UTF-8') { |
| 9330 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 9330 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 9331 | 9331 | return $str; |
| 9332 | 9332 | } |
| 9333 | 9333 | |
| 9334 | 9334 | if ($substring !== '') { |
| 9335 | - $length -= (int) \mb_strlen($substring); |
|
| 9335 | + $length -= (int)\mb_strlen($substring); |
|
| 9336 | 9336 | |
| 9337 | 9337 | /** @noinspection UnnecessaryCastingInspection */ |
| 9338 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
| 9338 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
| 9339 | 9339 | } |
| 9340 | 9340 | |
| 9341 | 9341 | /** @noinspection UnnecessaryCastingInspection */ |
| 9342 | - return (string) \mb_substr($str, 0, $length); |
|
| 9342 | + return (string)\mb_substr($str, 0, $length); |
|
| 9343 | 9343 | } |
| 9344 | 9344 | |
| 9345 | 9345 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 9346 | 9346 | |
| 9347 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 9347 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 9348 | 9348 | return $str; |
| 9349 | 9349 | } |
| 9350 | 9350 | |
| 9351 | 9351 | if ($substring !== '') { |
| 9352 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 9352 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 9353 | 9353 | } |
| 9354 | 9354 | |
| 9355 | 9355 | return ( |
| 9356 | - (string) self::substr( |
|
| 9356 | + (string)self::substr( |
|
| 9357 | 9357 | $str, |
| 9358 | 9358 | 0, |
| 9359 | 9359 | $length, |
| 9360 | 9360 | $encoding |
| 9361 | 9361 | ) |
| 9362 | - ) . $substring; |
|
| 9362 | + ).$substring; |
|
| 9363 | 9363 | } |
| 9364 | 9364 | |
| 9365 | 9365 | /** |
@@ -9393,12 +9393,12 @@ discard block |
||
| 9393 | 9393 | } |
| 9394 | 9394 | |
| 9395 | 9395 | if ($encoding === 'UTF-8') { |
| 9396 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 9396 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 9397 | 9397 | return $str; |
| 9398 | 9398 | } |
| 9399 | 9399 | |
| 9400 | 9400 | // need to further trim the string so we can append the substring |
| 9401 | - $length -= (int) \mb_strlen($substring); |
|
| 9401 | + $length -= (int)\mb_strlen($substring); |
|
| 9402 | 9402 | if ($length <= 0) { |
| 9403 | 9403 | return $substring; |
| 9404 | 9404 | } |
@@ -9424,18 +9424,18 @@ discard block |
||
| 9424 | 9424 | !$ignore_do_not_split_words_for_one_word |
| 9425 | 9425 | ) |
| 9426 | 9426 | ) { |
| 9427 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
| 9427 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
| 9428 | 9428 | } |
| 9429 | 9429 | } |
| 9430 | 9430 | } else { |
| 9431 | 9431 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 9432 | 9432 | |
| 9433 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 9433 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 9434 | 9434 | return $str; |
| 9435 | 9435 | } |
| 9436 | 9436 | |
| 9437 | 9437 | // need to further trim the string so we can append the substring |
| 9438 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 9438 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 9439 | 9439 | if ($length <= 0) { |
| 9440 | 9440 | return $substring; |
| 9441 | 9441 | } |
@@ -9461,12 +9461,12 @@ discard block |
||
| 9461 | 9461 | !$ignore_do_not_split_words_for_one_word |
| 9462 | 9462 | ) |
| 9463 | 9463 | ) { |
| 9464 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
| 9464 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
| 9465 | 9465 | } |
| 9466 | 9466 | } |
| 9467 | 9467 | } |
| 9468 | 9468 | |
| 9469 | - return $truncated . $substring; |
|
| 9469 | + return $truncated.$substring; |
|
| 9470 | 9470 | } |
| 9471 | 9471 | |
| 9472 | 9472 | /** |
@@ -9593,13 +9593,13 @@ discard block |
||
| 9593 | 9593 | } |
| 9594 | 9594 | } elseif ($format === 2) { |
| 9595 | 9595 | $number_of_words = []; |
| 9596 | - $offset = (int) self::strlen($str_parts[0]); |
|
| 9596 | + $offset = (int)self::strlen($str_parts[0]); |
|
| 9597 | 9597 | for ($i = 1; $i < $len; $i += 2) { |
| 9598 | 9598 | $number_of_words[$offset] = $str_parts[$i]; |
| 9599 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
| 9599 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
| 9600 | 9600 | } |
| 9601 | 9601 | } else { |
| 9602 | - $number_of_words = (int) (($len - 1) / 2); |
|
| 9602 | + $number_of_words = (int)(($len - 1) / 2); |
|
| 9603 | 9603 | } |
| 9604 | 9604 | |
| 9605 | 9605 | return $number_of_words; |
@@ -9732,7 +9732,7 @@ discard block |
||
| 9732 | 9732 | } |
| 9733 | 9733 | |
| 9734 | 9734 | if ($char_list === '') { |
| 9735 | - return (int) self::strlen($str, $encoding); |
|
| 9735 | + return (int)self::strlen($str, $encoding); |
|
| 9736 | 9736 | } |
| 9737 | 9737 | |
| 9738 | 9738 | if ($offset || $length !== null) { |
@@ -9759,7 +9759,7 @@ discard block |
||
| 9759 | 9759 | } |
| 9760 | 9760 | |
| 9761 | 9761 | $matches = []; |
| 9762 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
| 9762 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
| 9763 | 9763 | $return = self::strlen($matches[1], $encoding); |
| 9764 | 9764 | if ($return === false) { |
| 9765 | 9765 | return 0; |
@@ -9768,7 +9768,7 @@ discard block |
||
| 9768 | 9768 | return $return; |
| 9769 | 9769 | } |
| 9770 | 9770 | |
| 9771 | - return (int) self::strlen($str, $encoding); |
|
| 9771 | + return (int)self::strlen($str, $encoding); |
|
| 9772 | 9772 | } |
| 9773 | 9773 | |
| 9774 | 9774 | /** |
@@ -9831,7 +9831,7 @@ discard block |
||
| 9831 | 9831 | |
| 9832 | 9832 | $str = ''; |
| 9833 | 9833 | foreach ($intOrHex as $strPart) { |
| 9834 | - $str .= '&#' . (int) $strPart . ';'; |
|
| 9834 | + $str .= '&#'.(int)$strPart.';'; |
|
| 9835 | 9835 | } |
| 9836 | 9836 | |
| 9837 | 9837 | return self::html_entity_decode($str, \ENT_QUOTES | \ENT_HTML5); |
@@ -9928,7 +9928,7 @@ discard block |
||
| 9928 | 9928 | return ''; |
| 9929 | 9929 | } |
| 9930 | 9930 | |
| 9931 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
| 9931 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
| 9932 | 9932 | } |
| 9933 | 9933 | |
| 9934 | 9934 | /** |
@@ -9999,7 +9999,7 @@ discard block |
||
| 9999 | 9999 | // fallback for ascii only |
| 10000 | 10000 | // |
| 10001 | 10001 | |
| 10002 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10002 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10003 | 10003 | return \stripos($haystack, $needle, $offset); |
| 10004 | 10004 | } |
| 10005 | 10005 | |
@@ -10080,7 +10080,7 @@ discard block |
||
| 10080 | 10080 | /** |
| 10081 | 10081 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10082 | 10082 | */ |
| 10083 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10083 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10084 | 10084 | } |
| 10085 | 10085 | |
| 10086 | 10086 | if ( |
@@ -10094,11 +10094,11 @@ discard block |
||
| 10094 | 10094 | } |
| 10095 | 10095 | } |
| 10096 | 10096 | |
| 10097 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
| 10097 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
| 10098 | 10098 | return \stristr($haystack, $needle, $before_needle); |
| 10099 | 10099 | } |
| 10100 | 10100 | |
| 10101 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
| 10101 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
| 10102 | 10102 | |
| 10103 | 10103 | if (!isset($match[1])) { |
| 10104 | 10104 | return false; |
@@ -10108,7 +10108,7 @@ discard block |
||
| 10108 | 10108 | return $match[1]; |
| 10109 | 10109 | } |
| 10110 | 10110 | |
| 10111 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
| 10111 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
| 10112 | 10112 | } |
| 10113 | 10113 | |
| 10114 | 10114 | /** |
@@ -10191,7 +10191,7 @@ discard block |
||
| 10191 | 10191 | /** |
| 10192 | 10192 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10193 | 10193 | */ |
| 10194 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10194 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10195 | 10195 | } |
| 10196 | 10196 | |
| 10197 | 10197 | // |
@@ -10329,8 +10329,8 @@ discard block |
||
| 10329 | 10329 | } |
| 10330 | 10330 | |
| 10331 | 10331 | return \strnatcmp( |
| 10332 | - (string) self::strtonatfold($str1), |
|
| 10333 | - (string) self::strtonatfold($str2) |
|
| 10332 | + (string)self::strtonatfold($str1), |
|
| 10333 | + (string)self::strtonatfold($str2) |
|
| 10334 | 10334 | ); |
| 10335 | 10335 | } |
| 10336 | 10336 | |
@@ -10400,11 +10400,11 @@ discard block |
||
| 10400 | 10400 | } |
| 10401 | 10401 | |
| 10402 | 10402 | if ($encoding === 'UTF-8') { |
| 10403 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
| 10404 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
| 10403 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
| 10404 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
| 10405 | 10405 | } else { |
| 10406 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
| 10407 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
| 10406 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
| 10407 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
| 10408 | 10408 | } |
| 10409 | 10409 | |
| 10410 | 10410 | return self::strcmp($str1, $str2); |
@@ -10431,8 +10431,8 @@ discard block |
||
| 10431 | 10431 | return false; |
| 10432 | 10432 | } |
| 10433 | 10433 | |
| 10434 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
| 10435 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
| 10434 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
| 10435 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
| 10436 | 10436 | } |
| 10437 | 10437 | |
| 10438 | 10438 | return false; |
@@ -10471,10 +10471,10 @@ discard block |
||
| 10471 | 10471 | } |
| 10472 | 10472 | |
| 10473 | 10473 | // iconv and mbstring do not support integer $needle |
| 10474 | - if ((int) $needle === $needle) { |
|
| 10475 | - $needle = (string) self::chr($needle); |
|
| 10474 | + if ((int)$needle === $needle) { |
|
| 10475 | + $needle = (string)self::chr($needle); |
|
| 10476 | 10476 | } |
| 10477 | - $needle = (string) $needle; |
|
| 10477 | + $needle = (string)$needle; |
|
| 10478 | 10478 | |
| 10479 | 10479 | if ($needle === '') { |
| 10480 | 10480 | return false; |
@@ -10526,7 +10526,7 @@ discard block |
||
| 10526 | 10526 | /** |
| 10527 | 10527 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10528 | 10528 | */ |
| 10529 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10529 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10530 | 10530 | } |
| 10531 | 10531 | |
| 10532 | 10532 | // |
@@ -10567,7 +10567,7 @@ discard block |
||
| 10567 | 10567 | // fallback for ascii only |
| 10568 | 10568 | // |
| 10569 | 10569 | |
| 10570 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10570 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10571 | 10571 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Offset not contained in string */ |
| 10572 | 10572 | return @\strpos($haystack, $needle, $offset); |
| 10573 | 10573 | } |
@@ -10580,7 +10580,7 @@ discard block |
||
| 10580 | 10580 | if ($haystack_tmp === false) { |
| 10581 | 10581 | $haystack_tmp = ''; |
| 10582 | 10582 | } |
| 10583 | - $haystack = (string) $haystack_tmp; |
|
| 10583 | + $haystack = (string)$haystack_tmp; |
|
| 10584 | 10584 | |
| 10585 | 10585 | if ($offset < 0) { |
| 10586 | 10586 | $offset = 0; |
@@ -10592,7 +10592,7 @@ discard block |
||
| 10592 | 10592 | } |
| 10593 | 10593 | |
| 10594 | 10594 | if ($pos) { |
| 10595 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 10595 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 10596 | 10596 | } |
| 10597 | 10597 | |
| 10598 | 10598 | return $offset + 0; |
@@ -10747,7 +10747,7 @@ discard block |
||
| 10747 | 10747 | /** |
| 10748 | 10748 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10749 | 10749 | */ |
| 10750 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10750 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10751 | 10751 | } |
| 10752 | 10752 | |
| 10753 | 10753 | // |
@@ -10759,7 +10759,7 @@ discard block |
||
| 10759 | 10759 | if ($needle_tmp === false) { |
| 10760 | 10760 | return false; |
| 10761 | 10761 | } |
| 10762 | - $needle = (string) $needle_tmp; |
|
| 10762 | + $needle = (string)$needle_tmp; |
|
| 10763 | 10763 | |
| 10764 | 10764 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
| 10765 | 10765 | if ($pos === false) { |
@@ -10781,7 +10781,7 @@ discard block |
||
| 10781 | 10781 | if ($needle_tmp === false) { |
| 10782 | 10782 | return false; |
| 10783 | 10783 | } |
| 10784 | - $needle = (string) $needle_tmp; |
|
| 10784 | + $needle = (string)$needle_tmp; |
|
| 10785 | 10785 | |
| 10786 | 10786 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
| 10787 | 10787 | if ($pos === false) { |
@@ -10822,7 +10822,7 @@ discard block |
||
| 10822 | 10822 | if ($encoding === 'UTF-8') { |
| 10823 | 10823 | if (self::$SUPPORT['intl'] === true) { |
| 10824 | 10824 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
| 10825 | - $i = (int) \grapheme_strlen($str); |
|
| 10825 | + $i = (int)\grapheme_strlen($str); |
|
| 10826 | 10826 | while ($i--) { |
| 10827 | 10827 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
| 10828 | 10828 | if ($reversed_tmp !== false) { |
@@ -10830,7 +10830,7 @@ discard block |
||
| 10830 | 10830 | } |
| 10831 | 10831 | } |
| 10832 | 10832 | } else { |
| 10833 | - $i = (int) \mb_strlen($str); |
|
| 10833 | + $i = (int)\mb_strlen($str); |
|
| 10834 | 10834 | while ($i--) { |
| 10835 | 10835 | $reversed_tmp = \mb_substr($str, $i, 1); |
| 10836 | 10836 | if ($reversed_tmp !== false) { |
@@ -10841,7 +10841,7 @@ discard block |
||
| 10841 | 10841 | } else { |
| 10842 | 10842 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 10843 | 10843 | |
| 10844 | - $i = (int) self::strlen($str, $encoding); |
|
| 10844 | + $i = (int)self::strlen($str, $encoding); |
|
| 10845 | 10845 | while ($i--) { |
| 10846 | 10846 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
| 10847 | 10847 | if ($reversed_tmp !== false) { |
@@ -10920,7 +10920,7 @@ discard block |
||
| 10920 | 10920 | if ($needle_tmp === false) { |
| 10921 | 10921 | return false; |
| 10922 | 10922 | } |
| 10923 | - $needle = (string) $needle_tmp; |
|
| 10923 | + $needle = (string)$needle_tmp; |
|
| 10924 | 10924 | |
| 10925 | 10925 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
| 10926 | 10926 | if ($pos === false) { |
@@ -10963,10 +10963,10 @@ discard block |
||
| 10963 | 10963 | } |
| 10964 | 10964 | |
| 10965 | 10965 | // iconv and mbstring do not support integer $needle |
| 10966 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 10967 | - $needle = (string) self::chr($needle); |
|
| 10966 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 10967 | + $needle = (string)self::chr($needle); |
|
| 10968 | 10968 | } |
| 10969 | - $needle = (string) $needle; |
|
| 10969 | + $needle = (string)$needle; |
|
| 10970 | 10970 | |
| 10971 | 10971 | if ($needle === '') { |
| 10972 | 10972 | return false; |
@@ -11014,7 +11014,7 @@ discard block |
||
| 11014 | 11014 | /** |
| 11015 | 11015 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11016 | 11016 | */ |
| 11017 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11017 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11018 | 11018 | } |
| 11019 | 11019 | |
| 11020 | 11020 | // |
@@ -11038,7 +11038,7 @@ discard block |
||
| 11038 | 11038 | // fallback for ascii only |
| 11039 | 11039 | // |
| 11040 | 11040 | |
| 11041 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 11041 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 11042 | 11042 | return \strripos($haystack, $needle, $offset); |
| 11043 | 11043 | } |
| 11044 | 11044 | |
@@ -11121,10 +11121,10 @@ discard block |
||
| 11121 | 11121 | } |
| 11122 | 11122 | |
| 11123 | 11123 | // iconv and mbstring do not support integer $needle |
| 11124 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 11125 | - $needle = (string) self::chr($needle); |
|
| 11124 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 11125 | + $needle = (string)self::chr($needle); |
|
| 11126 | 11126 | } |
| 11127 | - $needle = (string) $needle; |
|
| 11127 | + $needle = (string)$needle; |
|
| 11128 | 11128 | |
| 11129 | 11129 | if ($needle === '') { |
| 11130 | 11130 | return false; |
@@ -11172,7 +11172,7 @@ discard block |
||
| 11172 | 11172 | /** |
| 11173 | 11173 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11174 | 11174 | */ |
| 11175 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11175 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11176 | 11176 | } |
| 11177 | 11177 | |
| 11178 | 11178 | // |
@@ -11196,7 +11196,7 @@ discard block |
||
| 11196 | 11196 | // fallback for ascii only |
| 11197 | 11197 | // |
| 11198 | 11198 | |
| 11199 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 11199 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 11200 | 11200 | return \strrpos($haystack, $needle, $offset); |
| 11201 | 11201 | } |
| 11202 | 11202 | |
@@ -11216,7 +11216,7 @@ discard block |
||
| 11216 | 11216 | if ($haystack_tmp === false) { |
| 11217 | 11217 | $haystack_tmp = ''; |
| 11218 | 11218 | } |
| 11219 | - $haystack = (string) $haystack_tmp; |
|
| 11219 | + $haystack = (string)$haystack_tmp; |
|
| 11220 | 11220 | } |
| 11221 | 11221 | |
| 11222 | 11222 | $pos = \strrpos($haystack, $needle); |
@@ -11230,7 +11230,7 @@ discard block |
||
| 11230 | 11230 | return false; |
| 11231 | 11231 | } |
| 11232 | 11232 | |
| 11233 | - return $offset + (int) self::strlen($str_tmp); |
|
| 11233 | + return $offset + (int)self::strlen($str_tmp); |
|
| 11234 | 11234 | } |
| 11235 | 11235 | |
| 11236 | 11236 | /** |
@@ -11298,12 +11298,12 @@ discard block |
||
| 11298 | 11298 | if ($offset || $length !== null) { |
| 11299 | 11299 | if ($encoding === 'UTF-8') { |
| 11300 | 11300 | if ($length === null) { |
| 11301 | - $str = (string) \mb_substr($str, $offset); |
|
| 11301 | + $str = (string)\mb_substr($str, $offset); |
|
| 11302 | 11302 | } else { |
| 11303 | - $str = (string) \mb_substr($str, $offset, $length); |
|
| 11303 | + $str = (string)\mb_substr($str, $offset, $length); |
|
| 11304 | 11304 | } |
| 11305 | 11305 | } else { |
| 11306 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
| 11306 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
| 11307 | 11307 | } |
| 11308 | 11308 | } |
| 11309 | 11309 | |
@@ -11313,7 +11313,7 @@ discard block |
||
| 11313 | 11313 | |
| 11314 | 11314 | $matches = []; |
| 11315 | 11315 | |
| 11316 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
| 11316 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
| 11317 | 11317 | } |
| 11318 | 11318 | |
| 11319 | 11319 | /** |
@@ -11395,7 +11395,7 @@ discard block |
||
| 11395 | 11395 | /** |
| 11396 | 11396 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11397 | 11397 | */ |
| 11398 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11398 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11399 | 11399 | } |
| 11400 | 11400 | |
| 11401 | 11401 | // |
@@ -11417,7 +11417,7 @@ discard block |
||
| 11417 | 11417 | // fallback for ascii only |
| 11418 | 11418 | // |
| 11419 | 11419 | |
| 11420 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 11420 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 11421 | 11421 | return \strstr($haystack, $needle, $before_needle); |
| 11422 | 11422 | } |
| 11423 | 11423 | |
@@ -11425,7 +11425,7 @@ discard block |
||
| 11425 | 11425 | // fallback via vanilla php |
| 11426 | 11426 | // |
| 11427 | 11427 | |
| 11428 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
| 11428 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
| 11429 | 11429 | |
| 11430 | 11430 | if (!isset($match[1])) { |
| 11431 | 11431 | return false; |
@@ -11435,7 +11435,7 @@ discard block |
||
| 11435 | 11435 | return $match[1]; |
| 11436 | 11436 | } |
| 11437 | 11437 | |
| 11438 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
| 11438 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
| 11439 | 11439 | } |
| 11440 | 11440 | |
| 11441 | 11441 | /** |
@@ -11565,7 +11565,7 @@ discard block |
||
| 11565 | 11565 | bool $try_to_keep_the_string_length = false |
| 11566 | 11566 | ): string { |
| 11567 | 11567 | // init |
| 11568 | - $str = (string) $str; |
|
| 11568 | + $str = (string)$str; |
|
| 11569 | 11569 | |
| 11570 | 11570 | if ($str === '') { |
| 11571 | 11571 | return ''; |
@@ -11594,25 +11594,25 @@ discard block |
||
| 11594 | 11594 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 11595 | 11595 | } |
| 11596 | 11596 | |
| 11597 | - $language_code = $lang . '-Lower'; |
|
| 11597 | + $language_code = $lang.'-Lower'; |
|
| 11598 | 11598 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 11599 | 11599 | /** |
| 11600 | 11600 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11601 | 11601 | */ |
| 11602 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
| 11602 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
| 11603 | 11603 | |
| 11604 | 11604 | $language_code = 'Any-Lower'; |
| 11605 | 11605 | } |
| 11606 | 11606 | |
| 11607 | 11607 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 11608 | 11608 | /** @noinspection UnnecessaryCastingInspection */ |
| 11609 | - return (string) \transliterator_transliterate($language_code, $str); |
|
| 11609 | + return (string)\transliterator_transliterate($language_code, $str); |
|
| 11610 | 11610 | } |
| 11611 | 11611 | |
| 11612 | 11612 | /** |
| 11613 | 11613 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11614 | 11614 | */ |
| 11615 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
| 11615 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
| 11616 | 11616 | } |
| 11617 | 11617 | |
| 11618 | 11618 | // always fallback via symfony polyfill |
@@ -11647,7 +11647,7 @@ discard block |
||
| 11647 | 11647 | bool $try_to_keep_the_string_length = false |
| 11648 | 11648 | ): string { |
| 11649 | 11649 | // init |
| 11650 | - $str = (string) $str; |
|
| 11650 | + $str = (string)$str; |
|
| 11651 | 11651 | |
| 11652 | 11652 | if ($str === '') { |
| 11653 | 11653 | return ''; |
@@ -11676,25 +11676,25 @@ discard block |
||
| 11676 | 11676 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 11677 | 11677 | } |
| 11678 | 11678 | |
| 11679 | - $language_code = $lang . '-Upper'; |
|
| 11679 | + $language_code = $lang.'-Upper'; |
|
| 11680 | 11680 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 11681 | 11681 | /** |
| 11682 | 11682 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11683 | 11683 | */ |
| 11684 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
| 11684 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
| 11685 | 11685 | |
| 11686 | 11686 | $language_code = 'Any-Upper'; |
| 11687 | 11687 | } |
| 11688 | 11688 | |
| 11689 | 11689 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 11690 | 11690 | /** @noinspection UnnecessaryCastingInspection */ |
| 11691 | - return (string) \transliterator_transliterate($language_code, $str); |
|
| 11691 | + return (string)\transliterator_transliterate($language_code, $str); |
|
| 11692 | 11692 | } |
| 11693 | 11693 | |
| 11694 | 11694 | /** |
| 11695 | 11695 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11696 | 11696 | */ |
| 11697 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
| 11697 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
| 11698 | 11698 | } |
| 11699 | 11699 | |
| 11700 | 11700 | // always fallback via symfony polyfill |
@@ -11758,7 +11758,7 @@ discard block |
||
| 11758 | 11758 | $from = \array_combine($from, $to); |
| 11759 | 11759 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 11760 | 11760 | if ($from === false) { |
| 11761 | - 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) . ')'); |
|
| 11761 | + 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).')'); |
|
| 11762 | 11762 | } |
| 11763 | 11763 | } |
| 11764 | 11764 | |
@@ -11824,9 +11824,9 @@ discard block |
||
| 11824 | 11824 | } |
| 11825 | 11825 | |
| 11826 | 11826 | $wide = 0; |
| 11827 | - $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); |
|
| 11827 | + $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); |
|
| 11828 | 11828 | |
| 11829 | - return ($wide << 1) + (int) self::strlen($str); |
|
| 11829 | + return ($wide << 1) + (int)self::strlen($str); |
|
| 11830 | 11830 | } |
| 11831 | 11831 | |
| 11832 | 11832 | /** |
@@ -11925,7 +11925,7 @@ discard block |
||
| 11925 | 11925 | return ''; |
| 11926 | 11926 | } |
| 11927 | 11927 | |
| 11928 | - $length = $length ?? (int) $str_length; |
|
| 11928 | + $length = $length ?? (int)$str_length; |
|
| 11929 | 11929 | |
| 11930 | 11930 | if ( |
| 11931 | 11931 | $encoding !== 'UTF-8' |
@@ -11935,7 +11935,7 @@ discard block |
||
| 11935 | 11935 | /** |
| 11936 | 11936 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11937 | 11937 | */ |
| 11938 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11938 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11939 | 11939 | } |
| 11940 | 11940 | |
| 11941 | 11941 | // |
@@ -12031,16 +12031,16 @@ discard block |
||
| 12031 | 12031 | ) { |
| 12032 | 12032 | if ($encoding === 'UTF-8') { |
| 12033 | 12033 | if ($length === null) { |
| 12034 | - $str1 = (string) \mb_substr($str1, $offset); |
|
| 12034 | + $str1 = (string)\mb_substr($str1, $offset); |
|
| 12035 | 12035 | } else { |
| 12036 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
| 12036 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
| 12037 | 12037 | } |
| 12038 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
| 12038 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
| 12039 | 12039 | } else { |
| 12040 | 12040 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 12041 | 12041 | |
| 12042 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
| 12043 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
| 12042 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
| 12043 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
| 12044 | 12044 | } |
| 12045 | 12045 | } |
| 12046 | 12046 | |
@@ -12107,13 +12107,13 @@ discard block |
||
| 12107 | 12107 | if ($length_tmp === false) { |
| 12108 | 12108 | return false; |
| 12109 | 12109 | } |
| 12110 | - $length = (int) $length_tmp; |
|
| 12110 | + $length = (int)$length_tmp; |
|
| 12111 | 12111 | } |
| 12112 | 12112 | |
| 12113 | 12113 | if ($encoding === 'UTF-8') { |
| 12114 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
| 12114 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
| 12115 | 12115 | } else { |
| 12116 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
| 12116 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
| 12117 | 12117 | } |
| 12118 | 12118 | } |
| 12119 | 12119 | |
@@ -12125,7 +12125,7 @@ discard block |
||
| 12125 | 12125 | /** |
| 12126 | 12126 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 12127 | 12127 | */ |
| 12128 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 12128 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 12129 | 12129 | } |
| 12130 | 12130 | |
| 12131 | 12131 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -12136,7 +12136,7 @@ discard block |
||
| 12136 | 12136 | return \mb_substr_count($haystack, $needle, $encoding); |
| 12137 | 12137 | } |
| 12138 | 12138 | |
| 12139 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 12139 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 12140 | 12140 | |
| 12141 | 12141 | return \count($matches); |
| 12142 | 12142 | } |
@@ -12186,7 +12186,7 @@ discard block |
||
| 12186 | 12186 | if ($length_tmp === false) { |
| 12187 | 12187 | return false; |
| 12188 | 12188 | } |
| 12189 | - $length = (int) $length_tmp; |
|
| 12189 | + $length = (int)$length_tmp; |
|
| 12190 | 12190 | } |
| 12191 | 12191 | |
| 12192 | 12192 | if ( |
@@ -12208,7 +12208,7 @@ discard block |
||
| 12208 | 12208 | if ($haystack_tmp === false) { |
| 12209 | 12209 | $haystack_tmp = ''; |
| 12210 | 12210 | } |
| 12211 | - $haystack = (string) $haystack_tmp; |
|
| 12211 | + $haystack = (string)$haystack_tmp; |
|
| 12212 | 12212 | } |
| 12213 | 12213 | |
| 12214 | 12214 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -12249,10 +12249,10 @@ discard block |
||
| 12249 | 12249 | |
| 12250 | 12250 | if ($encoding === 'UTF-8') { |
| 12251 | 12251 | if ($case_sensitive) { |
| 12252 | - return (int) \mb_substr_count($str, $substring); |
|
| 12252 | + return (int)\mb_substr_count($str, $substring); |
|
| 12253 | 12253 | } |
| 12254 | 12254 | |
| 12255 | - return (int) \mb_substr_count( |
|
| 12255 | + return (int)\mb_substr_count( |
|
| 12256 | 12256 | \mb_strtoupper($str), |
| 12257 | 12257 | \mb_strtoupper($substring) |
| 12258 | 12258 | ); |
@@ -12261,10 +12261,10 @@ discard block |
||
| 12261 | 12261 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 12262 | 12262 | |
| 12263 | 12263 | if ($case_sensitive) { |
| 12264 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
| 12264 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
| 12265 | 12265 | } |
| 12266 | 12266 | |
| 12267 | - return (int) \mb_substr_count( |
|
| 12267 | + return (int)\mb_substr_count( |
|
| 12268 | 12268 | self::strtocasefold($str, true, false, $encoding, null, false), |
| 12269 | 12269 | self::strtocasefold($substring, true, false, $encoding, null, false), |
| 12270 | 12270 | $encoding |
@@ -12298,7 +12298,7 @@ discard block |
||
| 12298 | 12298 | } |
| 12299 | 12299 | |
| 12300 | 12300 | if (self::str_istarts_with($haystack, $needle)) { |
| 12301 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 12301 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 12302 | 12302 | } |
| 12303 | 12303 | |
| 12304 | 12304 | return $haystack; |
@@ -12365,7 +12365,7 @@ discard block |
||
| 12365 | 12365 | } |
| 12366 | 12366 | |
| 12367 | 12367 | if (self::str_iends_with($haystack, $needle)) { |
| 12368 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
| 12368 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
| 12369 | 12369 | } |
| 12370 | 12370 | |
| 12371 | 12371 | return $haystack; |
@@ -12398,7 +12398,7 @@ discard block |
||
| 12398 | 12398 | } |
| 12399 | 12399 | |
| 12400 | 12400 | if (self::str_starts_with($haystack, $needle)) { |
| 12401 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 12401 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 12402 | 12402 | } |
| 12403 | 12403 | |
| 12404 | 12404 | return $haystack; |
@@ -12455,7 +12455,7 @@ discard block |
||
| 12455 | 12455 | if (\is_array($offset)) { |
| 12456 | 12456 | $offset = \array_slice($offset, 0, $num); |
| 12457 | 12457 | foreach ($offset as &$value_tmp) { |
| 12458 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
| 12458 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
| 12459 | 12459 | } |
| 12460 | 12460 | unset($value_tmp); |
| 12461 | 12461 | } else { |
@@ -12468,7 +12468,7 @@ discard block |
||
| 12468 | 12468 | } elseif (\is_array($length)) { |
| 12469 | 12469 | $length = \array_slice($length, 0, $num); |
| 12470 | 12470 | foreach ($length as &$value_tmp_V2) { |
| 12471 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
| 12471 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
| 12472 | 12472 | } |
| 12473 | 12473 | unset($value_tmp_V2); |
| 12474 | 12474 | } else { |
@@ -12488,8 +12488,8 @@ discard block |
||
| 12488 | 12488 | } |
| 12489 | 12489 | |
| 12490 | 12490 | // init |
| 12491 | - $str = (string) $str; |
|
| 12492 | - $replacement = (string) $replacement; |
|
| 12491 | + $str = (string)$str; |
|
| 12492 | + $replacement = (string)$replacement; |
|
| 12493 | 12493 | |
| 12494 | 12494 | if (\is_array($length)) { |
| 12495 | 12495 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -12504,16 +12504,16 @@ discard block |
||
| 12504 | 12504 | } |
| 12505 | 12505 | |
| 12506 | 12506 | if (self::$SUPPORT['mbstring'] === true) { |
| 12507 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 12507 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 12508 | 12508 | |
| 12509 | 12509 | if ($offset < 0) { |
| 12510 | - $offset = (int) \max(0, $string_length + $offset); |
|
| 12510 | + $offset = (int)\max(0, $string_length + $offset); |
|
| 12511 | 12511 | } elseif ($offset > $string_length) { |
| 12512 | 12512 | $offset = $string_length; |
| 12513 | 12513 | } |
| 12514 | 12514 | |
| 12515 | 12515 | if ($length !== null && $length < 0) { |
| 12516 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
| 12516 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
| 12517 | 12517 | } elseif ($length === null || $length > $string_length) { |
| 12518 | 12518 | $length = $string_length; |
| 12519 | 12519 | } |
@@ -12524,9 +12524,9 @@ discard block |
||
| 12524 | 12524 | } |
| 12525 | 12525 | |
| 12526 | 12526 | /** @noinspection AdditionOperationOnArraysInspection */ |
| 12527 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
| 12528 | - $replacement . |
|
| 12529 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 12527 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
| 12528 | + $replacement. |
|
| 12529 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 12530 | 12530 | } |
| 12531 | 12531 | |
| 12532 | 12532 | // |
@@ -12535,8 +12535,7 @@ discard block |
||
| 12535 | 12535 | |
| 12536 | 12536 | if (ASCII::is_ascii($str)) { |
| 12537 | 12537 | return ($length === null) ? |
| 12538 | - \substr_replace($str, $replacement, $offset) : |
|
| 12539 | - \substr_replace($str, $replacement, $offset, $length); |
|
| 12538 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
| 12540 | 12539 | } |
| 12541 | 12540 | |
| 12542 | 12541 | // |
@@ -12552,7 +12551,7 @@ discard block |
||
| 12552 | 12551 | // e.g.: non mbstring support + invalid chars |
| 12553 | 12552 | return ''; |
| 12554 | 12553 | } |
| 12555 | - $length = (int) $length_tmp; |
|
| 12554 | + $length = (int)$length_tmp; |
|
| 12556 | 12555 | } |
| 12557 | 12556 | |
| 12558 | 12557 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -12595,14 +12594,14 @@ discard block |
||
| 12595 | 12594 | && |
| 12596 | 12595 | \substr($haystack, -\strlen($needle)) === $needle |
| 12597 | 12596 | ) { |
| 12598 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
| 12597 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
| 12599 | 12598 | } |
| 12600 | 12599 | |
| 12601 | 12600 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
| 12602 | - return (string) self::substr( |
|
| 12601 | + return (string)self::substr( |
|
| 12603 | 12602 | $haystack, |
| 12604 | 12603 | 0, |
| 12605 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
| 12604 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
| 12606 | 12605 | $encoding |
| 12607 | 12606 | ); |
| 12608 | 12607 | } |
@@ -12637,10 +12636,10 @@ discard block |
||
| 12637 | 12636 | } |
| 12638 | 12637 | |
| 12639 | 12638 | if ($encoding === 'UTF-8') { |
| 12640 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 12639 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 12641 | 12640 | } |
| 12642 | 12641 | |
| 12643 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 12642 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 12644 | 12643 | } |
| 12645 | 12644 | |
| 12646 | 12645 | /** |
@@ -12854,7 +12853,7 @@ discard block |
||
| 12854 | 12853 | public static function to_boolean($str): bool |
| 12855 | 12854 | { |
| 12856 | 12855 | // init |
| 12857 | - $str = (string) $str; |
|
| 12856 | + $str = (string)$str; |
|
| 12858 | 12857 | |
| 12859 | 12858 | if ($str === '') { |
| 12860 | 12859 | return false; |
@@ -12882,10 +12881,10 @@ discard block |
||
| 12882 | 12881 | } |
| 12883 | 12882 | |
| 12884 | 12883 | if (\is_numeric($str)) { |
| 12885 | - return ((float) $str + 0) > 0; |
|
| 12884 | + return ((float)$str + 0) > 0; |
|
| 12886 | 12885 | } |
| 12887 | 12886 | |
| 12888 | - return (bool) \trim($str); |
|
| 12887 | + return (bool)\trim($str); |
|
| 12889 | 12888 | } |
| 12890 | 12889 | |
| 12891 | 12890 | /** |
@@ -12933,7 +12932,7 @@ discard block |
||
| 12933 | 12932 | return $str; |
| 12934 | 12933 | } |
| 12935 | 12934 | |
| 12936 | - $str = (string) $str; |
|
| 12935 | + $str = (string)$str; |
|
| 12937 | 12936 | if ($str === '') { |
| 12938 | 12937 | return ''; |
| 12939 | 12938 | } |
@@ -13041,7 +13040,7 @@ discard block |
||
| 13041 | 13040 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
| 13042 | 13041 | |
| 13043 | 13042 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 13044 | - $buf .= $c1 . $c2; |
|
| 13043 | + $buf .= $c1.$c2; |
|
| 13045 | 13044 | ++$i; |
| 13046 | 13045 | } else { // not valid UTF8 - convert it |
| 13047 | 13046 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13052,7 +13051,7 @@ discard block |
||
| 13052 | 13051 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
| 13053 | 13052 | |
| 13054 | 13053 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 13055 | - $buf .= $c1 . $c2 . $c3; |
|
| 13054 | + $buf .= $c1.$c2.$c3; |
|
| 13056 | 13055 | $i += 2; |
| 13057 | 13056 | } else { // not valid UTF8 - convert it |
| 13058 | 13057 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13064,7 +13063,7 @@ discard block |
||
| 13064 | 13063 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
| 13065 | 13064 | |
| 13066 | 13065 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 13067 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
| 13066 | + $buf .= $c1.$c2.$c3.$c4; |
|
| 13068 | 13067 | $i += 3; |
| 13069 | 13068 | } else { // not valid UTF8 - convert it |
| 13070 | 13069 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13092,13 +13091,13 @@ discard block |
||
| 13092 | 13091 | * |
| 13093 | 13092 | * @return string |
| 13094 | 13093 | */ |
| 13095 | - static function (array $matches): string { |
|
| 13094 | + static function(array $matches): string { |
|
| 13096 | 13095 | if (isset($matches[3])) { |
| 13097 | - $cp = (int) \hexdec($matches[3]); |
|
| 13096 | + $cp = (int)\hexdec($matches[3]); |
|
| 13098 | 13097 | } else { |
| 13099 | 13098 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
| 13100 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
| 13101 | - + (int) \hexdec($matches[2]) |
|
| 13099 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
| 13100 | + + (int)\hexdec($matches[2]) |
|
| 13102 | 13101 | + 0x10000 |
| 13103 | 13102 | - (0xD800 << 10) |
| 13104 | 13103 | - 0xDC00; |
@@ -13109,12 +13108,12 @@ discard block |
||
| 13109 | 13108 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
| 13110 | 13109 | |
| 13111 | 13110 | if ($cp < 0x80) { |
| 13112 | - return (string) self::chr($cp); |
|
| 13111 | + return (string)self::chr($cp); |
|
| 13113 | 13112 | } |
| 13114 | 13113 | |
| 13115 | 13114 | if ($cp < 0xA0) { |
| 13116 | 13115 | /** @noinspection UnnecessaryCastingInspection */ |
| 13117 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
| 13116 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
| 13118 | 13117 | } |
| 13119 | 13118 | |
| 13120 | 13119 | return self::decimal_to_chr($cp); |
@@ -13147,7 +13146,7 @@ discard block |
||
| 13147 | 13146 | public static function to_int(string $str) |
| 13148 | 13147 | { |
| 13149 | 13148 | if (\is_numeric($str)) { |
| 13150 | - return (int) $str; |
|
| 13149 | + return (int)$str; |
|
| 13151 | 13150 | } |
| 13152 | 13151 | |
| 13153 | 13152 | return null; |
@@ -13182,7 +13181,7 @@ discard block |
||
| 13182 | 13181 | || |
| 13183 | 13182 | $input_type === 'double' |
| 13184 | 13183 | ) { |
| 13185 | - return (string) $input; |
|
| 13184 | + return (string)$input; |
|
| 13186 | 13185 | } |
| 13187 | 13186 | |
| 13188 | 13187 | if ($input_type === 'object') { |
@@ -13192,7 +13191,7 @@ discard block |
||
| 13192 | 13191 | /** @noinspection NestedPositiveIfStatementsInspection */ |
| 13193 | 13192 | /** @noinspection MissingOrEmptyGroupStatementInspection */ |
| 13194 | 13193 | if (\method_exists($input, '__toString')) { |
| 13195 | - return (string) $input; |
|
| 13194 | + return (string)$input; |
|
| 13196 | 13195 | } |
| 13197 | 13196 | } |
| 13198 | 13197 | |
@@ -13233,7 +13232,7 @@ discard block |
||
| 13233 | 13232 | } |
| 13234 | 13233 | |
| 13235 | 13234 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 13236 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 13235 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 13237 | 13236 | } |
| 13238 | 13237 | |
| 13239 | 13238 | if ($chars !== null) { |
@@ -13284,15 +13283,15 @@ discard block |
||
| 13284 | 13283 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 13285 | 13284 | |
| 13286 | 13285 | if ($encoding === 'UTF-8') { |
| 13287 | - $str_part_two = (string) \mb_substr($str, 1); |
|
| 13286 | + $str_part_two = (string)\mb_substr($str, 1); |
|
| 13288 | 13287 | |
| 13289 | 13288 | if ($use_mb_functions) { |
| 13290 | 13289 | $str_part_one = \mb_strtoupper( |
| 13291 | - (string) \mb_substr($str, 0, 1) |
|
| 13290 | + (string)\mb_substr($str, 0, 1) |
|
| 13292 | 13291 | ); |
| 13293 | 13292 | } else { |
| 13294 | 13293 | $str_part_one = self::strtoupper( |
| 13295 | - (string) \mb_substr($str, 0, 1), |
|
| 13294 | + (string)\mb_substr($str, 0, 1), |
|
| 13296 | 13295 | $encoding, |
| 13297 | 13296 | false, |
| 13298 | 13297 | $lang, |
@@ -13302,16 +13301,16 @@ discard block |
||
| 13302 | 13301 | } else { |
| 13303 | 13302 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 13304 | 13303 | |
| 13305 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
| 13304 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
| 13306 | 13305 | |
| 13307 | 13306 | if ($use_mb_functions) { |
| 13308 | 13307 | $str_part_one = \mb_strtoupper( |
| 13309 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
| 13308 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
| 13310 | 13309 | $encoding |
| 13311 | 13310 | ); |
| 13312 | 13311 | } else { |
| 13313 | 13312 | $str_part_one = self::strtoupper( |
| 13314 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 13313 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 13315 | 13314 | $encoding, |
| 13316 | 13315 | false, |
| 13317 | 13316 | $lang, |
@@ -13320,7 +13319,7 @@ discard block |
||
| 13320 | 13319 | } |
| 13321 | 13320 | } |
| 13322 | 13321 | |
| 13323 | - return $str_part_one . $str_part_two; |
|
| 13322 | + return $str_part_one.$str_part_two; |
|
| 13324 | 13323 | } |
| 13325 | 13324 | |
| 13326 | 13325 | /** |
@@ -13381,7 +13380,7 @@ discard block |
||
| 13381 | 13380 | $str = self::clean($str); |
| 13382 | 13381 | } |
| 13383 | 13382 | |
| 13384 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
| 13383 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
| 13385 | 13384 | |
| 13386 | 13385 | if ( |
| 13387 | 13386 | $use_php_default_functions |
@@ -13798,7 +13797,7 @@ discard block |
||
| 13798 | 13797 | if ( |
| 13799 | 13798 | $keep_utf8_chars |
| 13800 | 13799 | && |
| 13801 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
| 13800 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
| 13802 | 13801 | ) { |
| 13803 | 13802 | return $str_backup; |
| 13804 | 13803 | } |
@@ -13889,17 +13888,17 @@ discard block |
||
| 13889 | 13888 | return ''; |
| 13890 | 13889 | } |
| 13891 | 13890 | |
| 13892 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
| 13891 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
| 13893 | 13892 | |
| 13894 | 13893 | if ( |
| 13895 | 13894 | !isset($matches[0]) |
| 13896 | 13895 | || |
| 13897 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
| 13896 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
| 13898 | 13897 | ) { |
| 13899 | 13898 | return $str; |
| 13900 | 13899 | } |
| 13901 | 13900 | |
| 13902 | - return \rtrim($matches[0]) . $str_add_on; |
|
| 13901 | + return \rtrim($matches[0]).$str_add_on; |
|
| 13903 | 13902 | } |
| 13904 | 13903 | |
| 13905 | 13904 | /** |
@@ -13994,7 +13993,7 @@ discard block |
||
| 13994 | 13993 | } |
| 13995 | 13994 | } |
| 13996 | 13995 | |
| 13997 | - return $str_return . \implode('', $charsArray); |
|
| 13996 | + return $str_return.\implode('', $charsArray); |
|
| 13998 | 13997 | } |
| 13999 | 13998 | |
| 14000 | 13999 | /** |
@@ -14048,7 +14047,7 @@ discard block |
||
| 14048 | 14047 | $final_break = ''; |
| 14049 | 14048 | } |
| 14050 | 14049 | |
| 14051 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
| 14050 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
| 14052 | 14051 | } |
| 14053 | 14052 | |
| 14054 | 14053 | /** |
@@ -14290,7 +14289,7 @@ discard block |
||
| 14290 | 14289 | /** @noinspection PhpIncludeInspection */ |
| 14291 | 14290 | /** @noinspection UsingInclusionReturnValueInspection */ |
| 14292 | 14291 | /** @psalm-suppress UnresolvableInclude */ |
| 14293 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
| 14292 | + return include __DIR__.'/data/'.$file.'.php'; |
|
| 14294 | 14293 | } |
| 14295 | 14294 | |
| 14296 | 14295 | /** |
@@ -14310,7 +14309,7 @@ discard block |
||
| 14310 | 14309 | */ |
| 14311 | 14310 | \uksort( |
| 14312 | 14311 | self::$EMOJI, |
| 14313 | - static function (string $a, string $b): int { |
|
| 14312 | + static function(string $a, string $b): int { |
|
| 14314 | 14313 | return \strlen($b) <=> \strlen($a); |
| 14315 | 14314 | } |
| 14316 | 14315 | ); |
@@ -14320,7 +14319,7 @@ discard block |
||
| 14320 | 14319 | |
| 14321 | 14320 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
| 14322 | 14321 | $tmp_key = \crc32($key); |
| 14323 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
| 14322 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
| 14324 | 14323 | } |
| 14325 | 14324 | |
| 14326 | 14325 | return true; |
@@ -14348,7 +14347,7 @@ discard block |
||
| 14348 | 14347 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 14349 | 14348 | return \defined('MB_OVERLOAD_STRING') |
| 14350 | 14349 | && |
| 14351 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 14350 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 14352 | 14351 | } |
| 14353 | 14352 | |
| 14354 | 14353 | /** |
@@ -14414,7 +14413,7 @@ discard block |
||
| 14414 | 14413 | */ |
| 14415 | 14414 | static $RX_CLASS_CACHE = []; |
| 14416 | 14415 | |
| 14417 | - $cache_key = $s . '_' . $class; |
|
| 14416 | + $cache_key = $s.'_'.$class; |
|
| 14418 | 14417 | |
| 14419 | 14418 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
| 14420 | 14419 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -14427,7 +14426,7 @@ discard block |
||
| 14427 | 14426 | /** @noinspection AlterInForeachInspection */ |
| 14428 | 14427 | foreach (self::str_split($s) as &$s) { |
| 14429 | 14428 | if ($s === '-') { |
| 14430 | - $class_array[0] = '-' . $class_array[0]; |
|
| 14429 | + $class_array[0] = '-'.$class_array[0]; |
|
| 14431 | 14430 | } elseif (!isset($s[2])) { |
| 14432 | 14431 | $class_array[0] .= \preg_quote($s, '/'); |
| 14433 | 14432 | } elseif (self::strlen($s) === 1) { |
@@ -14438,13 +14437,13 @@ discard block |
||
| 14438 | 14437 | } |
| 14439 | 14438 | |
| 14440 | 14439 | if ($class_array[0]) { |
| 14441 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
| 14440 | + $class_array[0] = '['.$class_array[0].']'; |
|
| 14442 | 14441 | } |
| 14443 | 14442 | |
| 14444 | 14443 | if (\count($class_array) === 1) { |
| 14445 | 14444 | $return = $class_array[0]; |
| 14446 | 14445 | } else { |
| 14447 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
| 14446 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
| 14448 | 14447 | } |
| 14449 | 14448 | |
| 14450 | 14449 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -14525,7 +14524,7 @@ discard block |
||
| 14525 | 14524 | |
| 14526 | 14525 | if ($delimiter === '-') { |
| 14527 | 14526 | /** @noinspection AlterInForeachInspection */ |
| 14528 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
| 14527 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
| 14529 | 14528 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
| 14530 | 14529 | $continue = true; |
| 14531 | 14530 | |
@@ -14535,7 +14534,7 @@ discard block |
||
| 14535 | 14534 | } |
| 14536 | 14535 | |
| 14537 | 14536 | /** @noinspection AlterInForeachInspection */ |
| 14538 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
| 14537 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
| 14539 | 14538 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
| 14540 | 14539 | $continue = true; |
| 14541 | 14540 | |
@@ -14605,8 +14604,8 @@ discard block |
||
| 14605 | 14604 | } else { |
| 14606 | 14605 | /** @noinspection OffsetOperationsInspection */ |
| 14607 | 14606 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
| 14608 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
| 14609 | - $buf .= $cc1 . $cc2; |
|
| 14607 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
| 14608 | + $buf .= $cc1.$cc2; |
|
| 14610 | 14609 | } |
| 14611 | 14610 | |
| 14612 | 14611 | return $buf; |
@@ -14625,7 +14624,7 @@ discard block |
||
| 14625 | 14624 | { |
| 14626 | 14625 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
| 14627 | 14626 | if (\preg_match($pattern, $str)) { |
| 14628 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
| 14627 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
| 14629 | 14628 | } |
| 14630 | 14629 | |
| 14631 | 14630 | return $str; |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require __DIR__ . '/../vendor/autoload.php'; |
|
| 4 | -require __DIR__ . '/vendor/autoload.php'; |
|
| 3 | +require __DIR__.'/../vendor/autoload.php'; |
|
| 4 | +require __DIR__.'/vendor/autoload.php'; |
|
| 5 | 5 | |
| 6 | 6 | $readmeText = (new \voku\PhpReadmeHelper\GenerateApi())->generate( |
| 7 | - __DIR__ . '/../src/voku/helper/UTF8.php', |
|
| 8 | - __DIR__ . '/docs/base.md' |
|
| 7 | + __DIR__.'/../src/voku/helper/UTF8.php', |
|
| 8 | + __DIR__.'/docs/base.md' |
|
| 9 | 9 | ); |
| 10 | 10 | |
| 11 | -file_put_contents(__DIR__ . '/../README.md', $readmeText); |
|
| 11 | +file_put_contents(__DIR__.'/../README.md', $readmeText); |
|