Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
87.50% |
7 / 8 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| HPOS | |
87.50% |
7 / 8 |
|
50.00% |
1 / 2 |
3.02 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| declare_compatibility | |
85.71% |
6 / 7 |
|
0.00% |
0 / 1 |
2.01 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Declare compatibility with WooCommere's new High Performance Order Storage (database tables). |
| 4 | * |
| 5 | * Rather, assert we are not doing anything incompatible! |
| 6 | * |
| 7 | * @see https://github.com/woocommerce/woocommerce/wiki/High-Performance-Order-Storage-Upgrade-Recipe-Book#declaring-extension-incompatibility |
| 8 | * |
| 9 | * @package brianhenryie/bh-wp-bitcoin-gateway |
| 10 | */ |
| 11 | |
| 12 | namespace BrianHenryIE\WP_Bitcoin_Gateway\Integrations\WooCommerce; |
| 13 | |
| 14 | use Automattic\WooCommerce\Utilities\FeaturesUtil; |
| 15 | use BrianHenryIE\WP_Bitcoin_Gateway\Settings_Interface; |
| 16 | |
| 17 | /** |
| 18 | * Message FeaturesUtil that this plugin has no incompatibilities with HPOS. |
| 19 | * |
| 20 | * @see https://woocommerce.com/document/high-performance-order-storage/ |
| 21 | */ |
| 22 | class HPOS { |
| 23 | |
| 24 | /** |
| 25 | * Constructor |
| 26 | * |
| 27 | * @param Settings_Interface $settings The plugin's settings. |
| 28 | */ |
| 29 | public function __construct( |
| 30 | protected Settings_Interface $settings // For the plugin basename. |
| 31 | ) { |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Register compatibility with HPOS. |
| 36 | * |
| 37 | * We do not use any funky SQL for orders, just WooCommerce's CRUD function. |
| 38 | * |
| 39 | * @hooked before_woocommerce_init |
| 40 | * @see WooCommerce::init() |
| 41 | */ |
| 42 | public function declare_compatibility(): void { |
| 43 | if ( ! class_exists( FeaturesUtil::class ) ) { |
| 44 | return; |
| 45 | } |
| 46 | |
| 47 | FeaturesUtil::declare_compatibility( |
| 48 | 'custom_order_tables', |
| 49 | $this->settings->get_plugin_basename(), |
| 50 | true |
| 51 | ); |
| 52 | } |
| 53 | } |