Completed
Pull Request — master (#10)
by Tomáš
07:18
created

ContainerFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 12 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([
0 ignored issues
show
Unused Code Comprehensibility introduced by
46% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
23
//            'rootDir' => __DIR__ . '/..'
24
//        ]);
25
26
        return $configurator->createContainer();
27
    }
28
29
    private function createAndReturnTempDir() : string
30
    {
31
        $tempDir = sys_get_temp_dir() . '/_multi-cs';
32
        FileSystem::delete($tempDir);
33
        FileSystem::createDir($tempDir);
34
35
        return $tempDir;
36
    }
37
}
38