set(!$this->get()); } public function get() { return get_option(self::OPTION_NAME, true) ? true : false; } public function validate($v): bool { return is_bool($v); } public function set($value) { if (!$this->validate($value)) throw new \Exception("Only boolean values are accepted to this setting"); update_option(self::OPTION_NAME, $value ? 1 : 0); return $this->get(); } } }