Completed
Pull Request — master (#10)
by Tomáš
24:14
created

ContainerFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 22
ccs 0
cts 16
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 10 1
A createAndReturnTempDir() 0 8 1
1
<?php
2
3
/*
4
 * This file is part of Symplify
5
 * Copyright (c) 2016 Tomas Votruba (http://tomasvotruba.cz).
6
 */
7
8
namespace Symplify\MultiCodingStandard\DI;
9
10
use Nette\Configurator;
11
use Nette\DI\Container;
12
use Nette\Utils\FileSystem;
13
14
final class ContainerFactory
15
{
16
    public function create() : Container
17
    {
18
        $configurator = new Configurator();
19
        $configurator->setDebugMode(true);
20
        $configurator->setTempDirectory($this->createAndReturnTempDir());
21
        $configurator->addConfig(__DIR__ . '/../config/config.neon');
22
        $configurator->addParameters(['rootDir' => __DIR__ . '/..']);
23
24
        return $configurator->createContainer();
25
    }
26
27
    private function createAndReturnTempDir() : string
28
    {
29
        $tempDir = sys_get_temp_dir() . '/_multi-cs';
30
        FileSystem::delete($tempDir);
31
        FileSystem::createDir($tempDir);
32
33
        return $tempDir;
34
    }
35
}
36