Completed
Push — master ( 9b25f2...d42705 )
by Tomáš
09:42 queued 07:08
created

ContainerFactory::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of Symplify
7
 * Copyright (c) 2016 Tomas Votruba (http://tomasvotruba.cz).
8
 */
9
10
namespace Symplify\PHP7_Sculpin\DI\Container;
11
12
use Nette\Configurator;
13
use Nette\DI\Container;
14
use Nette\Utils\FileSystem;
15
16
final class ContainerFactory
17
{
18 1
    public function create() : Container
19
    {
20 1
        $configurator = new Configurator();
21 1
        $configurator->setDebugMode(true);
22 1
        $configurator->setTempDirectory($this->createAndReturnTempDir());
23 1
        $configurator->addConfig(__DIR__.'/../../config/config.neon');
24
25 1
        return $configurator->createContainer();
26
    }
27
28 1
    private function createAndReturnTempDir() : string
29
    {
30 1
        $tempDir = sys_get_temp_dir().'/php7_sculpin';
31 1
        FileSystem::delete($tempDir);
32 1
        FileSystem::createDir($tempDir);
33
34 1
        return $tempDir;
35
    }
36
}
37