Report   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 104
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 2
dl 0
loc 104
ccs 0
cts 43
cp 0
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A sales() 0 6 1
A topSellers() 0 6 1
A coupons() 0 6 1
A customers() 0 6 1
A orders() 0 6 1
A products() 0 6 1
A reviews() 0 6 1
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