getSwitchOption(), true); } /** * @subcommand disable * @return void */ public function disable() { WordPressHelper::upsert_option($this->getSwitchOption(), false); } /** * @subcommand status * @return void */ public function status() { $status = get_option($this->getSwitchOption(), false); WP_CLI::print_value((int)$status); } private function isEnabled() { return (bool) get_option($this->getSwitchOption(), false); } /** * @throws ExitException */ protected function ensureCommandEnabled() { if (!$this->isEnabled()) { WP_CLI::error(sprintf("Command `%s` isn't enabled", get_class($this))); } } }