| Conditions | 5 |
| Paths | 5 |
| Total Lines | 26 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 5.246 |
| Changes | 4 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | 2 | public function process(ContainerBuilder $container) |
|
| 16 | { |
||
| 17 | 2 | if (!$container->has('serializer') || $container->hasAlias('serializer')) { |
|
| 18 | |||
| 19 | 1 | return; |
|
| 20 | } |
||
| 21 | |||
| 22 | 1 | $class = $container->getDefinition('serializer')->getClass(); |
|
| 23 | |||
| 24 | 1 | if ('%serializer.class%' === $class) { |
|
| 25 | // 2.x Definition |
||
| 26 | $class = $container->getParameter($class); |
||
| 27 | } |
||
| 28 | |||
| 29 | 1 | if (!in_array(SerializerInterface::class, class_implements($class), true)) { |
|
| 30 | return; |
||
| 31 | } |
||
| 32 | |||
| 33 | 1 | $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../../Resources/config')); |
|
| 34 | 1 | $loader->load('symfony_serializer.yml'); |
|
| 35 | |||
| 36 | /** @var Reference $converter */ |
||
| 37 | 1 | $converter = $container->getDefinition('serializer.normalizer.object')->getArgument(1); |
|
| 38 | |||
| 39 | 1 | $container->setAlias('serializer.normalizer.object.name_converter', (string)$converter); |
|
| 40 | 1 | } |
|
| 41 | } |
||
| 42 |