1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
<?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 ) ); } } }
|