// Kernel.php
<?php
namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
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
// Kernel.php | |
<?php | |
namespace App; | |
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; | |
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | |
use Symfony\Component\DependencyInjection\ContainerBuilder; | |
use Symfony\Component\DependencyInjection\Reference; | |
use Symfony\Component\HttpKernel\Kernel as BaseKernel; | |
use Symfony\Component\Mime\FileBinaryMimeTypeGuesser; |
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 | |
use Symfony\Component\Mime\{MimeTypes, FileBinaryMimeTypeGuesser}; | |
class FileCreator | |
{ | |
public function create(string $filePath): void | |
{ | |
$mimeTypes = new MimeTypes(); | |
// The last registered guesser has precedence over the other ones. |
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 | |
use Symfony\Component\Mime\MimeTypes; | |
class FileCreator | |
{ | |
public function create(string $filePath): void | |
{ | |
$mimeTypes = new MimeTypes(); | |
$mimeType = $mimeTypes->guessMimeType($filePath); | |
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 | |
declare(strict_types=1); | |
namespace Infrastructure\Symfony\Mime; | |
use Symfony\Component\Mime\FileBinaryMimeTypeGuesser; | |
use Symfony\Component\Mime\MimeTypeGuesserInterface; | |
/** |
class EmojiType extends AbstractType
{
public function configureOptions(OptionsResolver $resolver)
{
$countriesCode = Countries::getNames($options['choice_translation_locale']);
+ // If the option "only_emoji" is true, we display just the emoji
+ if (true === $options['only_emoji']) {
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 | |
// The form | |
namespace App\Form; | |
use App\Entity\Address; | |
use Symfony\Component\Form\AbstractType; | |
use Symfony\Component\Form\FormBuilderInterface; | |
use Symfony\Component\OptionsResolver\OptionsResolver; |
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 | |
namespace App\Form; | |
use Symfony\Component\Form\AbstractType; | |
use Symfony\Component\Form\ChoiceList\ChoiceList; | |
use Symfony\Component\Form\Extension\Core\Type\CountryType; | |
use Symfony\Component\Intl\Countries; | |
use Symfony\Component\OptionsResolver\Options; | |
use Symfony\Component\OptionsResolver\OptionsResolver; |
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 |