| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | public function validate(): void |
||
| 20 | { |
||
| 21 | $dsn = $_ENV['DATABASE_DSN'] ?? ''; |
||
| 22 | |||
| 23 | if ($dsn === '') { |
||
| 24 | throw new EnvironmentValidationException( |
||
| 25 | 'Database DSN is not set in config' |
||
| 26 | ); |
||
| 27 | } |
||
| 28 | |||
| 29 | try { |
||
| 30 | $this->dic->get(EntityManagerInterface::class)->getConnection()->connect(); |
||
| 31 | } catch (Throwable $e) { |
||
| 32 | throw new EnvironmentValidationException( |
||
| 33 | 'Database connection could not be established', |
||
| 34 | 0, |
||
| 35 | $e |
||
| 36 | ); |
||
| 40 |