28 lines
621 B
PHP
28 lines
621 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* Zentrale Konfiguration. Lädt das Array aus /config/config.php
|
|
* (liegt außerhalb des Webroots) und stellt es global bereit.
|
|
*/
|
|
final class Config
|
|
{
|
|
/** @var array<string,mixed> */
|
|
private static array $data = [];
|
|
|
|
public static function load(string $file): void
|
|
{
|
|
self::$data = require $file;
|
|
}
|
|
|
|
public static function get(string $key, mixed $default = null): mixed
|
|
{
|
|
return self::$data[$key] ?? $default;
|
|
}
|
|
|
|
/** @return array<string,mixed> */
|
|
public static function all(): array
|
|
{
|
|
return self::$data;
|
|
}
|
|
}
|