automatewoo/includes/Traits/IntegrationValidator.php
fei-source 47d3c9a8b6 Update to v6.2.2
Source: GrootMade/Festinger Vault
2026-03-15 08:31:15 +08:00

32 lines
859 B
PHP

<?php
namespace AutomateWoo\Traits;
use AutomateWoo\Exceptions\InvalidIntegration;
use AutomateWoo\Integrations;
/**
* Trait IntegrationValidator
*
* Validate that an integration is active and is a compatible version.
*
* @since 5.3.0
*/
trait IntegrationValidator {
/**
* Validate WooCommerce Bookings integration.
*
* @throws InvalidIntegration If integration is inactive or incompatible.
*/
protected function validate_bookings_integration() {
$name = 'WooCommerce Bookings';
if ( ! defined( 'WC_BOOKINGS_VERSION' ) ) {
throw InvalidIntegration::plugin_not_active( esc_html( $name ) );
}
if ( version_compare( WC_BOOKINGS_VERSION, Integrations::REQUIRED_BOOKINGS_VERSION, '<' ) ) {
throw InvalidIntegration::plugin_version_not_supported( esc_html( $name ), esc_html( Integrations::REQUIRED_BOOKINGS_VERSION ) );
}
}
}