@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | return false; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - $uri = (string) $_SERVER['REQUEST_URI']; |
|
| 73 | + $uri = (string)$_SERVER['REQUEST_URI']; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | $uriOrig = $uri; |
@@ -87,27 +87,27 @@ discard block |
||
| 87 | 87 | // When not, assumes Windows-1252 and redirects to the corresponding UTF-8 encoded URL |
| 88 | 88 | // |
| 89 | 89 | |
| 90 | - $uri = (string) \preg_replace_callback( |
|
| 90 | + $uri = (string)\preg_replace_callback( |
|
| 91 | 91 | '/[\x80-\xFF]+/', |
| 92 | 92 | /** |
| 93 | 93 | * @param array $m |
| 94 | 94 | * |
| 95 | 95 | * @return string |
| 96 | 96 | */ |
| 97 | - static function (array $m): string { |
|
| 97 | + static function(array $m): string { |
|
| 98 | 98 | return \rawurlencode($m[0]); |
| 99 | 99 | }, |
| 100 | 100 | $uri |
| 101 | 101 | ); |
| 102 | 102 | |
| 103 | - $uri = (string) \preg_replace_callback( |
|
| 103 | + $uri = (string)\preg_replace_callback( |
|
| 104 | 104 | '/(?:%[89A-F][0-9A-F])+/i', |
| 105 | 105 | /** |
| 106 | 106 | * @param array $m |
| 107 | 107 | * |
| 108 | 108 | * @return string |
| 109 | 109 | */ |
| 110 | - static function (array $m): string { |
|
| 110 | + static function(array $m): string { |
|
| 111 | 111 | return \rawurlencode(UTF8::rawurldecode($m[0])); |
| 112 | 112 | }, |
| 113 | 113 | $uri |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | ) { |
| 123 | 123 | // Use ob_start() to buffer content and avoid problem of headers already sent... |
| 124 | 124 | $severProtocol = ($_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'); |
| 125 | - \header($severProtocol . ' 301 Moved Permanently'); |
|
| 126 | - \header('Location: ' . $uri); |
|
| 125 | + \header($severProtocol.' 301 Moved Permanently'); |
|
| 126 | + \header('Location: '.$uri); |
|
| 127 | 127 | exit(); |
| 128 | 128 | } |
| 129 | 129 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | return false; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - $length = (int) $length; |
|
| 163 | + $length = (int)$length; |
|
| 164 | 164 | |
| 165 | 165 | if ($length <= 0) { |
| 166 | 166 | return false; |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | { |
| 192 | 192 | static $_IS_PHP; |
| 193 | 193 | |
| 194 | - $version = (string) $version; |
|
| 194 | + $version = (string)$version; |
|
| 195 | 195 | |
| 196 | 196 | if (!isset($_IS_PHP[$version])) { |
| 197 | 197 | $_IS_PHP[$version] = \version_compare(\PHP_VERSION, $version, '>='); |
@@ -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 | ]; |
@@ -602,22 +602,22 @@ discard block |
||
| 602 | 602 | * @psalm-suppress PossiblyNullArrayAccess |
| 603 | 603 | */ |
| 604 | 604 | $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
| 605 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 605 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 606 | 606 | } elseif ($code_point <= 0xFFFF) { |
| 607 | 607 | /** |
| 608 | 608 | * @psalm-suppress PossiblyNullArrayAccess |
| 609 | 609 | */ |
| 610 | 610 | $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
| 611 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 612 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 611 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 612 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 613 | 613 | } else { |
| 614 | 614 | /** |
| 615 | 615 | * @psalm-suppress PossiblyNullArrayAccess |
| 616 | 616 | */ |
| 617 | 617 | $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
| 618 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 619 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 620 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 618 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 619 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 620 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | if ($encoding !== 'UTF-8') { |
@@ -5804,8 +5804,8 @@ discard block |
||
| 5804 | 5804 | |
| 5805 | 5805 | /** @noinspection UnnecessaryCastingInspection */ |
| 5806 | 5806 | return (string) \mb_substr($str, 0, $index) . |
| 5807 | - $substring . |
|
| 5808 | - (string) \mb_substr($str, $index, $len); |
|
| 5807 | + $substring . |
|
| 5808 | + (string) \mb_substr($str, $index, $len); |
|
| 5809 | 5809 | } |
| 5810 | 5810 | |
| 5811 | 5811 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -5816,8 +5816,8 @@ discard block |
||
| 5816 | 5816 | } |
| 5817 | 5817 | |
| 5818 | 5818 | return ((string) self::substr($str, 0, $index, $encoding)) . |
| 5819 | - $substring . |
|
| 5820 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
| 5819 | + $substring . |
|
| 5820 | + ((string) self::substr($str, $index, $len, $encoding)); |
|
| 5821 | 5821 | } |
| 5822 | 5822 | |
| 5823 | 5823 | /** |
@@ -7757,11 +7757,11 @@ discard block |
||
| 7757 | 7757 | if ($useMbFunction === true) { |
| 7758 | 7758 | if ($encoding === 'UTF-8') { |
| 7759 | 7759 | return \mb_strtoupper(\mb_substr($match[0], 0, 1)) |
| 7760 | - . \mb_strtolower(\mb_substr($match[0], 1)); |
|
| 7760 | + . \mb_strtolower(\mb_substr($match[0], 1)); |
|
| 7761 | 7761 | } |
| 7762 | 7762 | |
| 7763 | 7763 | return \mb_strtoupper(\mb_substr($match[0], 0, 1, $encoding), $encoding) |
| 7764 | - . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
| 7764 | + . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
| 7765 | 7765 | } |
| 7766 | 7766 | |
| 7767 | 7767 | return self::ucfirst( |
@@ -8118,13 +8118,13 @@ discard block |
||
| 8118 | 8118 | } |
| 8119 | 8119 | |
| 8120 | 8120 | return ( |
| 8121 | - (string) self::substr( |
|
| 8122 | - $str, |
|
| 8123 | - 0, |
|
| 8124 | - $length, |
|
| 8125 | - $encoding |
|
| 8126 | - ) |
|
| 8127 | - ) . $substring; |
|
| 8121 | + (string) self::substr( |
|
| 8122 | + $str, |
|
| 8123 | + 0, |
|
| 8124 | + $length, |
|
| 8125 | + $encoding |
|
| 8126 | + ) |
|
| 8127 | + ) . $substring; |
|
| 8128 | 8128 | } |
| 8129 | 8129 | |
| 8130 | 8130 | /** |
@@ -10864,8 +10864,8 @@ discard block |
||
| 10864 | 10864 | |
| 10865 | 10865 | /** @noinspection AdditionOperationOnArraysInspection */ |
| 10866 | 10866 | return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
| 10867 | - $replacement . |
|
| 10868 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 10867 | + $replacement . |
|
| 10868 | + ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 10869 | 10869 | } |
| 10870 | 10870 | |
| 10871 | 10871 | // |
@@ -233,10 +233,10 @@ discard block |
||
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | if ($encoding === 'UTF-8') { |
| 236 | - return (string) \mb_substr($str, $pos, 1); |
|
| 236 | + return (string)\mb_substr($str, $pos, 1); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
| 239 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /** |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | public static function add_bom_to_string(string $str): string |
| 252 | 252 | { |
| 253 | 253 | if (self::string_has_bom($str) === false) { |
| 254 | - $str = self::bom() . $str; |
|
| 254 | + $str = self::bom().$str; |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | return $str; |
@@ -280,8 +280,8 @@ discard block |
||
| 280 | 280 | $return = []; |
| 281 | 281 | foreach ($array as $key => &$value) { |
| 282 | 282 | $key = $case === \CASE_LOWER |
| 283 | - ? self::strtolower((string) $key, $encoding) |
|
| 284 | - : self::strtoupper((string) $key, $encoding); |
|
| 283 | + ? self::strtolower((string)$key, $encoding) |
|
| 284 | + : self::strtoupper((string)$key, $encoding); |
|
| 285 | 285 | |
| 286 | 286 | $return[$key] = $value; |
| 287 | 287 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | return ''; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - $substrIndex = $posStart + (int) \mb_strlen($start); |
|
| 318 | + $substrIndex = $posStart + (int)\mb_strlen($start); |
|
| 319 | 319 | $posEnd = \mb_strpos($str, $end, $substrIndex); |
| 320 | 320 | if ( |
| 321 | 321 | $posEnd === false |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | return ''; |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | - return (string) \mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
| 328 | + return (string)\mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | return ''; |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - $substrIndex = $posStart + (int) self::strlen($start, $encoding); |
|
| 338 | + $substrIndex = $posStart + (int)self::strlen($start, $encoding); |
|
| 339 | 339 | $posEnd = self::strpos($str, $end, $substrIndex, $encoding); |
| 340 | 340 | if ( |
| 341 | 341 | $posEnd === false |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | return ''; |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | - return (string) self::substr( |
|
| 348 | + return (string)self::substr( |
|
| 349 | 349 | $str, |
| 350 | 350 | $substrIndex, |
| 351 | 351 | $posEnd - $substrIndex, |
@@ -413,10 +413,10 @@ discard block |
||
| 413 | 413 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
| 414 | 414 | { |
| 415 | 415 | if ($encoding === 'UTF-8') { |
| 416 | - return (string) \mb_substr($str, $index, 1); |
|
| 416 | + return (string)\mb_substr($str, $index, 1); |
|
| 417 | 417 | } |
| 418 | 418 | |
| 419 | - return (string) self::substr($str, $index, 1, $encoding); |
|
| 419 | + return (string)self::substr($str, $index, 1, $encoding); |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | /** |
@@ -515,10 +515,10 @@ discard block |
||
| 515 | 515 | && |
| 516 | 516 | self::$SUPPORT['mbstring'] === false |
| 517 | 517 | ) { |
| 518 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 518 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 519 | 519 | } |
| 520 | 520 | |
| 521 | - $cacheKey = $code_point . $encoding; |
|
| 521 | + $cacheKey = $code_point.$encoding; |
|
| 522 | 522 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
| 523 | 523 | return $CHAR_CACHE[$cacheKey]; |
| 524 | 524 | } |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | self::$CHR = self::getData('chr'); |
| 565 | 565 | } |
| 566 | 566 | |
| 567 | - $code_point = (int) $code_point; |
|
| 567 | + $code_point = (int)$code_point; |
|
| 568 | 568 | if ($code_point <= 0x7F) { |
| 569 | 569 | /** |
| 570 | 570 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -574,22 +574,22 @@ discard block |
||
| 574 | 574 | /** |
| 575 | 575 | * @psalm-suppress PossiblyNullArrayAccess |
| 576 | 576 | */ |
| 577 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
| 577 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
| 578 | 578 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 579 | 579 | } elseif ($code_point <= 0xFFFF) { |
| 580 | 580 | /** |
| 581 | 581 | * @psalm-suppress PossiblyNullArrayAccess |
| 582 | 582 | */ |
| 583 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
| 584 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 583 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
| 584 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 585 | 585 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 586 | 586 | } else { |
| 587 | 587 | /** |
| 588 | 588 | * @psalm-suppress PossiblyNullArrayAccess |
| 589 | 589 | */ |
| 590 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
| 591 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 592 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 590 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
| 591 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
| 592 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 593 | 593 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 594 | 594 | } |
| 595 | 595 | |
@@ -636,7 +636,7 @@ discard block |
||
| 636 | 636 | |
| 637 | 637 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
| 638 | 638 | return \array_map( |
| 639 | - static function (string $data): int { |
|
| 639 | + static function(string $data): int { |
|
| 640 | 640 | // "mb_" is available if overload is used, so use it ... |
| 641 | 641 | return \mb_strlen($data, 'CP850'); // 8-BIT |
| 642 | 642 | }, |
@@ -704,7 +704,7 @@ discard block |
||
| 704 | 704 | $char = ''; |
| 705 | 705 | } |
| 706 | 706 | |
| 707 | - return self::int_to_hex(self::ord((string) $char), $pfix); |
|
| 707 | + return self::int_to_hex(self::ord((string)$char), $pfix); |
|
| 708 | 708 | } |
| 709 | 709 | |
| 710 | 710 | /** |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
| 780 | 780 | /x'; |
| 781 | 781 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
| 782 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
| 782 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
| 783 | 783 | |
| 784 | 784 | if ($replace_diamond_question_mark === true) { |
| 785 | 785 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -814,7 +814,7 @@ discard block |
||
| 814 | 814 | public static function cleanup($str): string |
| 815 | 815 | { |
| 816 | 816 | // init |
| 817 | - $str = (string) $str; |
|
| 817 | + $str = (string)$str; |
|
| 818 | 818 | |
| 819 | 819 | if ($str === '') { |
| 820 | 820 | return ''; |
@@ -897,7 +897,7 @@ discard block |
||
| 897 | 897 | { |
| 898 | 898 | if (self::$SUPPORT['mbstring'] === true) { |
| 899 | 899 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 900 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 900 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 901 | 901 | } |
| 902 | 902 | |
| 903 | 903 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -937,7 +937,7 @@ discard block |
||
| 937 | 937 | */ |
| 938 | 938 | public static function css_stripe_media_queries(string $str): string |
| 939 | 939 | { |
| 940 | - return (string) \preg_replace( |
|
| 940 | + return (string)\preg_replace( |
|
| 941 | 941 | '#@media\\s+(?:only\\s)?(?:[\\s{\\(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
| 942 | 942 | '', |
| 943 | 943 | $str |
@@ -964,7 +964,7 @@ discard block |
||
| 964 | 964 | */ |
| 965 | 965 | public static function decimal_to_chr($int): string |
| 966 | 966 | { |
| 967 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
| 967 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
| 968 | 968 | } |
| 969 | 969 | |
| 970 | 970 | /** |
@@ -1009,16 +1009,16 @@ discard block |
||
| 1009 | 1009 | self::initEmojiData(); |
| 1010 | 1010 | |
| 1011 | 1011 | if ($useReversibleStringMapping === true) { |
| 1012 | - return (string) \str_replace( |
|
| 1013 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1014 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1012 | + return (string)\str_replace( |
|
| 1013 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1014 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1015 | 1015 | $str |
| 1016 | 1016 | ); |
| 1017 | 1017 | } |
| 1018 | 1018 | |
| 1019 | - return (string) \str_replace( |
|
| 1020 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 1021 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1019 | + return (string)\str_replace( |
|
| 1020 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 1021 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1022 | 1022 | $str |
| 1023 | 1023 | ); |
| 1024 | 1024 | } |
@@ -1038,16 +1038,16 @@ discard block |
||
| 1038 | 1038 | self::initEmojiData(); |
| 1039 | 1039 | |
| 1040 | 1040 | if ($useReversibleStringMapping === true) { |
| 1041 | - return (string) \str_replace( |
|
| 1042 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1043 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1041 | + return (string)\str_replace( |
|
| 1042 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1043 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1044 | 1044 | $str |
| 1045 | 1045 | ); |
| 1046 | 1046 | } |
| 1047 | 1047 | |
| 1048 | - return (string) \str_replace( |
|
| 1049 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1050 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 1048 | + return (string)\str_replace( |
|
| 1049 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1050 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 1051 | 1051 | $str |
| 1052 | 1052 | ); |
| 1053 | 1053 | } |
@@ -1101,7 +1101,7 @@ discard block |
||
| 1101 | 1101 | if ($toEncoding === 'JSON') { |
| 1102 | 1102 | $return = self::json_encode($str); |
| 1103 | 1103 | if ($return === false) { |
| 1104 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
| 1104 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
| 1105 | 1105 | } |
| 1106 | 1106 | |
| 1107 | 1107 | return $return; |
@@ -1187,7 +1187,7 @@ discard block |
||
| 1187 | 1187 | && |
| 1188 | 1188 | self::$SUPPORT['mbstring'] === false |
| 1189 | 1189 | ) { |
| 1190 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $toEncoding . '" encoding', \E_USER_WARNING); |
|
| 1190 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$toEncoding.'" encoding', \E_USER_WARNING); |
|
| 1191 | 1191 | } |
| 1192 | 1192 | |
| 1193 | 1193 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1281,31 +1281,31 @@ discard block |
||
| 1281 | 1281 | $trimChars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
| 1282 | 1282 | |
| 1283 | 1283 | if ($length === null) { |
| 1284 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
| 1284 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
| 1285 | 1285 | } |
| 1286 | 1286 | |
| 1287 | 1287 | if ($search === '') { |
| 1288 | 1288 | if ($encoding === 'UTF-8') { |
| 1289 | 1289 | if ($length > 0) { |
| 1290 | - $stringLength = (int) \mb_strlen($str); |
|
| 1290 | + $stringLength = (int)\mb_strlen($str); |
|
| 1291 | 1291 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
| 1292 | 1292 | } else { |
| 1293 | 1293 | $end = 0; |
| 1294 | 1294 | } |
| 1295 | 1295 | |
| 1296 | - $pos = (int) \min( |
|
| 1296 | + $pos = (int)\min( |
|
| 1297 | 1297 | \mb_strpos($str, ' ', $end), |
| 1298 | 1298 | \mb_strpos($str, '.', $end) |
| 1299 | 1299 | ); |
| 1300 | 1300 | } else { |
| 1301 | 1301 | if ($length > 0) { |
| 1302 | - $stringLength = (int) self::strlen($str, $encoding); |
|
| 1302 | + $stringLength = (int)self::strlen($str, $encoding); |
|
| 1303 | 1303 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
| 1304 | 1304 | } else { |
| 1305 | 1305 | $end = 0; |
| 1306 | 1306 | } |
| 1307 | 1307 | |
| 1308 | - $pos = (int) \min( |
|
| 1308 | + $pos = (int)\min( |
|
| 1309 | 1309 | self::strpos($str, ' ', $end, $encoding), |
| 1310 | 1310 | self::strpos($str, '.', $end, $encoding) |
| 1311 | 1311 | ); |
@@ -1322,18 +1322,18 @@ discard block |
||
| 1322 | 1322 | return ''; |
| 1323 | 1323 | } |
| 1324 | 1324 | |
| 1325 | - return \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
| 1325 | + return \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
| 1326 | 1326 | } |
| 1327 | 1327 | |
| 1328 | 1328 | return $str; |
| 1329 | 1329 | } |
| 1330 | 1330 | |
| 1331 | 1331 | if ($encoding === 'UTF-8') { |
| 1332 | - $wordPos = (int) \mb_stripos($str, $search); |
|
| 1333 | - $halfSide = (int) ($wordPos - $length / 2 + (int) \mb_strlen($search) / 2); |
|
| 1332 | + $wordPos = (int)\mb_stripos($str, $search); |
|
| 1333 | + $halfSide = (int)($wordPos - $length / 2 + (int)\mb_strlen($search) / 2); |
|
| 1334 | 1334 | } else { |
| 1335 | - $wordPos = (int) self::stripos($str, $search, 0, $encoding); |
|
| 1336 | - $halfSide = (int) ($wordPos - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
| 1335 | + $wordPos = (int)self::stripos($str, $search, 0, $encoding); |
|
| 1336 | + $halfSide = (int)($wordPos - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
| 1337 | 1337 | } |
| 1338 | 1338 | |
| 1339 | 1339 | $pos_start = 0; |
@@ -1345,12 +1345,12 @@ discard block |
||
| 1345 | 1345 | } |
| 1346 | 1346 | if ($halfText !== false) { |
| 1347 | 1347 | if ($encoding === 'UTF-8') { |
| 1348 | - $pos_start = (int) \max( |
|
| 1348 | + $pos_start = (int)\max( |
|
| 1349 | 1349 | \mb_strrpos($halfText, ' '), |
| 1350 | 1350 | \mb_strrpos($halfText, '.') |
| 1351 | 1351 | ); |
| 1352 | 1352 | } else { |
| 1353 | - $pos_start = (int) \max( |
|
| 1353 | + $pos_start = (int)\max( |
|
| 1354 | 1354 | self::strrpos($halfText, ' ', 0, $encoding), |
| 1355 | 1355 | self::strrpos($halfText, '.', 0, $encoding) |
| 1356 | 1356 | ); |
@@ -1360,19 +1360,19 @@ discard block |
||
| 1360 | 1360 | |
| 1361 | 1361 | if ($wordPos && $halfSide > 0) { |
| 1362 | 1362 | $offset = $pos_start + $length - 1; |
| 1363 | - $realLength = (int) self::strlen($str, $encoding); |
|
| 1363 | + $realLength = (int)self::strlen($str, $encoding); |
|
| 1364 | 1364 | |
| 1365 | 1365 | if ($offset > $realLength) { |
| 1366 | 1366 | $offset = $realLength; |
| 1367 | 1367 | } |
| 1368 | 1368 | |
| 1369 | 1369 | if ($encoding === 'UTF-8') { |
| 1370 | - $pos_end = (int) \min( |
|
| 1370 | + $pos_end = (int)\min( |
|
| 1371 | 1371 | \mb_strpos($str, ' ', $offset), |
| 1372 | 1372 | \mb_strpos($str, '.', $offset) |
| 1373 | 1373 | ) - $pos_start; |
| 1374 | 1374 | } else { |
| 1375 | - $pos_end = (int) \min( |
|
| 1375 | + $pos_end = (int)\min( |
|
| 1376 | 1376 | self::strpos($str, ' ', $offset, $encoding), |
| 1377 | 1377 | self::strpos($str, '.', $offset, $encoding) |
| 1378 | 1378 | ) - $pos_start; |
@@ -1380,12 +1380,12 @@ discard block |
||
| 1380 | 1380 | |
| 1381 | 1381 | if (!$pos_end || $pos_end <= 0) { |
| 1382 | 1382 | if ($encoding === 'UTF-8') { |
| 1383 | - $strSub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
| 1383 | + $strSub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
| 1384 | 1384 | } else { |
| 1385 | - $strSub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
| 1385 | + $strSub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
| 1386 | 1386 | } |
| 1387 | 1387 | if ($strSub !== false) { |
| 1388 | - $extract = $replacerForSkippedText . \ltrim($strSub, $trimChars); |
|
| 1388 | + $extract = $replacerForSkippedText.\ltrim($strSub, $trimChars); |
|
| 1389 | 1389 | } else { |
| 1390 | 1390 | $extract = ''; |
| 1391 | 1391 | } |
@@ -1396,26 +1396,26 @@ discard block |
||
| 1396 | 1396 | $strSub = self::substr($str, $pos_start, $pos_end, $encoding); |
| 1397 | 1397 | } |
| 1398 | 1398 | if ($strSub !== false) { |
| 1399 | - $extract = $replacerForSkippedText . \trim($strSub, $trimChars) . $replacerForSkippedText; |
|
| 1399 | + $extract = $replacerForSkippedText.\trim($strSub, $trimChars).$replacerForSkippedText; |
|
| 1400 | 1400 | } else { |
| 1401 | 1401 | $extract = ''; |
| 1402 | 1402 | } |
| 1403 | 1403 | } |
| 1404 | 1404 | } else { |
| 1405 | 1405 | $offset = $length - 1; |
| 1406 | - $trueLength = (int) self::strlen($str, $encoding); |
|
| 1406 | + $trueLength = (int)self::strlen($str, $encoding); |
|
| 1407 | 1407 | |
| 1408 | 1408 | if ($offset > $trueLength) { |
| 1409 | 1409 | $offset = $trueLength; |
| 1410 | 1410 | } |
| 1411 | 1411 | |
| 1412 | 1412 | if ($encoding === 'UTF-8') { |
| 1413 | - $pos_end = (int) \min( |
|
| 1413 | + $pos_end = (int)\min( |
|
| 1414 | 1414 | \mb_strpos($str, ' ', $offset), |
| 1415 | 1415 | \mb_strpos($str, '.', $offset) |
| 1416 | 1416 | ); |
| 1417 | 1417 | } else { |
| 1418 | - $pos_end = (int) \min( |
|
| 1418 | + $pos_end = (int)\min( |
|
| 1419 | 1419 | self::strpos($str, ' ', $offset, $encoding), |
| 1420 | 1420 | self::strpos($str, '.', $offset, $encoding) |
| 1421 | 1421 | ); |
@@ -1428,7 +1428,7 @@ discard block |
||
| 1428 | 1428 | $strSub = self::substr($str, 0, $pos_end, $encoding); |
| 1429 | 1429 | } |
| 1430 | 1430 | if ($strSub !== false) { |
| 1431 | - $extract = \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
| 1431 | + $extract = \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
| 1432 | 1432 | } else { |
| 1433 | 1433 | $extract = ''; |
| 1434 | 1434 | } |
@@ -1549,7 +1549,7 @@ discard block |
||
| 1549 | 1549 | { |
| 1550 | 1550 | $file_content = \file_get_contents($file_path); |
| 1551 | 1551 | if ($file_content === false) { |
| 1552 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
| 1552 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
| 1553 | 1553 | } |
| 1554 | 1554 | |
| 1555 | 1555 | return self::string_has_bom($file_content); |
@@ -1615,7 +1615,7 @@ discard block |
||
| 1615 | 1615 | ) { |
| 1616 | 1616 | // Prevent leading combining chars |
| 1617 | 1617 | // for NFC-safe concatenations. |
| 1618 | - $var = $leading_combining . $var; |
|
| 1618 | + $var = $leading_combining.$var; |
|
| 1619 | 1619 | } |
| 1620 | 1620 | } |
| 1621 | 1621 | |
@@ -1854,10 +1854,10 @@ discard block |
||
| 1854 | 1854 | } |
| 1855 | 1855 | |
| 1856 | 1856 | if ($encoding === 'UTF-8') { |
| 1857 | - return (string) \mb_substr($str, 0, $n); |
|
| 1857 | + return (string)\mb_substr($str, 0, $n); |
|
| 1858 | 1858 | } |
| 1859 | 1859 | |
| 1860 | - return (string) self::substr($str, 0, $n, $encoding); |
|
| 1860 | + return (string)self::substr($str, 0, $n, $encoding); |
|
| 1861 | 1861 | } |
| 1862 | 1862 | |
| 1863 | 1863 | /** |
@@ -1932,7 +1932,7 @@ discard block |
||
| 1932 | 1932 | return $str; |
| 1933 | 1933 | } |
| 1934 | 1934 | |
| 1935 | - $str = (string) $str; |
|
| 1935 | + $str = (string)$str; |
|
| 1936 | 1936 | $last = ''; |
| 1937 | 1937 | while ($last !== $str) { |
| 1938 | 1938 | $last = $str; |
@@ -2124,7 +2124,7 @@ discard block |
||
| 2124 | 2124 | return $fallback; |
| 2125 | 2125 | } |
| 2126 | 2126 | /** @noinspection OffsetOperationsInspection */ |
| 2127 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
| 2127 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
| 2128 | 2128 | |
| 2129 | 2129 | // DEBUG |
| 2130 | 2130 | //var_dump($type_code); |
@@ -2179,7 +2179,7 @@ discard block |
||
| 2179 | 2179 | // |
| 2180 | 2180 | |
| 2181 | 2181 | if ($encoding === 'UTF-8') { |
| 2182 | - $maxlength = (int) \mb_strlen($possibleChars); |
|
| 2182 | + $maxlength = (int)\mb_strlen($possibleChars); |
|
| 2183 | 2183 | if ($maxlength === 0) { |
| 2184 | 2184 | return ''; |
| 2185 | 2185 | } |
@@ -2200,7 +2200,7 @@ discard block |
||
| 2200 | 2200 | } else { |
| 2201 | 2201 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 2202 | 2202 | |
| 2203 | - $maxlength = (int) self::strlen($possibleChars, $encoding); |
|
| 2203 | + $maxlength = (int)self::strlen($possibleChars, $encoding); |
|
| 2204 | 2204 | if ($maxlength === 0) { |
| 2205 | 2205 | return ''; |
| 2206 | 2206 | } |
@@ -2231,16 +2231,16 @@ discard block |
||
| 2231 | 2231 | */ |
| 2232 | 2232 | public static function get_unique_string($entropyExtra = '', bool $md5 = true): string |
| 2233 | 2233 | { |
| 2234 | - $uniqueHelper = \random_int(0, \mt_getrandmax()) . |
|
| 2235 | - \session_id() . |
|
| 2236 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
| 2237 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
| 2234 | + $uniqueHelper = \random_int(0, \mt_getrandmax()). |
|
| 2235 | + \session_id(). |
|
| 2236 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
| 2237 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
| 2238 | 2238 | $entropyExtra; |
| 2239 | 2239 | |
| 2240 | 2240 | $uniqueString = \uniqid($uniqueHelper, true); |
| 2241 | 2241 | |
| 2242 | 2242 | if ($md5) { |
| 2243 | - $uniqueString = \md5($uniqueString . $uniqueHelper); |
|
| 2243 | + $uniqueString = \md5($uniqueString.$uniqueHelper); |
|
| 2244 | 2244 | } |
| 2245 | 2245 | |
| 2246 | 2246 | return $uniqueString; |
@@ -2319,7 +2319,7 @@ discard block |
||
| 2319 | 2319 | public static function hex_to_int($hexDec) |
| 2320 | 2320 | { |
| 2321 | 2321 | // init |
| 2322 | - $hexDec = (string) $hexDec; |
|
| 2322 | + $hexDec = (string)$hexDec; |
|
| 2323 | 2323 | |
| 2324 | 2324 | if ($hexDec === '') { |
| 2325 | 2325 | return false; |
@@ -2397,7 +2397,7 @@ discard block |
||
| 2397 | 2397 | return \implode( |
| 2398 | 2398 | '', |
| 2399 | 2399 | \array_map( |
| 2400 | - static function (string $chr) use ($keepAsciiChars, $encoding): string { |
|
| 2400 | + static function(string $chr) use ($keepAsciiChars, $encoding): string { |
|
| 2401 | 2401 | return self::single_chr_html_encode($chr, $keepAsciiChars, $encoding); |
| 2402 | 2402 | }, |
| 2403 | 2403 | self::str_split($str) |
@@ -2501,7 +2501,7 @@ discard block |
||
| 2501 | 2501 | && |
| 2502 | 2502 | self::$SUPPORT['mbstring'] === false |
| 2503 | 2503 | ) { |
| 2504 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 2504 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 2505 | 2505 | } |
| 2506 | 2506 | |
| 2507 | 2507 | do { |
@@ -2522,14 +2522,14 @@ discard block |
||
| 2522 | 2522 | ); |
| 2523 | 2523 | } |
| 2524 | 2524 | } else { |
| 2525 | - $str = (string) \preg_replace_callback( |
|
| 2525 | + $str = (string)\preg_replace_callback( |
|
| 2526 | 2526 | "/&#\d{2,6};/", |
| 2527 | 2527 | /** |
| 2528 | 2528 | * @param string[] $matches |
| 2529 | 2529 | * |
| 2530 | 2530 | * @return string |
| 2531 | 2531 | */ |
| 2532 | - static function (array $matches) use ($encoding): string { |
|
| 2532 | + static function(array $matches) use ($encoding): string { |
|
| 2533 | 2533 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
| 2534 | 2534 | if ($returnTmp !== '"' && $returnTmp !== "'") { |
| 2535 | 2535 | return $returnTmp; |
@@ -2544,7 +2544,7 @@ discard block |
||
| 2544 | 2544 | if (\strpos($str, '&') !== false) { |
| 2545 | 2545 | if (\strpos($str, '&#') !== false) { |
| 2546 | 2546 | // decode also numeric & UTF16 two byte entities |
| 2547 | - $str = (string) \preg_replace( |
|
| 2547 | + $str = (string)\preg_replace( |
|
| 2548 | 2548 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
| 2549 | 2549 | '$1;', |
| 2550 | 2550 | $str |
@@ -2590,7 +2590,7 @@ discard block |
||
| 2590 | 2590 | */ |
| 2591 | 2591 | public static function html_stripe_empty_tags(string $str): string |
| 2592 | 2592 | { |
| 2593 | - return (string) \preg_replace( |
|
| 2593 | + return (string)\preg_replace( |
|
| 2594 | 2594 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
| 2595 | 2595 | '', |
| 2596 | 2596 | $str |
@@ -2889,9 +2889,9 @@ discard block |
||
| 2889 | 2889 | { |
| 2890 | 2890 | $hex = \dechex($int); |
| 2891 | 2891 | |
| 2892 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
| 2892 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
| 2893 | 2893 | |
| 2894 | - return $pfix . $hex . ''; |
|
| 2894 | + return $pfix.$hex.''; |
|
| 2895 | 2895 | } |
| 2896 | 2896 | |
| 2897 | 2897 | /** |
@@ -3145,7 +3145,7 @@ discard block |
||
| 3145 | 3145 | */ |
| 3146 | 3146 | public static function is_binary($input, bool $strict = false): bool |
| 3147 | 3147 | { |
| 3148 | - $input = (string) $input; |
|
| 3148 | + $input = (string)$input; |
|
| 3149 | 3149 | if ($input === '') { |
| 3150 | 3150 | return false; |
| 3151 | 3151 | } |
@@ -3406,7 +3406,7 @@ discard block |
||
| 3406 | 3406 | public static function is_utf16($str, $checkIfStringIsBinary = true) |
| 3407 | 3407 | { |
| 3408 | 3408 | // init |
| 3409 | - $str = (string) $str; |
|
| 3409 | + $str = (string)$str; |
|
| 3410 | 3410 | $strChars = []; |
| 3411 | 3411 | |
| 3412 | 3412 | if ( |
@@ -3484,7 +3484,7 @@ discard block |
||
| 3484 | 3484 | public static function is_utf32($str, $checkIfStringIsBinary = true) |
| 3485 | 3485 | { |
| 3486 | 3486 | // init |
| 3487 | - $str = (string) $str; |
|
| 3487 | + $str = (string)$str; |
|
| 3488 | 3488 | $strChars = []; |
| 3489 | 3489 | |
| 3490 | 3490 | if ( |
@@ -3568,7 +3568,7 @@ discard block |
||
| 3568 | 3568 | return true; |
| 3569 | 3569 | } |
| 3570 | 3570 | |
| 3571 | - return self::is_utf8_string((string) $str, $strict); |
|
| 3571 | + return self::is_utf8_string((string)$str, $strict); |
|
| 3572 | 3572 | } |
| 3573 | 3573 | |
| 3574 | 3574 | /** |
@@ -3708,15 +3708,15 @@ discard block |
||
| 3708 | 3708 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
| 3709 | 3709 | |
| 3710 | 3710 | if ($encoding === 'UTF-8') { |
| 3711 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
| 3711 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
| 3712 | 3712 | |
| 3713 | 3713 | if ($useMbFunction === true) { |
| 3714 | 3714 | $strPartOne = \mb_strtolower( |
| 3715 | - (string) \mb_substr($str, 0, 1) |
|
| 3715 | + (string)\mb_substr($str, 0, 1) |
|
| 3716 | 3716 | ); |
| 3717 | 3717 | } else { |
| 3718 | 3718 | $strPartOne = self::strtolower( |
| 3719 | - (string) \mb_substr($str, 0, 1), |
|
| 3719 | + (string)\mb_substr($str, 0, 1), |
|
| 3720 | 3720 | $encoding, |
| 3721 | 3721 | false, |
| 3722 | 3722 | $lang, |
@@ -3726,10 +3726,10 @@ discard block |
||
| 3726 | 3726 | } else { |
| 3727 | 3727 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 3728 | 3728 | |
| 3729 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
| 3729 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
| 3730 | 3730 | |
| 3731 | 3731 | $strPartOne = self::strtolower( |
| 3732 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 3732 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 3733 | 3733 | $encoding, |
| 3734 | 3734 | false, |
| 3735 | 3735 | $lang, |
@@ -3737,7 +3737,7 @@ discard block |
||
| 3737 | 3737 | ); |
| 3738 | 3738 | } |
| 3739 | 3739 | |
| 3740 | - return $strPartOne . $strPartTwo; |
|
| 3740 | + return $strPartOne.$strPartTwo; |
|
| 3741 | 3741 | } |
| 3742 | 3742 | |
| 3743 | 3743 | /** |
@@ -3856,7 +3856,7 @@ discard block |
||
| 3856 | 3856 | |
| 3857 | 3857 | if (self::$SUPPORT['mbstring'] === true) { |
| 3858 | 3858 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 3859 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 3859 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 3860 | 3860 | } |
| 3861 | 3861 | |
| 3862 | 3862 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -3897,7 +3897,7 @@ discard block |
||
| 3897 | 3897 | { |
| 3898 | 3898 | $bytes = self::chr_size_list($str); |
| 3899 | 3899 | if (\count($bytes) > 0) { |
| 3900 | - return (int) \max($bytes); |
|
| 3900 | + return (int)\max($bytes); |
|
| 3901 | 3901 | } |
| 3902 | 3902 | |
| 3903 | 3903 | return 0; |
@@ -3966,7 +3966,7 @@ discard block |
||
| 3966 | 3966 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
| 3967 | 3967 | |
| 3968 | 3968 | // init |
| 3969 | - $encoding = (string) $encoding; |
|
| 3969 | + $encoding = (string)$encoding; |
|
| 3970 | 3970 | |
| 3971 | 3971 | if (!$encoding) { |
| 3972 | 3972 | return $fallback; |
@@ -4020,7 +4020,7 @@ discard block |
||
| 4020 | 4020 | |
| 4021 | 4021 | $encodingOrig = $encoding; |
| 4022 | 4022 | $encoding = \strtoupper($encoding); |
| 4023 | - $encodingUpperHelper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
| 4023 | + $encodingUpperHelper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
| 4024 | 4024 | |
| 4025 | 4025 | $equivalences = [ |
| 4026 | 4026 | 'ISO8859' => 'ISO-8859-1', |
@@ -4160,13 +4160,13 @@ discard block |
||
| 4160 | 4160 | static $CHAR_CACHE = []; |
| 4161 | 4161 | |
| 4162 | 4162 | // init |
| 4163 | - $chr = (string) $chr; |
|
| 4163 | + $chr = (string)$chr; |
|
| 4164 | 4164 | |
| 4165 | 4165 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
| 4166 | 4166 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4167 | 4167 | } |
| 4168 | 4168 | |
| 4169 | - $cacheKey = $chr . $encoding; |
|
| 4169 | + $cacheKey = $chr.$encoding; |
|
| 4170 | 4170 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
| 4171 | 4171 | return $CHAR_CACHE[$cacheKey]; |
| 4172 | 4172 | } |
@@ -4201,7 +4201,7 @@ discard block |
||
| 4201 | 4201 | // |
| 4202 | 4202 | |
| 4203 | 4203 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
| 4204 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
| 4204 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
| 4205 | 4205 | /** @noinspection OffsetOperationsInspection */ |
| 4206 | 4206 | $code = $chr ? $chr[1] : 0; |
| 4207 | 4207 | |
@@ -4209,21 +4209,21 @@ discard block |
||
| 4209 | 4209 | if ($code >= 0xF0 && isset($chr[4])) { |
| 4210 | 4210 | /** @noinspection UnnecessaryCastingInspection */ |
| 4211 | 4211 | /** @noinspection OffsetOperationsInspection */ |
| 4212 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 4212 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 4213 | 4213 | } |
| 4214 | 4214 | |
| 4215 | 4215 | /** @noinspection OffsetOperationsInspection */ |
| 4216 | 4216 | if ($code >= 0xE0 && isset($chr[3])) { |
| 4217 | 4217 | /** @noinspection UnnecessaryCastingInspection */ |
| 4218 | 4218 | /** @noinspection OffsetOperationsInspection */ |
| 4219 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 4219 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 4220 | 4220 | } |
| 4221 | 4221 | |
| 4222 | 4222 | /** @noinspection OffsetOperationsInspection */ |
| 4223 | 4223 | if ($code >= 0xC0 && isset($chr[2])) { |
| 4224 | 4224 | /** @noinspection UnnecessaryCastingInspection */ |
| 4225 | 4225 | /** @noinspection OffsetOperationsInspection */ |
| 4226 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 4226 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 4227 | 4227 | } |
| 4228 | 4228 | |
| 4229 | 4229 | return $CHAR_CACHE[$cacheKey] = $code; |
@@ -4272,7 +4272,7 @@ discard block |
||
| 4272 | 4272 | public static function pcre_utf8_support(): bool |
| 4273 | 4273 | { |
| 4274 | 4274 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 4275 | - return (bool) @\preg_match('//u', ''); |
|
| 4275 | + return (bool)@\preg_match('//u', ''); |
|
| 4276 | 4276 | } |
| 4277 | 4277 | |
| 4278 | 4278 | /** |
@@ -4304,11 +4304,11 @@ discard block |
||
| 4304 | 4304 | |
| 4305 | 4305 | if ($step !== 1) { |
| 4306 | 4306 | if (!\is_numeric($step)) { |
| 4307 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
| 4307 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
| 4308 | 4308 | } |
| 4309 | 4309 | |
| 4310 | 4310 | if ($step <= 0) { |
| 4311 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
| 4311 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
| 4312 | 4312 | } |
| 4313 | 4313 | } |
| 4314 | 4314 | |
@@ -4320,14 +4320,14 @@ discard block |
||
| 4320 | 4320 | $is_xdigit = false; |
| 4321 | 4321 | |
| 4322 | 4322 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4323 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
| 4323 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
| 4324 | 4324 | $is_digit = true; |
| 4325 | - $start = (int) $var1; |
|
| 4325 | + $start = (int)$var1; |
|
| 4326 | 4326 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
| 4327 | 4327 | $is_xdigit = true; |
| 4328 | - $start = (int) self::hex_to_int($var1); |
|
| 4328 | + $start = (int)self::hex_to_int($var1); |
|
| 4329 | 4329 | } elseif (!$use_ctype && \is_numeric($var1)) { |
| 4330 | - $start = (int) $var1; |
|
| 4330 | + $start = (int)$var1; |
|
| 4331 | 4331 | } else { |
| 4332 | 4332 | $start = self::ord($var1); |
| 4333 | 4333 | } |
@@ -4337,11 +4337,11 @@ discard block |
||
| 4337 | 4337 | } |
| 4338 | 4338 | |
| 4339 | 4339 | if ($is_digit) { |
| 4340 | - $end = (int) $var2; |
|
| 4340 | + $end = (int)$var2; |
|
| 4341 | 4341 | } elseif ($is_xdigit) { |
| 4342 | - $end = (int) self::hex_to_int($var2); |
|
| 4342 | + $end = (int)self::hex_to_int($var2); |
|
| 4343 | 4343 | } elseif (!$use_ctype && \is_numeric($var2)) { |
| 4344 | - $end = (int) $var2; |
|
| 4344 | + $end = (int)$var2; |
|
| 4345 | 4345 | } else { |
| 4346 | 4346 | $end = self::ord($var2); |
| 4347 | 4347 | } |
@@ -4352,7 +4352,7 @@ discard block |
||
| 4352 | 4352 | |
| 4353 | 4353 | $array = []; |
| 4354 | 4354 | foreach (\range($start, $end, $step) as $i) { |
| 4355 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
| 4355 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
| 4356 | 4356 | } |
| 4357 | 4357 | |
| 4358 | 4358 | return $array; |
@@ -4443,8 +4443,8 @@ discard block |
||
| 4443 | 4443 | $delimiter = '/'; |
| 4444 | 4444 | } |
| 4445 | 4445 | |
| 4446 | - return (string) \preg_replace( |
|
| 4447 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
| 4446 | + return (string)\preg_replace( |
|
| 4447 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
| 4448 | 4448 | $replacement, |
| 4449 | 4449 | $str |
| 4450 | 4450 | ); |
@@ -4486,9 +4486,9 @@ discard block |
||
| 4486 | 4486 | return ''; |
| 4487 | 4487 | } |
| 4488 | 4488 | |
| 4489 | - $strLength -= (int) $bomByteLength; |
|
| 4489 | + $strLength -= (int)$bomByteLength; |
|
| 4490 | 4490 | |
| 4491 | - $str = (string) $strTmp; |
|
| 4491 | + $str = (string)$strTmp; |
|
| 4492 | 4492 | } |
| 4493 | 4493 | } |
| 4494 | 4494 | |
@@ -4512,7 +4512,7 @@ discard block |
||
| 4512 | 4512 | if (\is_array($what) === true) { |
| 4513 | 4513 | /** @noinspection ForeachSourceInspection */ |
| 4514 | 4514 | foreach ($what as $item) { |
| 4515 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/u') . ')+/u', $item, $str); |
|
| 4515 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/u').')+/u', $item, $str); |
|
| 4516 | 4516 | } |
| 4517 | 4517 | } |
| 4518 | 4518 | |
@@ -4544,7 +4544,7 @@ discard block |
||
| 4544 | 4544 | */ |
| 4545 | 4545 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
| 4546 | 4546 | { |
| 4547 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 4547 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 4548 | 4548 | } |
| 4549 | 4549 | |
| 4550 | 4550 | /** |
@@ -4585,17 +4585,17 @@ discard block |
||
| 4585 | 4585 | { |
| 4586 | 4586 | if ($substring && \strpos($str, $substring) === 0) { |
| 4587 | 4587 | if ($encoding === 'UTF-8') { |
| 4588 | - return (string) \mb_substr( |
|
| 4588 | + return (string)\mb_substr( |
|
| 4589 | 4589 | $str, |
| 4590 | - (int) \mb_strlen($substring) |
|
| 4590 | + (int)\mb_strlen($substring) |
|
| 4591 | 4591 | ); |
| 4592 | 4592 | } |
| 4593 | 4593 | |
| 4594 | 4594 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4595 | 4595 | |
| 4596 | - return (string) self::substr( |
|
| 4596 | + return (string)self::substr( |
|
| 4597 | 4597 | $str, |
| 4598 | - (int) self::strlen($substring, $encoding), |
|
| 4598 | + (int)self::strlen($substring, $encoding), |
|
| 4599 | 4599 | null, |
| 4600 | 4600 | $encoding |
| 4601 | 4601 | ); |
@@ -4617,19 +4617,19 @@ discard block |
||
| 4617 | 4617 | { |
| 4618 | 4618 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
| 4619 | 4619 | if ($encoding === 'UTF-8') { |
| 4620 | - return (string) \mb_substr( |
|
| 4620 | + return (string)\mb_substr( |
|
| 4621 | 4621 | $str, |
| 4622 | 4622 | 0, |
| 4623 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
| 4623 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
| 4624 | 4624 | ); |
| 4625 | 4625 | } |
| 4626 | 4626 | |
| 4627 | 4627 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4628 | 4628 | |
| 4629 | - return (string) self::substr( |
|
| 4629 | + return (string)self::substr( |
|
| 4630 | 4630 | $str, |
| 4631 | 4631 | 0, |
| 4632 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
| 4632 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
| 4633 | 4633 | $encoding |
| 4634 | 4634 | ); |
| 4635 | 4635 | } |
@@ -4713,7 +4713,7 @@ discard block |
||
| 4713 | 4713 | $save = \mb_substitute_character(); |
| 4714 | 4714 | \mb_substitute_character($replacementCharHelper); |
| 4715 | 4715 | // the polyfill maybe return false, so cast to string |
| 4716 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 4716 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 4717 | 4717 | \mb_substitute_character($save); |
| 4718 | 4718 | } |
| 4719 | 4719 | |
@@ -4753,7 +4753,7 @@ discard block |
||
| 4753 | 4753 | |
| 4754 | 4754 | if (self::$SUPPORT['mbstring'] === true) { |
| 4755 | 4755 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4756 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 4756 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 4757 | 4757 | } |
| 4758 | 4758 | |
| 4759 | 4759 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -4768,7 +4768,7 @@ discard block |
||
| 4768 | 4768 | { |
| 4769 | 4769 | echo '<pre>'; |
| 4770 | 4770 | foreach (self::$SUPPORT as $key => &$value) { |
| 4771 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
| 4771 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
| 4772 | 4772 | } |
| 4773 | 4773 | unset($value); |
| 4774 | 4774 | echo '</pre>'; |
@@ -4797,7 +4797,7 @@ discard block |
||
| 4797 | 4797 | return $char; |
| 4798 | 4798 | } |
| 4799 | 4799 | |
| 4800 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
| 4800 | + return '&#'.self::ord($char, $encoding).';'; |
|
| 4801 | 4801 | } |
| 4802 | 4802 | |
| 4803 | 4803 | /** |
@@ -4888,18 +4888,18 @@ discard block |
||
| 4888 | 4888 | $lang, |
| 4889 | 4889 | $tryToKeepStringLength |
| 4890 | 4890 | ); |
| 4891 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
| 4891 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
| 4892 | 4892 | |
| 4893 | 4893 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
| 4894 | 4894 | |
| 4895 | - $str = (string) \preg_replace_callback( |
|
| 4895 | + $str = (string)\preg_replace_callback( |
|
| 4896 | 4896 | '/[-_\\s]+(.)?/u', |
| 4897 | 4897 | /** |
| 4898 | 4898 | * @param array $match |
| 4899 | 4899 | * |
| 4900 | 4900 | * @return string |
| 4901 | 4901 | */ |
| 4902 | - static function (array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
| 4902 | + static function(array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
| 4903 | 4903 | if (isset($match[1])) { |
| 4904 | 4904 | if ($useMbFunction === true) { |
| 4905 | 4905 | if ($encoding === 'UTF-8') { |
@@ -4917,14 +4917,14 @@ discard block |
||
| 4917 | 4917 | $str |
| 4918 | 4918 | ); |
| 4919 | 4919 | |
| 4920 | - return (string) \preg_replace_callback( |
|
| 4920 | + return (string)\preg_replace_callback( |
|
| 4921 | 4921 | '/[\\p{N}]+(.)?/u', |
| 4922 | 4922 | /** |
| 4923 | 4923 | * @param array $match |
| 4924 | 4924 | * |
| 4925 | 4925 | * @return string |
| 4926 | 4926 | */ |
| 4927 | - static function (array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
| 4927 | + static function(array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
| 4928 | 4928 | if ($useMbFunction === true) { |
| 4929 | 4929 | if ($encoding === 'UTF-8') { |
| 4930 | 4930 | return \mb_strtoupper($match[0]); |
@@ -5102,7 +5102,7 @@ discard block |
||
| 5102 | 5102 | ): string { |
| 5103 | 5103 | if (self::$SUPPORT['mbstring'] === true) { |
| 5104 | 5104 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5105 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
| 5105 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
| 5106 | 5106 | |
| 5107 | 5107 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
| 5108 | 5108 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5112,10 +5112,10 @@ discard block |
||
| 5112 | 5112 | } |
| 5113 | 5113 | |
| 5114 | 5114 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5115 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
| 5115 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
| 5116 | 5116 | } |
| 5117 | 5117 | |
| 5118 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
| 5118 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
| 5119 | 5119 | |
| 5120 | 5120 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
| 5121 | 5121 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5124,7 +5124,7 @@ discard block |
||
| 5124 | 5124 | $str = self::strtolower($str, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
| 5125 | 5125 | } |
| 5126 | 5126 | |
| 5127 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
| 5127 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
| 5128 | 5128 | } |
| 5129 | 5129 | |
| 5130 | 5130 | /** |
@@ -5139,7 +5139,7 @@ discard block |
||
| 5139 | 5139 | public static function str_detect_encoding($str) |
| 5140 | 5140 | { |
| 5141 | 5141 | // init |
| 5142 | - $str = (string) $str; |
|
| 5142 | + $str = (string)$str; |
|
| 5143 | 5143 | |
| 5144 | 5144 | // |
| 5145 | 5145 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5241,7 +5241,7 @@ discard block |
||
| 5241 | 5241 | foreach (self::$ENCODINGS as $encodingTmp) { |
| 5242 | 5242 | // INFO: //IGNORE but still throw notice |
| 5243 | 5243 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 5244 | - if ((string) @\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str) === $str) { |
|
| 5244 | + if ((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str) === $str) { |
|
| 5245 | 5245 | return $encodingTmp; |
| 5246 | 5246 | } |
| 5247 | 5247 | } |
@@ -5329,7 +5329,7 @@ discard block |
||
| 5329 | 5329 | return $str; |
| 5330 | 5330 | } |
| 5331 | 5331 | |
| 5332 | - return $substring . $str; |
|
| 5332 | + return $substring.$str; |
|
| 5333 | 5333 | } |
| 5334 | 5334 | |
| 5335 | 5335 | /** |
@@ -5583,27 +5583,27 @@ discard block |
||
| 5583 | 5583 | string $encoding = 'UTF-8' |
| 5584 | 5584 | ): string { |
| 5585 | 5585 | if ($encoding === 'UTF-8') { |
| 5586 | - $len = (int) \mb_strlen($str); |
|
| 5586 | + $len = (int)\mb_strlen($str); |
|
| 5587 | 5587 | if ($index > $len) { |
| 5588 | 5588 | return $str; |
| 5589 | 5589 | } |
| 5590 | 5590 | |
| 5591 | 5591 | /** @noinspection UnnecessaryCastingInspection */ |
| 5592 | - return (string) \mb_substr($str, 0, $index) . |
|
| 5593 | - $substring . |
|
| 5594 | - (string) \mb_substr($str, $index, $len); |
|
| 5592 | + return (string)\mb_substr($str, 0, $index). |
|
| 5593 | + $substring. |
|
| 5594 | + (string)\mb_substr($str, $index, $len); |
|
| 5595 | 5595 | } |
| 5596 | 5596 | |
| 5597 | 5597 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5598 | 5598 | |
| 5599 | - $len = (int) self::strlen($str, $encoding); |
|
| 5599 | + $len = (int)self::strlen($str, $encoding); |
|
| 5600 | 5600 | if ($index > $len) { |
| 5601 | 5601 | return $str; |
| 5602 | 5602 | } |
| 5603 | 5603 | |
| 5604 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
| 5605 | - $substring . |
|
| 5606 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
| 5604 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
| 5605 | + $substring. |
|
| 5606 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
| 5607 | 5607 | } |
| 5608 | 5608 | |
| 5609 | 5609 | /** |
@@ -5633,15 +5633,15 @@ discard block |
||
| 5633 | 5633 | */ |
| 5634 | 5634 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
| 5635 | 5635 | { |
| 5636 | - $search = (array) $search; |
|
| 5636 | + $search = (array)$search; |
|
| 5637 | 5637 | |
| 5638 | 5638 | /** @noinspection AlterInForeachInspection */ |
| 5639 | 5639 | foreach ($search as &$s) { |
| 5640 | - $s = (string) $s; |
|
| 5640 | + $s = (string)$s; |
|
| 5641 | 5641 | if ($s === '') { |
| 5642 | 5642 | $s = '/^(?<=.)$/'; |
| 5643 | 5643 | } else { |
| 5644 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
| 5644 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
| 5645 | 5645 | } |
| 5646 | 5646 | } |
| 5647 | 5647 | |
@@ -5673,11 +5673,11 @@ discard block |
||
| 5673 | 5673 | } |
| 5674 | 5674 | |
| 5675 | 5675 | if ($search === '') { |
| 5676 | - return $str . $replacement; |
|
| 5676 | + return $str.$replacement; |
|
| 5677 | 5677 | } |
| 5678 | 5678 | |
| 5679 | 5679 | if (\stripos($str, $search) === 0) { |
| 5680 | - return $replacement . \substr($str, \strlen($search)); |
|
| 5680 | + return $replacement.\substr($str, \strlen($search)); |
|
| 5681 | 5681 | } |
| 5682 | 5682 | |
| 5683 | 5683 | return $str; |
@@ -5705,11 +5705,11 @@ discard block |
||
| 5705 | 5705 | } |
| 5706 | 5706 | |
| 5707 | 5707 | if ($search === '') { |
| 5708 | - return $str . $replacement; |
|
| 5708 | + return $str.$replacement; |
|
| 5709 | 5709 | } |
| 5710 | 5710 | |
| 5711 | 5711 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 5712 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 5712 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 5713 | 5713 | } |
| 5714 | 5714 | |
| 5715 | 5715 | return $str; |
@@ -5786,15 +5786,15 @@ discard block |
||
| 5786 | 5786 | } |
| 5787 | 5787 | |
| 5788 | 5788 | if ($encoding === 'UTF-8') { |
| 5789 | - return (string) \mb_substr( |
|
| 5789 | + return (string)\mb_substr( |
|
| 5790 | 5790 | $str, |
| 5791 | - $offset + (int) \mb_strlen($separator) |
|
| 5791 | + $offset + (int)\mb_strlen($separator) |
|
| 5792 | 5792 | ); |
| 5793 | 5793 | } |
| 5794 | 5794 | |
| 5795 | - return (string) self::substr( |
|
| 5795 | + return (string)self::substr( |
|
| 5796 | 5796 | $str, |
| 5797 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 5797 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 5798 | 5798 | null, |
| 5799 | 5799 | $encoding |
| 5800 | 5800 | ); |
@@ -5821,15 +5821,15 @@ discard block |
||
| 5821 | 5821 | } |
| 5822 | 5822 | |
| 5823 | 5823 | if ($encoding === 'UTF-8') { |
| 5824 | - return (string) \mb_substr( |
|
| 5824 | + return (string)\mb_substr( |
|
| 5825 | 5825 | $str, |
| 5826 | - $offset + (int) self::strlen($separator) |
|
| 5826 | + $offset + (int)self::strlen($separator) |
|
| 5827 | 5827 | ); |
| 5828 | 5828 | } |
| 5829 | 5829 | |
| 5830 | - return (string) self::substr( |
|
| 5830 | + return (string)self::substr( |
|
| 5831 | 5831 | $str, |
| 5832 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 5832 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 5833 | 5833 | null, |
| 5834 | 5834 | $encoding |
| 5835 | 5835 | ); |
@@ -5856,10 +5856,10 @@ discard block |
||
| 5856 | 5856 | } |
| 5857 | 5857 | |
| 5858 | 5858 | if ($encoding === 'UTF-8') { |
| 5859 | - return (string) \mb_substr($str, 0, $offset); |
|
| 5859 | + return (string)\mb_substr($str, 0, $offset); |
|
| 5860 | 5860 | } |
| 5861 | 5861 | |
| 5862 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 5862 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 5863 | 5863 | } |
| 5864 | 5864 | |
| 5865 | 5865 | /** |
@@ -5883,7 +5883,7 @@ discard block |
||
| 5883 | 5883 | return ''; |
| 5884 | 5884 | } |
| 5885 | 5885 | |
| 5886 | - return (string) \mb_substr($str, 0, $offset); |
|
| 5886 | + return (string)\mb_substr($str, 0, $offset); |
|
| 5887 | 5887 | } |
| 5888 | 5888 | |
| 5889 | 5889 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -5891,7 +5891,7 @@ discard block |
||
| 5891 | 5891 | return ''; |
| 5892 | 5892 | } |
| 5893 | 5893 | |
| 5894 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 5894 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 5895 | 5895 | } |
| 5896 | 5896 | |
| 5897 | 5897 | /** |
@@ -5979,12 +5979,12 @@ discard block |
||
| 5979 | 5979 | } |
| 5980 | 5980 | |
| 5981 | 5981 | if ($encoding === 'UTF-8') { |
| 5982 | - return (string) \mb_substr($str, -$n); |
|
| 5982 | + return (string)\mb_substr($str, -$n); |
|
| 5983 | 5983 | } |
| 5984 | 5984 | |
| 5985 | 5985 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5986 | 5986 | |
| 5987 | - return (string) self::substr($str, -$n, null, $encoding); |
|
| 5987 | + return (string)self::substr($str, -$n, null, $encoding); |
|
| 5988 | 5988 | } |
| 5989 | 5989 | |
| 5990 | 5990 | /** |
@@ -6008,21 +6008,21 @@ discard block |
||
| 6008 | 6008 | } |
| 6009 | 6009 | |
| 6010 | 6010 | if ($encoding === 'UTF-8') { |
| 6011 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 6011 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 6012 | 6012 | return $str; |
| 6013 | 6013 | } |
| 6014 | 6014 | |
| 6015 | 6015 | /** @noinspection UnnecessaryCastingInspection */ |
| 6016 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($strAddOn)) . $strAddOn; |
|
| 6016 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($strAddOn)).$strAddOn; |
|
| 6017 | 6017 | } |
| 6018 | 6018 | |
| 6019 | 6019 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6020 | 6020 | |
| 6021 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 6021 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 6022 | 6022 | return $str; |
| 6023 | 6023 | } |
| 6024 | 6024 | |
| 6025 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($strAddOn), $encoding)) . $strAddOn; |
|
| 6025 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($strAddOn), $encoding)).$strAddOn; |
|
| 6026 | 6026 | } |
| 6027 | 6027 | |
| 6028 | 6028 | /** |
@@ -6047,12 +6047,12 @@ discard block |
||
| 6047 | 6047 | |
| 6048 | 6048 | if ($encoding === 'UTF-8') { |
| 6049 | 6049 | /** @noinspection UnnecessaryCastingInspection */ |
| 6050 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 6050 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 6051 | 6051 | return $str; |
| 6052 | 6052 | } |
| 6053 | 6053 | |
| 6054 | 6054 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
| 6055 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
| 6055 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
| 6056 | 6056 | } |
| 6057 | 6057 | |
| 6058 | 6058 | $str = \mb_substr($str, 0, $length); |
@@ -6062,20 +6062,20 @@ discard block |
||
| 6062 | 6062 | $new_str = \implode(' ', $array); |
| 6063 | 6063 | |
| 6064 | 6064 | if ($new_str === '') { |
| 6065 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
| 6065 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
| 6066 | 6066 | } |
| 6067 | 6067 | } else { |
| 6068 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 6068 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 6069 | 6069 | return $str; |
| 6070 | 6070 | } |
| 6071 | 6071 | |
| 6072 | 6072 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
| 6073 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
| 6073 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
| 6074 | 6074 | } |
| 6075 | 6075 | |
| 6076 | 6076 | $str = self::substr($str, 0, $length, $encoding); |
| 6077 | 6077 | if ($str === false) { |
| 6078 | - return '' . $strAddOn; |
|
| 6078 | + return ''.$strAddOn; |
|
| 6079 | 6079 | } |
| 6080 | 6080 | |
| 6081 | 6081 | $array = \explode(' ', $str); |
@@ -6083,11 +6083,11 @@ discard block |
||
| 6083 | 6083 | $new_str = \implode(' ', $array); |
| 6084 | 6084 | |
| 6085 | 6085 | if ($new_str === '') { |
| 6086 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
| 6086 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
| 6087 | 6087 | } |
| 6088 | 6088 | } |
| 6089 | 6089 | |
| 6090 | - return $new_str . $strAddOn; |
|
| 6090 | + return $new_str.$strAddOn; |
|
| 6091 | 6091 | } |
| 6092 | 6092 | |
| 6093 | 6093 | /** |
@@ -6105,7 +6105,7 @@ discard block |
||
| 6105 | 6105 | $longestCommonPrefix = ''; |
| 6106 | 6106 | |
| 6107 | 6107 | if ($encoding === 'UTF-8') { |
| 6108 | - $maxLength = (int) \min( |
|
| 6108 | + $maxLength = (int)\min( |
|
| 6109 | 6109 | \mb_strlen($str), |
| 6110 | 6110 | \mb_strlen($otherStr) |
| 6111 | 6111 | ); |
@@ -6126,7 +6126,7 @@ discard block |
||
| 6126 | 6126 | } else { |
| 6127 | 6127 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6128 | 6128 | |
| 6129 | - $maxLength = (int) \min( |
|
| 6129 | + $maxLength = (int)\min( |
|
| 6130 | 6130 | self::strlen($str, $encoding), |
| 6131 | 6131 | self::strlen($otherStr, $encoding) |
| 6132 | 6132 | ); |
@@ -6169,13 +6169,13 @@ discard block |
||
| 6169 | 6169 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
| 6170 | 6170 | |
| 6171 | 6171 | if ($encoding === 'UTF-8') { |
| 6172 | - $strLength = (int) \mb_strlen($str); |
|
| 6173 | - $otherLength = (int) \mb_strlen($otherStr); |
|
| 6172 | + $strLength = (int)\mb_strlen($str); |
|
| 6173 | + $otherLength = (int)\mb_strlen($otherStr); |
|
| 6174 | 6174 | } else { |
| 6175 | 6175 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6176 | 6176 | |
| 6177 | - $strLength = (int) self::strlen($str, $encoding); |
|
| 6178 | - $otherLength = (int) self::strlen($otherStr, $encoding); |
|
| 6177 | + $strLength = (int)self::strlen($str, $encoding); |
|
| 6178 | + $otherLength = (int)self::strlen($otherStr, $encoding); |
|
| 6179 | 6179 | } |
| 6180 | 6180 | |
| 6181 | 6181 | // Return if either string is empty |
@@ -6228,10 +6228,10 @@ discard block |
||
| 6228 | 6228 | } |
| 6229 | 6229 | |
| 6230 | 6230 | if ($encoding === 'UTF-8') { |
| 6231 | - return (string) \mb_substr($str, $end - $len, $len); |
|
| 6231 | + return (string)\mb_substr($str, $end - $len, $len); |
|
| 6232 | 6232 | } |
| 6233 | 6233 | |
| 6234 | - return (string) self::substr($str, $end - $len, $len, $encoding); |
|
| 6234 | + return (string)self::substr($str, $end - $len, $len, $encoding); |
|
| 6235 | 6235 | } |
| 6236 | 6236 | |
| 6237 | 6237 | /** |
@@ -6250,7 +6250,7 @@ discard block |
||
| 6250 | 6250 | } |
| 6251 | 6251 | |
| 6252 | 6252 | if ($encoding === 'UTF-8') { |
| 6253 | - $maxLength = (int) \min( |
|
| 6253 | + $maxLength = (int)\min( |
|
| 6254 | 6254 | \mb_strlen($str, $encoding), |
| 6255 | 6255 | \mb_strlen($otherStr, $encoding) |
| 6256 | 6256 | ); |
@@ -6264,7 +6264,7 @@ discard block |
||
| 6264 | 6264 | && |
| 6265 | 6265 | $char === \mb_substr($otherStr, -$i, 1) |
| 6266 | 6266 | ) { |
| 6267 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
| 6267 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
| 6268 | 6268 | } else { |
| 6269 | 6269 | break; |
| 6270 | 6270 | } |
@@ -6272,7 +6272,7 @@ discard block |
||
| 6272 | 6272 | } else { |
| 6273 | 6273 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6274 | 6274 | |
| 6275 | - $maxLength = (int) \min( |
|
| 6275 | + $maxLength = (int)\min( |
|
| 6276 | 6276 | self::strlen($str, $encoding), |
| 6277 | 6277 | self::strlen($otherStr, $encoding) |
| 6278 | 6278 | ); |
@@ -6286,7 +6286,7 @@ discard block |
||
| 6286 | 6286 | && |
| 6287 | 6287 | $char === self::substr($otherStr, -$i, 1, $encoding) |
| 6288 | 6288 | ) { |
| 6289 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
| 6289 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
| 6290 | 6290 | } else { |
| 6291 | 6291 | break; |
| 6292 | 6292 | } |
@@ -6306,7 +6306,7 @@ discard block |
||
| 6306 | 6306 | */ |
| 6307 | 6307 | public static function str_matches_pattern(string $str, string $pattern): bool |
| 6308 | 6308 | { |
| 6309 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
| 6309 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
| 6310 | 6310 | } |
| 6311 | 6311 | |
| 6312 | 6312 | /** |
@@ -6323,7 +6323,7 @@ discard block |
||
| 6323 | 6323 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
| 6324 | 6324 | { |
| 6325 | 6325 | // init |
| 6326 | - $length = (int) self::strlen($str, $encoding); |
|
| 6326 | + $length = (int)self::strlen($str, $encoding); |
|
| 6327 | 6327 | |
| 6328 | 6328 | if ($offset >= 0) { |
| 6329 | 6329 | return $length > $offset; |
@@ -6349,7 +6349,7 @@ discard block |
||
| 6349 | 6349 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
| 6350 | 6350 | { |
| 6351 | 6351 | // init |
| 6352 | - $length = (int) self::strlen($str); |
|
| 6352 | + $length = (int)self::strlen($str); |
|
| 6353 | 6353 | |
| 6354 | 6354 | if ( |
| 6355 | 6355 | ($index >= 0 && $length <= $index) |
@@ -6388,7 +6388,7 @@ discard block |
||
| 6388 | 6388 | return $str; |
| 6389 | 6389 | } |
| 6390 | 6390 | |
| 6391 | - if ($pad_type !== (int) $pad_type) { |
|
| 6391 | + if ($pad_type !== (int)$pad_type) { |
|
| 6392 | 6392 | if ($pad_type === 'left') { |
| 6393 | 6393 | $pad_type = \STR_PAD_LEFT; |
| 6394 | 6394 | } elseif ($pad_type === 'right') { |
@@ -6397,23 +6397,23 @@ discard block |
||
| 6397 | 6397 | $pad_type = \STR_PAD_BOTH; |
| 6398 | 6398 | } else { |
| 6399 | 6399 | throw new \InvalidArgumentException( |
| 6400 | - 'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
| 6400 | + 'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
| 6401 | 6401 | ); |
| 6402 | 6402 | } |
| 6403 | 6403 | } |
| 6404 | 6404 | |
| 6405 | 6405 | if ($encoding === 'UTF-8') { |
| 6406 | - $str_length = (int) \mb_strlen($str); |
|
| 6406 | + $str_length = (int)\mb_strlen($str); |
|
| 6407 | 6407 | |
| 6408 | 6408 | if ($pad_length >= $str_length) { |
| 6409 | 6409 | switch ($pad_type) { |
| 6410 | 6410 | case \STR_PAD_LEFT: |
| 6411 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 6411 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 6412 | 6412 | |
| 6413 | 6413 | $diff = ($pad_length - $str_length); |
| 6414 | 6414 | |
| 6415 | - $pre = (string) \mb_substr( |
|
| 6416 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 6415 | + $pre = (string)\mb_substr( |
|
| 6416 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 6417 | 6417 | 0, |
| 6418 | 6418 | $diff |
| 6419 | 6419 | ); |
@@ -6424,16 +6424,16 @@ discard block |
||
| 6424 | 6424 | case \STR_PAD_BOTH: |
| 6425 | 6425 | $diff = ($pad_length - $str_length); |
| 6426 | 6426 | |
| 6427 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 6427 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 6428 | 6428 | |
| 6429 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 6429 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 6430 | 6430 | |
| 6431 | - $pre = (string) \mb_substr( |
|
| 6431 | + $pre = (string)\mb_substr( |
|
| 6432 | 6432 | \str_repeat($pad_string, $ps_length_left), |
| 6433 | 6433 | 0, |
| 6434 | 6434 | $ps_length_left |
| 6435 | 6435 | ); |
| 6436 | - $post = (string) \mb_substr( |
|
| 6436 | + $post = (string)\mb_substr( |
|
| 6437 | 6437 | \str_repeat($pad_string, $ps_length_right), |
| 6438 | 6438 | 0, |
| 6439 | 6439 | $ps_length_right |
@@ -6443,19 +6443,19 @@ discard block |
||
| 6443 | 6443 | |
| 6444 | 6444 | case \STR_PAD_RIGHT: |
| 6445 | 6445 | default: |
| 6446 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 6446 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 6447 | 6447 | |
| 6448 | 6448 | $diff = ($pad_length - $str_length); |
| 6449 | 6449 | |
| 6450 | - $post = (string) \mb_substr( |
|
| 6451 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 6450 | + $post = (string)\mb_substr( |
|
| 6451 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 6452 | 6452 | 0, |
| 6453 | 6453 | $diff |
| 6454 | 6454 | ); |
| 6455 | 6455 | $pre = ''; |
| 6456 | 6456 | } |
| 6457 | 6457 | |
| 6458 | - return $pre . $str . $post; |
|
| 6458 | + return $pre.$str.$post; |
|
| 6459 | 6459 | } |
| 6460 | 6460 | |
| 6461 | 6461 | return $str; |
@@ -6463,17 +6463,17 @@ discard block |
||
| 6463 | 6463 | |
| 6464 | 6464 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6465 | 6465 | |
| 6466 | - $str_length = (int) self::strlen($str, $encoding); |
|
| 6466 | + $str_length = (int)self::strlen($str, $encoding); |
|
| 6467 | 6467 | |
| 6468 | 6468 | if ($pad_length >= $str_length) { |
| 6469 | 6469 | switch ($pad_type) { |
| 6470 | 6470 | case \STR_PAD_LEFT: |
| 6471 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 6471 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 6472 | 6472 | |
| 6473 | 6473 | $diff = ($pad_length - $str_length); |
| 6474 | 6474 | |
| 6475 | - $pre = (string) self::substr( |
|
| 6476 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 6475 | + $pre = (string)self::substr( |
|
| 6476 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 6477 | 6477 | 0, |
| 6478 | 6478 | $diff, |
| 6479 | 6479 | $encoding |
@@ -6485,17 +6485,17 @@ discard block |
||
| 6485 | 6485 | case \STR_PAD_BOTH: |
| 6486 | 6486 | $diff = ($pad_length - $str_length); |
| 6487 | 6487 | |
| 6488 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 6488 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 6489 | 6489 | |
| 6490 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 6490 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 6491 | 6491 | |
| 6492 | - $pre = (string) self::substr( |
|
| 6492 | + $pre = (string)self::substr( |
|
| 6493 | 6493 | \str_repeat($pad_string, $ps_length_left), |
| 6494 | 6494 | 0, |
| 6495 | 6495 | $ps_length_left, |
| 6496 | 6496 | $encoding |
| 6497 | 6497 | ); |
| 6498 | - $post = (string) self::substr( |
|
| 6498 | + $post = (string)self::substr( |
|
| 6499 | 6499 | \str_repeat($pad_string, $ps_length_right), |
| 6500 | 6500 | 0, |
| 6501 | 6501 | $ps_length_right, |
@@ -6506,12 +6506,12 @@ discard block |
||
| 6506 | 6506 | |
| 6507 | 6507 | case \STR_PAD_RIGHT: |
| 6508 | 6508 | default: |
| 6509 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 6509 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 6510 | 6510 | |
| 6511 | 6511 | $diff = ($pad_length - $str_length); |
| 6512 | 6512 | |
| 6513 | - $post = (string) self::substr( |
|
| 6514 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 6513 | + $post = (string)self::substr( |
|
| 6514 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 6515 | 6515 | 0, |
| 6516 | 6516 | $diff, |
| 6517 | 6517 | $encoding |
@@ -6519,7 +6519,7 @@ discard block |
||
| 6519 | 6519 | $pre = ''; |
| 6520 | 6520 | } |
| 6521 | 6521 | |
| 6522 | - return $pre . $str . $post; |
|
| 6522 | + return $pre.$str.$post; |
|
| 6523 | 6523 | } |
| 6524 | 6524 | |
| 6525 | 6525 | return $str; |
@@ -6678,11 +6678,11 @@ discard block |
||
| 6678 | 6678 | } |
| 6679 | 6679 | |
| 6680 | 6680 | if ($search === '') { |
| 6681 | - return $str . $replacement; |
|
| 6681 | + return $str.$replacement; |
|
| 6682 | 6682 | } |
| 6683 | 6683 | |
| 6684 | 6684 | if (\strpos($str, $search) === 0) { |
| 6685 | - return $replacement . \substr($str, \strlen($search)); |
|
| 6685 | + return $replacement.\substr($str, \strlen($search)); |
|
| 6686 | 6686 | } |
| 6687 | 6687 | |
| 6688 | 6688 | return $str; |
@@ -6710,11 +6710,11 @@ discard block |
||
| 6710 | 6710 | } |
| 6711 | 6711 | |
| 6712 | 6712 | if ($search === '') { |
| 6713 | - return $str . $replacement; |
|
| 6713 | + return $str.$replacement; |
|
| 6714 | 6714 | } |
| 6715 | 6715 | |
| 6716 | 6716 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 6717 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 6717 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 6718 | 6718 | } |
| 6719 | 6719 | |
| 6720 | 6720 | return $str; |
@@ -6743,7 +6743,7 @@ discard block |
||
| 6743 | 6743 | $subject, |
| 6744 | 6744 | $replace, |
| 6745 | 6745 | $pos, |
| 6746 | - (int) self::strlen($search) |
|
| 6746 | + (int)self::strlen($search) |
|
| 6747 | 6747 | ); |
| 6748 | 6748 | } |
| 6749 | 6749 | |
@@ -6775,7 +6775,7 @@ discard block |
||
| 6775 | 6775 | $subject, |
| 6776 | 6776 | $replace, |
| 6777 | 6777 | $pos, |
| 6778 | - (int) self::strlen($search) |
|
| 6778 | + (int)self::strlen($search) |
|
| 6779 | 6779 | ); |
| 6780 | 6780 | } |
| 6781 | 6781 | |
@@ -6795,7 +6795,7 @@ discard block |
||
| 6795 | 6795 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
| 6796 | 6796 | { |
| 6797 | 6797 | if ($encoding === 'UTF-8') { |
| 6798 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
| 6798 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
| 6799 | 6799 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 6800 | 6800 | \shuffle($indexes); |
| 6801 | 6801 | |
@@ -6811,7 +6811,7 @@ discard block |
||
| 6811 | 6811 | } else { |
| 6812 | 6812 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6813 | 6813 | |
| 6814 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
| 6814 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
| 6815 | 6815 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 6816 | 6816 | \shuffle($indexes); |
| 6817 | 6817 | |
@@ -6852,11 +6852,11 @@ discard block |
||
| 6852 | 6852 | ) { |
| 6853 | 6853 | if ($encoding === 'UTF-8') { |
| 6854 | 6854 | if ($end === null) { |
| 6855 | - $length = (int) \mb_strlen($str); |
|
| 6855 | + $length = (int)\mb_strlen($str); |
|
| 6856 | 6856 | } elseif ($end >= 0 && $end <= $start) { |
| 6857 | 6857 | return ''; |
| 6858 | 6858 | } elseif ($end < 0) { |
| 6859 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
| 6859 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
| 6860 | 6860 | } else { |
| 6861 | 6861 | $length = $end - $start; |
| 6862 | 6862 | } |
@@ -6867,11 +6867,11 @@ discard block |
||
| 6867 | 6867 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6868 | 6868 | |
| 6869 | 6869 | if ($end === null) { |
| 6870 | - $length = (int) self::strlen($str, $encoding); |
|
| 6870 | + $length = (int)self::strlen($str, $encoding); |
|
| 6871 | 6871 | } elseif ($end >= 0 && $end <= $start) { |
| 6872 | 6872 | return ''; |
| 6873 | 6873 | } elseif ($end < 0) { |
| 6874 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
| 6874 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
| 6875 | 6875 | } else { |
| 6876 | 6876 | $length = $end - $start; |
| 6877 | 6877 | } |
@@ -6903,35 +6903,35 @@ discard block |
||
| 6903 | 6903 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6904 | 6904 | } |
| 6905 | 6905 | |
| 6906 | - $str = (string) \preg_replace_callback( |
|
| 6906 | + $str = (string)\preg_replace_callback( |
|
| 6907 | 6907 | '/([\\p{N}|\\p{Lu}])/u', |
| 6908 | 6908 | /** |
| 6909 | 6909 | * @param string[] $matches |
| 6910 | 6910 | * |
| 6911 | 6911 | * @return string |
| 6912 | 6912 | */ |
| 6913 | - static function (array $matches) use ($encoding): string { |
|
| 6913 | + static function(array $matches) use ($encoding): string { |
|
| 6914 | 6914 | $match = $matches[1]; |
| 6915 | - $matchInt = (int) $match; |
|
| 6915 | + $matchInt = (int)$match; |
|
| 6916 | 6916 | |
| 6917 | - if ((string) $matchInt === $match) { |
|
| 6918 | - return '_' . $match . '_'; |
|
| 6917 | + if ((string)$matchInt === $match) { |
|
| 6918 | + return '_'.$match.'_'; |
|
| 6919 | 6919 | } |
| 6920 | 6920 | |
| 6921 | 6921 | if ($encoding === 'UTF-8') { |
| 6922 | - return '_' . \mb_strtolower($match); |
|
| 6922 | + return '_'.\mb_strtolower($match); |
|
| 6923 | 6923 | } |
| 6924 | 6924 | |
| 6925 | - return '_' . self::strtolower($match, $encoding); |
|
| 6925 | + return '_'.self::strtolower($match, $encoding); |
|
| 6926 | 6926 | }, |
| 6927 | 6927 | $str |
| 6928 | 6928 | ); |
| 6929 | 6929 | |
| 6930 | - $str = (string) \preg_replace( |
|
| 6930 | + $str = (string)\preg_replace( |
|
| 6931 | 6931 | [ |
| 6932 | - '/\\s+/u', // convert spaces to "_" |
|
| 6932 | + '/\\s+/u', // convert spaces to "_" |
|
| 6933 | 6933 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
| 6934 | - '/_+/', // remove double "_" |
|
| 6934 | + '/_+/', // remove double "_" |
|
| 6935 | 6935 | ], |
| 6936 | 6936 | [ |
| 6937 | 6937 | '_', |
@@ -7007,7 +7007,7 @@ discard block |
||
| 7007 | 7007 | } |
| 7008 | 7008 | |
| 7009 | 7009 | // init |
| 7010 | - $str = (string) $str; |
|
| 7010 | + $str = (string)$str; |
|
| 7011 | 7011 | |
| 7012 | 7012 | if ($str === '') { |
| 7013 | 7013 | return []; |
@@ -7054,7 +7054,7 @@ discard block |
||
| 7054 | 7054 | ($str[$i] & "\xE0") === "\xC0" |
| 7055 | 7055 | ) { |
| 7056 | 7056 | if (($str[$i + 1] & "\xC0") === "\x80") { |
| 7057 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
| 7057 | + $ret[] = $str[$i].$str[$i + 1]; |
|
| 7058 | 7058 | |
| 7059 | 7059 | ++$i; |
| 7060 | 7060 | } |
@@ -7068,7 +7068,7 @@ discard block |
||
| 7068 | 7068 | && |
| 7069 | 7069 | ($str[$i + 2] & "\xC0") === "\x80" |
| 7070 | 7070 | ) { |
| 7071 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
| 7071 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
| 7072 | 7072 | |
| 7073 | 7073 | $i += 2; |
| 7074 | 7074 | } |
@@ -7084,7 +7084,7 @@ discard block |
||
| 7084 | 7084 | && |
| 7085 | 7085 | ($str[$i + 3] & "\xC0") === "\x80" |
| 7086 | 7086 | ) { |
| 7087 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
| 7087 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
| 7088 | 7088 | |
| 7089 | 7089 | $i += 3; |
| 7090 | 7090 | } |
@@ -7096,7 +7096,7 @@ discard block |
||
| 7096 | 7096 | $ret = \array_chunk($ret, $length); |
| 7097 | 7097 | |
| 7098 | 7098 | return \array_map( |
| 7099 | - static function (array &$item): string { |
|
| 7099 | + static function(array &$item): string { |
|
| 7100 | 7100 | return \implode('', $item); |
| 7101 | 7101 | }, |
| 7102 | 7102 | $ret |
@@ -7159,7 +7159,7 @@ discard block |
||
| 7159 | 7159 | $limit = -1; |
| 7160 | 7160 | } |
| 7161 | 7161 | |
| 7162 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
| 7162 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
| 7163 | 7163 | |
| 7164 | 7164 | if ($array === false) { |
| 7165 | 7165 | return []; |
@@ -7243,9 +7243,9 @@ discard block |
||
| 7243 | 7243 | return ''; |
| 7244 | 7244 | } |
| 7245 | 7245 | |
| 7246 | - return (string) \mb_substr( |
|
| 7246 | + return (string)\mb_substr( |
|
| 7247 | 7247 | $str, |
| 7248 | - $offset + (int) \mb_strlen($separator) |
|
| 7248 | + $offset + (int)\mb_strlen($separator) |
|
| 7249 | 7249 | ); |
| 7250 | 7250 | } |
| 7251 | 7251 | |
@@ -7254,9 +7254,9 @@ discard block |
||
| 7254 | 7254 | return ''; |
| 7255 | 7255 | } |
| 7256 | 7256 | |
| 7257 | - return (string) \mb_substr( |
|
| 7257 | + return (string)\mb_substr( |
|
| 7258 | 7258 | $str, |
| 7259 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 7259 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 7260 | 7260 | null, |
| 7261 | 7261 | $encoding |
| 7262 | 7262 | ); |
@@ -7283,9 +7283,9 @@ discard block |
||
| 7283 | 7283 | return ''; |
| 7284 | 7284 | } |
| 7285 | 7285 | |
| 7286 | - return (string) \mb_substr( |
|
| 7286 | + return (string)\mb_substr( |
|
| 7287 | 7287 | $str, |
| 7288 | - $offset + (int) \mb_strlen($separator) |
|
| 7288 | + $offset + (int)\mb_strlen($separator) |
|
| 7289 | 7289 | ); |
| 7290 | 7290 | } |
| 7291 | 7291 | |
@@ -7294,9 +7294,9 @@ discard block |
||
| 7294 | 7294 | return ''; |
| 7295 | 7295 | } |
| 7296 | 7296 | |
| 7297 | - return (string) self::substr( |
|
| 7297 | + return (string)self::substr( |
|
| 7298 | 7298 | $str, |
| 7299 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 7299 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 7300 | 7300 | null, |
| 7301 | 7301 | $encoding |
| 7302 | 7302 | ); |
@@ -7326,7 +7326,7 @@ discard block |
||
| 7326 | 7326 | return ''; |
| 7327 | 7327 | } |
| 7328 | 7328 | |
| 7329 | - return (string) \mb_substr( |
|
| 7329 | + return (string)\mb_substr( |
|
| 7330 | 7330 | $str, |
| 7331 | 7331 | 0, |
| 7332 | 7332 | $offset |
@@ -7338,7 +7338,7 @@ discard block |
||
| 7338 | 7338 | return ''; |
| 7339 | 7339 | } |
| 7340 | 7340 | |
| 7341 | - return (string) self::substr( |
|
| 7341 | + return (string)self::substr( |
|
| 7342 | 7342 | $str, |
| 7343 | 7343 | 0, |
| 7344 | 7344 | $offset, |
@@ -7367,7 +7367,7 @@ discard block |
||
| 7367 | 7367 | return ''; |
| 7368 | 7368 | } |
| 7369 | 7369 | |
| 7370 | - return (string) \mb_substr( |
|
| 7370 | + return (string)\mb_substr( |
|
| 7371 | 7371 | $str, |
| 7372 | 7372 | 0, |
| 7373 | 7373 | $offset |
@@ -7381,7 +7381,7 @@ discard block |
||
| 7381 | 7381 | |
| 7382 | 7382 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7383 | 7383 | |
| 7384 | - return (string) self::substr( |
|
| 7384 | + return (string)self::substr( |
|
| 7385 | 7385 | $str, |
| 7386 | 7386 | 0, |
| 7387 | 7387 | $offset, |
@@ -7489,7 +7489,7 @@ discard block |
||
| 7489 | 7489 | */ |
| 7490 | 7490 | public static function str_surround(string $str, string $substring): string |
| 7491 | 7491 | { |
| 7492 | - return $substring . $str . $substring; |
|
| 7492 | + return $substring.$str.$substring; |
|
| 7493 | 7493 | } |
| 7494 | 7494 | |
| 7495 | 7495 | /** |
@@ -7545,9 +7545,9 @@ discard block |
||
| 7545 | 7545 | $word_define_chars = ''; |
| 7546 | 7546 | } |
| 7547 | 7547 | |
| 7548 | - $str = (string) \preg_replace_callback( |
|
| 7549 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
| 7550 | - static function (array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
| 7548 | + $str = (string)\preg_replace_callback( |
|
| 7549 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
| 7550 | + static function(array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
| 7551 | 7551 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
| 7552 | 7552 | return $match[0]; |
| 7553 | 7553 | } |
@@ -7638,16 +7638,16 @@ discard block |
||
| 7638 | 7638 | } |
| 7639 | 7639 | |
| 7640 | 7640 | // the main substitutions |
| 7641 | - $str = (string) \preg_replace_callback( |
|
| 7641 | + $str = (string)\preg_replace_callback( |
|
| 7642 | 7642 | '~\\b (_*) (?: # 1. Leading underscore and |
| 7643 | 7643 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
| 7644 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) # URL, domain, or email |
|
| 7644 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) # URL, domain, or email |
|
| 7645 | 7645 | | |
| 7646 | - ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' ) # 3. or small word (case-insensitive) |
|
| 7646 | + ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' ) # 3. or small word (case-insensitive) |
|
| 7647 | 7647 | | |
| 7648 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 4. or word w/o internal caps |
|
| 7648 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 4. or word w/o internal caps |
|
| 7649 | 7649 | | |
| 7650 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 5. or some other word |
|
| 7650 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 5. or some other word |
|
| 7651 | 7651 | ) (_*) \\b # 6. With trailing underscore |
| 7652 | 7652 | ~ux', |
| 7653 | 7653 | /** |
@@ -7655,7 +7655,7 @@ discard block |
||
| 7655 | 7655 | * |
| 7656 | 7656 | * @return string |
| 7657 | 7657 | */ |
| 7658 | - static function (array $matches) use ($encoding): string { |
|
| 7658 | + static function(array $matches) use ($encoding): string { |
|
| 7659 | 7659 | // preserve leading underscore |
| 7660 | 7660 | $str = $matches[1]; |
| 7661 | 7661 | if ($matches[2]) { |
@@ -7680,26 +7680,26 @@ discard block |
||
| 7680 | 7680 | ); |
| 7681 | 7681 | |
| 7682 | 7682 | // Exceptions for small words: capitalize at start of title... |
| 7683 | - $str = (string) \preg_replace_callback( |
|
| 7683 | + $str = (string)\preg_replace_callback( |
|
| 7684 | 7684 | '~( \\A [[:punct:]]* # start of title... |
| 7685 | 7685 | | [:.;?!][ ]+ # or of subsentence... |
| 7686 | 7686 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
| 7687 | - ( ' . $smallWordsRx . ' ) \\b # ...followed by small word |
|
| 7687 | + ( ' . $smallWordsRx.' ) \\b # ...followed by small word |
|
| 7688 | 7688 | ~uxi', |
| 7689 | 7689 | /** |
| 7690 | 7690 | * @param string[] $matches |
| 7691 | 7691 | * |
| 7692 | 7692 | * @return string |
| 7693 | 7693 | */ |
| 7694 | - static function (array $matches) use ($encoding): string { |
|
| 7695 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
| 7694 | + static function(array $matches) use ($encoding): string { |
|
| 7695 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
| 7696 | 7696 | }, |
| 7697 | 7697 | $str |
| 7698 | 7698 | ); |
| 7699 | 7699 | |
| 7700 | 7700 | // ...and end of title |
| 7701 | - $str = (string) \preg_replace_callback( |
|
| 7702 | - '~\\b ( ' . $smallWordsRx . ' ) # small word... |
|
| 7701 | + $str = (string)\preg_replace_callback( |
|
| 7702 | + '~\\b ( '.$smallWordsRx.' ) # small word... |
|
| 7703 | 7703 | (?= [[:punct:]]* \Z # ...at the end of the title... |
| 7704 | 7704 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
| 7705 | 7705 | ~uxi', |
@@ -7708,7 +7708,7 @@ discard block |
||
| 7708 | 7708 | * |
| 7709 | 7709 | * @return string |
| 7710 | 7710 | */ |
| 7711 | - static function (array $matches) use ($encoding): string { |
|
| 7711 | + static function(array $matches) use ($encoding): string { |
|
| 7712 | 7712 | return static::str_upper_first($matches[1], $encoding); |
| 7713 | 7713 | }, |
| 7714 | 7714 | $str |
@@ -7716,10 +7716,10 @@ discard block |
||
| 7716 | 7716 | |
| 7717 | 7717 | // Exceptions for small words in hyphenated compound words. |
| 7718 | 7718 | // e.g. "in-flight" -> In-Flight |
| 7719 | - $str = (string) \preg_replace_callback( |
|
| 7719 | + $str = (string)\preg_replace_callback( |
|
| 7720 | 7720 | '~\\b |
| 7721 | 7721 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
| 7722 | - ( ' . $smallWordsRx . ' ) |
|
| 7722 | + ( ' . $smallWordsRx.' ) |
|
| 7723 | 7723 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
| 7724 | 7724 | ~uxi', |
| 7725 | 7725 | /** |
@@ -7727,18 +7727,18 @@ discard block |
||
| 7727 | 7727 | * |
| 7728 | 7728 | * @return string |
| 7729 | 7729 | */ |
| 7730 | - static function (array $matches) use ($encoding): string { |
|
| 7730 | + static function(array $matches) use ($encoding): string { |
|
| 7731 | 7731 | return static::str_upper_first($matches[1], $encoding); |
| 7732 | 7732 | }, |
| 7733 | 7733 | $str |
| 7734 | 7734 | ); |
| 7735 | 7735 | |
| 7736 | 7736 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
| 7737 | - $str = (string) \preg_replace_callback( |
|
| 7737 | + $str = (string)\preg_replace_callback( |
|
| 7738 | 7738 | '~\\b |
| 7739 | 7739 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
| 7740 | 7740 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
| 7741 | - ( ' . $smallWordsRx . ' ) # ...followed by small word |
|
| 7741 | + ( ' . $smallWordsRx.' ) # ...followed by small word |
|
| 7742 | 7742 | (?! - ) # Negative lookahead for another - |
| 7743 | 7743 | ~uxi', |
| 7744 | 7744 | /** |
@@ -7746,8 +7746,8 @@ discard block |
||
| 7746 | 7746 | * |
| 7747 | 7747 | * @return string |
| 7748 | 7748 | */ |
| 7749 | - static function (array $matches) use ($encoding): string { |
|
| 7750 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
| 7749 | + static function(array $matches) use ($encoding): string { |
|
| 7750 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
| 7751 | 7751 | }, |
| 7752 | 7752 | $str |
| 7753 | 7753 | ); |
@@ -7855,7 +7855,7 @@ discard block |
||
| 7855 | 7855 | ); |
| 7856 | 7856 | |
| 7857 | 7857 | foreach ($tmpReturn as &$item) { |
| 7858 | - $item = (string) $item; |
|
| 7858 | + $item = (string)$item; |
|
| 7859 | 7859 | } |
| 7860 | 7860 | |
| 7861 | 7861 | return $tmpReturn; |
@@ -7901,39 +7901,39 @@ discard block |
||
| 7901 | 7901 | } |
| 7902 | 7902 | |
| 7903 | 7903 | if ($encoding === 'UTF-8') { |
| 7904 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 7904 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 7905 | 7905 | return $str; |
| 7906 | 7906 | } |
| 7907 | 7907 | |
| 7908 | 7908 | if ($substring !== '') { |
| 7909 | - $length -= (int) \mb_strlen($substring); |
|
| 7909 | + $length -= (int)\mb_strlen($substring); |
|
| 7910 | 7910 | |
| 7911 | 7911 | /** @noinspection UnnecessaryCastingInspection */ |
| 7912 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
| 7912 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
| 7913 | 7913 | } |
| 7914 | 7914 | |
| 7915 | 7915 | /** @noinspection UnnecessaryCastingInspection */ |
| 7916 | - return (string) \mb_substr($str, 0, $length); |
|
| 7916 | + return (string)\mb_substr($str, 0, $length); |
|
| 7917 | 7917 | } |
| 7918 | 7918 | |
| 7919 | 7919 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7920 | 7920 | |
| 7921 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 7921 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 7922 | 7922 | return $str; |
| 7923 | 7923 | } |
| 7924 | 7924 | |
| 7925 | 7925 | if ($substring !== '') { |
| 7926 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 7926 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 7927 | 7927 | } |
| 7928 | 7928 | |
| 7929 | 7929 | return ( |
| 7930 | - (string) self::substr( |
|
| 7930 | + (string)self::substr( |
|
| 7931 | 7931 | $str, |
| 7932 | 7932 | 0, |
| 7933 | 7933 | $length, |
| 7934 | 7934 | $encoding |
| 7935 | 7935 | ) |
| 7936 | - ) . $substring; |
|
| 7936 | + ).$substring; |
|
| 7937 | 7937 | } |
| 7938 | 7938 | |
| 7939 | 7939 | /** |
@@ -7963,12 +7963,12 @@ discard block |
||
| 7963 | 7963 | } |
| 7964 | 7964 | |
| 7965 | 7965 | if ($encoding === 'UTF-8') { |
| 7966 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 7966 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 7967 | 7967 | return $str; |
| 7968 | 7968 | } |
| 7969 | 7969 | |
| 7970 | 7970 | // need to further trim the string so we can append the substring |
| 7971 | - $length -= (int) \mb_strlen($substring); |
|
| 7971 | + $length -= (int)\mb_strlen($substring); |
|
| 7972 | 7972 | if ($length <= 0) { |
| 7973 | 7973 | return $substring; |
| 7974 | 7974 | } |
@@ -7990,18 +7990,18 @@ discard block |
||
| 7990 | 7990 | || |
| 7991 | 7991 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
| 7992 | 7992 | ) { |
| 7993 | - $truncated = (string) \mb_substr($truncated, 0, (int) $lastPos); |
|
| 7993 | + $truncated = (string)\mb_substr($truncated, 0, (int)$lastPos); |
|
| 7994 | 7994 | } |
| 7995 | 7995 | } |
| 7996 | 7996 | } else { |
| 7997 | 7997 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7998 | 7998 | |
| 7999 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 7999 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 8000 | 8000 | return $str; |
| 8001 | 8001 | } |
| 8002 | 8002 | |
| 8003 | 8003 | // need to further trim the string so we can append the substring |
| 8004 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 8004 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 8005 | 8005 | if ($length <= 0) { |
| 8006 | 8006 | return $substring; |
| 8007 | 8007 | } |
@@ -8023,12 +8023,12 @@ discard block |
||
| 8023 | 8023 | || |
| 8024 | 8024 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
| 8025 | 8025 | ) { |
| 8026 | - $truncated = (string) self::substr($truncated, 0, (int) $lastPos, $encoding); |
|
| 8026 | + $truncated = (string)self::substr($truncated, 0, (int)$lastPos, $encoding); |
|
| 8027 | 8027 | } |
| 8028 | 8028 | } |
| 8029 | 8029 | } |
| 8030 | 8030 | |
| 8031 | - return $truncated . $substring; |
|
| 8031 | + return $truncated.$substring; |
|
| 8032 | 8032 | } |
| 8033 | 8033 | |
| 8034 | 8034 | /** |
@@ -8125,13 +8125,13 @@ discard block |
||
| 8125 | 8125 | } |
| 8126 | 8126 | } elseif ($format === 2) { |
| 8127 | 8127 | $numberOfWords = []; |
| 8128 | - $offset = (int) self::strlen($strParts[0]); |
|
| 8128 | + $offset = (int)self::strlen($strParts[0]); |
|
| 8129 | 8129 | for ($i = 1; $i < $len; $i += 2) { |
| 8130 | 8130 | $numberOfWords[$offset] = $strParts[$i]; |
| 8131 | - $offset += (int) self::strlen($strParts[$i]) + (int) self::strlen($strParts[$i + 1]); |
|
| 8131 | + $offset += (int)self::strlen($strParts[$i]) + (int)self::strlen($strParts[$i + 1]); |
|
| 8132 | 8132 | } |
| 8133 | 8133 | } else { |
| 8134 | - $numberOfWords = (int) (($len - 1) / 2); |
|
| 8134 | + $numberOfWords = (int)(($len - 1) / 2); |
|
| 8135 | 8135 | } |
| 8136 | 8136 | |
| 8137 | 8137 | return $numberOfWords; |
@@ -8228,21 +8228,21 @@ discard block |
||
| 8228 | 8228 | } |
| 8229 | 8229 | |
| 8230 | 8230 | if ($charList === '') { |
| 8231 | - return (int) self::strlen($str, $encoding); |
|
| 8231 | + return (int)self::strlen($str, $encoding); |
|
| 8232 | 8232 | } |
| 8233 | 8233 | |
| 8234 | 8234 | if ($offset !== null || $length !== null) { |
| 8235 | 8235 | if ($encoding === 'UTF-8') { |
| 8236 | 8236 | if ($length === null) { |
| 8237 | 8237 | /** @noinspection UnnecessaryCastingInspection */ |
| 8238 | - $strTmp = \mb_substr($str, (int) $offset); |
|
| 8238 | + $strTmp = \mb_substr($str, (int)$offset); |
|
| 8239 | 8239 | } else { |
| 8240 | 8240 | /** @noinspection UnnecessaryCastingInspection */ |
| 8241 | - $strTmp = \mb_substr($str, (int) $offset, $length); |
|
| 8241 | + $strTmp = \mb_substr($str, (int)$offset, $length); |
|
| 8242 | 8242 | } |
| 8243 | 8243 | } else { |
| 8244 | 8244 | /** @noinspection UnnecessaryCastingInspection */ |
| 8245 | - $strTmp = self::substr($str, (int) $offset, $length, $encoding); |
|
| 8245 | + $strTmp = self::substr($str, (int)$offset, $length, $encoding); |
|
| 8246 | 8246 | } |
| 8247 | 8247 | |
| 8248 | 8248 | if ($strTmp === false) { |
@@ -8257,7 +8257,7 @@ discard block |
||
| 8257 | 8257 | } |
| 8258 | 8258 | |
| 8259 | 8259 | $matches = []; |
| 8260 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $matches)) { |
|
| 8260 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $matches)) { |
|
| 8261 | 8261 | $return = self::strlen($matches[1], $encoding); |
| 8262 | 8262 | if ($return === false) { |
| 8263 | 8263 | return 0; |
@@ -8266,7 +8266,7 @@ discard block |
||
| 8266 | 8266 | return $return; |
| 8267 | 8267 | } |
| 8268 | 8268 | |
| 8269 | - return (int) self::strlen($str, $encoding); |
|
| 8269 | + return (int)self::strlen($str, $encoding); |
|
| 8270 | 8270 | } |
| 8271 | 8271 | |
| 8272 | 8272 | /** |
@@ -8388,7 +8388,7 @@ discard block |
||
| 8388 | 8388 | return ''; |
| 8389 | 8389 | } |
| 8390 | 8390 | |
| 8391 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
| 8391 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
| 8392 | 8392 | } |
| 8393 | 8393 | |
| 8394 | 8394 | /** |
@@ -8453,7 +8453,7 @@ discard block |
||
| 8453 | 8453 | // fallback for ascii only |
| 8454 | 8454 | // |
| 8455 | 8455 | |
| 8456 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 8456 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 8457 | 8457 | return \stripos($haystack, $needle, $offset); |
| 8458 | 8458 | } |
| 8459 | 8459 | |
@@ -8520,7 +8520,7 @@ discard block |
||
| 8520 | 8520 | && |
| 8521 | 8521 | self::$SUPPORT['mbstring'] === false |
| 8522 | 8522 | ) { |
| 8523 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 8523 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 8524 | 8524 | } |
| 8525 | 8525 | |
| 8526 | 8526 | if ( |
@@ -8534,11 +8534,11 @@ discard block |
||
| 8534 | 8534 | } |
| 8535 | 8535 | } |
| 8536 | 8536 | |
| 8537 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
| 8537 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
| 8538 | 8538 | return \stristr($haystack, $needle, $before_needle); |
| 8539 | 8539 | } |
| 8540 | 8540 | |
| 8541 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
| 8541 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
| 8542 | 8542 | |
| 8543 | 8543 | if (!isset($match[1])) { |
| 8544 | 8544 | return false; |
@@ -8548,7 +8548,7 @@ discard block |
||
| 8548 | 8548 | return $match[1]; |
| 8549 | 8549 | } |
| 8550 | 8550 | |
| 8551 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
| 8551 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
| 8552 | 8552 | } |
| 8553 | 8553 | |
| 8554 | 8554 | /** |
@@ -8615,7 +8615,7 @@ discard block |
||
| 8615 | 8615 | && |
| 8616 | 8616 | self::$SUPPORT['iconv'] === false |
| 8617 | 8617 | ) { |
| 8618 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 8618 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 8619 | 8619 | } |
| 8620 | 8620 | |
| 8621 | 8621 | // |
@@ -8731,8 +8731,8 @@ discard block |
||
| 8731 | 8731 | } |
| 8732 | 8732 | |
| 8733 | 8733 | return \strnatcmp( |
| 8734 | - (string) self::strtonatfold($str1), |
|
| 8735 | - (string) self::strtonatfold($str2) |
|
| 8734 | + (string)self::strtonatfold($str1), |
|
| 8735 | + (string)self::strtonatfold($str2) |
|
| 8736 | 8736 | ); |
| 8737 | 8737 | } |
| 8738 | 8738 | |
@@ -8790,11 +8790,11 @@ discard block |
||
| 8790 | 8790 | } |
| 8791 | 8791 | |
| 8792 | 8792 | if ($encoding === 'UTF-8') { |
| 8793 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
| 8794 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
| 8793 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
| 8794 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
| 8795 | 8795 | } else { |
| 8796 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
| 8797 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
| 8796 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
| 8797 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
| 8798 | 8798 | } |
| 8799 | 8799 | |
| 8800 | 8800 | return self::strcmp($str1, $str2); |
@@ -8816,8 +8816,8 @@ discard block |
||
| 8816 | 8816 | return false; |
| 8817 | 8817 | } |
| 8818 | 8818 | |
| 8819 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
| 8820 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
| 8819 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
| 8820 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
| 8821 | 8821 | } |
| 8822 | 8822 | |
| 8823 | 8823 | return false; |
@@ -8850,10 +8850,10 @@ discard block |
||
| 8850 | 8850 | } |
| 8851 | 8851 | |
| 8852 | 8852 | // iconv and mbstring do not support integer $needle |
| 8853 | - if ((int) $needle === $needle) { |
|
| 8854 | - $needle = (string) self::chr($needle); |
|
| 8853 | + if ((int)$needle === $needle) { |
|
| 8854 | + $needle = (string)self::chr($needle); |
|
| 8855 | 8855 | } |
| 8856 | - $needle = (string) $needle; |
|
| 8856 | + $needle = (string)$needle; |
|
| 8857 | 8857 | |
| 8858 | 8858 | if ($needle === '') { |
| 8859 | 8859 | return false; |
@@ -8900,7 +8900,7 @@ discard block |
||
| 8900 | 8900 | && |
| 8901 | 8901 | self::$SUPPORT['mbstring'] === false |
| 8902 | 8902 | ) { |
| 8903 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 8903 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 8904 | 8904 | } |
| 8905 | 8905 | |
| 8906 | 8906 | // |
@@ -8941,7 +8941,7 @@ discard block |
||
| 8941 | 8941 | // fallback for ascii only |
| 8942 | 8942 | // |
| 8943 | 8943 | |
| 8944 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 8944 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 8945 | 8945 | return \strpos($haystack, $needle, $offset); |
| 8946 | 8946 | } |
| 8947 | 8947 | |
@@ -8953,7 +8953,7 @@ discard block |
||
| 8953 | 8953 | if ($haystackTmp === false) { |
| 8954 | 8954 | $haystackTmp = ''; |
| 8955 | 8955 | } |
| 8956 | - $haystack = (string) $haystackTmp; |
|
| 8956 | + $haystack = (string)$haystackTmp; |
|
| 8957 | 8957 | |
| 8958 | 8958 | if ($offset < 0) { |
| 8959 | 8959 | $offset = 0; |
@@ -8965,7 +8965,7 @@ discard block |
||
| 8965 | 8965 | } |
| 8966 | 8966 | |
| 8967 | 8967 | if ($pos) { |
| 8968 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 8968 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 8969 | 8969 | } |
| 8970 | 8970 | |
| 8971 | 8971 | return $offset + 0; |
@@ -9076,7 +9076,7 @@ discard block |
||
| 9076 | 9076 | && |
| 9077 | 9077 | self::$SUPPORT['mbstring'] === false |
| 9078 | 9078 | ) { |
| 9079 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9079 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9080 | 9080 | } |
| 9081 | 9081 | |
| 9082 | 9082 | // |
@@ -9088,7 +9088,7 @@ discard block |
||
| 9088 | 9088 | if ($needleTmp === false) { |
| 9089 | 9089 | return false; |
| 9090 | 9090 | } |
| 9091 | - $needle = (string) $needleTmp; |
|
| 9091 | + $needle = (string)$needleTmp; |
|
| 9092 | 9092 | |
| 9093 | 9093 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
| 9094 | 9094 | if ($pos === false) { |
@@ -9110,7 +9110,7 @@ discard block |
||
| 9110 | 9110 | if ($needleTmp === false) { |
| 9111 | 9111 | return false; |
| 9112 | 9112 | } |
| 9113 | - $needle = (string) $needleTmp; |
|
| 9113 | + $needle = (string)$needleTmp; |
|
| 9114 | 9114 | |
| 9115 | 9115 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
| 9116 | 9116 | if ($pos === false) { |
@@ -9146,7 +9146,7 @@ discard block |
||
| 9146 | 9146 | if ($encoding === 'UTF-8') { |
| 9147 | 9147 | if (self::$SUPPORT['intl'] === true) { |
| 9148 | 9148 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
| 9149 | - $i = (int) \grapheme_strlen($str); |
|
| 9149 | + $i = (int)\grapheme_strlen($str); |
|
| 9150 | 9150 | while ($i--) { |
| 9151 | 9151 | $reversedTmp = \grapheme_substr($str, $i, 1); |
| 9152 | 9152 | if ($reversedTmp !== false) { |
@@ -9154,7 +9154,7 @@ discard block |
||
| 9154 | 9154 | } |
| 9155 | 9155 | } |
| 9156 | 9156 | } else { |
| 9157 | - $i = (int) \mb_strlen($str); |
|
| 9157 | + $i = (int)\mb_strlen($str); |
|
| 9158 | 9158 | while ($i--) { |
| 9159 | 9159 | $reversedTmp = \mb_substr($str, $i, 1); |
| 9160 | 9160 | if ($reversedTmp !== false) { |
@@ -9165,7 +9165,7 @@ discard block |
||
| 9165 | 9165 | } else { |
| 9166 | 9166 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 9167 | 9167 | |
| 9168 | - $i = (int) self::strlen($str, $encoding); |
|
| 9168 | + $i = (int)self::strlen($str, $encoding); |
|
| 9169 | 9169 | while ($i--) { |
| 9170 | 9170 | $reversedTmp = self::substr($str, $i, 1, $encoding); |
| 9171 | 9171 | if ($reversedTmp !== false) { |
@@ -9239,7 +9239,7 @@ discard block |
||
| 9239 | 9239 | if ($needleTmp === false) { |
| 9240 | 9240 | return false; |
| 9241 | 9241 | } |
| 9242 | - $needle = (string) $needleTmp; |
|
| 9242 | + $needle = (string)$needleTmp; |
|
| 9243 | 9243 | |
| 9244 | 9244 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
| 9245 | 9245 | if ($pos === false) { |
@@ -9278,10 +9278,10 @@ discard block |
||
| 9278 | 9278 | } |
| 9279 | 9279 | |
| 9280 | 9280 | // iconv and mbstring do not support integer $needle |
| 9281 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 9282 | - $needle = (string) self::chr($needle); |
|
| 9281 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 9282 | + $needle = (string)self::chr($needle); |
|
| 9283 | 9283 | } |
| 9284 | - $needle = (string) $needle; |
|
| 9284 | + $needle = (string)$needle; |
|
| 9285 | 9285 | |
| 9286 | 9286 | if ($needle === '') { |
| 9287 | 9287 | return false; |
@@ -9326,7 +9326,7 @@ discard block |
||
| 9326 | 9326 | && |
| 9327 | 9327 | self::$SUPPORT['mbstring'] === false |
| 9328 | 9328 | ) { |
| 9329 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9329 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9330 | 9330 | } |
| 9331 | 9331 | |
| 9332 | 9332 | // |
@@ -9350,7 +9350,7 @@ discard block |
||
| 9350 | 9350 | // fallback for ascii only |
| 9351 | 9351 | // |
| 9352 | 9352 | |
| 9353 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 9353 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 9354 | 9354 | return \strripos($haystack, $needle, $offset); |
| 9355 | 9355 | } |
| 9356 | 9356 | |
@@ -9426,10 +9426,10 @@ discard block |
||
| 9426 | 9426 | } |
| 9427 | 9427 | |
| 9428 | 9428 | // iconv and mbstring do not support integer $needle |
| 9429 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 9430 | - $needle = (string) self::chr($needle); |
|
| 9429 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 9430 | + $needle = (string)self::chr($needle); |
|
| 9431 | 9431 | } |
| 9432 | - $needle = (string) $needle; |
|
| 9432 | + $needle = (string)$needle; |
|
| 9433 | 9433 | |
| 9434 | 9434 | if ($needle === '') { |
| 9435 | 9435 | return false; |
@@ -9474,7 +9474,7 @@ discard block |
||
| 9474 | 9474 | && |
| 9475 | 9475 | self::$SUPPORT['mbstring'] === false |
| 9476 | 9476 | ) { |
| 9477 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9477 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9478 | 9478 | } |
| 9479 | 9479 | |
| 9480 | 9480 | // |
@@ -9498,7 +9498,7 @@ discard block |
||
| 9498 | 9498 | // fallback for ascii only |
| 9499 | 9499 | // |
| 9500 | 9500 | |
| 9501 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 9501 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 9502 | 9502 | return \strrpos($haystack, $needle, $offset); |
| 9503 | 9503 | } |
| 9504 | 9504 | |
@@ -9518,7 +9518,7 @@ discard block |
||
| 9518 | 9518 | if ($haystackTmp === false) { |
| 9519 | 9519 | $haystackTmp = ''; |
| 9520 | 9520 | } |
| 9521 | - $haystack = (string) $haystackTmp; |
|
| 9521 | + $haystack = (string)$haystackTmp; |
|
| 9522 | 9522 | } |
| 9523 | 9523 | |
| 9524 | 9524 | $pos = \strrpos($haystack, $needle); |
@@ -9531,7 +9531,7 @@ discard block |
||
| 9531 | 9531 | return false; |
| 9532 | 9532 | } |
| 9533 | 9533 | |
| 9534 | - return $offset + (int) self::strlen($strTmp); |
|
| 9534 | + return $offset + (int)self::strlen($strTmp); |
|
| 9535 | 9535 | } |
| 9536 | 9536 | |
| 9537 | 9537 | /** |
@@ -9591,12 +9591,12 @@ discard block |
||
| 9591 | 9591 | if ($offset || $length !== null) { |
| 9592 | 9592 | if ($encoding === 'UTF-8') { |
| 9593 | 9593 | if ($length === null) { |
| 9594 | - $str = (string) \mb_substr($str, $offset); |
|
| 9594 | + $str = (string)\mb_substr($str, $offset); |
|
| 9595 | 9595 | } else { |
| 9596 | - $str = (string) \mb_substr($str, $offset, $length); |
|
| 9596 | + $str = (string)\mb_substr($str, $offset, $length); |
|
| 9597 | 9597 | } |
| 9598 | 9598 | } else { |
| 9599 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
| 9599 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
| 9600 | 9600 | } |
| 9601 | 9601 | } |
| 9602 | 9602 | |
@@ -9606,7 +9606,7 @@ discard block |
||
| 9606 | 9606 | |
| 9607 | 9607 | $matches = []; |
| 9608 | 9608 | |
| 9609 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
| 9609 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
| 9610 | 9610 | } |
| 9611 | 9611 | |
| 9612 | 9612 | /** |
@@ -9675,7 +9675,7 @@ discard block |
||
| 9675 | 9675 | && |
| 9676 | 9676 | self::$SUPPORT['mbstring'] === false |
| 9677 | 9677 | ) { |
| 9678 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9678 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9679 | 9679 | } |
| 9680 | 9680 | |
| 9681 | 9681 | // |
@@ -9697,7 +9697,7 @@ discard block |
||
| 9697 | 9697 | // fallback for ascii only |
| 9698 | 9698 | // |
| 9699 | 9699 | |
| 9700 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 9700 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 9701 | 9701 | return \strstr($haystack, $needle, $before_needle); |
| 9702 | 9702 | } |
| 9703 | 9703 | |
@@ -9705,7 +9705,7 @@ discard block |
||
| 9705 | 9705 | // fallback via vanilla php |
| 9706 | 9706 | // |
| 9707 | 9707 | |
| 9708 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
| 9708 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
| 9709 | 9709 | |
| 9710 | 9710 | if (!isset($match[1])) { |
| 9711 | 9711 | return false; |
@@ -9715,7 +9715,7 @@ discard block |
||
| 9715 | 9715 | return $match[1]; |
| 9716 | 9716 | } |
| 9717 | 9717 | |
| 9718 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
| 9718 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
| 9719 | 9719 | } |
| 9720 | 9720 | |
| 9721 | 9721 | /** |
@@ -9829,7 +9829,7 @@ discard block |
||
| 9829 | 9829 | bool $tryToKeepStringLength = false |
| 9830 | 9830 | ): string { |
| 9831 | 9831 | // init |
| 9832 | - $str = (string) $str; |
|
| 9832 | + $str = (string)$str; |
|
| 9833 | 9833 | |
| 9834 | 9834 | if ($str === '') { |
| 9835 | 9835 | return ''; |
@@ -9858,19 +9858,19 @@ discard block |
||
| 9858 | 9858 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 9859 | 9859 | } |
| 9860 | 9860 | |
| 9861 | - $langCode = $lang . '-Lower'; |
|
| 9861 | + $langCode = $lang.'-Lower'; |
|
| 9862 | 9862 | if (!\in_array($langCode, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 9863 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
| 9863 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
| 9864 | 9864 | |
| 9865 | 9865 | $langCode = 'Any-Lower'; |
| 9866 | 9866 | } |
| 9867 | 9867 | |
| 9868 | 9868 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 9869 | 9869 | /** @noinspection UnnecessaryCastingInspection */ |
| 9870 | - return (string) \transliterator_transliterate($langCode, $str); |
|
| 9870 | + return (string)\transliterator_transliterate($langCode, $str); |
|
| 9871 | 9871 | } |
| 9872 | 9872 | |
| 9873 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
| 9873 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
| 9874 | 9874 | } |
| 9875 | 9875 | |
| 9876 | 9876 | // always fallback via symfony polyfill |
@@ -9899,7 +9899,7 @@ discard block |
||
| 9899 | 9899 | bool $tryToKeepStringLength = false |
| 9900 | 9900 | ): string { |
| 9901 | 9901 | // init |
| 9902 | - $str = (string) $str; |
|
| 9902 | + $str = (string)$str; |
|
| 9903 | 9903 | |
| 9904 | 9904 | if ($str === '') { |
| 9905 | 9905 | return ''; |
@@ -9928,19 +9928,19 @@ discard block |
||
| 9928 | 9928 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 9929 | 9929 | } |
| 9930 | 9930 | |
| 9931 | - $langCode = $lang . '-Upper'; |
|
| 9931 | + $langCode = $lang.'-Upper'; |
|
| 9932 | 9932 | if (!\in_array($langCode, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 9933 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
| 9933 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
| 9934 | 9934 | |
| 9935 | 9935 | $langCode = 'Any-Upper'; |
| 9936 | 9936 | } |
| 9937 | 9937 | |
| 9938 | 9938 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 9939 | 9939 | /** @noinspection UnnecessaryCastingInspection */ |
| 9940 | - return (string) \transliterator_transliterate($langCode, $str); |
|
| 9940 | + return (string)\transliterator_transliterate($langCode, $str); |
|
| 9941 | 9941 | } |
| 9942 | 9942 | |
| 9943 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
| 9943 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
| 9944 | 9944 | } |
| 9945 | 9945 | |
| 9946 | 9946 | // always fallback via symfony polyfill |
@@ -9985,7 +9985,7 @@ discard block |
||
| 9985 | 9985 | $from = \array_combine($from, $to); |
| 9986 | 9986 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 9987 | 9987 | if ($from === false) { |
| 9988 | - 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) . ')'); |
|
| 9988 | + 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).')'); |
|
| 9989 | 9989 | } |
| 9990 | 9990 | } |
| 9991 | 9991 | |
@@ -10042,9 +10042,9 @@ discard block |
||
| 10042 | 10042 | } |
| 10043 | 10043 | |
| 10044 | 10044 | $wide = 0; |
| 10045 | - $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); |
|
| 10045 | + $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); |
|
| 10046 | 10046 | |
| 10047 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
| 10047 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
| 10048 | 10048 | } |
| 10049 | 10049 | |
| 10050 | 10050 | /** |
@@ -10144,9 +10144,9 @@ discard block |
||
| 10144 | 10144 | } |
| 10145 | 10145 | |
| 10146 | 10146 | if ($length === null) { |
| 10147 | - $length = (int) $str_length; |
|
| 10147 | + $length = (int)$str_length; |
|
| 10148 | 10148 | } else { |
| 10149 | - $length = (int) $length; |
|
| 10149 | + $length = (int)$length; |
|
| 10150 | 10150 | } |
| 10151 | 10151 | |
| 10152 | 10152 | if ( |
@@ -10154,7 +10154,7 @@ discard block |
||
| 10154 | 10154 | && |
| 10155 | 10155 | self::$SUPPORT['mbstring'] === false |
| 10156 | 10156 | ) { |
| 10157 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10157 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10158 | 10158 | } |
| 10159 | 10159 | |
| 10160 | 10160 | // |
@@ -10242,16 +10242,16 @@ discard block |
||
| 10242 | 10242 | ) { |
| 10243 | 10243 | if ($encoding === 'UTF-8') { |
| 10244 | 10244 | if ($length === null) { |
| 10245 | - $str1 = (string) \mb_substr($str1, $offset); |
|
| 10245 | + $str1 = (string)\mb_substr($str1, $offset); |
|
| 10246 | 10246 | } else { |
| 10247 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
| 10247 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
| 10248 | 10248 | } |
| 10249 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
| 10249 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
| 10250 | 10250 | } else { |
| 10251 | 10251 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 10252 | 10252 | |
| 10253 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
| 10254 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
| 10253 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
| 10254 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
| 10255 | 10255 | } |
| 10256 | 10256 | } |
| 10257 | 10257 | |
@@ -10313,13 +10313,13 @@ discard block |
||
| 10313 | 10313 | if ($lengthTmp === false) { |
| 10314 | 10314 | return false; |
| 10315 | 10315 | } |
| 10316 | - $length = (int) $lengthTmp; |
|
| 10316 | + $length = (int)$lengthTmp; |
|
| 10317 | 10317 | } |
| 10318 | 10318 | |
| 10319 | 10319 | if ($encoding === 'UTF-8') { |
| 10320 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
| 10320 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
| 10321 | 10321 | } else { |
| 10322 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
| 10322 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
| 10323 | 10323 | } |
| 10324 | 10324 | } |
| 10325 | 10325 | |
@@ -10328,7 +10328,7 @@ discard block |
||
| 10328 | 10328 | && |
| 10329 | 10329 | self::$SUPPORT['mbstring'] === false |
| 10330 | 10330 | ) { |
| 10331 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10331 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10332 | 10332 | } |
| 10333 | 10333 | |
| 10334 | 10334 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10339,7 +10339,7 @@ discard block |
||
| 10339 | 10339 | return \mb_substr_count($haystack, $needle, $encoding); |
| 10340 | 10340 | } |
| 10341 | 10341 | |
| 10342 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 10342 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 10343 | 10343 | |
| 10344 | 10344 | return \count($matches); |
| 10345 | 10345 | } |
@@ -10386,7 +10386,7 @@ discard block |
||
| 10386 | 10386 | if ($lengthTmp === false) { |
| 10387 | 10387 | return false; |
| 10388 | 10388 | } |
| 10389 | - $length = (int) $lengthTmp; |
|
| 10389 | + $length = (int)$lengthTmp; |
|
| 10390 | 10390 | } |
| 10391 | 10391 | |
| 10392 | 10392 | if ( |
@@ -10407,7 +10407,7 @@ discard block |
||
| 10407 | 10407 | if ($haystackTmp === false) { |
| 10408 | 10408 | $haystackTmp = ''; |
| 10409 | 10409 | } |
| 10410 | - $haystack = (string) $haystackTmp; |
|
| 10410 | + $haystack = (string)$haystackTmp; |
|
| 10411 | 10411 | } |
| 10412 | 10412 | |
| 10413 | 10413 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10446,10 +10446,10 @@ discard block |
||
| 10446 | 10446 | |
| 10447 | 10447 | if ($encoding === 'UTF-8') { |
| 10448 | 10448 | if ($caseSensitive) { |
| 10449 | - return (int) \mb_substr_count($str, $substring); |
|
| 10449 | + return (int)\mb_substr_count($str, $substring); |
|
| 10450 | 10450 | } |
| 10451 | 10451 | |
| 10452 | - return (int) \mb_substr_count( |
|
| 10452 | + return (int)\mb_substr_count( |
|
| 10453 | 10453 | \mb_strtoupper($str), |
| 10454 | 10454 | \mb_strtoupper($substring) |
| 10455 | 10455 | ); |
@@ -10458,10 +10458,10 @@ discard block |
||
| 10458 | 10458 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 10459 | 10459 | |
| 10460 | 10460 | if ($caseSensitive) { |
| 10461 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
| 10461 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
| 10462 | 10462 | } |
| 10463 | 10463 | |
| 10464 | - return (int) \mb_substr_count( |
|
| 10464 | + return (int)\mb_substr_count( |
|
| 10465 | 10465 | self::strtocasefold($str, true, false, $encoding, null, false), |
| 10466 | 10466 | self::strtocasefold($substring, true, false, $encoding, null, false), |
| 10467 | 10467 | $encoding |
@@ -10487,7 +10487,7 @@ discard block |
||
| 10487 | 10487 | } |
| 10488 | 10488 | |
| 10489 | 10489 | if (self::str_istarts_with($haystack, $needle) === true) { |
| 10490 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 10490 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 10491 | 10491 | } |
| 10492 | 10492 | |
| 10493 | 10493 | return $haystack; |
@@ -10544,7 +10544,7 @@ discard block |
||
| 10544 | 10544 | } |
| 10545 | 10545 | |
| 10546 | 10546 | if (self::str_iends_with($haystack, $needle) === true) { |
| 10547 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
| 10547 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
| 10548 | 10548 | } |
| 10549 | 10549 | |
| 10550 | 10550 | return $haystack; |
@@ -10569,7 +10569,7 @@ discard block |
||
| 10569 | 10569 | } |
| 10570 | 10570 | |
| 10571 | 10571 | if (self::str_starts_with($haystack, $needle) === true) { |
| 10572 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 10572 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 10573 | 10573 | } |
| 10574 | 10574 | |
| 10575 | 10575 | return $haystack; |
@@ -10621,7 +10621,7 @@ discard block |
||
| 10621 | 10621 | if (\is_array($offset) === true) { |
| 10622 | 10622 | $offset = \array_slice($offset, 0, $num); |
| 10623 | 10623 | foreach ($offset as &$valueTmp) { |
| 10624 | - $valueTmp = (int) $valueTmp === $valueTmp ? $valueTmp : 0; |
|
| 10624 | + $valueTmp = (int)$valueTmp === $valueTmp ? $valueTmp : 0; |
|
| 10625 | 10625 | } |
| 10626 | 10626 | unset($valueTmp); |
| 10627 | 10627 | } else { |
@@ -10634,7 +10634,7 @@ discard block |
||
| 10634 | 10634 | } elseif (\is_array($length) === true) { |
| 10635 | 10635 | $length = \array_slice($length, 0, $num); |
| 10636 | 10636 | foreach ($length as &$valueTmpV2) { |
| 10637 | - $valueTmpV2 = (int) $valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
| 10637 | + $valueTmpV2 = (int)$valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
| 10638 | 10638 | } |
| 10639 | 10639 | unset($valueTmpV2); |
| 10640 | 10640 | } else { |
@@ -10654,8 +10654,8 @@ discard block |
||
| 10654 | 10654 | } |
| 10655 | 10655 | |
| 10656 | 10656 | // init |
| 10657 | - $str = (string) $str; |
|
| 10658 | - $replacement = (string) $replacement; |
|
| 10657 | + $str = (string)$str; |
|
| 10658 | + $replacement = (string)$replacement; |
|
| 10659 | 10659 | |
| 10660 | 10660 | if (\is_array($length) === true) { |
| 10661 | 10661 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -10670,16 +10670,16 @@ discard block |
||
| 10670 | 10670 | } |
| 10671 | 10671 | |
| 10672 | 10672 | if (self::$SUPPORT['mbstring'] === true) { |
| 10673 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 10673 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 10674 | 10674 | |
| 10675 | 10675 | if ($offset < 0) { |
| 10676 | - $offset = (int) \max(0, $string_length + $offset); |
|
| 10676 | + $offset = (int)\max(0, $string_length + $offset); |
|
| 10677 | 10677 | } elseif ($offset > $string_length) { |
| 10678 | 10678 | $offset = $string_length; |
| 10679 | 10679 | } |
| 10680 | 10680 | |
| 10681 | 10681 | if ($length !== null && $length < 0) { |
| 10682 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
| 10682 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
| 10683 | 10683 | } elseif ($length === null || $length > $string_length) { |
| 10684 | 10684 | $length = $string_length; |
| 10685 | 10685 | } |
@@ -10690,9 +10690,9 @@ discard block |
||
| 10690 | 10690 | } |
| 10691 | 10691 | |
| 10692 | 10692 | /** @noinspection AdditionOperationOnArraysInspection */ |
| 10693 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
| 10694 | - $replacement . |
|
| 10695 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 10693 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
| 10694 | + $replacement. |
|
| 10695 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 10696 | 10696 | } |
| 10697 | 10697 | |
| 10698 | 10698 | // |
@@ -10701,8 +10701,7 @@ discard block |
||
| 10701 | 10701 | |
| 10702 | 10702 | if (ASCII::is_ascii($str)) { |
| 10703 | 10703 | return ($length === null) ? |
| 10704 | - \substr_replace($str, $replacement, $offset) : |
|
| 10705 | - \substr_replace($str, $replacement, $offset, $length); |
|
| 10704 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
| 10706 | 10705 | } |
| 10707 | 10706 | |
| 10708 | 10707 | // |
@@ -10718,7 +10717,7 @@ discard block |
||
| 10718 | 10717 | // e.g.: non mbstring support + invalid chars |
| 10719 | 10718 | return ''; |
| 10720 | 10719 | } |
| 10721 | - $length = (int) $lengthTmp; |
|
| 10720 | + $length = (int)$lengthTmp; |
|
| 10722 | 10721 | } |
| 10723 | 10722 | |
| 10724 | 10723 | \array_splice($smatches[0], $offset, $length, $rmatches[0]); |
@@ -10753,14 +10752,14 @@ discard block |
||
| 10753 | 10752 | && |
| 10754 | 10753 | \substr($haystack, -\strlen($needle)) === $needle |
| 10755 | 10754 | ) { |
| 10756 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
| 10755 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
| 10757 | 10756 | } |
| 10758 | 10757 | |
| 10759 | 10758 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
| 10760 | - return (string) self::substr( |
|
| 10759 | + return (string)self::substr( |
|
| 10761 | 10760 | $haystack, |
| 10762 | 10761 | 0, |
| 10763 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
| 10762 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
| 10764 | 10763 | $encoding |
| 10765 | 10764 | ); |
| 10766 | 10765 | } |
@@ -10790,10 +10789,10 @@ discard block |
||
| 10790 | 10789 | } |
| 10791 | 10790 | |
| 10792 | 10791 | if ($encoding === 'UTF-8') { |
| 10793 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 10792 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 10794 | 10793 | } |
| 10795 | 10794 | |
| 10796 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 10795 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 10797 | 10796 | } |
| 10798 | 10797 | |
| 10799 | 10798 | /** |
@@ -10970,7 +10969,7 @@ discard block |
||
| 10970 | 10969 | public static function to_boolean($str): bool |
| 10971 | 10970 | { |
| 10972 | 10971 | // init |
| 10973 | - $str = (string) $str; |
|
| 10972 | + $str = (string)$str; |
|
| 10974 | 10973 | |
| 10975 | 10974 | if ($str === '') { |
| 10976 | 10975 | return false; |
@@ -10998,10 +10997,10 @@ discard block |
||
| 10998 | 10997 | } |
| 10999 | 10998 | |
| 11000 | 10999 | if (\is_numeric($str)) { |
| 11001 | - return ((float) $str + 0) > 0; |
|
| 11000 | + return ((float)$str + 0) > 0; |
|
| 11002 | 11001 | } |
| 11003 | 11002 | |
| 11004 | - return (bool) \trim($str); |
|
| 11003 | + return (bool)\trim($str); |
|
| 11005 | 11004 | } |
| 11006 | 11005 | |
| 11007 | 11006 | /** |
@@ -11043,7 +11042,7 @@ discard block |
||
| 11043 | 11042 | return $str; |
| 11044 | 11043 | } |
| 11045 | 11044 | |
| 11046 | - $str = (string) $str; |
|
| 11045 | + $str = (string)$str; |
|
| 11047 | 11046 | if ($str === '') { |
| 11048 | 11047 | return ''; |
| 11049 | 11048 | } |
@@ -11090,7 +11089,7 @@ discard block |
||
| 11090 | 11089 | return $str; |
| 11091 | 11090 | } |
| 11092 | 11091 | |
| 11093 | - $str = (string) $str; |
|
| 11092 | + $str = (string)$str; |
|
| 11094 | 11093 | if ($str === '') { |
| 11095 | 11094 | return $str; |
| 11096 | 11095 | } |
@@ -11108,7 +11107,7 @@ discard block |
||
| 11108 | 11107 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
| 11109 | 11108 | |
| 11110 | 11109 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 11111 | - $buf .= $c1 . $c2; |
|
| 11110 | + $buf .= $c1.$c2; |
|
| 11112 | 11111 | ++$i; |
| 11113 | 11112 | } else { // not valid UTF8 - convert it |
| 11114 | 11113 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11119,7 +11118,7 @@ discard block |
||
| 11119 | 11118 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
| 11120 | 11119 | |
| 11121 | 11120 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 11122 | - $buf .= $c1 . $c2 . $c3; |
|
| 11121 | + $buf .= $c1.$c2.$c3; |
|
| 11123 | 11122 | $i += 2; |
| 11124 | 11123 | } else { // not valid UTF8 - convert it |
| 11125 | 11124 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11131,7 +11130,7 @@ discard block |
||
| 11131 | 11130 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
| 11132 | 11131 | |
| 11133 | 11132 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 11134 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
| 11133 | + $buf .= $c1.$c2.$c3.$c4; |
|
| 11135 | 11134 | $i += 3; |
| 11136 | 11135 | } else { // not valid UTF8 - convert it |
| 11137 | 11136 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11157,13 +11156,13 @@ discard block |
||
| 11157 | 11156 | * |
| 11158 | 11157 | * @return string |
| 11159 | 11158 | */ |
| 11160 | - static function (array $matches): string { |
|
| 11159 | + static function(array $matches): string { |
|
| 11161 | 11160 | if (isset($matches[3])) { |
| 11162 | - $cp = (int) \hexdec($matches[3]); |
|
| 11161 | + $cp = (int)\hexdec($matches[3]); |
|
| 11163 | 11162 | } else { |
| 11164 | 11163 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
| 11165 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
| 11166 | - + (int) \hexdec($matches[2]) |
|
| 11164 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
| 11165 | + + (int)\hexdec($matches[2]) |
|
| 11167 | 11166 | + 0x10000 |
| 11168 | 11167 | - (0xD800 << 10) |
| 11169 | 11168 | - 0xDC00; |
@@ -11174,12 +11173,12 @@ discard block |
||
| 11174 | 11173 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
| 11175 | 11174 | |
| 11176 | 11175 | if ($cp < 0x80) { |
| 11177 | - return (string) self::chr($cp); |
|
| 11176 | + return (string)self::chr($cp); |
|
| 11178 | 11177 | } |
| 11179 | 11178 | |
| 11180 | 11179 | if ($cp < 0xA0) { |
| 11181 | 11180 | /** @noinspection UnnecessaryCastingInspection */ |
| 11182 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
| 11181 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
| 11183 | 11182 | } |
| 11184 | 11183 | |
| 11185 | 11184 | return self::decimal_to_chr($cp); |
@@ -11227,7 +11226,7 @@ discard block |
||
| 11227 | 11226 | |
| 11228 | 11227 | if (self::$SUPPORT['mbstring'] === true) { |
| 11229 | 11228 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 11230 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 11229 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 11231 | 11230 | } |
| 11232 | 11231 | |
| 11233 | 11232 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -11264,15 +11263,15 @@ discard block |
||
| 11264 | 11263 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
| 11265 | 11264 | |
| 11266 | 11265 | if ($encoding === 'UTF-8') { |
| 11267 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
| 11266 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
| 11268 | 11267 | |
| 11269 | 11268 | if ($useMbFunction === true) { |
| 11270 | 11269 | $strPartOne = \mb_strtoupper( |
| 11271 | - (string) \mb_substr($str, 0, 1) |
|
| 11270 | + (string)\mb_substr($str, 0, 1) |
|
| 11272 | 11271 | ); |
| 11273 | 11272 | } else { |
| 11274 | 11273 | $strPartOne = self::strtoupper( |
| 11275 | - (string) \mb_substr($str, 0, 1), |
|
| 11274 | + (string)\mb_substr($str, 0, 1), |
|
| 11276 | 11275 | $encoding, |
| 11277 | 11276 | false, |
| 11278 | 11277 | $lang, |
@@ -11282,16 +11281,16 @@ discard block |
||
| 11282 | 11281 | } else { |
| 11283 | 11282 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 11284 | 11283 | |
| 11285 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
| 11284 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
| 11286 | 11285 | |
| 11287 | 11286 | if ($useMbFunction === true) { |
| 11288 | 11287 | $strPartOne = \mb_strtoupper( |
| 11289 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
| 11288 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
| 11290 | 11289 | $encoding |
| 11291 | 11290 | ); |
| 11292 | 11291 | } else { |
| 11293 | 11292 | $strPartOne = self::strtoupper( |
| 11294 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 11293 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 11295 | 11294 | $encoding, |
| 11296 | 11295 | false, |
| 11297 | 11296 | $lang, |
@@ -11300,7 +11299,7 @@ discard block |
||
| 11300 | 11299 | } |
| 11301 | 11300 | } |
| 11302 | 11301 | |
| 11303 | - return $strPartOne . $strPartTwo; |
|
| 11302 | + return $strPartOne.$strPartTwo; |
|
| 11304 | 11303 | } |
| 11305 | 11304 | |
| 11306 | 11305 | /** |
@@ -11351,7 +11350,7 @@ discard block |
||
| 11351 | 11350 | $str = self::clean($str); |
| 11352 | 11351 | } |
| 11353 | 11352 | |
| 11354 | - $usePhpDefaultFunctions = !(bool) ($charlist . \implode('', $exceptions)); |
|
| 11353 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
| 11355 | 11354 | |
| 11356 | 11355 | if ( |
| 11357 | 11356 | $usePhpDefaultFunctions === true |
@@ -11738,7 +11737,7 @@ discard block |
||
| 11738 | 11737 | if ( |
| 11739 | 11738 | $keepUtf8Chars === true |
| 11740 | 11739 | && |
| 11741 | - self::strlen($return) >= (int) self::strlen($str_backup) |
|
| 11740 | + self::strlen($return) >= (int)self::strlen($str_backup) |
|
| 11742 | 11741 | ) { |
| 11743 | 11742 | return $str_backup; |
| 11744 | 11743 | } |
@@ -11814,17 +11813,17 @@ discard block |
||
| 11814 | 11813 | return ''; |
| 11815 | 11814 | } |
| 11816 | 11815 | |
| 11817 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
| 11816 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
| 11818 | 11817 | |
| 11819 | 11818 | if ( |
| 11820 | 11819 | !isset($matches[0]) |
| 11821 | 11820 | || |
| 11822 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
| 11821 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
| 11823 | 11822 | ) { |
| 11824 | 11823 | return $str; |
| 11825 | 11824 | } |
| 11826 | 11825 | |
| 11827 | - return \rtrim($matches[0]) . $strAddOn; |
|
| 11826 | + return \rtrim($matches[0]).$strAddOn; |
|
| 11828 | 11827 | } |
| 11829 | 11828 | |
| 11830 | 11829 | /** |
@@ -11911,7 +11910,7 @@ discard block |
||
| 11911 | 11910 | } |
| 11912 | 11911 | } |
| 11913 | 11912 | |
| 11914 | - return $strReturn . \implode('', $chars); |
|
| 11913 | + return $strReturn.\implode('', $chars); |
|
| 11915 | 11914 | } |
| 11916 | 11915 | |
| 11917 | 11916 | /** |
@@ -11963,7 +11962,7 @@ discard block |
||
| 11963 | 11962 | $finalBreak = ''; |
| 11964 | 11963 | } |
| 11965 | 11964 | |
| 11966 | - return \implode($delimiter ?? "\n", $stringArray) . $finalBreak; |
|
| 11965 | + return \implode($delimiter ?? "\n", $stringArray).$finalBreak; |
|
| 11967 | 11966 | } |
| 11968 | 11967 | |
| 11969 | 11968 | /** |
@@ -12021,7 +12020,7 @@ discard block |
||
| 12021 | 12020 | self::$ORD = self::getData('ord'); |
| 12022 | 12021 | } |
| 12023 | 12022 | |
| 12024 | - $len = \strlen((string) $str); |
|
| 12023 | + $len = \strlen((string)$str); |
|
| 12025 | 12024 | /** @noinspection ForeachInvariantsInspection */ |
| 12026 | 12025 | for ($i = 0; $i < $len; ++$i) { |
| 12027 | 12026 | $in = self::$ORD[$str[$i]]; |
@@ -12176,7 +12175,7 @@ discard block |
||
| 12176 | 12175 | /** @noinspection PhpIncludeInspection */ |
| 12177 | 12176 | /** @noinspection UsingInclusionReturnValueInspection */ |
| 12178 | 12177 | /** @psalm-suppress UnresolvableInclude */ |
| 12179 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
| 12178 | + return include __DIR__.'/data/'.$file.'.php'; |
|
| 12180 | 12179 | } |
| 12181 | 12180 | |
| 12182 | 12181 | /** |
@@ -12191,7 +12190,7 @@ discard block |
||
| 12191 | 12190 | |
| 12192 | 12191 | \uksort( |
| 12193 | 12192 | self::$EMOJI, |
| 12194 | - static function (string $a, string $b): int { |
|
| 12193 | + static function(string $a, string $b): int { |
|
| 12195 | 12194 | return \strlen($b) <=> \strlen($a); |
| 12196 | 12195 | } |
| 12197 | 12196 | ); |
@@ -12201,7 +12200,7 @@ discard block |
||
| 12201 | 12200 | |
| 12202 | 12201 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
| 12203 | 12202 | $tmpKey = \crc32($key); |
| 12204 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmpKey . '_-_' . \strrev((string) $tmpKey) . '_-_8FTU_ELBATROP_-_'; |
|
| 12203 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmpKey.'_-_'.\strrev((string)$tmpKey).'_-_8FTU_ELBATROP_-_'; |
|
| 12205 | 12204 | } |
| 12206 | 12205 | |
| 12207 | 12206 | return true; |
@@ -12225,7 +12224,7 @@ discard block |
||
| 12225 | 12224 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 12226 | 12225 | return \defined('MB_OVERLOAD_STRING') |
| 12227 | 12226 | && |
| 12228 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 12227 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 12229 | 12228 | } |
| 12230 | 12229 | |
| 12231 | 12230 | /** |
@@ -12275,7 +12274,7 @@ discard block |
||
| 12275 | 12274 | { |
| 12276 | 12275 | static $RX_CLASS_CACHE = []; |
| 12277 | 12276 | |
| 12278 | - $cacheKey = $s . $class; |
|
| 12277 | + $cacheKey = $s.$class; |
|
| 12279 | 12278 | |
| 12280 | 12279 | if (isset($RX_CLASS_CACHE[$cacheKey])) { |
| 12281 | 12280 | return $RX_CLASS_CACHE[$cacheKey]; |
@@ -12287,7 +12286,7 @@ discard block |
||
| 12287 | 12286 | /** @noinspection AlterInForeachInspection */ |
| 12288 | 12287 | foreach (self::str_split($s) as &$s) { |
| 12289 | 12288 | if ($s === '-') { |
| 12290 | - $classArray[0] = '-' . $classArray[0]; |
|
| 12289 | + $classArray[0] = '-'.$classArray[0]; |
|
| 12291 | 12290 | } elseif (!isset($s[2])) { |
| 12292 | 12291 | $classArray[0] .= \preg_quote($s, '/'); |
| 12293 | 12292 | } elseif (self::strlen($s) === 1) { |
@@ -12298,13 +12297,13 @@ discard block |
||
| 12298 | 12297 | } |
| 12299 | 12298 | |
| 12300 | 12299 | if ($classArray[0]) { |
| 12301 | - $classArray[0] = '[' . $classArray[0] . ']'; |
|
| 12300 | + $classArray[0] = '['.$classArray[0].']'; |
|
| 12302 | 12301 | } |
| 12303 | 12302 | |
| 12304 | 12303 | if (\count($classArray) === 1) { |
| 12305 | 12304 | $return = $classArray[0]; |
| 12306 | 12305 | } else { |
| 12307 | - $return = '(?:' . \implode('|', $classArray) . ')'; |
|
| 12306 | + $return = '(?:'.\implode('|', $classArray).')'; |
|
| 12308 | 12307 | } |
| 12309 | 12308 | |
| 12310 | 12309 | $RX_CLASS_CACHE[$cacheKey] = $return; |
@@ -12379,7 +12378,7 @@ discard block |
||
| 12379 | 12378 | |
| 12380 | 12379 | if ($delimiter === '-') { |
| 12381 | 12380 | /** @noinspection AlterInForeachInspection */ |
| 12382 | - foreach ((array) $specialCases['names'] as &$beginning) { |
|
| 12381 | + foreach ((array)$specialCases['names'] as &$beginning) { |
|
| 12383 | 12382 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
| 12384 | 12383 | $continue = true; |
| 12385 | 12384 | } |
@@ -12387,7 +12386,7 @@ discard block |
||
| 12387 | 12386 | } |
| 12388 | 12387 | |
| 12389 | 12388 | /** @noinspection AlterInForeachInspection */ |
| 12390 | - foreach ((array) $specialCases['prefixes'] as &$beginning) { |
|
| 12389 | + foreach ((array)$specialCases['prefixes'] as &$beginning) { |
|
| 12391 | 12390 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
| 12392 | 12391 | $continue = true; |
| 12393 | 12392 | } |
@@ -12447,8 +12446,8 @@ discard block |
||
| 12447 | 12446 | } else { |
| 12448 | 12447 | /** @noinspection OffsetOperationsInspection */ |
| 12449 | 12448 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
| 12450 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
| 12451 | - $buf .= $cc1 . $cc2; |
|
| 12449 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
| 12450 | + $buf .= $cc1.$cc2; |
|
| 12452 | 12451 | } |
| 12453 | 12452 | |
| 12454 | 12453 | return $buf; |
@@ -12463,7 +12462,7 @@ discard block |
||
| 12463 | 12462 | { |
| 12464 | 12463 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
| 12465 | 12464 | if (\preg_match($pattern, $str)) { |
| 12466 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
| 12465 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
| 12467 | 12466 | } |
| 12468 | 12467 | |
| 12469 | 12468 | return $str; |