@@ 16-36 (lines=21) @@ | ||
13 | use Nette\DI\Container; |
|
14 | use Nette\Utils\FileSystem; |
|
15 | ||
16 | final class ContainerFactory |
|
17 | { |
|
18 | public function create() : Container |
|
19 | { |
|
20 | $configurator = new Configurator(); |
|
21 | $configurator->setDebugMode(true); |
|
22 | $configurator->setTempDirectory($this->createAndReturnTempDir()); |
|
23 | $configurator->addConfig(__DIR__.'/../config/config.neon'); |
|
24 | ||
25 | return $configurator->createContainer(); |
|
26 | } |
|
27 | ||
28 | private function createAndReturnTempDir() : string |
|
29 | { |
|
30 | $tempDir = sys_get_temp_dir().'/_multi-cs'; |
|
31 | FileSystem::delete($tempDir); |
|
32 | FileSystem::createDir($tempDir); |
|
33 | ||
34 | return $tempDir; |
|
35 | } |
|
36 | } |
|
37 |
@@ 11-35 (lines=25) @@ | ||
8 | use Nette\DI\Container; |
|
9 | use Nette\Utils\FileSystem; |
|
10 | ||
11 | final class ContainerFactory |
|
12 | { |
|
13 | public function create() : Container |
|
14 | { |
|
15 | return $this->createWithConfig(__DIR__.'/../src/config/config.neon'); |
|
16 | } |
|
17 | ||
18 | public function createWithConfig($config) : Container |
|
19 | { |
|
20 | $configurator = new Configurator(); |
|
21 | $configurator->setTempDirectory($this->createAndReturnTempDir()); |
|
22 | $configurator->addConfig($config); |
|
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 |