jilo-web/app/core/ConfigLoader.php

28 lines
593 B
PHP
Raw Normal View History

2025-04-24 10:49:52 +00:00
<?php
namespace App\Core;
class ConfigLoader
{
/**
* Load configuration array from a set of possible file locations.
*
* @param string[] $locations
* @return array
*/
public static function loadConfig(array $locations): array
{
$configFile = null;
foreach ($locations as $location) {
if (file_exists($location)) {
$configFile = $location;
break;
}
}
if (!$configFile) {
die('Config file not found');
}
return require $configFile;
}
}