get($key); if ($value === null) { throw new RuntimeException(sprintf('Missing required configuration: %s', $key)); } return $value; } public function int(string $key, int $default = 0): int { $value = $this->get($key); return $value === null ? $default : (int) $value; } /** * Interprete les conventions usuelles de booleen textuel d'environnement. */ public function bool(string $key, bool $default = false): bool { $value = $this->get($key); if ($value === null) { return $default; } return in_array(strtolower($value), ['1', 'true', 'yes', 'on'], true); } public function appEnv(): string { return $this->get('APP_ENV', 'production') ?? 'production'; } public function isDebug(): bool { return $this->bool('APP_DEBUG', false); } public function timezone(): string { return $this->get('APP_TIMEZONE', 'UTC') ?? 'UTC'; } }