wpdb = $wpdb; } public function get(): array { return array_replace( [ 'latitude' => null, 'longitude' => null ], (array) get_option( self::OPTION, [] ) ); } public function save( array $location ): array { try { return ( new ResourceLockRepository( $this->wpdb ) )->run( null, function () use ( $location ): array { update_option( self::OPTION, $location, false ); if ( $this->wpdb->last_error || $this->get() !== $location ) { throw new \ABeCe\Booking\Domain\CatalogException( 'abece_booking_settings_error', __( 'Club location could not be saved.', 'abece-booking' ), 500 ); } return $location; } ); } catch ( \Throwable $error ) { wp_cache_delete( self::OPTION, 'options' ); wp_cache_delete( 'notoptions', 'options' ); throw $error; } } }