MetadataFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 23
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 17 2
1
<?php
2
3
namespace As3\Bundle\ModlrBundle\DependencyInjection\ServiceLoader;
4
5
use As3\Bundle\ModlrBundle\DependencyInjection\Utility;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Definition;
8
use Symfony\Component\DependencyInjection\Reference;
9
10
/**
11
 * Loads the metadata factory service.
12
 *
13
 * @author  Jacob Bare <[email protected]>
14
 */
15
class MetadataFactory implements ServiceLoaderInterface
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function load(array $config, ContainerBuilder $container)
21
    {
22
        $definition = new Definition(
23
            Utility::getLibraryClass('Metadata\MetadataFactory'),
24
            [
25
                new Reference(Utility::getAliasedName('metadata.default_driver')),
26
                new Reference(Utility::getAliasedName('util.entity')),
27
                new Reference(Utility::getAliasedName('event_dispatcher')),
28
            ]
29
        );
30
31
        if (true === $config['metadata']['cache']['enabled']) {
32
            $definition->addMethodCall('setCache', [new Reference(Utility::getAliasedName('metadata.cache'))]);
33
        }
34
        $container->setDefinition(Utility::getAliasedName('metadata.factory'), $definition);
35
        return $this;
36
    }
37
}
38