migrator = $migrator; $this->options_storage = $storage->get_options(); $this->user_storage = $storage->get_user_storage(); $this->oauth_storage = $storage->get_oauth(); $this->cookie = $cookie; $this->api_wrapper = $api_wrapper; $this->error_handler = $error_handler; } public function uninstall() { try { $this->delete_integration(); } catch ( Exception $e ) { $this->error_handler->capture_exception( $e ); } try { $this->rollback_migrations(); } catch ( Exception $e ) { $this->error_handler->capture_exception( $e ); } $this->options_storage->delete_wp_options(); $this->user_storage->delete_wp_user_meta(); $this->cookie->delete_wp_cookies(); } /** * @throws Migration_Exception */ private function rollback_migrations() { $this->migrator->rollback_all(); } /** * @throws Account_Exception * @throws NotFoundException * @throws TokenNotFoundException */ private function delete_integration() { $this->api_wrapper->delete_integration( $this->oauth_storage->get_integration_id() ); } }