Passed
Push — develop ( d429ec...3e77ee )
by Edwin
02:54
created

Customer::all()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
crap 1
1
<?php
2
3
namespace ShopifyClient\Resource;
4
5
/**
6
 * https://help.shopify.com/api/reference/customer
7
 */
8
class Customer extends AbstractCrudResource
9
{
10
    /**
11
     * @var string
12
     */
13
    protected $resourceKeySingular = 'customer';
14
15
    /**
16
     * @var string
17
     */
18
    protected $resourceKeyPleural = 'customers';
19
20
    /**
21
     * @var bool
22
     */
23
    protected $countable = true;
24
25
    /**
26
     * @var CustomerAddress
27
     */
28
    public $addresses;
29
30
    /**
31
     * @param array $query
32
     * @return mixed
33
     */
34 1
    public function search(array $query = [])
35
    {
36 1
        $response = $this->request('GET', '/admin/customers/search.json', [
37 1
            'query' => $query
38
        ]);
39
40 1
        return $response['customers'];
41
    }
42
43
    /**
44
     * @param float $id
45
     * @return array
46
     */
47 1
    public function orders(float $id)
48
    {
49 1
        $response = $this->request('GET', sprintf('/admin/customers/%s/orders.json', $id));
50
51 1
        return $response['orders'];
52
    }
53
}
54