@@ -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 | // |
@@ -247,10 +247,10 @@ discard block |
||
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | if ($encoding === 'UTF-8') { |
| 250 | - return (string) \mb_substr($str, $pos, 1); |
|
| 250 | + return (string)\mb_substr($str, $pos, 1); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
| 253 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | /** |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | public static function add_bom_to_string(string $str): string |
| 269 | 269 | { |
| 270 | 270 | if (!self::string_has_bom($str)) { |
| 271 | - $str = self::bom() . $str; |
|
| 271 | + $str = self::bom().$str; |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | return $str; |
@@ -303,8 +303,8 @@ discard block |
||
| 303 | 303 | $return = []; |
| 304 | 304 | foreach ($array as $key => &$value) { |
| 305 | 305 | $key = $case === \CASE_LOWER |
| 306 | - ? self::strtolower((string) $key, $encoding) |
|
| 307 | - : self::strtoupper((string) $key, $encoding); |
|
| 306 | + ? self::strtolower((string)$key, $encoding) |
|
| 307 | + : self::strtoupper((string)$key, $encoding); |
|
| 308 | 308 | |
| 309 | 309 | $return[$key] = $value; |
| 310 | 310 | } |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | return ''; |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
| 343 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
| 344 | 344 | $end_position = \mb_strpos($str, $end, $substr_index); |
| 345 | 345 | if ( |
| 346 | 346 | $end_position === false |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | return ''; |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
| 353 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | return ''; |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
| 363 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
| 364 | 364 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
| 365 | 365 | if ( |
| 366 | 366 | $end_position === false |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | return ''; |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - return (string) self::substr( |
|
| 373 | + return (string)self::substr( |
|
| 374 | 374 | $str, |
| 375 | 375 | $substr_index, |
| 376 | 376 | $end_position - $substr_index, |
@@ -448,10 +448,10 @@ discard block |
||
| 448 | 448 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
| 449 | 449 | { |
| 450 | 450 | if ($encoding === 'UTF-8') { |
| 451 | - return (string) \mb_substr($str, $index, 1); |
|
| 451 | + return (string)\mb_substr($str, $index, 1); |
|
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - return (string) self::substr($str, $index, 1, $encoding); |
|
| 454 | + return (string)self::substr($str, $index, 1, $encoding); |
|
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | /** |
@@ -565,14 +565,14 @@ discard block |
||
| 565 | 565 | /** |
| 566 | 566 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 567 | 567 | */ |
| 568 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 568 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | if ($code_point <= 0) { |
| 572 | 572 | return null; |
| 573 | 573 | } |
| 574 | 574 | |
| 575 | - $cache_key = $code_point . '_' . $encoding; |
|
| 575 | + $cache_key = $code_point.'_'.$encoding; |
|
| 576 | 576 | if (isset($CHAR_CACHE[$cache_key])) { |
| 577 | 577 | return $CHAR_CACHE[$cache_key]; |
| 578 | 578 | } |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | self::$CHR = self::getData('chr'); |
| 619 | 619 | } |
| 620 | 620 | |
| 621 | - $code_point = (int) $code_point; |
|
| 621 | + $code_point = (int)$code_point; |
|
| 622 | 622 | if ($code_point <= 0x7F) { |
| 623 | 623 | /** |
| 624 | 624 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -628,22 +628,22 @@ discard block |
||
| 628 | 628 | /** |
| 629 | 629 | * @psalm-suppress PossiblyNullArrayAccess |
| 630 | 630 | */ |
| 631 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
| 631 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
| 632 | 632 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 633 | 633 | } elseif ($code_point <= 0xFFFF) { |
| 634 | 634 | /** |
| 635 | 635 | * @psalm-suppress PossiblyNullArrayAccess |
| 636 | 636 | */ |
| 637 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
| 638 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 637 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
| 638 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 639 | 639 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 640 | 640 | } else { |
| 641 | 641 | /** |
| 642 | 642 | * @psalm-suppress PossiblyNullArrayAccess |
| 643 | 643 | */ |
| 644 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
| 645 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 646 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 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 | 647 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 648 | 648 | } |
| 649 | 649 | |
@@ -696,7 +696,7 @@ discard block |
||
| 696 | 696 | |
| 697 | 697 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
| 698 | 698 | return \array_map( |
| 699 | - static function (string $data): int { |
|
| 699 | + static function(string $data): int { |
|
| 700 | 700 | // "mb_" is available if overload is used, so use it ... |
| 701 | 701 | return \mb_strlen($data, 'CP850'); // 8-BIT |
| 702 | 702 | }, |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | $char = ''; |
| 778 | 778 | } |
| 779 | 779 | |
| 780 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
| 780 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
| 781 | 781 | } |
| 782 | 782 | |
| 783 | 783 | /** |
@@ -870,7 +870,7 @@ discard block |
||
| 870 | 870 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
| 871 | 871 | /x'; |
| 872 | 872 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
| 873 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
| 873 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
| 874 | 874 | |
| 875 | 875 | if ($replace_diamond_question_mark) { |
| 876 | 876 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -907,7 +907,7 @@ discard block |
||
| 907 | 907 | public static function cleanup($str): string |
| 908 | 908 | { |
| 909 | 909 | // init |
| 910 | - $str = (string) $str; |
|
| 910 | + $str = (string)$str; |
|
| 911 | 911 | |
| 912 | 912 | if ($str === '') { |
| 913 | 913 | return ''; |
@@ -1004,7 +1004,7 @@ discard block |
||
| 1004 | 1004 | { |
| 1005 | 1005 | if (self::$SUPPORT['mbstring'] === true) { |
| 1006 | 1006 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 1007 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 1007 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 1008 | 1008 | } |
| 1009 | 1009 | |
| 1010 | 1010 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -1092,9 +1092,9 @@ discard block |
||
| 1092 | 1092 | // - 0-9 (U+0061 - U+007A) |
| 1093 | 1093 | // - ISO 10646 characters U+00A1 and higher |
| 1094 | 1094 | // We strip out any character not in the above list. |
| 1095 | - $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); |
|
| 1095 | + $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); |
|
| 1096 | 1096 | // Identifiers cannot start with a digit, two hyphens, or a hyphen followed by a digit. |
| 1097 | - $str = (string) \preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
| 1097 | + $str = (string)\preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
| 1098 | 1098 | |
| 1099 | 1099 | return \trim($str, '-'); |
| 1100 | 1100 | } |
@@ -1110,7 +1110,7 @@ discard block |
||
| 1110 | 1110 | */ |
| 1111 | 1111 | public static function css_stripe_media_queries(string $str): string |
| 1112 | 1112 | { |
| 1113 | - return (string) \preg_replace( |
|
| 1113 | + return (string)\preg_replace( |
|
| 1114 | 1114 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
| 1115 | 1115 | '', |
| 1116 | 1116 | $str |
@@ -1141,7 +1141,7 @@ discard block |
||
| 1141 | 1141 | */ |
| 1142 | 1142 | public static function decimal_to_chr($int): string |
| 1143 | 1143 | { |
| 1144 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
| 1144 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
| 1145 | 1145 | } |
| 1146 | 1146 | |
| 1147 | 1147 | /** |
@@ -1191,7 +1191,7 @@ discard block |
||
| 1191 | 1191 | $flagOffset = 0x1F1E6; |
| 1192 | 1192 | $asciiOffset = 0x41; |
| 1193 | 1193 | |
| 1194 | - return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? '') . |
|
| 1194 | + return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? ''). |
|
| 1195 | 1195 | (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
| 1196 | 1196 | } |
| 1197 | 1197 | |
@@ -1214,16 +1214,16 @@ discard block |
||
| 1214 | 1214 | self::initEmojiData(); |
| 1215 | 1215 | |
| 1216 | 1216 | if ($use_reversible_string_mappings) { |
| 1217 | - return (string) \str_replace( |
|
| 1218 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1219 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1217 | + return (string)\str_replace( |
|
| 1218 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1219 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1220 | 1220 | $str |
| 1221 | 1221 | ); |
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | - return (string) \str_replace( |
|
| 1225 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 1226 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1224 | + return (string)\str_replace( |
|
| 1225 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 1226 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1227 | 1227 | $str |
| 1228 | 1228 | ); |
| 1229 | 1229 | } |
@@ -1247,16 +1247,16 @@ discard block |
||
| 1247 | 1247 | self::initEmojiData(); |
| 1248 | 1248 | |
| 1249 | 1249 | if ($use_reversible_string_mappings) { |
| 1250 | - return (string) \str_replace( |
|
| 1251 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1252 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1250 | + return (string)\str_replace( |
|
| 1251 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1252 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1253 | 1253 | $str |
| 1254 | 1254 | ); |
| 1255 | 1255 | } |
| 1256 | 1256 | |
| 1257 | - return (string) \str_replace( |
|
| 1258 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1259 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 1257 | + return (string)\str_replace( |
|
| 1258 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1259 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 1260 | 1260 | $str |
| 1261 | 1261 | ); |
| 1262 | 1262 | } |
@@ -1312,7 +1312,7 @@ discard block |
||
| 1312 | 1312 | if ($to_encoding === 'JSON') { |
| 1313 | 1313 | $return = self::json_encode($str); |
| 1314 | 1314 | if ($return === false) { |
| 1315 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
| 1315 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
| 1316 | 1316 | } |
| 1317 | 1317 | |
| 1318 | 1318 | return $return; |
@@ -1402,7 +1402,7 @@ discard block |
||
| 1402 | 1402 | /** |
| 1403 | 1403 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 1404 | 1404 | */ |
| 1405 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
| 1405 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
| 1406 | 1406 | } |
| 1407 | 1407 | |
| 1408 | 1408 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1502,31 +1502,31 @@ discard block |
||
| 1502 | 1502 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
| 1503 | 1503 | |
| 1504 | 1504 | if ($length === null) { |
| 1505 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
| 1505 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
| 1506 | 1506 | } |
| 1507 | 1507 | |
| 1508 | 1508 | if ($search === '') { |
| 1509 | 1509 | if ($encoding === 'UTF-8') { |
| 1510 | 1510 | if ($length > 0) { |
| 1511 | - $string_length = (int) \mb_strlen($str); |
|
| 1511 | + $string_length = (int)\mb_strlen($str); |
|
| 1512 | 1512 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
| 1513 | 1513 | } else { |
| 1514 | 1514 | $end = 0; |
| 1515 | 1515 | } |
| 1516 | 1516 | |
| 1517 | - $pos = (int) \min( |
|
| 1517 | + $pos = (int)\min( |
|
| 1518 | 1518 | \mb_strpos($str, ' ', $end), |
| 1519 | 1519 | \mb_strpos($str, '.', $end) |
| 1520 | 1520 | ); |
| 1521 | 1521 | } else { |
| 1522 | 1522 | if ($length > 0) { |
| 1523 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 1523 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 1524 | 1524 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
| 1525 | 1525 | } else { |
| 1526 | 1526 | $end = 0; |
| 1527 | 1527 | } |
| 1528 | 1528 | |
| 1529 | - $pos = (int) \min( |
|
| 1529 | + $pos = (int)\min( |
|
| 1530 | 1530 | self::strpos($str, ' ', $end, $encoding), |
| 1531 | 1531 | self::strpos($str, '.', $end, $encoding) |
| 1532 | 1532 | ); |
@@ -1543,18 +1543,18 @@ discard block |
||
| 1543 | 1543 | return ''; |
| 1544 | 1544 | } |
| 1545 | 1545 | |
| 1546 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1546 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1547 | 1547 | } |
| 1548 | 1548 | |
| 1549 | 1549 | return $str; |
| 1550 | 1550 | } |
| 1551 | 1551 | |
| 1552 | 1552 | if ($encoding === 'UTF-8') { |
| 1553 | - $word_position = (int) \mb_stripos($str, $search); |
|
| 1554 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
| 1553 | + $word_position = (int)\mb_stripos($str, $search); |
|
| 1554 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
| 1555 | 1555 | } else { |
| 1556 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
| 1557 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
| 1556 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
| 1557 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
| 1558 | 1558 | } |
| 1559 | 1559 | |
| 1560 | 1560 | $pos_start = 0; |
@@ -1566,12 +1566,12 @@ discard block |
||
| 1566 | 1566 | } |
| 1567 | 1567 | if ($half_text !== false) { |
| 1568 | 1568 | if ($encoding === 'UTF-8') { |
| 1569 | - $pos_start = (int) \max( |
|
| 1569 | + $pos_start = (int)\max( |
|
| 1570 | 1570 | \mb_strrpos($half_text, ' '), |
| 1571 | 1571 | \mb_strrpos($half_text, '.') |
| 1572 | 1572 | ); |
| 1573 | 1573 | } else { |
| 1574 | - $pos_start = (int) \max( |
|
| 1574 | + $pos_start = (int)\max( |
|
| 1575 | 1575 | self::strrpos($half_text, ' ', 0, $encoding), |
| 1576 | 1576 | self::strrpos($half_text, '.', 0, $encoding) |
| 1577 | 1577 | ); |
@@ -1581,19 +1581,19 @@ discard block |
||
| 1581 | 1581 | |
| 1582 | 1582 | if ($word_position && $half_side > 0) { |
| 1583 | 1583 | $offset = $pos_start + $length - 1; |
| 1584 | - $real_length = (int) self::strlen($str, $encoding); |
|
| 1584 | + $real_length = (int)self::strlen($str, $encoding); |
|
| 1585 | 1585 | |
| 1586 | 1586 | if ($offset > $real_length) { |
| 1587 | 1587 | $offset = $real_length; |
| 1588 | 1588 | } |
| 1589 | 1589 | |
| 1590 | 1590 | if ($encoding === 'UTF-8') { |
| 1591 | - $pos_end = (int) \min( |
|
| 1591 | + $pos_end = (int)\min( |
|
| 1592 | 1592 | \mb_strpos($str, ' ', $offset), |
| 1593 | 1593 | \mb_strpos($str, '.', $offset) |
| 1594 | 1594 | ) - $pos_start; |
| 1595 | 1595 | } else { |
| 1596 | - $pos_end = (int) \min( |
|
| 1596 | + $pos_end = (int)\min( |
|
| 1597 | 1597 | self::strpos($str, ' ', $offset, $encoding), |
| 1598 | 1598 | self::strpos($str, '.', $offset, $encoding) |
| 1599 | 1599 | ) - $pos_start; |
@@ -1601,12 +1601,12 @@ discard block |
||
| 1601 | 1601 | |
| 1602 | 1602 | if (!$pos_end || $pos_end <= 0) { |
| 1603 | 1603 | if ($encoding === 'UTF-8') { |
| 1604 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
| 1604 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
| 1605 | 1605 | } else { |
| 1606 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
| 1606 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
| 1607 | 1607 | } |
| 1608 | 1608 | if ($str_sub !== false) { |
| 1609 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
| 1609 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
| 1610 | 1610 | } else { |
| 1611 | 1611 | $extract = ''; |
| 1612 | 1612 | } |
@@ -1617,26 +1617,26 @@ discard block |
||
| 1617 | 1617 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
| 1618 | 1618 | } |
| 1619 | 1619 | if ($str_sub !== false) { |
| 1620 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1620 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1621 | 1621 | } else { |
| 1622 | 1622 | $extract = ''; |
| 1623 | 1623 | } |
| 1624 | 1624 | } |
| 1625 | 1625 | } else { |
| 1626 | 1626 | $offset = $length - 1; |
| 1627 | - $true_length = (int) self::strlen($str, $encoding); |
|
| 1627 | + $true_length = (int)self::strlen($str, $encoding); |
|
| 1628 | 1628 | |
| 1629 | 1629 | if ($offset > $true_length) { |
| 1630 | 1630 | $offset = $true_length; |
| 1631 | 1631 | } |
| 1632 | 1632 | |
| 1633 | 1633 | if ($encoding === 'UTF-8') { |
| 1634 | - $pos_end = (int) \min( |
|
| 1634 | + $pos_end = (int)\min( |
|
| 1635 | 1635 | \mb_strpos($str, ' ', $offset), |
| 1636 | 1636 | \mb_strpos($str, '.', $offset) |
| 1637 | 1637 | ); |
| 1638 | 1638 | } else { |
| 1639 | - $pos_end = (int) \min( |
|
| 1639 | + $pos_end = (int)\min( |
|
| 1640 | 1640 | self::strpos($str, ' ', $offset, $encoding), |
| 1641 | 1641 | self::strpos($str, '.', $offset, $encoding) |
| 1642 | 1642 | ); |
@@ -1649,7 +1649,7 @@ discard block |
||
| 1649 | 1649 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
| 1650 | 1650 | } |
| 1651 | 1651 | if ($str_sub !== false) { |
| 1652 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1652 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1653 | 1653 | } else { |
| 1654 | 1654 | $extract = ''; |
| 1655 | 1655 | } |
@@ -1778,7 +1778,7 @@ discard block |
||
| 1778 | 1778 | { |
| 1779 | 1779 | $file_content = \file_get_contents($file_path); |
| 1780 | 1780 | if ($file_content === false) { |
| 1781 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
| 1781 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
| 1782 | 1782 | } |
| 1783 | 1783 | |
| 1784 | 1784 | return self::string_has_bom($file_content); |
@@ -1838,7 +1838,7 @@ discard block |
||
| 1838 | 1838 | ) { |
| 1839 | 1839 | // Prevent leading combining chars |
| 1840 | 1840 | // for NFC-safe concatenations. |
| 1841 | - $var = $leading_combining . $var; |
|
| 1841 | + $var = $leading_combining.$var; |
|
| 1842 | 1842 | } |
| 1843 | 1843 | } |
| 1844 | 1844 | |
@@ -2123,10 +2123,10 @@ discard block |
||
| 2123 | 2123 | } |
| 2124 | 2124 | |
| 2125 | 2125 | if ($encoding === 'UTF-8') { |
| 2126 | - return (string) \mb_substr($str, 0, $n); |
|
| 2126 | + return (string)\mb_substr($str, 0, $n); |
|
| 2127 | 2127 | } |
| 2128 | 2128 | |
| 2129 | - return (string) self::substr($str, 0, $n, $encoding); |
|
| 2129 | + return (string)self::substr($str, 0, $n, $encoding); |
|
| 2130 | 2130 | } |
| 2131 | 2131 | |
| 2132 | 2132 | /** |
@@ -2142,7 +2142,7 @@ discard block |
||
| 2142 | 2142 | */ |
| 2143 | 2143 | public static function fits_inside(string $str, int $box_size): bool |
| 2144 | 2144 | { |
| 2145 | - return (int) self::strlen($str) <= $box_size; |
|
| 2145 | + return (int)self::strlen($str) <= $box_size; |
|
| 2146 | 2146 | } |
| 2147 | 2147 | |
| 2148 | 2148 | /** |
@@ -2221,7 +2221,7 @@ discard block |
||
| 2221 | 2221 | return $str; |
| 2222 | 2222 | } |
| 2223 | 2223 | |
| 2224 | - $str = (string) $str; |
|
| 2224 | + $str = (string)$str; |
|
| 2225 | 2225 | $last = ''; |
| 2226 | 2226 | while ($last !== $str) { |
| 2227 | 2227 | $last = $str; |
@@ -2428,7 +2428,7 @@ discard block |
||
| 2428 | 2428 | return $fallback; |
| 2429 | 2429 | } |
| 2430 | 2430 | /** @noinspection OffsetOperationsInspection */ |
| 2431 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
| 2431 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
| 2432 | 2432 | |
| 2433 | 2433 | // DEBUG |
| 2434 | 2434 | //var_dump($type_code); |
@@ -2486,7 +2486,7 @@ discard block |
||
| 2486 | 2486 | // |
| 2487 | 2487 | |
| 2488 | 2488 | if ($encoding === 'UTF-8') { |
| 2489 | - $max_length = (int) \mb_strlen($possible_chars); |
|
| 2489 | + $max_length = (int)\mb_strlen($possible_chars); |
|
| 2490 | 2490 | if ($max_length === 0) { |
| 2491 | 2491 | return ''; |
| 2492 | 2492 | } |
@@ -2507,7 +2507,7 @@ discard block |
||
| 2507 | 2507 | } else { |
| 2508 | 2508 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 2509 | 2509 | |
| 2510 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
| 2510 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
| 2511 | 2511 | if ($max_length === 0) { |
| 2512 | 2512 | return ''; |
| 2513 | 2513 | } |
@@ -2545,16 +2545,16 @@ discard block |
||
| 2545 | 2545 | $rand_int = \mt_rand(0, \mt_getrandmax()); |
| 2546 | 2546 | } |
| 2547 | 2547 | |
| 2548 | - $unique_helper = $rand_int . |
|
| 2549 | - \session_id() . |
|
| 2550 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
| 2551 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
| 2548 | + $unique_helper = $rand_int. |
|
| 2549 | + \session_id(). |
|
| 2550 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
| 2551 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
| 2552 | 2552 | $extra_entropy; |
| 2553 | 2553 | |
| 2554 | 2554 | $unique_string = \uniqid($unique_helper, true); |
| 2555 | 2555 | |
| 2556 | 2556 | if ($use_md5) { |
| 2557 | - $unique_string = \md5($unique_string . $unique_helper); |
|
| 2557 | + $unique_string = \md5($unique_string.$unique_helper); |
|
| 2558 | 2558 | } |
| 2559 | 2559 | |
| 2560 | 2560 | return $unique_string; |
@@ -2666,7 +2666,7 @@ discard block |
||
| 2666 | 2666 | public static function hex_to_int($hexdec) |
| 2667 | 2667 | { |
| 2668 | 2668 | // init |
| 2669 | - $hexdec = (string) $hexdec; |
|
| 2669 | + $hexdec = (string)$hexdec; |
|
| 2670 | 2670 | |
| 2671 | 2671 | if ($hexdec === '') { |
| 2672 | 2672 | return false; |
@@ -2763,7 +2763,7 @@ discard block |
||
| 2763 | 2763 | return \implode( |
| 2764 | 2764 | '', |
| 2765 | 2765 | \array_map( |
| 2766 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
| 2766 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
| 2767 | 2767 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
| 2768 | 2768 | }, |
| 2769 | 2769 | self::str_split($str) |
@@ -2875,7 +2875,7 @@ discard block |
||
| 2875 | 2875 | /** |
| 2876 | 2876 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 2877 | 2877 | */ |
| 2878 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 2878 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 2879 | 2879 | } |
| 2880 | 2880 | |
| 2881 | 2881 | do { |
@@ -2884,7 +2884,7 @@ discard block |
||
| 2884 | 2884 | if (\strpos($str, '&') !== false) { |
| 2885 | 2885 | if (\strpos($str, '&#') !== false) { |
| 2886 | 2886 | // decode also numeric & UTF16 two byte entities |
| 2887 | - $str = (string) \preg_replace( |
|
| 2887 | + $str = (string)\preg_replace( |
|
| 2888 | 2888 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
| 2889 | 2889 | '$1;', |
| 2890 | 2890 | $str |
@@ -2934,7 +2934,7 @@ discard block |
||
| 2934 | 2934 | */ |
| 2935 | 2935 | public static function html_stripe_empty_tags(string $str): string |
| 2936 | 2936 | { |
| 2937 | - return (string) \preg_replace( |
|
| 2937 | + return (string)\preg_replace( |
|
| 2938 | 2938 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
| 2939 | 2939 | '', |
| 2940 | 2940 | $str |
@@ -3254,9 +3254,9 @@ discard block |
||
| 3254 | 3254 | { |
| 3255 | 3255 | $hex = \dechex($int); |
| 3256 | 3256 | |
| 3257 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
| 3257 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
| 3258 | 3258 | |
| 3259 | - return $prefix . $hex . ''; |
|
| 3259 | + return $prefix.$hex.''; |
|
| 3260 | 3260 | } |
| 3261 | 3261 | |
| 3262 | 3262 | /** |
@@ -3577,7 +3577,7 @@ discard block |
||
| 3577 | 3577 | */ |
| 3578 | 3578 | public static function is_binary($input, bool $strict = false): bool |
| 3579 | 3579 | { |
| 3580 | - $input = (string) $input; |
|
| 3580 | + $input = (string)$input; |
|
| 3581 | 3581 | if ($input === '') { |
| 3582 | 3582 | return false; |
| 3583 | 3583 | } |
@@ -3921,7 +3921,7 @@ discard block |
||
| 3921 | 3921 | public static function is_utf16($str, bool $check_if_string_is_binary = true) |
| 3922 | 3922 | { |
| 3923 | 3923 | // init |
| 3924 | - $str = (string) $str; |
|
| 3924 | + $str = (string)$str; |
|
| 3925 | 3925 | $str_chars = []; |
| 3926 | 3926 | |
| 3927 | 3927 | if ( |
@@ -4007,7 +4007,7 @@ discard block |
||
| 4007 | 4007 | public static function is_utf32($str, bool $check_if_string_is_binary = true) |
| 4008 | 4008 | { |
| 4009 | 4009 | // init |
| 4010 | - $str = (string) $str; |
|
| 4010 | + $str = (string)$str; |
|
| 4011 | 4011 | $str_chars = []; |
| 4012 | 4012 | |
| 4013 | 4013 | if ( |
@@ -4099,7 +4099,7 @@ discard block |
||
| 4099 | 4099 | return true; |
| 4100 | 4100 | } |
| 4101 | 4101 | |
| 4102 | - return self::is_utf8_string((string) $str, $strict); |
|
| 4102 | + return self::is_utf8_string((string)$str, $strict); |
|
| 4103 | 4103 | } |
| 4104 | 4104 | |
| 4105 | 4105 | /** |
@@ -4249,15 +4249,15 @@ discard block |
||
| 4249 | 4249 | $use_mb_functions = ($lang === null && !$try_to_keep_the_string_length); |
| 4250 | 4250 | |
| 4251 | 4251 | if ($encoding === 'UTF-8') { |
| 4252 | - $str_part_two = (string) \mb_substr($str, 1); |
|
| 4252 | + $str_part_two = (string)\mb_substr($str, 1); |
|
| 4253 | 4253 | |
| 4254 | 4254 | if ($use_mb_functions) { |
| 4255 | 4255 | $str_part_one = \mb_strtolower( |
| 4256 | - (string) \mb_substr($str, 0, 1) |
|
| 4256 | + (string)\mb_substr($str, 0, 1) |
|
| 4257 | 4257 | ); |
| 4258 | 4258 | } else { |
| 4259 | 4259 | $str_part_one = self::strtolower( |
| 4260 | - (string) \mb_substr($str, 0, 1), |
|
| 4260 | + (string)\mb_substr($str, 0, 1), |
|
| 4261 | 4261 | $encoding, |
| 4262 | 4262 | false, |
| 4263 | 4263 | $lang, |
@@ -4267,10 +4267,10 @@ discard block |
||
| 4267 | 4267 | } else { |
| 4268 | 4268 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4269 | 4269 | |
| 4270 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
| 4270 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
| 4271 | 4271 | |
| 4272 | 4272 | $str_part_one = self::strtolower( |
| 4273 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 4273 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 4274 | 4274 | $encoding, |
| 4275 | 4275 | false, |
| 4276 | 4276 | $lang, |
@@ -4278,7 +4278,7 @@ discard block |
||
| 4278 | 4278 | ); |
| 4279 | 4279 | } |
| 4280 | 4280 | |
| 4281 | - return $str_part_one . $str_part_two; |
|
| 4281 | + return $str_part_one.$str_part_two; |
|
| 4282 | 4282 | } |
| 4283 | 4283 | |
| 4284 | 4284 | /** |
@@ -4425,7 +4425,7 @@ discard block |
||
| 4425 | 4425 | } |
| 4426 | 4426 | |
| 4427 | 4427 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4428 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 4428 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 4429 | 4429 | } |
| 4430 | 4430 | |
| 4431 | 4431 | if ($chars) { |
@@ -4478,7 +4478,7 @@ discard block |
||
| 4478 | 4478 | { |
| 4479 | 4479 | $bytes = self::chr_size_list($str); |
| 4480 | 4480 | if ($bytes !== []) { |
| 4481 | - return (int) \max($bytes); |
|
| 4481 | + return (int)\max($bytes); |
|
| 4482 | 4482 | } |
| 4483 | 4483 | |
| 4484 | 4484 | return 0; |
@@ -4560,7 +4560,7 @@ discard block |
||
| 4560 | 4560 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
| 4561 | 4561 | |
| 4562 | 4562 | // init |
| 4563 | - $encoding = (string) $encoding; |
|
| 4563 | + $encoding = (string)$encoding; |
|
| 4564 | 4564 | |
| 4565 | 4565 | if (!$encoding) { |
| 4566 | 4566 | return $fallback; |
@@ -4622,7 +4622,7 @@ discard block |
||
| 4622 | 4622 | |
| 4623 | 4623 | $encoding_original = $encoding; |
| 4624 | 4624 | $encoding = \strtoupper($encoding); |
| 4625 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
| 4625 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
| 4626 | 4626 | |
| 4627 | 4627 | $equivalences = [ |
| 4628 | 4628 | 'ISO8859' => 'ISO-8859-1', |
@@ -4780,13 +4780,13 @@ discard block |
||
| 4780 | 4780 | static $CHAR_CACHE = []; |
| 4781 | 4781 | |
| 4782 | 4782 | // init |
| 4783 | - $chr = (string) $chr; |
|
| 4783 | + $chr = (string)$chr; |
|
| 4784 | 4784 | |
| 4785 | 4785 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
| 4786 | 4786 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4787 | 4787 | } |
| 4788 | 4788 | |
| 4789 | - $cache_key = $chr . '_' . $encoding; |
|
| 4789 | + $cache_key = $chr.'_'.$encoding; |
|
| 4790 | 4790 | if (isset($CHAR_CACHE[$cache_key])) { |
| 4791 | 4791 | return $CHAR_CACHE[$cache_key]; |
| 4792 | 4792 | } |
@@ -4821,7 +4821,7 @@ discard block |
||
| 4821 | 4821 | // |
| 4822 | 4822 | |
| 4823 | 4823 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 4824 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
| 4824 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
| 4825 | 4825 | /** @noinspection OffsetOperationsInspection */ |
| 4826 | 4826 | $code = $chr ? $chr[1] : 0; |
| 4827 | 4827 | |
@@ -4829,21 +4829,21 @@ discard block |
||
| 4829 | 4829 | if ($code >= 0xF0 && isset($chr[4])) { |
| 4830 | 4830 | /** @noinspection UnnecessaryCastingInspection */ |
| 4831 | 4831 | /** @noinspection OffsetOperationsInspection */ |
| 4832 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 4832 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 4833 | 4833 | } |
| 4834 | 4834 | |
| 4835 | 4835 | /** @noinspection OffsetOperationsInspection */ |
| 4836 | 4836 | if ($code >= 0xE0 && isset($chr[3])) { |
| 4837 | 4837 | /** @noinspection UnnecessaryCastingInspection */ |
| 4838 | 4838 | /** @noinspection OffsetOperationsInspection */ |
| 4839 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 4839 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 4840 | 4840 | } |
| 4841 | 4841 | |
| 4842 | 4842 | /** @noinspection OffsetOperationsInspection */ |
| 4843 | 4843 | if ($code >= 0xC0 && isset($chr[2])) { |
| 4844 | 4844 | /** @noinspection UnnecessaryCastingInspection */ |
| 4845 | 4845 | /** @noinspection OffsetOperationsInspection */ |
| 4846 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 4846 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 4847 | 4847 | } |
| 4848 | 4848 | |
| 4849 | 4849 | return $CHAR_CACHE[$cache_key] = $code; |
@@ -4900,7 +4900,7 @@ discard block |
||
| 4900 | 4900 | public static function pcre_utf8_support(): bool |
| 4901 | 4901 | { |
| 4902 | 4902 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 4903 | - return (bool) @\preg_match('//u', ''); |
|
| 4903 | + return (bool)@\preg_match('//u', ''); |
|
| 4904 | 4904 | } |
| 4905 | 4905 | |
| 4906 | 4906 | /** |
@@ -4939,14 +4939,14 @@ discard block |
||
| 4939 | 4939 | * @psalm-suppress DocblockTypeContradiction |
| 4940 | 4940 | */ |
| 4941 | 4941 | if (!\is_numeric($step)) { |
| 4942 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
| 4942 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
| 4943 | 4943 | } |
| 4944 | 4944 | |
| 4945 | 4945 | /** |
| 4946 | 4946 | * @psalm-suppress RedundantConditionGivenDocblockType - false-positive from psalm? |
| 4947 | 4947 | */ |
| 4948 | 4948 | if ($step <= 0) { |
| 4949 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
| 4949 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
| 4950 | 4950 | } |
| 4951 | 4951 | } |
| 4952 | 4952 | |
@@ -4958,14 +4958,14 @@ discard block |
||
| 4958 | 4958 | $is_xdigit = false; |
| 4959 | 4959 | |
| 4960 | 4960 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4961 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
| 4961 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
| 4962 | 4962 | $is_digit = true; |
| 4963 | - $start = (int) $var1; |
|
| 4963 | + $start = (int)$var1; |
|
| 4964 | 4964 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
| 4965 | 4965 | $is_xdigit = true; |
| 4966 | - $start = (int) self::hex_to_int($var1); |
|
| 4966 | + $start = (int)self::hex_to_int($var1); |
|
| 4967 | 4967 | } elseif (!$use_ctype && \is_numeric($var1)) { |
| 4968 | - $start = (int) $var1; |
|
| 4968 | + $start = (int)$var1; |
|
| 4969 | 4969 | } else { |
| 4970 | 4970 | $start = self::ord($var1); |
| 4971 | 4971 | } |
@@ -4975,11 +4975,11 @@ discard block |
||
| 4975 | 4975 | } |
| 4976 | 4976 | |
| 4977 | 4977 | if ($is_digit) { |
| 4978 | - $end = (int) $var2; |
|
| 4978 | + $end = (int)$var2; |
|
| 4979 | 4979 | } elseif ($is_xdigit) { |
| 4980 | - $end = (int) self::hex_to_int($var2); |
|
| 4980 | + $end = (int)self::hex_to_int($var2); |
|
| 4981 | 4981 | } elseif (!$use_ctype && \is_numeric($var2)) { |
| 4982 | - $end = (int) $var2; |
|
| 4982 | + $end = (int)$var2; |
|
| 4983 | 4983 | } else { |
| 4984 | 4984 | $end = self::ord($var2); |
| 4985 | 4985 | } |
@@ -4990,7 +4990,7 @@ discard block |
||
| 4990 | 4990 | |
| 4991 | 4991 | $array = []; |
| 4992 | 4992 | foreach (\range($start, $end, $step) as $i) { |
| 4993 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
| 4993 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
| 4994 | 4994 | } |
| 4995 | 4995 | |
| 4996 | 4996 | return $array; |
@@ -5100,8 +5100,8 @@ discard block |
||
| 5100 | 5100 | $delimiter = '/'; |
| 5101 | 5101 | } |
| 5102 | 5102 | |
| 5103 | - return (string) \preg_replace( |
|
| 5104 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
| 5103 | + return (string)\preg_replace( |
|
| 5104 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
| 5105 | 5105 | $replacement, |
| 5106 | 5106 | $str |
| 5107 | 5107 | ); |
@@ -5149,9 +5149,9 @@ discard block |
||
| 5149 | 5149 | return ''; |
| 5150 | 5150 | } |
| 5151 | 5151 | |
| 5152 | - $str_length -= (int) $bom_byte_length; |
|
| 5152 | + $str_length -= (int)$bom_byte_length; |
|
| 5153 | 5153 | |
| 5154 | - $str = (string) $str_tmp; |
|
| 5154 | + $str = (string)$str_tmp; |
|
| 5155 | 5155 | } |
| 5156 | 5156 | } |
| 5157 | 5157 | |
@@ -5180,7 +5180,7 @@ discard block |
||
| 5180 | 5180 | */ |
| 5181 | 5181 | if (\is_array($what)) { |
| 5182 | 5182 | foreach ($what as $item) { |
| 5183 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
| 5183 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
| 5184 | 5184 | } |
| 5185 | 5185 | } |
| 5186 | 5186 | |
@@ -5218,7 +5218,7 @@ discard block |
||
| 5218 | 5218 | */ |
| 5219 | 5219 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
| 5220 | 5220 | { |
| 5221 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 5221 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 5222 | 5222 | } |
| 5223 | 5223 | |
| 5224 | 5224 | /** |
@@ -5273,17 +5273,17 @@ discard block |
||
| 5273 | 5273 | ): string { |
| 5274 | 5274 | if ($substring && \strpos($str, $substring) === 0) { |
| 5275 | 5275 | if ($encoding === 'UTF-8') { |
| 5276 | - return (string) \mb_substr( |
|
| 5276 | + return (string)\mb_substr( |
|
| 5277 | 5277 | $str, |
| 5278 | - (int) \mb_strlen($substring) |
|
| 5278 | + (int)\mb_strlen($substring) |
|
| 5279 | 5279 | ); |
| 5280 | 5280 | } |
| 5281 | 5281 | |
| 5282 | 5282 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5283 | 5283 | |
| 5284 | - return (string) self::substr( |
|
| 5284 | + return (string)self::substr( |
|
| 5285 | 5285 | $str, |
| 5286 | - (int) self::strlen($substring, $encoding), |
|
| 5286 | + (int)self::strlen($substring, $encoding), |
|
| 5287 | 5287 | null, |
| 5288 | 5288 | $encoding |
| 5289 | 5289 | ); |
@@ -5311,19 +5311,19 @@ discard block |
||
| 5311 | 5311 | ): string { |
| 5312 | 5312 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
| 5313 | 5313 | if ($encoding === 'UTF-8') { |
| 5314 | - return (string) \mb_substr( |
|
| 5314 | + return (string)\mb_substr( |
|
| 5315 | 5315 | $str, |
| 5316 | 5316 | 0, |
| 5317 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
| 5317 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
| 5318 | 5318 | ); |
| 5319 | 5319 | } |
| 5320 | 5320 | |
| 5321 | 5321 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5322 | 5322 | |
| 5323 | - return (string) self::substr( |
|
| 5323 | + return (string)self::substr( |
|
| 5324 | 5324 | $str, |
| 5325 | 5325 | 0, |
| 5326 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
| 5326 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
| 5327 | 5327 | $encoding |
| 5328 | 5328 | ); |
| 5329 | 5329 | } |
@@ -5423,7 +5423,7 @@ discard block |
||
| 5423 | 5423 | /** @noinspection PhpUsageOfSilenceOperatorInspection - ignore "Unknown character" warnings, it's working anyway */ |
| 5424 | 5424 | @\mb_substitute_character($replacement_char_helper); |
| 5425 | 5425 | // the polyfill maybe return false, so cast to string |
| 5426 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 5426 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 5427 | 5427 | \mb_substitute_character($save); |
| 5428 | 5428 | } |
| 5429 | 5429 | |
@@ -5467,7 +5467,7 @@ discard block |
||
| 5467 | 5467 | } |
| 5468 | 5468 | |
| 5469 | 5469 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5470 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 5470 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 5471 | 5471 | } |
| 5472 | 5472 | |
| 5473 | 5473 | if ($chars) { |
@@ -5497,7 +5497,7 @@ discard block |
||
| 5497 | 5497 | $html .= '<pre>'; |
| 5498 | 5498 | /** @noinspection AlterInForeachInspection */ |
| 5499 | 5499 | foreach (self::$SUPPORT as $key => &$value) { |
| 5500 | - $html .= $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
| 5500 | + $html .= $key.' - '.\print_r($value, true)."\n<br>"; |
|
| 5501 | 5501 | } |
| 5502 | 5502 | $html .= '</pre>'; |
| 5503 | 5503 | |
@@ -5537,7 +5537,7 @@ discard block |
||
| 5537 | 5537 | return $char; |
| 5538 | 5538 | } |
| 5539 | 5539 | |
| 5540 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
| 5540 | + return '&#'.self::ord($char, $encoding).';'; |
|
| 5541 | 5541 | } |
| 5542 | 5542 | |
| 5543 | 5543 | /** |
@@ -5641,11 +5641,11 @@ discard block |
||
| 5641 | 5641 | $lang, |
| 5642 | 5642 | $try_to_keep_the_string_length |
| 5643 | 5643 | ); |
| 5644 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
| 5644 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
| 5645 | 5645 | |
| 5646 | 5646 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 5647 | 5647 | |
| 5648 | - $str = (string) \preg_replace_callback( |
|
| 5648 | + $str = (string)\preg_replace_callback( |
|
| 5649 | 5649 | '/[-_\\s]+(.)?/u', |
| 5650 | 5650 | /** |
| 5651 | 5651 | * @param array $match |
@@ -5654,7 +5654,7 @@ discard block |
||
| 5654 | 5654 | * |
| 5655 | 5655 | * @return string |
| 5656 | 5656 | */ |
| 5657 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
| 5657 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
| 5658 | 5658 | if (isset($match[1])) { |
| 5659 | 5659 | if ($use_mb_functions) { |
| 5660 | 5660 | if ($encoding === 'UTF-8') { |
@@ -5672,7 +5672,7 @@ discard block |
||
| 5672 | 5672 | $str |
| 5673 | 5673 | ); |
| 5674 | 5674 | |
| 5675 | - return (string) \preg_replace_callback( |
|
| 5675 | + return (string)\preg_replace_callback( |
|
| 5676 | 5676 | '/[\\p{N}]+(.)?/u', |
| 5677 | 5677 | /** |
| 5678 | 5678 | * @param array $match |
@@ -5681,7 +5681,7 @@ discard block |
||
| 5681 | 5681 | * |
| 5682 | 5682 | * @return string |
| 5683 | 5683 | */ |
| 5684 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
| 5684 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
| 5685 | 5685 | if ($use_mb_functions) { |
| 5686 | 5686 | if ($encoding === 'UTF-8') { |
| 5687 | 5687 | return \mb_strtoupper($match[0]); |
@@ -5873,7 +5873,7 @@ discard block |
||
| 5873 | 5873 | ): string { |
| 5874 | 5874 | if (self::$SUPPORT['mbstring'] === true) { |
| 5875 | 5875 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5876 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
| 5876 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
| 5877 | 5877 | |
| 5878 | 5878 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 5879 | 5879 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -5883,10 +5883,10 @@ discard block |
||
| 5883 | 5883 | } |
| 5884 | 5884 | |
| 5885 | 5885 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5886 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
| 5886 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
| 5887 | 5887 | } |
| 5888 | 5888 | |
| 5889 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
| 5889 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
| 5890 | 5890 | |
| 5891 | 5891 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 5892 | 5892 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -5895,7 +5895,7 @@ discard block |
||
| 5895 | 5895 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
| 5896 | 5896 | } |
| 5897 | 5897 | |
| 5898 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
| 5898 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
| 5899 | 5899 | } |
| 5900 | 5900 | |
| 5901 | 5901 | /** |
@@ -5912,7 +5912,7 @@ discard block |
||
| 5912 | 5912 | public static function str_detect_encoding($str) |
| 5913 | 5913 | { |
| 5914 | 5914 | // init |
| 5915 | - $str = (string) $str; |
|
| 5915 | + $str = (string)$str; |
|
| 5916 | 5916 | |
| 5917 | 5917 | // |
| 5918 | 5918 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -6014,7 +6014,7 @@ discard block |
||
| 6014 | 6014 | foreach (self::$ENCODINGS as $encoding_tmp) { |
| 6015 | 6015 | // INFO: //IGNORE but still throw notice |
| 6016 | 6016 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 6017 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
| 6017 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
| 6018 | 6018 | return $encoding_tmp; |
| 6019 | 6019 | } |
| 6020 | 6020 | } |
@@ -6111,7 +6111,7 @@ discard block |
||
| 6111 | 6111 | return $str; |
| 6112 | 6112 | } |
| 6113 | 6113 | |
| 6114 | - return $substring . $str; |
|
| 6114 | + return $substring.$str; |
|
| 6115 | 6115 | } |
| 6116 | 6116 | |
| 6117 | 6117 | /** |
@@ -6402,27 +6402,27 @@ discard block |
||
| 6402 | 6402 | string $encoding = 'UTF-8' |
| 6403 | 6403 | ): string { |
| 6404 | 6404 | if ($encoding === 'UTF-8') { |
| 6405 | - $len = (int) \mb_strlen($str); |
|
| 6405 | + $len = (int)\mb_strlen($str); |
|
| 6406 | 6406 | if ($index > $len) { |
| 6407 | 6407 | return $str; |
| 6408 | 6408 | } |
| 6409 | 6409 | |
| 6410 | 6410 | /** @noinspection UnnecessaryCastingInspection */ |
| 6411 | - return (string) \mb_substr($str, 0, $index) . |
|
| 6412 | - $substring . |
|
| 6413 | - (string) \mb_substr($str, $index, $len); |
|
| 6411 | + return (string)\mb_substr($str, 0, $index). |
|
| 6412 | + $substring. |
|
| 6413 | + (string)\mb_substr($str, $index, $len); |
|
| 6414 | 6414 | } |
| 6415 | 6415 | |
| 6416 | 6416 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6417 | 6417 | |
| 6418 | - $len = (int) self::strlen($str, $encoding); |
|
| 6418 | + $len = (int)self::strlen($str, $encoding); |
|
| 6419 | 6419 | if ($index > $len) { |
| 6420 | 6420 | return $str; |
| 6421 | 6421 | } |
| 6422 | 6422 | |
| 6423 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
| 6424 | - $substring . |
|
| 6425 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
| 6423 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
| 6424 | + $substring. |
|
| 6425 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
| 6426 | 6426 | } |
| 6427 | 6427 | |
| 6428 | 6428 | /** |
@@ -6453,15 +6453,15 @@ discard block |
||
| 6453 | 6453 | */ |
| 6454 | 6454 | public static function str_ireplace($search, $replacement, $subject, &$count = null) |
| 6455 | 6455 | { |
| 6456 | - $search = (array) $search; |
|
| 6456 | + $search = (array)$search; |
|
| 6457 | 6457 | |
| 6458 | 6458 | /** @noinspection AlterInForeachInspection */ |
| 6459 | 6459 | foreach ($search as &$s) { |
| 6460 | - $s = (string) $s; |
|
| 6460 | + $s = (string)$s; |
|
| 6461 | 6461 | if ($s === '') { |
| 6462 | 6462 | $s = '/^(?<=.)$/'; |
| 6463 | 6463 | } else { |
| 6464 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
| 6464 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
| 6465 | 6465 | } |
| 6466 | 6466 | } |
| 6467 | 6467 | |
@@ -6497,11 +6497,11 @@ discard block |
||
| 6497 | 6497 | } |
| 6498 | 6498 | |
| 6499 | 6499 | if ($search === '') { |
| 6500 | - return $str . $replacement; |
|
| 6500 | + return $str.$replacement; |
|
| 6501 | 6501 | } |
| 6502 | 6502 | |
| 6503 | 6503 | if (\stripos($str, $search) === 0) { |
| 6504 | - return $replacement . \substr($str, \strlen($search)); |
|
| 6504 | + return $replacement.\substr($str, \strlen($search)); |
|
| 6505 | 6505 | } |
| 6506 | 6506 | |
| 6507 | 6507 | return $str; |
@@ -6532,11 +6532,11 @@ discard block |
||
| 6532 | 6532 | } |
| 6533 | 6533 | |
| 6534 | 6534 | if ($search === '') { |
| 6535 | - return $str . $replacement; |
|
| 6535 | + return $str.$replacement; |
|
| 6536 | 6536 | } |
| 6537 | 6537 | |
| 6538 | 6538 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 6539 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 6539 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 6540 | 6540 | } |
| 6541 | 6541 | |
| 6542 | 6542 | return $str; |
@@ -6622,15 +6622,15 @@ discard block |
||
| 6622 | 6622 | } |
| 6623 | 6623 | |
| 6624 | 6624 | if ($encoding === 'UTF-8') { |
| 6625 | - return (string) \mb_substr( |
|
| 6625 | + return (string)\mb_substr( |
|
| 6626 | 6626 | $str, |
| 6627 | - $offset + (int) \mb_strlen($separator) |
|
| 6627 | + $offset + (int)\mb_strlen($separator) |
|
| 6628 | 6628 | ); |
| 6629 | 6629 | } |
| 6630 | 6630 | |
| 6631 | - return (string) self::substr( |
|
| 6631 | + return (string)self::substr( |
|
| 6632 | 6632 | $str, |
| 6633 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6633 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6634 | 6634 | null, |
| 6635 | 6635 | $encoding |
| 6636 | 6636 | ); |
@@ -6662,15 +6662,15 @@ discard block |
||
| 6662 | 6662 | } |
| 6663 | 6663 | |
| 6664 | 6664 | if ($encoding === 'UTF-8') { |
| 6665 | - return (string) \mb_substr( |
|
| 6665 | + return (string)\mb_substr( |
|
| 6666 | 6666 | $str, |
| 6667 | - $offset + (int) self::strlen($separator) |
|
| 6667 | + $offset + (int)self::strlen($separator) |
|
| 6668 | 6668 | ); |
| 6669 | 6669 | } |
| 6670 | 6670 | |
| 6671 | - return (string) self::substr( |
|
| 6671 | + return (string)self::substr( |
|
| 6672 | 6672 | $str, |
| 6673 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6673 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6674 | 6674 | null, |
| 6675 | 6675 | $encoding |
| 6676 | 6676 | ); |
@@ -6702,10 +6702,10 @@ discard block |
||
| 6702 | 6702 | } |
| 6703 | 6703 | |
| 6704 | 6704 | if ($encoding === 'UTF-8') { |
| 6705 | - return (string) \mb_substr($str, 0, $offset); |
|
| 6705 | + return (string)\mb_substr($str, 0, $offset); |
|
| 6706 | 6706 | } |
| 6707 | 6707 | |
| 6708 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 6708 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 6709 | 6709 | } |
| 6710 | 6710 | |
| 6711 | 6711 | /** |
@@ -6734,7 +6734,7 @@ discard block |
||
| 6734 | 6734 | return ''; |
| 6735 | 6735 | } |
| 6736 | 6736 | |
| 6737 | - return (string) \mb_substr($str, 0, $offset); |
|
| 6737 | + return (string)\mb_substr($str, 0, $offset); |
|
| 6738 | 6738 | } |
| 6739 | 6739 | |
| 6740 | 6740 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6742,7 +6742,7 @@ discard block |
||
| 6742 | 6742 | return ''; |
| 6743 | 6743 | } |
| 6744 | 6744 | |
| 6745 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 6745 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 6746 | 6746 | } |
| 6747 | 6747 | |
| 6748 | 6748 | /** |
@@ -6844,12 +6844,12 @@ discard block |
||
| 6844 | 6844 | } |
| 6845 | 6845 | |
| 6846 | 6846 | if ($encoding === 'UTF-8') { |
| 6847 | - return (string) \mb_substr($str, -$n); |
|
| 6847 | + return (string)\mb_substr($str, -$n); |
|
| 6848 | 6848 | } |
| 6849 | 6849 | |
| 6850 | 6850 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6851 | 6851 | |
| 6852 | - return (string) self::substr($str, -$n, null, $encoding); |
|
| 6852 | + return (string)self::substr($str, -$n, null, $encoding); |
|
| 6853 | 6853 | } |
| 6854 | 6854 | |
| 6855 | 6855 | /** |
@@ -6875,21 +6875,21 @@ discard block |
||
| 6875 | 6875 | } |
| 6876 | 6876 | |
| 6877 | 6877 | if ($encoding === 'UTF-8') { |
| 6878 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 6878 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 6879 | 6879 | return $str; |
| 6880 | 6880 | } |
| 6881 | 6881 | |
| 6882 | 6882 | /** @noinspection UnnecessaryCastingInspection */ |
| 6883 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
| 6883 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
| 6884 | 6884 | } |
| 6885 | 6885 | |
| 6886 | 6886 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6887 | 6887 | |
| 6888 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 6888 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 6889 | 6889 | return $str; |
| 6890 | 6890 | } |
| 6891 | 6891 | |
| 6892 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
| 6892 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
| 6893 | 6893 | } |
| 6894 | 6894 | |
| 6895 | 6895 | /** |
@@ -6916,12 +6916,12 @@ discard block |
||
| 6916 | 6916 | |
| 6917 | 6917 | if ($encoding === 'UTF-8') { |
| 6918 | 6918 | /** @noinspection UnnecessaryCastingInspection */ |
| 6919 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 6919 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 6920 | 6920 | return $str; |
| 6921 | 6921 | } |
| 6922 | 6922 | |
| 6923 | 6923 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
| 6924 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
| 6924 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
| 6925 | 6925 | } |
| 6926 | 6926 | |
| 6927 | 6927 | $str = \mb_substr($str, 0, $length); |
@@ -6930,33 +6930,33 @@ discard block |
||
| 6930 | 6930 | $new_str = \implode(' ', $array); |
| 6931 | 6931 | |
| 6932 | 6932 | if ($new_str === '') { |
| 6933 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
| 6933 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
| 6934 | 6934 | } |
| 6935 | 6935 | } else { |
| 6936 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 6936 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 6937 | 6937 | return $str; |
| 6938 | 6938 | } |
| 6939 | 6939 | |
| 6940 | 6940 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
| 6941 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
| 6941 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
| 6942 | 6942 | } |
| 6943 | 6943 | |
| 6944 | 6944 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 6945 | 6945 | $str = self::substr($str, 0, $length, $encoding); |
| 6946 | 6946 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 6947 | 6947 | if ($str === false) { |
| 6948 | - return '' . $str_add_on; |
|
| 6948 | + return ''.$str_add_on; |
|
| 6949 | 6949 | } |
| 6950 | 6950 | |
| 6951 | 6951 | $array = \explode(' ', $str, -1); |
| 6952 | 6952 | $new_str = \implode(' ', $array); |
| 6953 | 6953 | |
| 6954 | 6954 | if ($new_str === '') { |
| 6955 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
| 6955 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
| 6956 | 6956 | } |
| 6957 | 6957 | } |
| 6958 | 6958 | |
| 6959 | - return $new_str . $str_add_on; |
|
| 6959 | + return $new_str.$str_add_on; |
|
| 6960 | 6960 | } |
| 6961 | 6961 | |
| 6962 | 6962 | /** |
@@ -6979,7 +6979,7 @@ discard block |
||
| 6979 | 6979 | $longest_common_prefix = ''; |
| 6980 | 6980 | |
| 6981 | 6981 | if ($encoding === 'UTF-8') { |
| 6982 | - $max_length = (int) \min( |
|
| 6982 | + $max_length = (int)\min( |
|
| 6983 | 6983 | \mb_strlen($str1), |
| 6984 | 6984 | \mb_strlen($str2) |
| 6985 | 6985 | ); |
@@ -7000,7 +7000,7 @@ discard block |
||
| 7000 | 7000 | } else { |
| 7001 | 7001 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7002 | 7002 | |
| 7003 | - $max_length = (int) \min( |
|
| 7003 | + $max_length = (int)\min( |
|
| 7004 | 7004 | self::strlen($str1, $encoding), |
| 7005 | 7005 | self::strlen($str2, $encoding) |
| 7006 | 7006 | ); |
@@ -7049,13 +7049,13 @@ discard block |
||
| 7049 | 7049 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
| 7050 | 7050 | |
| 7051 | 7051 | if ($encoding === 'UTF-8') { |
| 7052 | - $str_length = (int) \mb_strlen($str1); |
|
| 7053 | - $other_length = (int) \mb_strlen($str2); |
|
| 7052 | + $str_length = (int)\mb_strlen($str1); |
|
| 7053 | + $other_length = (int)\mb_strlen($str2); |
|
| 7054 | 7054 | } else { |
| 7055 | 7055 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7056 | 7056 | |
| 7057 | - $str_length = (int) self::strlen($str1, $encoding); |
|
| 7058 | - $other_length = (int) self::strlen($str2, $encoding); |
|
| 7057 | + $str_length = (int)self::strlen($str1, $encoding); |
|
| 7058 | + $other_length = (int)self::strlen($str2, $encoding); |
|
| 7059 | 7059 | } |
| 7060 | 7060 | |
| 7061 | 7061 | // Return if either string is empty |
@@ -7108,10 +7108,10 @@ discard block |
||
| 7108 | 7108 | } |
| 7109 | 7109 | |
| 7110 | 7110 | if ($encoding === 'UTF-8') { |
| 7111 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
| 7111 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
| 7112 | 7112 | } |
| 7113 | 7113 | |
| 7114 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
| 7114 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
| 7115 | 7115 | } |
| 7116 | 7116 | |
| 7117 | 7117 | /** |
@@ -7135,7 +7135,7 @@ discard block |
||
| 7135 | 7135 | } |
| 7136 | 7136 | |
| 7137 | 7137 | if ($encoding === 'UTF-8') { |
| 7138 | - $max_length = (int) \min( |
|
| 7138 | + $max_length = (int)\min( |
|
| 7139 | 7139 | \mb_strlen($str1, $encoding), |
| 7140 | 7140 | \mb_strlen($str2, $encoding) |
| 7141 | 7141 | ); |
@@ -7149,7 +7149,7 @@ discard block |
||
| 7149 | 7149 | && |
| 7150 | 7150 | $char === \mb_substr($str2, -$i, 1) |
| 7151 | 7151 | ) { |
| 7152 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
| 7152 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
| 7153 | 7153 | } else { |
| 7154 | 7154 | break; |
| 7155 | 7155 | } |
@@ -7157,7 +7157,7 @@ discard block |
||
| 7157 | 7157 | } else { |
| 7158 | 7158 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7159 | 7159 | |
| 7160 | - $max_length = (int) \min( |
|
| 7160 | + $max_length = (int)\min( |
|
| 7161 | 7161 | self::strlen($str1, $encoding), |
| 7162 | 7162 | self::strlen($str2, $encoding) |
| 7163 | 7163 | ); |
@@ -7171,7 +7171,7 @@ discard block |
||
| 7171 | 7171 | && |
| 7172 | 7172 | $char === self::substr($str2, -$i, 1, $encoding) |
| 7173 | 7173 | ) { |
| 7174 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
| 7174 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
| 7175 | 7175 | } else { |
| 7176 | 7176 | break; |
| 7177 | 7177 | } |
@@ -7193,7 +7193,7 @@ discard block |
||
| 7193 | 7193 | */ |
| 7194 | 7194 | public static function str_matches_pattern(string $str, string $pattern): bool |
| 7195 | 7195 | { |
| 7196 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
| 7196 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
| 7197 | 7197 | } |
| 7198 | 7198 | |
| 7199 | 7199 | /** |
@@ -7212,7 +7212,7 @@ discard block |
||
| 7212 | 7212 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
| 7213 | 7213 | { |
| 7214 | 7214 | // init |
| 7215 | - $length = (int) self::strlen($str, $encoding); |
|
| 7215 | + $length = (int)self::strlen($str, $encoding); |
|
| 7216 | 7216 | |
| 7217 | 7217 | if ($offset >= 0) { |
| 7218 | 7218 | return $length > $offset; |
@@ -7241,7 +7241,7 @@ discard block |
||
| 7241 | 7241 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
| 7242 | 7242 | { |
| 7243 | 7243 | // init |
| 7244 | - $length = (int) self::strlen($str); |
|
| 7244 | + $length = (int)self::strlen($str); |
|
| 7245 | 7245 | |
| 7246 | 7246 | if ( |
| 7247 | 7247 | ($index >= 0 && $length <= $index) |
@@ -7283,7 +7283,7 @@ discard block |
||
| 7283 | 7283 | return $str; |
| 7284 | 7284 | } |
| 7285 | 7285 | |
| 7286 | - if ($pad_type !== (int) $pad_type) { |
|
| 7286 | + if ($pad_type !== (int)$pad_type) { |
|
| 7287 | 7287 | if ($pad_type === 'left') { |
| 7288 | 7288 | $pad_type = \STR_PAD_LEFT; |
| 7289 | 7289 | } elseif ($pad_type === 'right') { |
@@ -7292,23 +7292,23 @@ discard block |
||
| 7292 | 7292 | $pad_type = \STR_PAD_BOTH; |
| 7293 | 7293 | } else { |
| 7294 | 7294 | throw new \InvalidArgumentException( |
| 7295 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
| 7295 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
| 7296 | 7296 | ); |
| 7297 | 7297 | } |
| 7298 | 7298 | } |
| 7299 | 7299 | |
| 7300 | 7300 | if ($encoding === 'UTF-8') { |
| 7301 | - $str_length = (int) \mb_strlen($str); |
|
| 7301 | + $str_length = (int)\mb_strlen($str); |
|
| 7302 | 7302 | |
| 7303 | 7303 | if ($pad_length >= $str_length) { |
| 7304 | 7304 | switch ($pad_type) { |
| 7305 | 7305 | case \STR_PAD_LEFT: |
| 7306 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 7306 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 7307 | 7307 | |
| 7308 | 7308 | $diff = ($pad_length - $str_length); |
| 7309 | 7309 | |
| 7310 | - $pre = (string) \mb_substr( |
|
| 7311 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7310 | + $pre = (string)\mb_substr( |
|
| 7311 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7312 | 7312 | 0, |
| 7313 | 7313 | $diff |
| 7314 | 7314 | ); |
@@ -7319,16 +7319,16 @@ discard block |
||
| 7319 | 7319 | case \STR_PAD_BOTH: |
| 7320 | 7320 | $diff = ($pad_length - $str_length); |
| 7321 | 7321 | |
| 7322 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 7322 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 7323 | 7323 | |
| 7324 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 7324 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 7325 | 7325 | |
| 7326 | - $pre = (string) \mb_substr( |
|
| 7326 | + $pre = (string)\mb_substr( |
|
| 7327 | 7327 | \str_repeat($pad_string, $ps_length_left), |
| 7328 | 7328 | 0, |
| 7329 | 7329 | $ps_length_left |
| 7330 | 7330 | ); |
| 7331 | - $post = (string) \mb_substr( |
|
| 7331 | + $post = (string)\mb_substr( |
|
| 7332 | 7332 | \str_repeat($pad_string, $ps_length_right), |
| 7333 | 7333 | 0, |
| 7334 | 7334 | $ps_length_right |
@@ -7338,19 +7338,19 @@ discard block |
||
| 7338 | 7338 | |
| 7339 | 7339 | case \STR_PAD_RIGHT: |
| 7340 | 7340 | default: |
| 7341 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 7341 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 7342 | 7342 | |
| 7343 | 7343 | $diff = ($pad_length - $str_length); |
| 7344 | 7344 | |
| 7345 | - $post = (string) \mb_substr( |
|
| 7346 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7345 | + $post = (string)\mb_substr( |
|
| 7346 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7347 | 7347 | 0, |
| 7348 | 7348 | $diff |
| 7349 | 7349 | ); |
| 7350 | 7350 | $pre = ''; |
| 7351 | 7351 | } |
| 7352 | 7352 | |
| 7353 | - return $pre . $str . $post; |
|
| 7353 | + return $pre.$str.$post; |
|
| 7354 | 7354 | } |
| 7355 | 7355 | |
| 7356 | 7356 | return $str; |
@@ -7358,17 +7358,17 @@ discard block |
||
| 7358 | 7358 | |
| 7359 | 7359 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7360 | 7360 | |
| 7361 | - $str_length = (int) self::strlen($str, $encoding); |
|
| 7361 | + $str_length = (int)self::strlen($str, $encoding); |
|
| 7362 | 7362 | |
| 7363 | 7363 | if ($pad_length >= $str_length) { |
| 7364 | 7364 | switch ($pad_type) { |
| 7365 | 7365 | case \STR_PAD_LEFT: |
| 7366 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 7366 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 7367 | 7367 | |
| 7368 | 7368 | $diff = ($pad_length - $str_length); |
| 7369 | 7369 | |
| 7370 | - $pre = (string) self::substr( |
|
| 7371 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7370 | + $pre = (string)self::substr( |
|
| 7371 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7372 | 7372 | 0, |
| 7373 | 7373 | $diff, |
| 7374 | 7374 | $encoding |
@@ -7380,17 +7380,17 @@ discard block |
||
| 7380 | 7380 | case \STR_PAD_BOTH: |
| 7381 | 7381 | $diff = ($pad_length - $str_length); |
| 7382 | 7382 | |
| 7383 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 7383 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 7384 | 7384 | |
| 7385 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 7385 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 7386 | 7386 | |
| 7387 | - $pre = (string) self::substr( |
|
| 7387 | + $pre = (string)self::substr( |
|
| 7388 | 7388 | \str_repeat($pad_string, $ps_length_left), |
| 7389 | 7389 | 0, |
| 7390 | 7390 | $ps_length_left, |
| 7391 | 7391 | $encoding |
| 7392 | 7392 | ); |
| 7393 | - $post = (string) self::substr( |
|
| 7393 | + $post = (string)self::substr( |
|
| 7394 | 7394 | \str_repeat($pad_string, $ps_length_right), |
| 7395 | 7395 | 0, |
| 7396 | 7396 | $ps_length_right, |
@@ -7401,12 +7401,12 @@ discard block |
||
| 7401 | 7401 | |
| 7402 | 7402 | case \STR_PAD_RIGHT: |
| 7403 | 7403 | default: |
| 7404 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 7404 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 7405 | 7405 | |
| 7406 | 7406 | $diff = ($pad_length - $str_length); |
| 7407 | 7407 | |
| 7408 | - $post = (string) self::substr( |
|
| 7409 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7408 | + $post = (string)self::substr( |
|
| 7409 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7410 | 7410 | 0, |
| 7411 | 7411 | $diff, |
| 7412 | 7412 | $encoding |
@@ -7414,7 +7414,7 @@ discard block |
||
| 7414 | 7414 | $pre = ''; |
| 7415 | 7415 | } |
| 7416 | 7416 | |
| 7417 | - return $pre . $str . $post; |
|
| 7417 | + return $pre.$str.$post; |
|
| 7418 | 7418 | } |
| 7419 | 7419 | |
| 7420 | 7420 | return $str; |
@@ -7611,11 +7611,11 @@ discard block |
||
| 7611 | 7611 | } |
| 7612 | 7612 | |
| 7613 | 7613 | if ($search === '') { |
| 7614 | - return $str . $replacement; |
|
| 7614 | + return $str.$replacement; |
|
| 7615 | 7615 | } |
| 7616 | 7616 | |
| 7617 | 7617 | if (\strpos($str, $search) === 0) { |
| 7618 | - return $replacement . \substr($str, \strlen($search)); |
|
| 7618 | + return $replacement.\substr($str, \strlen($search)); |
|
| 7619 | 7619 | } |
| 7620 | 7620 | |
| 7621 | 7621 | return $str; |
@@ -7649,11 +7649,11 @@ discard block |
||
| 7649 | 7649 | } |
| 7650 | 7650 | |
| 7651 | 7651 | if ($search === '') { |
| 7652 | - return $str . $replacement; |
|
| 7652 | + return $str.$replacement; |
|
| 7653 | 7653 | } |
| 7654 | 7654 | |
| 7655 | 7655 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 7656 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 7656 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 7657 | 7657 | } |
| 7658 | 7658 | |
| 7659 | 7659 | return $str; |
@@ -7687,7 +7687,7 @@ discard block |
||
| 7687 | 7687 | $subject, |
| 7688 | 7688 | $replace, |
| 7689 | 7689 | $pos, |
| 7690 | - (int) self::strlen($search) |
|
| 7690 | + (int)self::strlen($search) |
|
| 7691 | 7691 | ); |
| 7692 | 7692 | } |
| 7693 | 7693 | |
@@ -7721,7 +7721,7 @@ discard block |
||
| 7721 | 7721 | $subject, |
| 7722 | 7722 | $replace, |
| 7723 | 7723 | $pos, |
| 7724 | - (int) self::strlen($search) |
|
| 7724 | + (int)self::strlen($search) |
|
| 7725 | 7725 | ); |
| 7726 | 7726 | } |
| 7727 | 7727 | |
@@ -7742,7 +7742,7 @@ discard block |
||
| 7742 | 7742 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
| 7743 | 7743 | { |
| 7744 | 7744 | if ($encoding === 'UTF-8') { |
| 7745 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
| 7745 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
| 7746 | 7746 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 7747 | 7747 | \shuffle($indexes); |
| 7748 | 7748 | |
@@ -7758,7 +7758,7 @@ discard block |
||
| 7758 | 7758 | } else { |
| 7759 | 7759 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7760 | 7760 | |
| 7761 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
| 7761 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
| 7762 | 7762 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 7763 | 7763 | \shuffle($indexes); |
| 7764 | 7764 | |
@@ -7801,11 +7801,11 @@ discard block |
||
| 7801 | 7801 | ) { |
| 7802 | 7802 | if ($encoding === 'UTF-8') { |
| 7803 | 7803 | if ($end === null) { |
| 7804 | - $length = (int) \mb_strlen($str); |
|
| 7804 | + $length = (int)\mb_strlen($str); |
|
| 7805 | 7805 | } elseif ($end >= 0 && $end <= $start) { |
| 7806 | 7806 | return ''; |
| 7807 | 7807 | } elseif ($end < 0) { |
| 7808 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
| 7808 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
| 7809 | 7809 | } else { |
| 7810 | 7810 | $length = $end - $start; |
| 7811 | 7811 | } |
@@ -7816,11 +7816,11 @@ discard block |
||
| 7816 | 7816 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7817 | 7817 | |
| 7818 | 7818 | if ($end === null) { |
| 7819 | - $length = (int) self::strlen($str, $encoding); |
|
| 7819 | + $length = (int)self::strlen($str, $encoding); |
|
| 7820 | 7820 | } elseif ($end >= 0 && $end <= $start) { |
| 7821 | 7821 | return ''; |
| 7822 | 7822 | } elseif ($end < 0) { |
| 7823 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
| 7823 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
| 7824 | 7824 | } else { |
| 7825 | 7825 | $length = $end - $start; |
| 7826 | 7826 | } |
@@ -7855,7 +7855,7 @@ discard block |
||
| 7855 | 7855 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7856 | 7856 | } |
| 7857 | 7857 | |
| 7858 | - $str = (string) \preg_replace_callback( |
|
| 7858 | + $str = (string)\preg_replace_callback( |
|
| 7859 | 7859 | '/([\\p{N}|\\p{Lu}])/u', |
| 7860 | 7860 | /** |
| 7861 | 7861 | * @param string[] $matches |
@@ -7864,28 +7864,28 @@ discard block |
||
| 7864 | 7864 | * |
| 7865 | 7865 | * @return string |
| 7866 | 7866 | */ |
| 7867 | - static function (array $matches) use ($encoding): string { |
|
| 7867 | + static function(array $matches) use ($encoding): string { |
|
| 7868 | 7868 | $match = $matches[1]; |
| 7869 | - $match_int = (int) $match; |
|
| 7869 | + $match_int = (int)$match; |
|
| 7870 | 7870 | |
| 7871 | - if ((string) $match_int === $match) { |
|
| 7872 | - return '_' . $match . '_'; |
|
| 7871 | + if ((string)$match_int === $match) { |
|
| 7872 | + return '_'.$match.'_'; |
|
| 7873 | 7873 | } |
| 7874 | 7874 | |
| 7875 | 7875 | if ($encoding === 'UTF-8') { |
| 7876 | - return '_' . \mb_strtolower($match); |
|
| 7876 | + return '_'.\mb_strtolower($match); |
|
| 7877 | 7877 | } |
| 7878 | 7878 | |
| 7879 | - return '_' . self::strtolower($match, $encoding); |
|
| 7879 | + return '_'.self::strtolower($match, $encoding); |
|
| 7880 | 7880 | }, |
| 7881 | 7881 | $str |
| 7882 | 7882 | ); |
| 7883 | 7883 | |
| 7884 | - $str = (string) \preg_replace( |
|
| 7884 | + $str = (string)\preg_replace( |
|
| 7885 | 7885 | [ |
| 7886 | - '/\\s+/u', // convert spaces to "_" |
|
| 7886 | + '/\\s+/u', // convert spaces to "_" |
|
| 7887 | 7887 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
| 7888 | - '/_+/', // remove double "_" |
|
| 7888 | + '/_+/', // remove double "_" |
|
| 7889 | 7889 | ], |
| 7890 | 7890 | [ |
| 7891 | 7891 | '_', |
@@ -8008,7 +8008,7 @@ discard block |
||
| 8008 | 8008 | } |
| 8009 | 8009 | |
| 8010 | 8010 | // init |
| 8011 | - $input = (string) $input; |
|
| 8011 | + $input = (string)$input; |
|
| 8012 | 8012 | |
| 8013 | 8013 | if ($input === '') { |
| 8014 | 8014 | return []; |
@@ -8065,7 +8065,7 @@ discard block |
||
| 8065 | 8065 | ($input[$i] & "\xE0") === "\xC0" |
| 8066 | 8066 | ) { |
| 8067 | 8067 | if (($input[$i + 1] & "\xC0") === "\x80") { |
| 8068 | - $ret[] = $input[$i] . $input[$i + 1]; |
|
| 8068 | + $ret[] = $input[$i].$input[$i + 1]; |
|
| 8069 | 8069 | |
| 8070 | 8070 | ++$i; |
| 8071 | 8071 | } |
@@ -8079,7 +8079,7 @@ discard block |
||
| 8079 | 8079 | && |
| 8080 | 8080 | ($input[$i + 2] & "\xC0") === "\x80" |
| 8081 | 8081 | ) { |
| 8082 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2]; |
|
| 8082 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2]; |
|
| 8083 | 8083 | |
| 8084 | 8084 | $i += 2; |
| 8085 | 8085 | } |
@@ -8095,7 +8095,7 @@ discard block |
||
| 8095 | 8095 | && |
| 8096 | 8096 | ($input[$i + 3] & "\xC0") === "\x80" |
| 8097 | 8097 | ) { |
| 8098 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2] . $input[$i + 3]; |
|
| 8098 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2].$input[$i + 3]; |
|
| 8099 | 8099 | |
| 8100 | 8100 | $i += 3; |
| 8101 | 8101 | } |
@@ -8107,7 +8107,7 @@ discard block |
||
| 8107 | 8107 | $ret = \array_chunk($ret, $length); |
| 8108 | 8108 | |
| 8109 | 8109 | return \array_map( |
| 8110 | - static function (array &$item): string { |
|
| 8110 | + static function(array &$item): string { |
|
| 8111 | 8111 | return \implode('', $item); |
| 8112 | 8112 | }, |
| 8113 | 8113 | $ret |
@@ -8173,7 +8173,7 @@ discard block |
||
| 8173 | 8173 | $limit = -1; |
| 8174 | 8174 | } |
| 8175 | 8175 | |
| 8176 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
| 8176 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
| 8177 | 8177 | |
| 8178 | 8178 | if ($array === false) { |
| 8179 | 8179 | return []; |
@@ -8263,9 +8263,9 @@ discard block |
||
| 8263 | 8263 | return ''; |
| 8264 | 8264 | } |
| 8265 | 8265 | |
| 8266 | - return (string) \mb_substr( |
|
| 8266 | + return (string)\mb_substr( |
|
| 8267 | 8267 | $str, |
| 8268 | - $offset + (int) \mb_strlen($separator) |
|
| 8268 | + $offset + (int)\mb_strlen($separator) |
|
| 8269 | 8269 | ); |
| 8270 | 8270 | } |
| 8271 | 8271 | |
@@ -8274,9 +8274,9 @@ discard block |
||
| 8274 | 8274 | return ''; |
| 8275 | 8275 | } |
| 8276 | 8276 | |
| 8277 | - return (string) \mb_substr( |
|
| 8277 | + return (string)\mb_substr( |
|
| 8278 | 8278 | $str, |
| 8279 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 8279 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 8280 | 8280 | null, |
| 8281 | 8281 | $encoding |
| 8282 | 8282 | ); |
@@ -8305,9 +8305,9 @@ discard block |
||
| 8305 | 8305 | return ''; |
| 8306 | 8306 | } |
| 8307 | 8307 | |
| 8308 | - return (string) \mb_substr( |
|
| 8308 | + return (string)\mb_substr( |
|
| 8309 | 8309 | $str, |
| 8310 | - $offset + (int) \mb_strlen($separator) |
|
| 8310 | + $offset + (int)\mb_strlen($separator) |
|
| 8311 | 8311 | ); |
| 8312 | 8312 | } |
| 8313 | 8313 | |
@@ -8316,9 +8316,9 @@ discard block |
||
| 8316 | 8316 | return ''; |
| 8317 | 8317 | } |
| 8318 | 8318 | |
| 8319 | - return (string) self::substr( |
|
| 8319 | + return (string)self::substr( |
|
| 8320 | 8320 | $str, |
| 8321 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 8321 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 8322 | 8322 | null, |
| 8323 | 8323 | $encoding |
| 8324 | 8324 | ); |
@@ -8350,7 +8350,7 @@ discard block |
||
| 8350 | 8350 | return ''; |
| 8351 | 8351 | } |
| 8352 | 8352 | |
| 8353 | - return (string) \mb_substr( |
|
| 8353 | + return (string)\mb_substr( |
|
| 8354 | 8354 | $str, |
| 8355 | 8355 | 0, |
| 8356 | 8356 | $offset |
@@ -8362,7 +8362,7 @@ discard block |
||
| 8362 | 8362 | return ''; |
| 8363 | 8363 | } |
| 8364 | 8364 | |
| 8365 | - return (string) self::substr( |
|
| 8365 | + return (string)self::substr( |
|
| 8366 | 8366 | $str, |
| 8367 | 8367 | 0, |
| 8368 | 8368 | $offset, |
@@ -8393,7 +8393,7 @@ discard block |
||
| 8393 | 8393 | return ''; |
| 8394 | 8394 | } |
| 8395 | 8395 | |
| 8396 | - return (string) \mb_substr( |
|
| 8396 | + return (string)\mb_substr( |
|
| 8397 | 8397 | $str, |
| 8398 | 8398 | 0, |
| 8399 | 8399 | $offset |
@@ -8407,7 +8407,7 @@ discard block |
||
| 8407 | 8407 | |
| 8408 | 8408 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8409 | 8409 | |
| 8410 | - return (string) self::substr( |
|
| 8410 | + return (string)self::substr( |
|
| 8411 | 8411 | $str, |
| 8412 | 8412 | 0, |
| 8413 | 8413 | $offset, |
@@ -8522,7 +8522,7 @@ discard block |
||
| 8522 | 8522 | */ |
| 8523 | 8523 | public static function str_surround(string $str, string $substring): string |
| 8524 | 8524 | { |
| 8525 | - return $substring . $str . $substring; |
|
| 8525 | + return $substring.$str.$substring; |
|
| 8526 | 8526 | } |
| 8527 | 8527 | |
| 8528 | 8528 | /** |
@@ -8586,9 +8586,9 @@ discard block |
||
| 8586 | 8586 | $word_define_chars = ''; |
| 8587 | 8587 | } |
| 8588 | 8588 | |
| 8589 | - $str = (string) \preg_replace_callback( |
|
| 8590 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
| 8591 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
| 8589 | + $str = (string)\preg_replace_callback( |
|
| 8590 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
| 8591 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
| 8592 | 8592 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
| 8593 | 8593 | return $match[0]; |
| 8594 | 8594 | } |
@@ -8688,16 +8688,16 @@ discard block |
||
| 8688 | 8688 | |
| 8689 | 8689 | // the main substitutions |
| 8690 | 8690 | /** @noinspection RegExpDuplicateAlternationBranch - false-positive - https://youtrack.jetbrains.com/issue/WI-51002 */ |
| 8691 | - $str = (string) \preg_replace_callback( |
|
| 8691 | + $str = (string)\preg_replace_callback( |
|
| 8692 | 8692 | '~\\b (_*) (?: # 1. Leading underscore and |
| 8693 | 8693 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
| 8694 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
| 8694 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
| 8695 | 8695 | | |
| 8696 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
| 8696 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
| 8697 | 8697 | | |
| 8698 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
| 8698 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
| 8699 | 8699 | | |
| 8700 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
| 8700 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
| 8701 | 8701 | ) (_*) \\b # 6. With trailing underscore |
| 8702 | 8702 | ~ux', |
| 8703 | 8703 | /** |
@@ -8707,7 +8707,7 @@ discard block |
||
| 8707 | 8707 | * |
| 8708 | 8708 | * @return string |
| 8709 | 8709 | */ |
| 8710 | - static function (array $matches) use ($encoding): string { |
|
| 8710 | + static function(array $matches) use ($encoding): string { |
|
| 8711 | 8711 | // preserve leading underscore |
| 8712 | 8712 | $str = $matches[1]; |
| 8713 | 8713 | if ($matches[2]) { |
@@ -8732,11 +8732,11 @@ discard block |
||
| 8732 | 8732 | ); |
| 8733 | 8733 | |
| 8734 | 8734 | // Exceptions for small words: capitalize at start of title... |
| 8735 | - $str = (string) \preg_replace_callback( |
|
| 8735 | + $str = (string)\preg_replace_callback( |
|
| 8736 | 8736 | '~( \\A [[:punct:]]* # start of title... |
| 8737 | 8737 | | [:.;?!][ ]+ # or of subsentence... |
| 8738 | 8738 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
| 8739 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
| 8739 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
| 8740 | 8740 | ~uxi', |
| 8741 | 8741 | /** |
| 8742 | 8742 | * @param string[] $matches |
@@ -8745,15 +8745,15 @@ discard block |
||
| 8745 | 8745 | * |
| 8746 | 8746 | * @return string |
| 8747 | 8747 | */ |
| 8748 | - static function (array $matches) use ($encoding): string { |
|
| 8749 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
| 8748 | + static function(array $matches) use ($encoding): string { |
|
| 8749 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
| 8750 | 8750 | }, |
| 8751 | 8751 | $str |
| 8752 | 8752 | ); |
| 8753 | 8753 | |
| 8754 | 8754 | // ...and end of title |
| 8755 | - $str = (string) \preg_replace_callback( |
|
| 8756 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
| 8755 | + $str = (string)\preg_replace_callback( |
|
| 8756 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
| 8757 | 8757 | (?= [[:punct:]]* \Z # ...at the end of the title... |
| 8758 | 8758 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
| 8759 | 8759 | ~uxi', |
@@ -8764,7 +8764,7 @@ discard block |
||
| 8764 | 8764 | * |
| 8765 | 8765 | * @return string |
| 8766 | 8766 | */ |
| 8767 | - static function (array $matches) use ($encoding): string { |
|
| 8767 | + static function(array $matches) use ($encoding): string { |
|
| 8768 | 8768 | return static::ucfirst($matches[1], $encoding); |
| 8769 | 8769 | }, |
| 8770 | 8770 | $str |
@@ -8772,10 +8772,10 @@ discard block |
||
| 8772 | 8772 | |
| 8773 | 8773 | // Exceptions for small words in hyphenated compound words. |
| 8774 | 8774 | // e.g. "in-flight" -> In-Flight |
| 8775 | - $str = (string) \preg_replace_callback( |
|
| 8775 | + $str = (string)\preg_replace_callback( |
|
| 8776 | 8776 | '~\\b |
| 8777 | 8777 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
| 8778 | - ( ' . $small_words_rx . ' ) |
|
| 8778 | + ( ' . $small_words_rx.' ) |
|
| 8779 | 8779 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
| 8780 | 8780 | ~uxi', |
| 8781 | 8781 | /** |
@@ -8785,18 +8785,18 @@ discard block |
||
| 8785 | 8785 | * |
| 8786 | 8786 | * @return string |
| 8787 | 8787 | */ |
| 8788 | - static function (array $matches) use ($encoding): string { |
|
| 8788 | + static function(array $matches) use ($encoding): string { |
|
| 8789 | 8789 | return static::ucfirst($matches[1], $encoding); |
| 8790 | 8790 | }, |
| 8791 | 8791 | $str |
| 8792 | 8792 | ); |
| 8793 | 8793 | |
| 8794 | 8794 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
| 8795 | - $str = (string) \preg_replace_callback( |
|
| 8795 | + $str = (string)\preg_replace_callback( |
|
| 8796 | 8796 | '~\\b |
| 8797 | 8797 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
| 8798 | 8798 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
| 8799 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
| 8799 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
| 8800 | 8800 | (?! - ) # Negative lookahead for another - |
| 8801 | 8801 | ~uxi', |
| 8802 | 8802 | /** |
@@ -8806,8 +8806,8 @@ discard block |
||
| 8806 | 8806 | * |
| 8807 | 8807 | * @return string |
| 8808 | 8808 | */ |
| 8809 | - static function (array $matches) use ($encoding): string { |
|
| 8810 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
| 8809 | + static function(array $matches) use ($encoding): string { |
|
| 8810 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
| 8811 | 8811 | }, |
| 8812 | 8812 | $str |
| 8813 | 8813 | ); |
@@ -8922,7 +8922,7 @@ discard block |
||
| 8922 | 8922 | ); |
| 8923 | 8923 | |
| 8924 | 8924 | foreach ($tmp_return as &$item) { |
| 8925 | - $item = (string) $item; |
|
| 8925 | + $item = (string)$item; |
|
| 8926 | 8926 | } |
| 8927 | 8927 | |
| 8928 | 8928 | return $tmp_return; |
@@ -8976,39 +8976,39 @@ discard block |
||
| 8976 | 8976 | } |
| 8977 | 8977 | |
| 8978 | 8978 | if ($encoding === 'UTF-8') { |
| 8979 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 8979 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 8980 | 8980 | return $str; |
| 8981 | 8981 | } |
| 8982 | 8982 | |
| 8983 | 8983 | if ($substring !== '') { |
| 8984 | - $length -= (int) \mb_strlen($substring); |
|
| 8984 | + $length -= (int)\mb_strlen($substring); |
|
| 8985 | 8985 | |
| 8986 | 8986 | /** @noinspection UnnecessaryCastingInspection */ |
| 8987 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
| 8987 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
| 8988 | 8988 | } |
| 8989 | 8989 | |
| 8990 | 8990 | /** @noinspection UnnecessaryCastingInspection */ |
| 8991 | - return (string) \mb_substr($str, 0, $length); |
|
| 8991 | + return (string)\mb_substr($str, 0, $length); |
|
| 8992 | 8992 | } |
| 8993 | 8993 | |
| 8994 | 8994 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8995 | 8995 | |
| 8996 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 8996 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 8997 | 8997 | return $str; |
| 8998 | 8998 | } |
| 8999 | 8999 | |
| 9000 | 9000 | if ($substring !== '') { |
| 9001 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 9001 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 9002 | 9002 | } |
| 9003 | 9003 | |
| 9004 | 9004 | return ( |
| 9005 | - (string) self::substr( |
|
| 9005 | + (string)self::substr( |
|
| 9006 | 9006 | $str, |
| 9007 | 9007 | 0, |
| 9008 | 9008 | $length, |
| 9009 | 9009 | $encoding |
| 9010 | 9010 | ) |
| 9011 | - ) . $substring; |
|
| 9011 | + ).$substring; |
|
| 9012 | 9012 | } |
| 9013 | 9013 | |
| 9014 | 9014 | /** |
@@ -9042,12 +9042,12 @@ discard block |
||
| 9042 | 9042 | } |
| 9043 | 9043 | |
| 9044 | 9044 | if ($encoding === 'UTF-8') { |
| 9045 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 9045 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 9046 | 9046 | return $str; |
| 9047 | 9047 | } |
| 9048 | 9048 | |
| 9049 | 9049 | // need to further trim the string so we can append the substring |
| 9050 | - $length -= (int) \mb_strlen($substring); |
|
| 9050 | + $length -= (int)\mb_strlen($substring); |
|
| 9051 | 9051 | if ($length <= 0) { |
| 9052 | 9052 | return $substring; |
| 9053 | 9053 | } |
@@ -9073,18 +9073,18 @@ discard block |
||
| 9073 | 9073 | !$ignore_do_not_split_words_for_one_word |
| 9074 | 9074 | ) |
| 9075 | 9075 | ) { |
| 9076 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
| 9076 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
| 9077 | 9077 | } |
| 9078 | 9078 | } |
| 9079 | 9079 | } else { |
| 9080 | 9080 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 9081 | 9081 | |
| 9082 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 9082 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 9083 | 9083 | return $str; |
| 9084 | 9084 | } |
| 9085 | 9085 | |
| 9086 | 9086 | // need to further trim the string so we can append the substring |
| 9087 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 9087 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 9088 | 9088 | if ($length <= 0) { |
| 9089 | 9089 | return $substring; |
| 9090 | 9090 | } |
@@ -9110,12 +9110,12 @@ discard block |
||
| 9110 | 9110 | !$ignore_do_not_split_words_for_one_word |
| 9111 | 9111 | ) |
| 9112 | 9112 | ) { |
| 9113 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
| 9113 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
| 9114 | 9114 | } |
| 9115 | 9115 | } |
| 9116 | 9116 | } |
| 9117 | 9117 | |
| 9118 | - return $truncated . $substring; |
|
| 9118 | + return $truncated.$substring; |
|
| 9119 | 9119 | } |
| 9120 | 9120 | |
| 9121 | 9121 | /** |
@@ -9225,13 +9225,13 @@ discard block |
||
| 9225 | 9225 | } |
| 9226 | 9226 | } elseif ($format === 2) { |
| 9227 | 9227 | $number_of_words = []; |
| 9228 | - $offset = (int) self::strlen($str_parts[0]); |
|
| 9228 | + $offset = (int)self::strlen($str_parts[0]); |
|
| 9229 | 9229 | for ($i = 1; $i < $len; $i += 2) { |
| 9230 | 9230 | $number_of_words[$offset] = $str_parts[$i]; |
| 9231 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
| 9231 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
| 9232 | 9232 | } |
| 9233 | 9233 | } else { |
| 9234 | - $number_of_words = (int) (($len - 1) / 2); |
|
| 9234 | + $number_of_words = (int)(($len - 1) / 2); |
|
| 9235 | 9235 | } |
| 9236 | 9236 | |
| 9237 | 9237 | return $number_of_words; |
@@ -9360,21 +9360,21 @@ discard block |
||
| 9360 | 9360 | } |
| 9361 | 9361 | |
| 9362 | 9362 | if ($char_list === '') { |
| 9363 | - return (int) self::strlen($str, $encoding); |
|
| 9363 | + return (int)self::strlen($str, $encoding); |
|
| 9364 | 9364 | } |
| 9365 | 9365 | |
| 9366 | 9366 | if ($offset !== null || $length !== null) { |
| 9367 | 9367 | if ($encoding === 'UTF-8') { |
| 9368 | 9368 | if ($length === null) { |
| 9369 | 9369 | /** @noinspection UnnecessaryCastingInspection */ |
| 9370 | - $str_tmp = \mb_substr($str, (int) $offset); |
|
| 9370 | + $str_tmp = \mb_substr($str, (int)$offset); |
|
| 9371 | 9371 | } else { |
| 9372 | 9372 | /** @noinspection UnnecessaryCastingInspection */ |
| 9373 | - $str_tmp = \mb_substr($str, (int) $offset, $length); |
|
| 9373 | + $str_tmp = \mb_substr($str, (int)$offset, $length); |
|
| 9374 | 9374 | } |
| 9375 | 9375 | } else { |
| 9376 | 9376 | /** @noinspection UnnecessaryCastingInspection */ |
| 9377 | - $str_tmp = self::substr($str, (int) $offset, $length, $encoding); |
|
| 9377 | + $str_tmp = self::substr($str, (int)$offset, $length, $encoding); |
|
| 9378 | 9378 | } |
| 9379 | 9379 | |
| 9380 | 9380 | if ($str_tmp === false) { |
@@ -9390,7 +9390,7 @@ discard block |
||
| 9390 | 9390 | } |
| 9391 | 9391 | |
| 9392 | 9392 | $matches = []; |
| 9393 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
| 9393 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
| 9394 | 9394 | $return = self::strlen($matches[1], $encoding); |
| 9395 | 9395 | if ($return === false) { |
| 9396 | 9396 | return 0; |
@@ -9399,7 +9399,7 @@ discard block |
||
| 9399 | 9399 | return $return; |
| 9400 | 9400 | } |
| 9401 | 9401 | |
| 9402 | - return (int) self::strlen($str, $encoding); |
|
| 9402 | + return (int)self::strlen($str, $encoding); |
|
| 9403 | 9403 | } |
| 9404 | 9404 | |
| 9405 | 9405 | /** |
@@ -9454,7 +9454,7 @@ discard block |
||
| 9454 | 9454 | |
| 9455 | 9455 | $str = ''; |
| 9456 | 9456 | foreach ($array as $strPart) { |
| 9457 | - $str .= '&#' . (int) $strPart . ';'; |
|
| 9457 | + $str .= '&#'.(int)$strPart.';'; |
|
| 9458 | 9458 | } |
| 9459 | 9459 | |
| 9460 | 9460 | return self::html_entity_decode($str, \ENT_QUOTES | \ENT_HTML5); |
@@ -9543,7 +9543,7 @@ discard block |
||
| 9543 | 9543 | return ''; |
| 9544 | 9544 | } |
| 9545 | 9545 | |
| 9546 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
| 9546 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
| 9547 | 9547 | } |
| 9548 | 9548 | |
| 9549 | 9549 | /** |
@@ -9610,7 +9610,7 @@ discard block |
||
| 9610 | 9610 | // fallback for ascii only |
| 9611 | 9611 | // |
| 9612 | 9612 | |
| 9613 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 9613 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 9614 | 9614 | return \stripos($haystack, $needle, $offset); |
| 9615 | 9615 | } |
| 9616 | 9616 | |
@@ -9683,7 +9683,7 @@ discard block |
||
| 9683 | 9683 | /** |
| 9684 | 9684 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 9685 | 9685 | */ |
| 9686 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9686 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9687 | 9687 | } |
| 9688 | 9688 | |
| 9689 | 9689 | if ( |
@@ -9697,11 +9697,11 @@ discard block |
||
| 9697 | 9697 | } |
| 9698 | 9698 | } |
| 9699 | 9699 | |
| 9700 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
| 9700 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
| 9701 | 9701 | return \stristr($haystack, $needle, $before_needle); |
| 9702 | 9702 | } |
| 9703 | 9703 | |
| 9704 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
| 9704 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
| 9705 | 9705 | |
| 9706 | 9706 | if (!isset($match[1])) { |
| 9707 | 9707 | return false; |
@@ -9711,7 +9711,7 @@ discard block |
||
| 9711 | 9711 | return $match[1]; |
| 9712 | 9712 | } |
| 9713 | 9713 | |
| 9714 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
| 9714 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
| 9715 | 9715 | } |
| 9716 | 9716 | |
| 9717 | 9717 | /** |
@@ -9790,7 +9790,7 @@ discard block |
||
| 9790 | 9790 | /** |
| 9791 | 9791 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 9792 | 9792 | */ |
| 9793 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9793 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9794 | 9794 | } |
| 9795 | 9795 | |
| 9796 | 9796 | // |
@@ -9912,8 +9912,8 @@ discard block |
||
| 9912 | 9912 | } |
| 9913 | 9913 | |
| 9914 | 9914 | return \strnatcmp( |
| 9915 | - (string) self::strtonatfold($str1), |
|
| 9916 | - (string) self::strtonatfold($str2) |
|
| 9915 | + (string)self::strtonatfold($str1), |
|
| 9916 | + (string)self::strtonatfold($str2) |
|
| 9917 | 9917 | ); |
| 9918 | 9918 | } |
| 9919 | 9919 | |
@@ -9975,11 +9975,11 @@ discard block |
||
| 9975 | 9975 | } |
| 9976 | 9976 | |
| 9977 | 9977 | if ($encoding === 'UTF-8') { |
| 9978 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
| 9979 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
| 9978 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
| 9979 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
| 9980 | 9980 | } else { |
| 9981 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
| 9982 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
| 9981 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
| 9982 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
| 9983 | 9983 | } |
| 9984 | 9984 | |
| 9985 | 9985 | return self::strcmp($str1, $str2); |
@@ -10004,8 +10004,8 @@ discard block |
||
| 10004 | 10004 | return false; |
| 10005 | 10005 | } |
| 10006 | 10006 | |
| 10007 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
| 10008 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
| 10007 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
| 10008 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
| 10009 | 10009 | } |
| 10010 | 10010 | |
| 10011 | 10011 | return false; |
@@ -10040,10 +10040,10 @@ discard block |
||
| 10040 | 10040 | } |
| 10041 | 10041 | |
| 10042 | 10042 | // iconv and mbstring do not support integer $needle |
| 10043 | - if ((int) $needle === $needle) { |
|
| 10044 | - $needle = (string) self::chr($needle); |
|
| 10043 | + if ((int)$needle === $needle) { |
|
| 10044 | + $needle = (string)self::chr($needle); |
|
| 10045 | 10045 | } |
| 10046 | - $needle = (string) $needle; |
|
| 10046 | + $needle = (string)$needle; |
|
| 10047 | 10047 | |
| 10048 | 10048 | if ($needle === '') { |
| 10049 | 10049 | return false; |
@@ -10095,7 +10095,7 @@ discard block |
||
| 10095 | 10095 | /** |
| 10096 | 10096 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10097 | 10097 | */ |
| 10098 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10098 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10099 | 10099 | } |
| 10100 | 10100 | |
| 10101 | 10101 | // |
@@ -10136,7 +10136,7 @@ discard block |
||
| 10136 | 10136 | // fallback for ascii only |
| 10137 | 10137 | // |
| 10138 | 10138 | |
| 10139 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10139 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10140 | 10140 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Offset not contained in string */ |
| 10141 | 10141 | return @\strpos($haystack, $needle, $offset); |
| 10142 | 10142 | } |
@@ -10149,7 +10149,7 @@ discard block |
||
| 10149 | 10149 | if ($haystack_tmp === false) { |
| 10150 | 10150 | $haystack_tmp = ''; |
| 10151 | 10151 | } |
| 10152 | - $haystack = (string) $haystack_tmp; |
|
| 10152 | + $haystack = (string)$haystack_tmp; |
|
| 10153 | 10153 | |
| 10154 | 10154 | if ($offset < 0) { |
| 10155 | 10155 | $offset = 0; |
@@ -10161,7 +10161,7 @@ discard block |
||
| 10161 | 10161 | } |
| 10162 | 10162 | |
| 10163 | 10163 | if ($pos) { |
| 10164 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 10164 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 10165 | 10165 | } |
| 10166 | 10166 | |
| 10167 | 10167 | return $offset + 0; |
@@ -10314,7 +10314,7 @@ discard block |
||
| 10314 | 10314 | /** |
| 10315 | 10315 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10316 | 10316 | */ |
| 10317 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10317 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10318 | 10318 | } |
| 10319 | 10319 | |
| 10320 | 10320 | // |
@@ -10326,7 +10326,7 @@ discard block |
||
| 10326 | 10326 | if ($needle_tmp === false) { |
| 10327 | 10327 | return false; |
| 10328 | 10328 | } |
| 10329 | - $needle = (string) $needle_tmp; |
|
| 10329 | + $needle = (string)$needle_tmp; |
|
| 10330 | 10330 | |
| 10331 | 10331 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
| 10332 | 10332 | if ($pos === false) { |
@@ -10348,7 +10348,7 @@ discard block |
||
| 10348 | 10348 | if ($needle_tmp === false) { |
| 10349 | 10349 | return false; |
| 10350 | 10350 | } |
| 10351 | - $needle = (string) $needle_tmp; |
|
| 10351 | + $needle = (string)$needle_tmp; |
|
| 10352 | 10352 | |
| 10353 | 10353 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
| 10354 | 10354 | if ($pos === false) { |
@@ -10387,7 +10387,7 @@ discard block |
||
| 10387 | 10387 | if ($encoding === 'UTF-8') { |
| 10388 | 10388 | if (self::$SUPPORT['intl'] === true) { |
| 10389 | 10389 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
| 10390 | - $i = (int) \grapheme_strlen($str); |
|
| 10390 | + $i = (int)\grapheme_strlen($str); |
|
| 10391 | 10391 | while ($i--) { |
| 10392 | 10392 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
| 10393 | 10393 | if ($reversed_tmp !== false) { |
@@ -10395,7 +10395,7 @@ discard block |
||
| 10395 | 10395 | } |
| 10396 | 10396 | } |
| 10397 | 10397 | } else { |
| 10398 | - $i = (int) \mb_strlen($str); |
|
| 10398 | + $i = (int)\mb_strlen($str); |
|
| 10399 | 10399 | while ($i--) { |
| 10400 | 10400 | $reversed_tmp = \mb_substr($str, $i, 1); |
| 10401 | 10401 | if ($reversed_tmp !== false) { |
@@ -10406,7 +10406,7 @@ discard block |
||
| 10406 | 10406 | } else { |
| 10407 | 10407 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 10408 | 10408 | |
| 10409 | - $i = (int) self::strlen($str, $encoding); |
|
| 10409 | + $i = (int)self::strlen($str, $encoding); |
|
| 10410 | 10410 | while ($i--) { |
| 10411 | 10411 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
| 10412 | 10412 | if ($reversed_tmp !== false) { |
@@ -10483,7 +10483,7 @@ discard block |
||
| 10483 | 10483 | if ($needle_tmp === false) { |
| 10484 | 10484 | return false; |
| 10485 | 10485 | } |
| 10486 | - $needle = (string) $needle_tmp; |
|
| 10486 | + $needle = (string)$needle_tmp; |
|
| 10487 | 10487 | |
| 10488 | 10488 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
| 10489 | 10489 | if ($pos === false) { |
@@ -10524,10 +10524,10 @@ discard block |
||
| 10524 | 10524 | } |
| 10525 | 10525 | |
| 10526 | 10526 | // iconv and mbstring do not support integer $needle |
| 10527 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 10528 | - $needle = (string) self::chr($needle); |
|
| 10527 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 10528 | + $needle = (string)self::chr($needle); |
|
| 10529 | 10529 | } |
| 10530 | - $needle = (string) $needle; |
|
| 10530 | + $needle = (string)$needle; |
|
| 10531 | 10531 | |
| 10532 | 10532 | if ($needle === '') { |
| 10533 | 10533 | return false; |
@@ -10575,7 +10575,7 @@ discard block |
||
| 10575 | 10575 | /** |
| 10576 | 10576 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10577 | 10577 | */ |
| 10578 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10578 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10579 | 10579 | } |
| 10580 | 10580 | |
| 10581 | 10581 | // |
@@ -10599,7 +10599,7 @@ discard block |
||
| 10599 | 10599 | // fallback for ascii only |
| 10600 | 10600 | // |
| 10601 | 10601 | |
| 10602 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10602 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10603 | 10603 | return \strripos($haystack, $needle, $offset); |
| 10604 | 10604 | } |
| 10605 | 10605 | |
@@ -10680,10 +10680,10 @@ discard block |
||
| 10680 | 10680 | } |
| 10681 | 10681 | |
| 10682 | 10682 | // iconv and mbstring do not support integer $needle |
| 10683 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 10684 | - $needle = (string) self::chr($needle); |
|
| 10683 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 10684 | + $needle = (string)self::chr($needle); |
|
| 10685 | 10685 | } |
| 10686 | - $needle = (string) $needle; |
|
| 10686 | + $needle = (string)$needle; |
|
| 10687 | 10687 | |
| 10688 | 10688 | if ($needle === '') { |
| 10689 | 10689 | return false; |
@@ -10731,7 +10731,7 @@ discard block |
||
| 10731 | 10731 | /** |
| 10732 | 10732 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10733 | 10733 | */ |
| 10734 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10734 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10735 | 10735 | } |
| 10736 | 10736 | |
| 10737 | 10737 | // |
@@ -10755,7 +10755,7 @@ discard block |
||
| 10755 | 10755 | // fallback for ascii only |
| 10756 | 10756 | // |
| 10757 | 10757 | |
| 10758 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10758 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10759 | 10759 | return \strrpos($haystack, $needle, $offset); |
| 10760 | 10760 | } |
| 10761 | 10761 | |
@@ -10775,7 +10775,7 @@ discard block |
||
| 10775 | 10775 | if ($haystack_tmp === false) { |
| 10776 | 10776 | $haystack_tmp = ''; |
| 10777 | 10777 | } |
| 10778 | - $haystack = (string) $haystack_tmp; |
|
| 10778 | + $haystack = (string)$haystack_tmp; |
|
| 10779 | 10779 | } |
| 10780 | 10780 | |
| 10781 | 10781 | $pos = \strrpos($haystack, $needle); |
@@ -10789,7 +10789,7 @@ discard block |
||
| 10789 | 10789 | return false; |
| 10790 | 10790 | } |
| 10791 | 10791 | |
| 10792 | - return $offset + (int) self::strlen($str_tmp); |
|
| 10792 | + return $offset + (int)self::strlen($str_tmp); |
|
| 10793 | 10793 | } |
| 10794 | 10794 | |
| 10795 | 10795 | /** |
@@ -10855,12 +10855,12 @@ discard block |
||
| 10855 | 10855 | if ($offset || $length !== null) { |
| 10856 | 10856 | if ($encoding === 'UTF-8') { |
| 10857 | 10857 | if ($length === null) { |
| 10858 | - $str = (string) \mb_substr($str, $offset); |
|
| 10858 | + $str = (string)\mb_substr($str, $offset); |
|
| 10859 | 10859 | } else { |
| 10860 | - $str = (string) \mb_substr($str, $offset, $length); |
|
| 10860 | + $str = (string)\mb_substr($str, $offset, $length); |
|
| 10861 | 10861 | } |
| 10862 | 10862 | } else { |
| 10863 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
| 10863 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
| 10864 | 10864 | } |
| 10865 | 10865 | } |
| 10866 | 10866 | |
@@ -10870,7 +10870,7 @@ discard block |
||
| 10870 | 10870 | |
| 10871 | 10871 | $matches = []; |
| 10872 | 10872 | |
| 10873 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
| 10873 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
| 10874 | 10874 | } |
| 10875 | 10875 | |
| 10876 | 10876 | /** |
@@ -10944,7 +10944,7 @@ discard block |
||
| 10944 | 10944 | /** |
| 10945 | 10945 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10946 | 10946 | */ |
| 10947 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10947 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10948 | 10948 | } |
| 10949 | 10949 | |
| 10950 | 10950 | // |
@@ -10966,7 +10966,7 @@ discard block |
||
| 10966 | 10966 | // fallback for ascii only |
| 10967 | 10967 | // |
| 10968 | 10968 | |
| 10969 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10969 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10970 | 10970 | return \strstr($haystack, $needle, $before_needle); |
| 10971 | 10971 | } |
| 10972 | 10972 | |
@@ -10974,7 +10974,7 @@ discard block |
||
| 10974 | 10974 | // fallback via vanilla php |
| 10975 | 10975 | // |
| 10976 | 10976 | |
| 10977 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
| 10977 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
| 10978 | 10978 | |
| 10979 | 10979 | if (!isset($match[1])) { |
| 10980 | 10980 | return false; |
@@ -10984,7 +10984,7 @@ discard block |
||
| 10984 | 10984 | return $match[1]; |
| 10985 | 10985 | } |
| 10986 | 10986 | |
| 10987 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
| 10987 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
| 10988 | 10988 | } |
| 10989 | 10989 | |
| 10990 | 10990 | /** |
@@ -11110,7 +11110,7 @@ discard block |
||
| 11110 | 11110 | bool $try_to_keep_the_string_length = false |
| 11111 | 11111 | ): string { |
| 11112 | 11112 | // init |
| 11113 | - $str = (string) $str; |
|
| 11113 | + $str = (string)$str; |
|
| 11114 | 11114 | |
| 11115 | 11115 | if ($str === '') { |
| 11116 | 11116 | return ''; |
@@ -11139,25 +11139,25 @@ discard block |
||
| 11139 | 11139 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 11140 | 11140 | } |
| 11141 | 11141 | |
| 11142 | - $language_code = $lang . '-Lower'; |
|
| 11142 | + $language_code = $lang.'-Lower'; |
|
| 11143 | 11143 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 11144 | 11144 | /** |
| 11145 | 11145 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11146 | 11146 | */ |
| 11147 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
| 11147 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
| 11148 | 11148 | |
| 11149 | 11149 | $language_code = 'Any-Lower'; |
| 11150 | 11150 | } |
| 11151 | 11151 | |
| 11152 | 11152 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 11153 | 11153 | /** @noinspection UnnecessaryCastingInspection */ |
| 11154 | - return (string) \transliterator_transliterate($language_code, $str); |
|
| 11154 | + return (string)\transliterator_transliterate($language_code, $str); |
|
| 11155 | 11155 | } |
| 11156 | 11156 | |
| 11157 | 11157 | /** |
| 11158 | 11158 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11159 | 11159 | */ |
| 11160 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
| 11160 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
| 11161 | 11161 | } |
| 11162 | 11162 | |
| 11163 | 11163 | // always fallback via symfony polyfill |
@@ -11190,7 +11190,7 @@ discard block |
||
| 11190 | 11190 | bool $try_to_keep_the_string_length = false |
| 11191 | 11191 | ): string { |
| 11192 | 11192 | // init |
| 11193 | - $str = (string) $str; |
|
| 11193 | + $str = (string)$str; |
|
| 11194 | 11194 | |
| 11195 | 11195 | if ($str === '') { |
| 11196 | 11196 | return ''; |
@@ -11219,25 +11219,25 @@ discard block |
||
| 11219 | 11219 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 11220 | 11220 | } |
| 11221 | 11221 | |
| 11222 | - $language_code = $lang . '-Upper'; |
|
| 11222 | + $language_code = $lang.'-Upper'; |
|
| 11223 | 11223 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 11224 | 11224 | /** |
| 11225 | 11225 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11226 | 11226 | */ |
| 11227 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
| 11227 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
| 11228 | 11228 | |
| 11229 | 11229 | $language_code = 'Any-Upper'; |
| 11230 | 11230 | } |
| 11231 | 11231 | |
| 11232 | 11232 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 11233 | 11233 | /** @noinspection UnnecessaryCastingInspection */ |
| 11234 | - return (string) \transliterator_transliterate($language_code, $str); |
|
| 11234 | + return (string)\transliterator_transliterate($language_code, $str); |
|
| 11235 | 11235 | } |
| 11236 | 11236 | |
| 11237 | 11237 | /** |
| 11238 | 11238 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11239 | 11239 | */ |
| 11240 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
| 11240 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
| 11241 | 11241 | } |
| 11242 | 11242 | |
| 11243 | 11243 | // always fallback via symfony polyfill |
@@ -11306,7 +11306,7 @@ discard block |
||
| 11306 | 11306 | $from = \array_combine($from, $to); |
| 11307 | 11307 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 11308 | 11308 | if ($from === false) { |
| 11309 | - 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) . ')'); |
|
| 11309 | + 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).')'); |
|
| 11310 | 11310 | } |
| 11311 | 11311 | } |
| 11312 | 11312 | |
@@ -11368,9 +11368,9 @@ discard block |
||
| 11368 | 11368 | } |
| 11369 | 11369 | |
| 11370 | 11370 | $wide = 0; |
| 11371 | - $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); |
|
| 11371 | + $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); |
|
| 11372 | 11372 | |
| 11373 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
| 11373 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
| 11374 | 11374 | } |
| 11375 | 11375 | |
| 11376 | 11376 | /** |
@@ -11468,9 +11468,9 @@ discard block |
||
| 11468 | 11468 | } |
| 11469 | 11469 | |
| 11470 | 11470 | if ($length === null) { |
| 11471 | - $length = (int) $str_length; |
|
| 11471 | + $length = (int)$str_length; |
|
| 11472 | 11472 | } else { |
| 11473 | - $length = (int) $length; |
|
| 11473 | + $length = (int)$length; |
|
| 11474 | 11474 | } |
| 11475 | 11475 | |
| 11476 | 11476 | if ( |
@@ -11481,7 +11481,7 @@ discard block |
||
| 11481 | 11481 | /** |
| 11482 | 11482 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11483 | 11483 | */ |
| 11484 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11484 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11485 | 11485 | } |
| 11486 | 11486 | |
| 11487 | 11487 | // |
@@ -11571,16 +11571,16 @@ discard block |
||
| 11571 | 11571 | ) { |
| 11572 | 11572 | if ($encoding === 'UTF-8') { |
| 11573 | 11573 | if ($length === null) { |
| 11574 | - $str1 = (string) \mb_substr($str1, $offset); |
|
| 11574 | + $str1 = (string)\mb_substr($str1, $offset); |
|
| 11575 | 11575 | } else { |
| 11576 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
| 11576 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
| 11577 | 11577 | } |
| 11578 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
| 11578 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
| 11579 | 11579 | } else { |
| 11580 | 11580 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 11581 | 11581 | |
| 11582 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
| 11583 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
| 11582 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
| 11583 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
| 11584 | 11584 | } |
| 11585 | 11585 | } |
| 11586 | 11586 | |
@@ -11645,13 +11645,13 @@ discard block |
||
| 11645 | 11645 | if ($length_tmp === false) { |
| 11646 | 11646 | return false; |
| 11647 | 11647 | } |
| 11648 | - $length = (int) $length_tmp; |
|
| 11648 | + $length = (int)$length_tmp; |
|
| 11649 | 11649 | } |
| 11650 | 11650 | |
| 11651 | 11651 | if ($encoding === 'UTF-8') { |
| 11652 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
| 11652 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
| 11653 | 11653 | } else { |
| 11654 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
| 11654 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
| 11655 | 11655 | } |
| 11656 | 11656 | } |
| 11657 | 11657 | |
@@ -11663,7 +11663,7 @@ discard block |
||
| 11663 | 11663 | /** |
| 11664 | 11664 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11665 | 11665 | */ |
| 11666 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11666 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11667 | 11667 | } |
| 11668 | 11668 | |
| 11669 | 11669 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -11674,7 +11674,7 @@ discard block |
||
| 11674 | 11674 | return \mb_substr_count($haystack, $needle, $encoding); |
| 11675 | 11675 | } |
| 11676 | 11676 | |
| 11677 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 11677 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 11678 | 11678 | |
| 11679 | 11679 | return \count($matches); |
| 11680 | 11680 | } |
@@ -11724,7 +11724,7 @@ discard block |
||
| 11724 | 11724 | if ($length_tmp === false) { |
| 11725 | 11725 | return false; |
| 11726 | 11726 | } |
| 11727 | - $length = (int) $length_tmp; |
|
| 11727 | + $length = (int)$length_tmp; |
|
| 11728 | 11728 | } |
| 11729 | 11729 | |
| 11730 | 11730 | if ( |
@@ -11746,7 +11746,7 @@ discard block |
||
| 11746 | 11746 | if ($haystack_tmp === false) { |
| 11747 | 11747 | $haystack_tmp = ''; |
| 11748 | 11748 | } |
| 11749 | - $haystack = (string) $haystack_tmp; |
|
| 11749 | + $haystack = (string)$haystack_tmp; |
|
| 11750 | 11750 | } |
| 11751 | 11751 | |
| 11752 | 11752 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -11787,10 +11787,10 @@ discard block |
||
| 11787 | 11787 | |
| 11788 | 11788 | if ($encoding === 'UTF-8') { |
| 11789 | 11789 | if ($case_sensitive) { |
| 11790 | - return (int) \mb_substr_count($str, $substring); |
|
| 11790 | + return (int)\mb_substr_count($str, $substring); |
|
| 11791 | 11791 | } |
| 11792 | 11792 | |
| 11793 | - return (int) \mb_substr_count( |
|
| 11793 | + return (int)\mb_substr_count( |
|
| 11794 | 11794 | \mb_strtoupper($str), |
| 11795 | 11795 | \mb_strtoupper($substring) |
| 11796 | 11796 | ); |
@@ -11799,10 +11799,10 @@ discard block |
||
| 11799 | 11799 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 11800 | 11800 | |
| 11801 | 11801 | if ($case_sensitive) { |
| 11802 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
| 11802 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
| 11803 | 11803 | } |
| 11804 | 11804 | |
| 11805 | - return (int) \mb_substr_count( |
|
| 11805 | + return (int)\mb_substr_count( |
|
| 11806 | 11806 | self::strtocasefold($str, true, false, $encoding, null, false), |
| 11807 | 11807 | self::strtocasefold($substring, true, false, $encoding, null, false), |
| 11808 | 11808 | $encoding |
@@ -11831,7 +11831,7 @@ discard block |
||
| 11831 | 11831 | } |
| 11832 | 11832 | |
| 11833 | 11833 | if (self::str_istarts_with($haystack, $needle)) { |
| 11834 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 11834 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 11835 | 11835 | } |
| 11836 | 11836 | |
| 11837 | 11837 | return $haystack; |
@@ -11893,7 +11893,7 @@ discard block |
||
| 11893 | 11893 | } |
| 11894 | 11894 | |
| 11895 | 11895 | if (self::str_iends_with($haystack, $needle)) { |
| 11896 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
| 11896 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
| 11897 | 11897 | } |
| 11898 | 11898 | |
| 11899 | 11899 | return $haystack; |
@@ -11921,7 +11921,7 @@ discard block |
||
| 11921 | 11921 | } |
| 11922 | 11922 | |
| 11923 | 11923 | if (self::str_starts_with($haystack, $needle)) { |
| 11924 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 11924 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 11925 | 11925 | } |
| 11926 | 11926 | |
| 11927 | 11927 | return $haystack; |
@@ -11976,7 +11976,7 @@ discard block |
||
| 11976 | 11976 | if (\is_array($offset)) { |
| 11977 | 11977 | $offset = \array_slice($offset, 0, $num); |
| 11978 | 11978 | foreach ($offset as &$value_tmp) { |
| 11979 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
| 11979 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
| 11980 | 11980 | } |
| 11981 | 11981 | unset($value_tmp); |
| 11982 | 11982 | } else { |
@@ -11989,7 +11989,7 @@ discard block |
||
| 11989 | 11989 | } elseif (\is_array($length)) { |
| 11990 | 11990 | $length = \array_slice($length, 0, $num); |
| 11991 | 11991 | foreach ($length as &$value_tmp_V2) { |
| 11992 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
| 11992 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
| 11993 | 11993 | } |
| 11994 | 11994 | unset($value_tmp_V2); |
| 11995 | 11995 | } else { |
@@ -12009,8 +12009,8 @@ discard block |
||
| 12009 | 12009 | } |
| 12010 | 12010 | |
| 12011 | 12011 | // init |
| 12012 | - $str = (string) $str; |
|
| 12013 | - $replacement = (string) $replacement; |
|
| 12012 | + $str = (string)$str; |
|
| 12013 | + $replacement = (string)$replacement; |
|
| 12014 | 12014 | |
| 12015 | 12015 | if (\is_array($length)) { |
| 12016 | 12016 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -12025,16 +12025,16 @@ discard block |
||
| 12025 | 12025 | } |
| 12026 | 12026 | |
| 12027 | 12027 | if (self::$SUPPORT['mbstring'] === true) { |
| 12028 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 12028 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 12029 | 12029 | |
| 12030 | 12030 | if ($offset < 0) { |
| 12031 | - $offset = (int) \max(0, $string_length + $offset); |
|
| 12031 | + $offset = (int)\max(0, $string_length + $offset); |
|
| 12032 | 12032 | } elseif ($offset > $string_length) { |
| 12033 | 12033 | $offset = $string_length; |
| 12034 | 12034 | } |
| 12035 | 12035 | |
| 12036 | 12036 | if ($length !== null && $length < 0) { |
| 12037 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
| 12037 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
| 12038 | 12038 | } elseif ($length === null || $length > $string_length) { |
| 12039 | 12039 | $length = $string_length; |
| 12040 | 12040 | } |
@@ -12045,9 +12045,9 @@ discard block |
||
| 12045 | 12045 | } |
| 12046 | 12046 | |
| 12047 | 12047 | /** @noinspection AdditionOperationOnArraysInspection */ |
| 12048 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
| 12049 | - $replacement . |
|
| 12050 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 12048 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
| 12049 | + $replacement. |
|
| 12050 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 12051 | 12051 | } |
| 12052 | 12052 | |
| 12053 | 12053 | // |
@@ -12056,8 +12056,7 @@ discard block |
||
| 12056 | 12056 | |
| 12057 | 12057 | if (ASCII::is_ascii($str)) { |
| 12058 | 12058 | return ($length === null) ? |
| 12059 | - \substr_replace($str, $replacement, $offset) : |
|
| 12060 | - \substr_replace($str, $replacement, $offset, $length); |
|
| 12059 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
| 12061 | 12060 | } |
| 12062 | 12061 | |
| 12063 | 12062 | // |
@@ -12073,7 +12072,7 @@ discard block |
||
| 12073 | 12072 | // e.g.: non mbstring support + invalid chars |
| 12074 | 12073 | return ''; |
| 12075 | 12074 | } |
| 12076 | - $length = (int) $length_tmp; |
|
| 12075 | + $length = (int)$length_tmp; |
|
| 12077 | 12076 | } |
| 12078 | 12077 | |
| 12079 | 12078 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -12111,14 +12110,14 @@ discard block |
||
| 12111 | 12110 | && |
| 12112 | 12111 | \substr($haystack, -\strlen($needle)) === $needle |
| 12113 | 12112 | ) { |
| 12114 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
| 12113 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
| 12115 | 12114 | } |
| 12116 | 12115 | |
| 12117 | 12116 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
| 12118 | - return (string) self::substr( |
|
| 12117 | + return (string)self::substr( |
|
| 12119 | 12118 | $haystack, |
| 12120 | 12119 | 0, |
| 12121 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
| 12120 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
| 12122 | 12121 | $encoding |
| 12123 | 12122 | ); |
| 12124 | 12123 | } |
@@ -12151,10 +12150,10 @@ discard block |
||
| 12151 | 12150 | } |
| 12152 | 12151 | |
| 12153 | 12152 | if ($encoding === 'UTF-8') { |
| 12154 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 12153 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 12155 | 12154 | } |
| 12156 | 12155 | |
| 12157 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 12156 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 12158 | 12157 | } |
| 12159 | 12158 | |
| 12160 | 12159 | /** |
@@ -12362,7 +12361,7 @@ discard block |
||
| 12362 | 12361 | public static function to_boolean($str): bool |
| 12363 | 12362 | { |
| 12364 | 12363 | // init |
| 12365 | - $str = (string) $str; |
|
| 12364 | + $str = (string)$str; |
|
| 12366 | 12365 | |
| 12367 | 12366 | if ($str === '') { |
| 12368 | 12367 | return false; |
@@ -12390,10 +12389,10 @@ discard block |
||
| 12390 | 12389 | } |
| 12391 | 12390 | |
| 12392 | 12391 | if (\is_numeric($str)) { |
| 12393 | - return ((float) $str + 0) > 0; |
|
| 12392 | + return ((float)$str + 0) > 0; |
|
| 12394 | 12393 | } |
| 12395 | 12394 | |
| 12396 | - return (bool) \trim($str); |
|
| 12395 | + return (bool)\trim($str); |
|
| 12397 | 12396 | } |
| 12398 | 12397 | |
| 12399 | 12398 | /** |
@@ -12439,7 +12438,7 @@ discard block |
||
| 12439 | 12438 | return $str; |
| 12440 | 12439 | } |
| 12441 | 12440 | |
| 12442 | - $str = (string) $str; |
|
| 12441 | + $str = (string)$str; |
|
| 12443 | 12442 | if ($str === '') { |
| 12444 | 12443 | return ''; |
| 12445 | 12444 | } |
@@ -12494,7 +12493,7 @@ discard block |
||
| 12494 | 12493 | return $str; |
| 12495 | 12494 | } |
| 12496 | 12495 | |
| 12497 | - $str = (string) $str; |
|
| 12496 | + $str = (string)$str; |
|
| 12498 | 12497 | if ($str === '') { |
| 12499 | 12498 | return $str; |
| 12500 | 12499 | } |
@@ -12512,7 +12511,7 @@ discard block |
||
| 12512 | 12511 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
| 12513 | 12512 | |
| 12514 | 12513 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 12515 | - $buf .= $c1 . $c2; |
|
| 12514 | + $buf .= $c1.$c2; |
|
| 12516 | 12515 | ++$i; |
| 12517 | 12516 | } else { // not valid UTF8 - convert it |
| 12518 | 12517 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12523,7 +12522,7 @@ discard block |
||
| 12523 | 12522 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
| 12524 | 12523 | |
| 12525 | 12524 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 12526 | - $buf .= $c1 . $c2 . $c3; |
|
| 12525 | + $buf .= $c1.$c2.$c3; |
|
| 12527 | 12526 | $i += 2; |
| 12528 | 12527 | } else { // not valid UTF8 - convert it |
| 12529 | 12528 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12535,7 +12534,7 @@ discard block |
||
| 12535 | 12534 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
| 12536 | 12535 | |
| 12537 | 12536 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 12538 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
| 12537 | + $buf .= $c1.$c2.$c3.$c4; |
|
| 12539 | 12538 | $i += 3; |
| 12540 | 12539 | } else { // not valid UTF8 - convert it |
| 12541 | 12540 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12563,13 +12562,13 @@ discard block |
||
| 12563 | 12562 | * |
| 12564 | 12563 | * @return string |
| 12565 | 12564 | */ |
| 12566 | - static function (array $matches): string { |
|
| 12565 | + static function(array $matches): string { |
|
| 12567 | 12566 | if (isset($matches[3])) { |
| 12568 | - $cp = (int) \hexdec($matches[3]); |
|
| 12567 | + $cp = (int)\hexdec($matches[3]); |
|
| 12569 | 12568 | } else { |
| 12570 | 12569 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
| 12571 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
| 12572 | - + (int) \hexdec($matches[2]) |
|
| 12570 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
| 12571 | + + (int)\hexdec($matches[2]) |
|
| 12573 | 12572 | + 0x10000 |
| 12574 | 12573 | - (0xD800 << 10) |
| 12575 | 12574 | - 0xDC00; |
@@ -12580,12 +12579,12 @@ discard block |
||
| 12580 | 12579 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
| 12581 | 12580 | |
| 12582 | 12581 | if ($cp < 0x80) { |
| 12583 | - return (string) self::chr($cp); |
|
| 12582 | + return (string)self::chr($cp); |
|
| 12584 | 12583 | } |
| 12585 | 12584 | |
| 12586 | 12585 | if ($cp < 0xA0) { |
| 12587 | 12586 | /** @noinspection UnnecessaryCastingInspection */ |
| 12588 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
| 12587 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
| 12589 | 12588 | } |
| 12590 | 12589 | |
| 12591 | 12590 | return self::decimal_to_chr($cp); |
@@ -12618,7 +12617,7 @@ discard block |
||
| 12618 | 12617 | public static function to_int(string $str) |
| 12619 | 12618 | { |
| 12620 | 12619 | if (\is_numeric($str)) { |
| 12621 | - return (int) $str; |
|
| 12620 | + return (int)$str; |
|
| 12622 | 12621 | } |
| 12623 | 12622 | |
| 12624 | 12623 | return null; |
@@ -12649,7 +12648,7 @@ discard block |
||
| 12649 | 12648 | || |
| 12650 | 12649 | $input_type === 'double' |
| 12651 | 12650 | ) { |
| 12652 | - return (string) $input; |
|
| 12651 | + return (string)$input; |
|
| 12653 | 12652 | } |
| 12654 | 12653 | |
| 12655 | 12654 | if ( |
@@ -12657,7 +12656,7 @@ discard block |
||
| 12657 | 12656 | && |
| 12658 | 12657 | \method_exists($input, '__toString') |
| 12659 | 12658 | ) { |
| 12660 | - return (string) $input; |
|
| 12659 | + return (string)$input; |
|
| 12661 | 12660 | } |
| 12662 | 12661 | |
| 12663 | 12662 | return null; |
@@ -12695,7 +12694,7 @@ discard block |
||
| 12695 | 12694 | } |
| 12696 | 12695 | |
| 12697 | 12696 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 12698 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 12697 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 12699 | 12698 | } |
| 12700 | 12699 | |
| 12701 | 12700 | if ($chars) { |
@@ -12744,15 +12743,15 @@ discard block |
||
| 12744 | 12743 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 12745 | 12744 | |
| 12746 | 12745 | if ($encoding === 'UTF-8') { |
| 12747 | - $str_part_two = (string) \mb_substr($str, 1); |
|
| 12746 | + $str_part_two = (string)\mb_substr($str, 1); |
|
| 12748 | 12747 | |
| 12749 | 12748 | if ($use_mb_functions) { |
| 12750 | 12749 | $str_part_one = \mb_strtoupper( |
| 12751 | - (string) \mb_substr($str, 0, 1) |
|
| 12750 | + (string)\mb_substr($str, 0, 1) |
|
| 12752 | 12751 | ); |
| 12753 | 12752 | } else { |
| 12754 | 12753 | $str_part_one = self::strtoupper( |
| 12755 | - (string) \mb_substr($str, 0, 1), |
|
| 12754 | + (string)\mb_substr($str, 0, 1), |
|
| 12756 | 12755 | $encoding, |
| 12757 | 12756 | false, |
| 12758 | 12757 | $lang, |
@@ -12762,16 +12761,16 @@ discard block |
||
| 12762 | 12761 | } else { |
| 12763 | 12762 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 12764 | 12763 | |
| 12765 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
| 12764 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
| 12766 | 12765 | |
| 12767 | 12766 | if ($use_mb_functions) { |
| 12768 | 12767 | $str_part_one = \mb_strtoupper( |
| 12769 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
| 12768 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
| 12770 | 12769 | $encoding |
| 12771 | 12770 | ); |
| 12772 | 12771 | } else { |
| 12773 | 12772 | $str_part_one = self::strtoupper( |
| 12774 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 12773 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 12775 | 12774 | $encoding, |
| 12776 | 12775 | false, |
| 12777 | 12776 | $lang, |
@@ -12780,7 +12779,7 @@ discard block |
||
| 12780 | 12779 | } |
| 12781 | 12780 | } |
| 12782 | 12781 | |
| 12783 | - return $str_part_one . $str_part_two; |
|
| 12782 | + return $str_part_one.$str_part_two; |
|
| 12784 | 12783 | } |
| 12785 | 12784 | |
| 12786 | 12785 | /** |
@@ -12839,7 +12838,7 @@ discard block |
||
| 12839 | 12838 | $str = self::clean($str); |
| 12840 | 12839 | } |
| 12841 | 12840 | |
| 12842 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
| 12841 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
| 12843 | 12842 | |
| 12844 | 12843 | if ( |
| 12845 | 12844 | $use_php_default_functions |
@@ -13252,7 +13251,7 @@ discard block |
||
| 13252 | 13251 | if ( |
| 13253 | 13252 | $keep_utf8_chars |
| 13254 | 13253 | && |
| 13255 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
| 13254 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
| 13256 | 13255 | ) { |
| 13257 | 13256 | return $str_backup; |
| 13258 | 13257 | } |
@@ -13339,17 +13338,17 @@ discard block |
||
| 13339 | 13338 | return ''; |
| 13340 | 13339 | } |
| 13341 | 13340 | |
| 13342 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
| 13341 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
| 13343 | 13342 | |
| 13344 | 13343 | if ( |
| 13345 | 13344 | !isset($matches[0]) |
| 13346 | 13345 | || |
| 13347 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
| 13346 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
| 13348 | 13347 | ) { |
| 13349 | 13348 | return $str; |
| 13350 | 13349 | } |
| 13351 | 13350 | |
| 13352 | - return \rtrim($matches[0]) . $str_add_on; |
|
| 13351 | + return \rtrim($matches[0]).$str_add_on; |
|
| 13353 | 13352 | } |
| 13354 | 13353 | |
| 13355 | 13354 | /** |
@@ -13442,7 +13441,7 @@ discard block |
||
| 13442 | 13441 | } |
| 13443 | 13442 | } |
| 13444 | 13443 | |
| 13445 | - return $str_return . \implode('', $charsArray); |
|
| 13444 | + return $str_return.\implode('', $charsArray); |
|
| 13446 | 13445 | } |
| 13447 | 13446 | |
| 13448 | 13447 | /** |
@@ -13496,7 +13495,7 @@ discard block |
||
| 13496 | 13495 | $final_break = ''; |
| 13497 | 13496 | } |
| 13498 | 13497 | |
| 13499 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
| 13498 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
| 13500 | 13499 | } |
| 13501 | 13500 | |
| 13502 | 13501 | /** |
@@ -13732,7 +13731,7 @@ discard block |
||
| 13732 | 13731 | /** @noinspection PhpIncludeInspection */ |
| 13733 | 13732 | /** @noinspection UsingInclusionReturnValueInspection */ |
| 13734 | 13733 | /** @psalm-suppress UnresolvableInclude */ |
| 13735 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
| 13734 | + return include __DIR__.'/data/'.$file.'.php'; |
|
| 13736 | 13735 | } |
| 13737 | 13736 | |
| 13738 | 13737 | /** |
@@ -13752,7 +13751,7 @@ discard block |
||
| 13752 | 13751 | */ |
| 13753 | 13752 | \uksort( |
| 13754 | 13753 | self::$EMOJI, |
| 13755 | - static function (string $a, string $b): int { |
|
| 13754 | + static function(string $a, string $b): int { |
|
| 13756 | 13755 | return \strlen($b) <=> \strlen($a); |
| 13757 | 13756 | } |
| 13758 | 13757 | ); |
@@ -13762,7 +13761,7 @@ discard block |
||
| 13762 | 13761 | |
| 13763 | 13762 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
| 13764 | 13763 | $tmp_key = \crc32($key); |
| 13765 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
| 13764 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
| 13766 | 13765 | } |
| 13767 | 13766 | |
| 13768 | 13767 | return true; |
@@ -13790,7 +13789,7 @@ discard block |
||
| 13790 | 13789 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 13791 | 13790 | return \defined('MB_OVERLOAD_STRING') |
| 13792 | 13791 | && |
| 13793 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 13792 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 13794 | 13793 | } |
| 13795 | 13794 | |
| 13796 | 13795 | /** |
@@ -13856,7 +13855,7 @@ discard block |
||
| 13856 | 13855 | */ |
| 13857 | 13856 | static $RX_CLASS_CACHE = []; |
| 13858 | 13857 | |
| 13859 | - $cache_key = $s . '_' . $class; |
|
| 13858 | + $cache_key = $s.'_'.$class; |
|
| 13860 | 13859 | |
| 13861 | 13860 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
| 13862 | 13861 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -13869,7 +13868,7 @@ discard block |
||
| 13869 | 13868 | /** @noinspection AlterInForeachInspection */ |
| 13870 | 13869 | foreach (self::str_split($s) as &$s) { |
| 13871 | 13870 | if ($s === '-') { |
| 13872 | - $class_array[0] = '-' . $class_array[0]; |
|
| 13871 | + $class_array[0] = '-'.$class_array[0]; |
|
| 13873 | 13872 | } elseif (!isset($s[2])) { |
| 13874 | 13873 | $class_array[0] .= \preg_quote($s, '/'); |
| 13875 | 13874 | } elseif (self::strlen($s) === 1) { |
@@ -13880,13 +13879,13 @@ discard block |
||
| 13880 | 13879 | } |
| 13881 | 13880 | |
| 13882 | 13881 | if ($class_array[0]) { |
| 13883 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
| 13882 | + $class_array[0] = '['.$class_array[0].']'; |
|
| 13884 | 13883 | } |
| 13885 | 13884 | |
| 13886 | 13885 | if (\count($class_array) === 1) { |
| 13887 | 13886 | $return = $class_array[0]; |
| 13888 | 13887 | } else { |
| 13889 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
| 13888 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
| 13890 | 13889 | } |
| 13891 | 13890 | |
| 13892 | 13891 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -13967,7 +13966,7 @@ discard block |
||
| 13967 | 13966 | |
| 13968 | 13967 | if ($delimiter === '-') { |
| 13969 | 13968 | /** @noinspection AlterInForeachInspection */ |
| 13970 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
| 13969 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
| 13971 | 13970 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
| 13972 | 13971 | $continue = true; |
| 13973 | 13972 | |
@@ -13977,7 +13976,7 @@ discard block |
||
| 13977 | 13976 | } |
| 13978 | 13977 | |
| 13979 | 13978 | /** @noinspection AlterInForeachInspection */ |
| 13980 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
| 13979 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
| 13981 | 13980 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
| 13982 | 13981 | $continue = true; |
| 13983 | 13982 | |
@@ -14047,8 +14046,8 @@ discard block |
||
| 14047 | 14046 | } else { |
| 14048 | 14047 | /** @noinspection OffsetOperationsInspection */ |
| 14049 | 14048 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
| 14050 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
| 14051 | - $buf .= $cc1 . $cc2; |
|
| 14049 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
| 14050 | + $buf .= $cc1.$cc2; |
|
| 14052 | 14051 | } |
| 14053 | 14052 | |
| 14054 | 14053 | return $buf; |
@@ -14067,7 +14066,7 @@ discard block |
||
| 14067 | 14066 | { |
| 14068 | 14067 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
| 14069 | 14068 | if (\preg_match($pattern, $str)) { |
| 14070 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
| 14069 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
| 14071 | 14070 | } |
| 14072 | 14071 | |
| 14073 | 14072 | return $str; |
@@ -2,14 +2,14 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | use voku\helper\UTF8; |
| 4 | 4 | |
| 5 | -require __DIR__ . '/../vendor/autoload.php'; |
|
| 5 | +require __DIR__.'/../vendor/autoload.php'; |
|
| 6 | 6 | |
| 7 | 7 | $factory = \phpDocumentor\Reflection\DocBlockFactory::createInstance(); |
| 8 | 8 | $reflection = new ReflectionClass(UTF8::class); |
| 9 | 9 | |
| 10 | 10 | // ------------------------------------- |
| 11 | 11 | |
| 12 | -$templateDocument = file_get_contents(__DIR__ . '/docs/base.md'); |
|
| 12 | +$templateDocument = file_get_contents(__DIR__.'/docs/base.md'); |
|
| 13 | 13 | |
| 14 | 14 | $templateMethodParam = <<<RAW |
| 15 | 15 | - %param% |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | $paramsTemplate = new TemplateFormatter($templateMethodParam); |
| 106 | 106 | $paramsTemplate->set('param', (string)$tagParam); |
| 107 | 107 | $params[] = $paramsTemplate->format(); |
| 108 | - $paramsTypes[] = $tagParam->getType() . ' ' . '$' . $tagParam->getVariableName(); |
|
| 108 | + $paramsTypes[] = $tagParam->getType().' '.'$'.$tagParam->getVariableName(); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | if (count($params) !== 0) { |
@@ -131,14 +131,14 @@ discard block |
||
| 131 | 131 | $methodTemplate->set('return', '__void__'); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - $methodWithType = $method->getShortName() . '(' . implode(', ', $paramsTypes) . '): ' . implode('|', $returnsTypes); |
|
| 134 | + $methodWithType = $method->getShortName().'('.implode(', ', $paramsTypes).'): '.implode('|', $returnsTypes); |
|
| 135 | 135 | |
| 136 | 136 | $methodTemplate->set('name', $methodWithType); |
| 137 | 137 | $methodTemplate->set('description', $doc->getDescription()); |
| 138 | 138 | $methodTemplate->set('code', '```php echo ```'); |
| 139 | 139 | |
| 140 | 140 | $methodIndexTemplate->set('title', $method->getShortName()); |
| 141 | - $methodIndexTemplate->set('href', '#' . UTF8::css_identifier($methodWithType)); |
|
| 141 | + $methodIndexTemplate->set('href', '#'.UTF8::css_identifier($methodWithType)); |
|
| 142 | 142 | |
| 143 | 143 | $functionsDocumentation[$method->getShortName()] = $methodTemplate->format(); |
| 144 | 144 | $functionsIndex[$method->getShortName()] = $methodIndexTemplate->format(); |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $indexStrResult .= '<tr>'; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - $indexStrResult .= '<td>' . sprintf("%s\n", $_template) . '</td>'; |
|
| 167 | + $indexStrResult .= '<td>'.sprintf("%s\n", $_template).'</td>'; |
|
| 168 | 168 | |
| 169 | 169 | if ($counterTmp === 4) { |
| 170 | 170 | $counterTmp = 0; |
@@ -176,10 +176,10 @@ discard block |
||
| 176 | 176 | } |
| 177 | 177 | $indexStrResult = ' |
| 178 | 178 | <table> |
| 179 | - ' . $indexStrResult . ' |
|
| 179 | + ' . $indexStrResult.' |
|
| 180 | 180 | </table> |
| 181 | 181 | '; |
| 182 | 182 | |
| 183 | 183 | $documentTemplate->set('__functions_index__', $indexStrResult); |
| 184 | 184 | |
| 185 | -file_put_contents(__DIR__ . '/README_TEST.md', $documentTemplate->format()); |
|
| 185 | +file_put_contents(__DIR__.'/README_TEST.md', $documentTemplate->format()); |
|