| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 30 | public static function loadEnvironmentVariables(): void |
||
| 31 | { |
||
| 32 | $envPath = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR; |
||
| 33 | $envFileMain = '.env'; |
||
| 34 | $envFileLocal = '.env.local'; |
||
| 35 | |||
| 36 | if (file_exists($envPath . $envFileLocal)) { |
||
| 37 | $envFile = $envFileLocal; |
||
| 38 | } elseif (file_exists($envPath . $envFileMain)) { |
||
| 39 | $envFile = $envFileMain; |
||
| 40 | } else { |
||
| 41 | $envPath = realpath($envPath); |
||
| 42 | throw new \RuntimeException("Environment file ('{$envFileMain}' nor '{$envFileLocal}') not found in directory '{$envPath}'!"); |
||
| 43 | } |
||
| 44 | |||
| 45 | $dotenv = Dotenv::createUnsafeImmutable($envPath, $envFile); |
||
| 46 | $dotenv->load(); |
||
| 47 | $dotenv->required(['BBB_SECRET', 'BBB_SERVER_BASE_URL']); |
||
| 48 | } |
||
| 50 |