RegisterCurrencyConvertersPass::process()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 12
rs 10
cc 3
nc 3
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Setono\SyliusStockMovementPlugin\DependencyInjection\Compiler;
6
7
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
8
use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait;
9
use Symfony\Component\DependencyInjection\ContainerBuilder;
10
11
final class RegisterCurrencyConvertersPass implements CompilerPassInterface
12
{
13
    use PriorityTaggedServiceTrait;
0 ignored issues
show
Bug introduced by
The trait Symfony\Component\Depend...orityTaggedServiceTrait requires the property $name which is not provided by Setono\SyliusStockMoveme...rCurrencyConvertersPass.
Loading history...
14
15
    public function process(ContainerBuilder $container): void
16
    {
17
        if (!$container->hasDefinition('setono_sylius_stock_movement.currency_converter.composite')) {
18
            return;
19
        }
20
21
        $compositeCurrencyConverter = $container->getDefinition('setono_sylius_stock_movement.currency_converter.composite');
22
23
        $currencyConverters = $this->findAndSortTaggedServices('setono_sylius_stock_movement.currency_converter', $container);
24
25
        foreach ($currencyConverters as $currencyConverter) {
26
            $compositeCurrencyConverter->addArgument($currencyConverter);
27
        }
28
    }
29
}
30