createConfig(); } private function createConfig(): void { if (file_exists($this->getConfigFile())) { return; } else { if (!is_dir($this->getConfigPath())) { mkdir($this->getConfigPath(), 0755, true); } $this->writeConfig([]); } } } readonly class config { public function __construct( private string $path, private string $fileName = 'config.php', ) {} public function get(string $key, mixed $default = null): mixed { if (!file_exists($this->getConfigFile())) { return $default; } $config = include $this->getConfigFile(); return $config[$key] ?? $default; } public function set(string $key, mixed $value): void { $config = include $this->getConfigFile(); $config[$key] = $value; $this->writeConfig($config); } protected function getConfigFile(): string { return path($this->getConfigPath(), $this->fileName); } protected function getConfigPath(): string { return $this->path; } protected function writeConfig(array $config): void { file_put_contents($this->getConfigFile(), '