| Conditions | 4 |
| Paths | 4 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public function fetchConfig(string $configFolder, string $applicationEnvironment) : array |
||
| 26 | { |
||
| 27 | $config = []; |
||
| 28 | |||
| 29 | // load the config.php if it exists |
||
| 30 | $path = $configFolder . '/config.php'; |
||
| 31 | if (file_exists($path)) { |
||
| 32 | $config = require_once $path; |
||
| 33 | } |
||
| 34 | |||
| 35 | // check environment config folder exists |
||
| 36 | $path = $configFolder . '/' . $applicationEnvironment; |
||
| 37 | if (file_exists($path)) { |
||
| 38 | $files = glob($path . '/*.php'); |
||
| 39 | foreach ($files as $file) { |
||
| 40 | $config = array_merge($config, require_once $file); |
||
| 41 | } |
||
| 42 | } |
||
| 43 | |||
| 44 | return $config; |
||
| 45 | } |
||
| 46 | } |