Report::products()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Codexshaper\WooCommerce\Models;
4
5
use Codexshaper\WooCommerce\Facades\Query;
6
use Codexshaper\WooCommerce\Traits\QueryBuilderTrait;
7
8
class Report extends BaseModel
9
{
10
    use QueryBuilderTrait;
11
12
    protected $endpoint = 'reports';
13
14
    /**
15
     * Retrieve all sales.
16
     *
17
     * @param array $options
18
     *
19
     * @return array
20
     */
21
    protected function sales($options = [])
22
    {
23
        return Query::init()
24
            ->setEndpoint('reports/sales')
25
            ->all($options);
26
    }
27
28
    /**
29
     * Retrieve all top sellers.
30
     *
31
     * @param array $options
32
     *
33
     * @return array
34
     */
35
    protected function topSellers($options = [])
36
    {
37
        return Query::init()
38
            ->setEndpoint('reports/top_sellers')
39
            ->all($options);
40
    }
41
42
    /**
43
     * Retrieve all coupons.
44
     *
45
     * @param array $options
46
     *
47
     * @return array
48
     */
49
    protected function coupons($options = [])
50
    {
51
        return Query::init()
52
            ->setEndpoint('reports/coupons/totals')
53
            ->all($options);
54
    }
55
56
    /**
57
     * Retrieve all customers.
58
     *
59
     * @param array $options
60
     *
61
     * @return array
62
     */
63
    protected function customers($options = [])
64
    {
65
        return Query::init()
66
            ->setEndpoint('reports/customers/totals')
67
            ->all($options);
68
    }
69
70
    /**
71
     * Retrieve all orders.
72
     *
73
     * @param array $options
74
     *
75
     * @return array
76
     */
77
    protected function orders($options = [])
78
    {
79
        return Query::init()
80
            ->setEndpoint('reports/orders/totals')
81
            ->all($options);
82
    }
83
84
    /**
85
     * Retrieve all products.
86
     *
87
     * @param array $options
88
     *
89
     * @return array
90
     */
91
    protected function products($options = [])
92
    {
93
        return Query::init()
94
            ->setEndpoint('reports/products/totals')
95
            ->all($options);
96
    }
97
98
    /**
99
     * Retrieve all reviews.
100
     *
101
     * @param array $options
102
     *
103
     * @return array
104
     */
105
    protected function reviews($options = [])
106
    {
107
        return Query::init()
108
            ->setEndpoint('reports/reviews/totals')
109
            ->all($options);
110
    }
111
}
112