Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| Wpcom_Forward_Handler | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| run | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * The `wpcom` handler: forwards a report to WordPress.com. |
| 4 | * |
| 5 | * @package automattic/jetpack-woocommerce-stats |
| 6 | */ |
| 7 | |
| 8 | namespace Automattic\Jetpack\WooCommerceStats\Report_Execution; |
| 9 | |
| 10 | use Automattic\Jetpack\WooCommerceStats\Api_Proxy_Controller; |
| 11 | |
| 12 | /** |
| 13 | * One handler for every report WordPress.com serves, through the proxy controller's transport. |
| 14 | * |
| 15 | * @since 0.3.3 |
| 16 | */ |
| 17 | class Wpcom_Forward_Handler implements Report_Handler { |
| 18 | |
| 19 | /** |
| 20 | * The controller holding the cache, the connection check and the forward. |
| 21 | * |
| 22 | * @var Api_Proxy_Controller |
| 23 | */ |
| 24 | private $controller; |
| 25 | |
| 26 | /** |
| 27 | * Constructor. |
| 28 | * |
| 29 | * @param Api_Proxy_Controller $controller The transport. |
| 30 | */ |
| 31 | public function __construct( Api_Proxy_Controller $controller ) { |
| 32 | $this->controller = $controller; |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * {@inheritDoc} |
| 37 | * |
| 38 | * @param Report_Request $request The request. |
| 39 | */ |
| 40 | public function run( Report_Request $request ) { |
| 41 | return $this->controller->fetch_remote( $request->route, $request->params, $request->force_refresh ); |
| 42 | } |
| 43 | } |