Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2/**
3 * A source that can serve store reports.
4 *
5 * @package automattic/jetpack-woocommerce-stats
6 */
7
8namespace Automattic\Jetpack\WooCommerceStats\Report_Execution;
9
10use WP_Error;
11
12/**
13 * Declares the reports it serves, whether it can serve them now, and serves them in the wpcom report shape.
14 *
15 * @since $$next-version$$
16 */
17interface Report_Provider {
18
19    /**
20     * The provider's name, as the `execution` param and the provenance name it.
21     *
22     * @return string `local` or `remote`.
23     */
24    public function get_name();
25
26    /**
27     * Whether the provider declares the report.
28     *
29     * @param string $route Report route below `analytics/reports/`, e.g. `orders/by-date`.
30     * @return bool
31     */
32    public function supports( $route );
33
34    /**
35     * Whether the provider's prerequisites for the report hold on this site.
36     *
37     * @param string $route Report route.
38     * @return true|WP_Error A 503 error with a `reason` when a prerequisite is missing.
39     */
40    public function check_ready( $route );
41
42    /**
43     * Serve the report.
44     *
45     * @param string $route  Report route.
46     * @param array  $params Report query params, without the `execution` override.
47     * @return array|WP_Error `data`, `status`, `headers`, and optionally `generated_at` and `unsupported_fields`.
48     */
49    public function run( $route, array $params );
50}