Last active
January 30, 2022 00:02
-
-
Save ismail1432/effc827ffd453de200818bd49d4af8d5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class EmojiType extends AbstractType | |
{ | |
public function getParent() | |
{ | |
return CountryType::class; | |
} | |
public static function getEmojiFlag(string $countryCode): string | |
{ | |
$regionalOffset = 0x1F1A5; | |
return mb_chr($regionalOffset + mb_ord($countryCode[0], 'UTF-8'), 'UTF-8') | |
. mb_chr($regionalOffset + mb_ord($countryCode[1], 'UTF-8'), 'UTF-8'); | |
} | |
public function configureOptions(OptionsResolver $resolver) | |
{ | |
// the magic is coming, continue to read | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment