Completed
Push — master ( 007cba...a69311 )
by Christian
01:55 queued 11s
created

JMSFormErrorHandlerPass   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 13
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 10 2
1
<?php
2
3
/*
4
 * This file is part of the FOSRestBundle package.
5
 *
6
 * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace FOS\RestBundle\DependencyInjection\Compiler;
13
14
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use FOS\RestBundle\Serializer\Normalizer\FormErrorHandler;
17
use Symfony\Component\DependencyInjection\Reference;
18
19
/**
20
 * Decorates the JMS FormErrorHandler.
21
 *
22
 * @author Guilhem Niot <[email protected]>
23
 * @author Christian Flothmann <[email protected]>
24
 *
25
 * @internal
26
 */
27
final class JMSFormErrorHandlerPass implements CompilerPassInterface
28
{
29
    public function process(ContainerBuilder $container): void
30
    {
31
        if (!$container->has('jms_serializer.form_error_handler')) {
32
            return;
33
        }
34
35
        $container->register('fos_rest.serializer.form_error_handler', FormErrorHandler::class)
36
            ->setDecoratedService('jms_serializer.form_error_handler')
37
            ->addArgument(new Reference('fos_rest.serializer.form_error_handler.inner'));
38
    }
39
}
40