Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| Local_Report_Provider | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
3 | |
100.00% |
1 / 1 |
| check_ready | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
3 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Reports from this site's own WooCommerce data. |
| 4 | * |
| 5 | * @package automattic/jetpack-woocommerce-stats |
| 6 | */ |
| 7 | |
| 8 | namespace Automattic\Jetpack\WooCommerceStats\Report_Execution; |
| 9 | |
| 10 | use Automattic\WooCommerce\Utilities\FeaturesUtil; |
| 11 | use WP_Error; |
| 12 | |
| 13 | /** |
| 14 | * The `local` provider: WooCommerce with its Analytics, whose `wc-analytics` routes the handlers call. |
| 15 | * |
| 16 | * @internal |
| 17 | * |
| 18 | * @since 0.5.0 |
| 19 | */ |
| 20 | class Local_Report_Provider implements Report_Provider { |
| 21 | |
| 22 | /** |
| 23 | * {@inheritDoc} |
| 24 | */ |
| 25 | public function check_ready() { |
| 26 | if ( ! class_exists( FeaturesUtil::class ) || ! FeaturesUtil::feature_is_enabled( 'analytics' ) ) { |
| 27 | return new WP_Error( |
| 28 | 'local_unavailable', |
| 29 | __( 'This report needs WooCommerce with its Analytics enabled.', 'jetpack-woocommerce-stats-pkg' ), |
| 30 | array( 'status' => 503 ) |
| 31 | ); |
| 32 | } |
| 33 | |
| 34 | return true; |
| 35 | } |
| 36 | } |