Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| Remote_Report_Provider | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
| get_name | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| check_ready | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
6 | |||
| 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 | |
| 12 | /** |
| 13 | * The `remote` provider: every remote handler needs the Jetpack connection. |
| 14 | * |
| 15 | * @since $$next-version$$ |
| 16 | */ |
| 17 | class Remote_Report_Provider implements Report_Provider { |
| 18 | |
| 19 | /** |
| 20 | * {@inheritDoc} |
| 21 | */ |
| 22 | public function get_name() { |
| 23 | return 'remote'; |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * {@inheritDoc} |
| 28 | * |
| 29 | * @param Report_Query $query The request. |
| 30 | */ |
| 31 | public function check_ready( Report_Query $query ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- The connection is the same for every request. |
| 32 | if ( ( new Manager() )->is_connected() ) { |
| 33 | return true; |
| 34 | } |
| 35 | |
| 36 | return Report_Executor::error( |
| 37 | 'needs_connection', |
| 38 | 503, |
| 39 | 'needs_connection', |
| 40 | __( 'Connect this site to WordPress.com to see this report.', 'jetpack-woocommerce-stats-pkg' ) |
| 41 | ); |
| 42 | } |
| 43 | } |