| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace RenzoJohnson\Blocks\Settings; |
| 6 |
|
| 7 |
\defined( 'ABSPATH' ) || exit; |
| 8 |
|
| 9 |
enum Requirement { |
| 10 |
case Always; |
| 11 |
case WooCommerce; |
| 12 |
case WooCommerceSubscriptions; |
| 13 |
|
| 14 |
public function satisfied(): bool { |
| 15 |
return match ( $this ) { |
| 16 |
self::Always => true, |
| 17 |
self::WooCommerce => \class_exists( 'WooCommerce' ), |
| 18 |
self::WooCommerceSubscriptions => \class_exists( 'WooCommerce' ) && \class_exists( 'WC_Subscriptions' ), |
| 19 |
}; |
| 20 |
} |
| 21 |
} |
| 22 |
|