Conditions | 3 |
Paths | 4 |
Total Lines | 21 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 3 |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
1307 | 12 | public static function emoji_encode( |
|
1308 | string $str, |
||
1309 | bool $use_reversible_string_mappings = false |
||
1310 | ): string { |
||
1311 | 12 | if (self::$EMOJI_KEYS_CACHE === null) { |
|
1312 | /** @phpstan-ignore-next-line - we need to load the data first */ |
||
1313 | 1 | self::initEmojiData(); |
|
1314 | } |
||
1315 | |||
1316 | 12 | if ($use_reversible_string_mappings) { |
|
1317 | 9 | return (string) \str_replace( |
|
1318 | 9 | (array) self::$EMOJI_VALUES_CACHE, |
|
1319 | 9 | (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1320 | 9 | $str |
|
1321 | ); |
||
1322 | } |
||
1323 | |||
1324 | 4 | return (string) \str_replace( |
|
1325 | 4 | (array) self::$EMOJI_VALUES_CACHE, |
|
1326 | 4 | (array) self::$EMOJI_KEYS_CACHE, |
|
1327 | 4 | $str |
|
1328 | ); |
||
13689 |