TaggedServicesCompilerPass   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
eloc 10
dl 0
loc 21
c 0
b 0
f 0
ccs 0
cts 12
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 14 4
1
<?php
2
3
/*******************************************************************************
4
 *  This file is part of the GraphQL Bundle package.
5
 *
6
 *  (c) YnloUltratech <[email protected]>
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 Ynlo\GraphQLBundle\Component\TaggedServices;
13
14
@trigger_error("TaggedServices component has been deprecated since v1.1 and will be deleted in v2.0, use symfony tag injection instead \"!tagged tag_name\"", E_USER_DEPRECATED);
15
16
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
17
use Symfony\Component\DependencyInjection\ContainerBuilder;
18
19
/**
20
 * @deprecated since v1.1 and will be deleted in v2.0, use symfony tag injection instead "!tagged tag_name"
21
 */
22
class TaggedServicesCompilerPass implements CompilerPassInterface
23
{
24
    /**
25
     * {@inheritdoc}
26
     *
27
     * @throws \InvalidArgumentException
28
     */
29
    public function process(ContainerBuilder $container)
30
    {
31
        if (!$container->hasDefinition(TaggedServices::class)) {
32
            return;
33
        }
34
35
        $manager = $container->getDefinition(TaggedServices::class);
36
37
        $definitions = $container->getDefinitions();
38
        foreach ($definitions as $id => $definition) {
39
            foreach ($definition->getTags() as $tagName => $tagAttributes) {
40
                $manager->addMethodCall(
41
                    'addSpecification',
42
                    [$id, $tagName, $tagAttributes[0]]
43
                );
44
            }
45
        }
46
    }
47
}
48