Container   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 0
cbo 3
dl 0
loc 34
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getConfigServices() 0 5 1
A get() 0 4 1
1
<?php
2
3
namespace IgnoreFiles;
4
5
use Symfony\Component\Config\FileLocator;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
8
9
class Container
10
{
11
    const SERVICES_FILE = 'services.xml';
12
    const CONFIG_PATH = '/../../config/';
13
    /**
14
     * @var ContainerBuilder
15
     */
16
    private $container;
17
18
    /**
19
     * Container constructor.
20
     */
21
    public function __construct()
22
    {
23
        $this->container = new ContainerBuilder();
24
        $this->getConfigServices();
25
    }
26
27
    private function getConfigServices()
28
    {
29
        $loader = new XmlFileLoader($this->container, new FileLocator(__DIR__.self::CONFIG_PATH));
30
        $loader->load(self::SERVICES_FILE);
31
    }
32
33
    /**
34
     * @param string $serviceName
35
     *
36
     * @return object
37
     */
38
    public function get($serviceName)
39
    {
40
        return $this->container->get($serviceName);
41
    }
42
}
43