|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace Symfony\Component\DependencyInjection\Loader\Configurator; |
| 6 | + |
| 7 | +use Budgegeria\Bundle\IntlBundle\Twig\IntlFormatterExtension; |
| 8 | +use Budgegeria\IntlFormat\Formatter\CurrencySymbolFormatter; |
| 9 | +use Budgegeria\IntlFormat\Formatter\ExceptionFormatter; |
| 10 | +use Budgegeria\IntlFormat\Formatter\FormatterInterface; |
| 11 | +use Budgegeria\IntlFormat\Formatter\LocaleFormatter; |
| 12 | +use Budgegeria\IntlFormat\Formatter\MessageFormatter; |
| 13 | +use Budgegeria\IntlFormat\Formatter\PrecisionNumberFormatter; |
| 14 | +use Budgegeria\IntlFormat\Formatter\TimeZoneFormatter; |
| 15 | +use Budgegeria\IntlFormat\IntlFormat; |
| 16 | +use Budgegeria\IntlFormat\IntlFormatInterface; |
| 17 | +use Budgegeria\IntlFormat\MessageParser\SprintfParser; |
| 18 | + |
| 19 | +return static function (ContainerConfigurator $container): void { |
| 20 | + $services = $container->services(); |
| 21 | + |
| 22 | + $services->defaults() |
| 23 | + ->private() |
| 24 | + ->autowire() |
| 25 | + ->autoconfigure(); |
| 26 | + |
| 27 | + $services->load('Budgegeria\\Bundle\\IntlBundle\\', '../../*') |
| 28 | + ->exclude(['../../{DependencyInjection,Resources}']); |
| 29 | + |
| 30 | + $services->instanceof(FormatterInterface::class) |
| 31 | + ->tag('budgegeria_intl.formatter') |
| 32 | + ->bind('$locale', '%budgegeria_intl.locale%'); |
| 33 | + |
| 34 | + $services->set(CurrencySymbolFormatter::class); |
| 35 | + |
| 36 | + $services->set(ExceptionFormatter::class); |
| 37 | + |
| 38 | + $services->set(LocaleFormatter::class); |
| 39 | + |
| 40 | + $services->set(PrecisionNumberFormatter::class); |
| 41 | + |
| 42 | + $services->set(TimeZoneFormatter::class); |
| 43 | + |
| 44 | + $services->set('budgegeria_intl_bundle.message_number_formatter', MessageFormatter::class) |
| 45 | + ->factory([null, 'createNumberValueFormatter']); |
| 46 | + |
| 47 | + $services->set('budgegeria_intl_bundle.message_date_formatter', MessageFormatter::class) |
| 48 | + ->factory([null, 'createDateValueFormatter']); |
| 49 | + |
| 50 | + $services->set(SprintfParser::class); |
| 51 | + |
| 52 | + $services->alias(IntlFormatInterface::class, IntlFormat::class); |
| 53 | + |
| 54 | + $services->set(IntlFormat::class) |
| 55 | + ->args([ |
| 56 | + tagged_iterator('budgegeria_intl.formatter'), |
| 57 | + service(SprintfParser::class), |
| 58 | + ]); |
| 59 | + |
| 60 | + $services->set(IntlFormatterExtension::class) |
| 61 | + ->bind('$currency', '%budgegeria_intl.currency%') |
| 62 | + ->tag('twig.extension'); |
| 63 | +}; |
0 commit comments