*/ private array $data; /** * @param array $data */ public function __construct(array $data = []) { $this->data = $data; } /** * Check whether a module is enabled. */ public function isModuleEnabled(string $name): bool { $modules = $this->data['modules'] ?? []; if (!is_array($modules)) return false; return !empty($modules[$name]); } /** * Get a value with optional default. * @param mixed $default * @return mixed */ public function get(string $key, mixed $default = null): mixed { // Support simple dot-notation for nested keys, e.g. "limits.max_size" if (strpos($key, '.') === false) { return $this->data[$key] ?? $default; } $parts = explode('.', $key); $cur = $this->data; foreach ($parts as $p) { if (!is_array($cur) || !array_key_exists($p, $cur)) { return $default; } $cur = $cur[$p]; } return $cur; } /** * Return the raw config array. * @return array */ public function toArray(): array { return $this->data; } }