PHP Class WC_API_Reports

Inheritance: extends WC_API_Resource
Show file Open project: woocommerce/woocommerce

Protected Properties

Property Type Description
$base string the route base

Public Methods

Method Description
get_reports ( ) : array Get a simple listing of available reports
get_sales_report ( string $fields = null, array $filter = [] ) : array Get the sales report
get_top_sellers_report ( string $fields = null, array $filter = [] ) : array Get the top sellers report
register_routes ( array $routes ) : array Register the routes for this class

Protected Methods

Method Description
validate_request ( null $id = null, null $type = null, null $context = null ) : boolean Verify that the current user has permission to view reports

Private Methods

Method Description
setup_report ( array $filter ) Setup the report object and parse any date filtering

Method Details

get_reports() public method

Get a simple listing of available reports
Since: 2.1
public get_reports ( ) : array
return array

get_sales_report() public method

Get the sales report
Since: 2.1
public get_sales_report ( string $fields = null, array $filter = [] ) : array
$fields string fields to include in response
$filter array date filtering
return array

get_top_sellers_report() public method

Get the top sellers report
Since: 2.1
public get_top_sellers_report ( string $fields = null, array $filter = [] ) : array
$fields string fields to include in response
$filter array date filtering
return array

register_routes() public method

GET /reports GET /reports/sales
Since: 2.1
public register_routes ( array $routes ) : array
$routes array
return array

validate_request() protected method

Verify that the current user has permission to view reports
See also: WC_API_Resource::validate_request()
Since: 2.1
protected validate_request ( null $id = null, null $type = null, null $context = null ) : boolean
$id null unused
$type null unused
$context null unused
return boolean true if the request is valid and should be processed, false otherwise

Property Details

$base protected property

the route base
protected string $base
return string