validate($value)) { throw new \Exception("Invalid value for order sync trigger. Must be one of: " . implode(', ', self::VALID_VALUES)); } update_option(self::OPTION_NAME, (string) $value); return $this->get(); } /** * Static helper to get the current trigger status * * @return string Current trigger status */ public static function getTriggerStatus() { return get_option(self::OPTION_NAME, self::DEFAULT_VALUE); } /** * Check if order sync is enabled * * @return bool */ public static function isEnabled() { return self::getTriggerStatus() !== 'disabled'; } } }