Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| Wpcom_Report_Provider | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
| check_ready | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * WordPress.com's synced data. |
| 4 | * |
| 5 | * @package automattic/jetpack-woocommerce-stats |
| 6 | */ |
| 7 | |
| 8 | namespace Automattic\Jetpack\WooCommerceStats\Report_Execution; |
| 9 | |
| 10 | use Automattic\Jetpack\Connection\Manager; |
| 11 | use WP_Error; |
| 12 | |
| 13 | /** |
| 14 | * The `wpcom` provider: every WordPress.com handler needs the Jetpack connection. |
| 15 | * |
| 16 | * @since 0.3.3 |
| 17 | */ |
| 18 | class Wpcom_Report_Provider implements Report_Provider { |
| 19 | |
| 20 | /** |
| 21 | * {@inheritDoc} |
| 22 | */ |
| 23 | public function check_ready() { |
| 24 | if ( ( new Manager() )->is_connected() ) { |
| 25 | return true; |
| 26 | } |
| 27 | |
| 28 | return new WP_Error( |
| 29 | 'needs_connection', |
| 30 | __( 'Connect this site to WordPress.com to see this report.', 'jetpack-woocommerce-stats-pkg' ), |
| 31 | array( 'status' => 503 ) |
| 32 | ); |
| 33 | } |
| 34 | } |