packman = (bool) (My::settings()->get('packman') ?? false); $this->file_pattern = (string) (My::settings()->get('file_pattern') ?? ''); } /** * Overwrite a plugin settings (in db) * * @param string $key The setting ID * @param mixed $value The setting value * * @return bool True on success */ public function set(string $key, mixed $value): bool { if (property_exists($this, $key) && settype($value, gettype($this->{$key})) === true) { My::settings()->drop($key); My::settings()->put($key, $value, gettype($this->{$key}), '', true, true); return true; } return false; } /** * List defined settings keys * * @return array The settings keys */ public function dump(): array { return get_object_vars($this); } }