Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types = 1); |
||
19 | public function __invoke() |
||
20 | { |
||
21 | $filePath = rtrim($this->kernel()->rootPath(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '.env'; |
||
22 | |||
23 | $envLoader = new Loader($filePath); |
||
24 | $envLoader->load(); |
||
25 | |||
26 | if ($this->kernel()->isCli()) { |
||
27 | // todo: Load different env fire for each environment. |
||
28 | $env = (new ArgvInput)->getParameterOption(['--env', '-e']); |
||
29 | if ($env) { |
||
30 | $envLoader->setEnvironmentVariable('APP_ENV', $env); |
||
31 | } |
||
32 | } |
||
33 | } |
||
34 | |||
35 | } |