| Conditions | 3 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 39 | 15 | public function readEnvFile(HostId $hostId): void |
|
| 40 | { |
||
| 41 | 15 | if ($this->isEnvFileAlreadyLoaded) { |
|
| 42 | 1 | return; |
|
| 43 | } |
||
| 44 | |||
| 45 | try { |
||
| 46 | 15 | $dotEnv = \Dotenv\Dotenv::create( |
|
| 47 | 15 | $this->pathResolver->resolvePathToEnvFile($hostId), |
|
| 48 | 15 | $this->fileNameResolver->resolveEnvFileName($hostId) |
|
| 49 | ); |
||
| 50 | 15 | $dotEnv->overload(); |
|
| 51 | 14 | $this->isEnvFileAlreadyLoaded = true; |
|
| 52 | 1 | } catch (\Dotenv\Exception\ExceptionInterface $exception) { |
|
| 53 | 1 | throw EnvFileReaderException::becauseEnvFileCanNotBeProcessed($exception); |
|
| 54 | } |
||
| 57 |