LoadTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A configure() 0 25 2
1
<?php
2
3
namespace SfCod\SocketIoBundle\Tests\Data;
4
5
use Monolog\Logger;
6
use Psr\Log\LoggerInterface;
7
use SfCod\SocketIoBundle\DependencyInjection\SocketIoExtension;
8
use Symfony\Component\DependencyInjection\ContainerBuilder;
9
use Symfony\Component\Dotenv\Dotenv;
10
use Symfony\Component\Dotenv\Exception\PathException;
11
12
trait LoadTrait
13
{
14
    protected $container;
15
16
    protected function configure()
17
    {
18
        $dotenv = new Dotenv();
19
        try {
20
            $dotenv->load(__DIR__ . '/../../.env');
21
        } catch (PathException $e) {
22
            // Nothing
23
        }
24
25
        $extension = new SocketIoExtension();
26
        $container = new ContainerBuilder();
27
        $container->setParameter('kernel.project_dir', getenv('KERNEL_PROJECT_DIR'));
28
        $container->setParameter('kernel.root_dir', realpath(__DIR__ . '/../../../../SfCod/'));
29
        $container->set(LoggerInterface::class, new Logger('test'));
30
31
        $extension->load([
32
            0 => [
33
                'namespaces' => [
34
                    'SfCod\SocketIoBundle\Tests\Data',
35
                ],
36
            ],
37
        ], $container);
38
39
        $this->container = $container;
40
    }
41
}
42