ContainerFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 14
ccs 7
cts 7
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A createContainer() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * neuralyzer : Data Anonymization Library and CLI Tool
7
 *
8
 * PHP Version 7.2
9
 *
10
 * @author    Emmanuel Dyan
11
 *
12
 * @copyright 2020 Emmanuel Dyan
13
 *
14
 * @package edyan/neuralyzer
15
 *
16
 * @license GNU General Public License v2.0
17
 *
18
 * @link https://github.com/edyan/neuralyzer
19
 */
20
21
namespace Edyan\Neuralyzer;
22
23
use Symfony\Component\Config\FileLocator;
24
use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass;
25
use Symfony\Component\DependencyInjection\ContainerBuilder;
26
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
27
28
/**
29
 * Class ContainerFactory
30
 *
31
 * @package edyan/neuralyzer
32
 */
33
class ContainerFactory
34 71
{
35
    /**
36 71
     * @throws \Exception
37 71
     */
38 71
    public static function createContainer(): ContainerBuilder
39 71
    {
40 71
        $container = new ContainerBuilder();
41
        $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../config'));
42 71
        $loader->load('services.yml');
43
        $container->addCompilerPass(new AddConsoleCommandPass());
44
        $container->compile();
45
46
        return $container;
47
    }
48
}
49