prefix = $config['prefix']; $this->casing = $config['casing'] ?? 'snakeCase'; } /** * @inheritDoc */ public function get(string $key) { return get_option($this->prefix . $this->convertCase($key)) ?? null; } /** * @inheritDoc */ public function getMultiple(array $keys): array { $result = []; foreach ($keys as $key) { $result[$key] = $this->get($this->convertCase($key)); } return $result; } /** * @inheritDoc */ public function store(string $key, $value): void { update_option($this->prefix . $this->convertCase($key), $value, false); } /** * @inheritDoc */ public function storeMultiple(array $settings): void { foreach ($settings as $key => $value) { $this->store($key, $value); } } /** * @inheritDoc */ public function save(): void { if (empty($this->settings)) { return; } $this->storeMultiple($this->settings); } }