Completed
Push — develop ( fbac2a...fa8907 )
by Edwin
04:58
created

Customer::search()   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
 * @method create(array $parameters = [])
9
 * @method get(float $parentId)
10
 * @method all(float $parentId)
11
 * @method count(float $parentId)
12
 * @method update(float $parentId, array $parameters = [])
13
 * @method delete(float $parentId)
14
 *
15
 * @property ProductMetaField $metafields
16
 * @property CustomerAddress $addresses
17
 */
18
class Customer extends AbstractResource implements Resource
19
{
20
    /**
21
     * @var array
22
     */
23
    protected $actions = [
24
        'create' => [
25
            'method'      => 'POST',
26
            'endpoint'    => 'customers.json',
27
            'resourceKey' => 'customer',
28
            'responseKey' => 'customer',
29
        ],
30
        'get'    => [
31
            'method'      => 'GET',
32
            'endpoint'    => 'customers/%s.json',
33
            'resourceKey' => 'customer',
34
            'responseKey' => 'customer',
35
        ],
36
        'search' => [
37
            'method'      => 'GET',
38
            'endpoint'    => 'customers/search.json',
39
            'responseKey' => 'customers',
40
        ],
41
        'all'    => [
42
            'method'      => 'GET',
43
            'endpoint'    => 'customers.json',
44
            'resourceKey' => 'customers',
45
            'responseKey' => 'customers',
46
        ],
47
        'count'  => [
48
            'method'      => 'GET',
49
            'endpoint'    => 'customers/count.json',
50
            'resourceKey' => 'count',
51
            'responseKey' => 'count',
52
        ],
53
        'update' => [
54
            'method'      => 'PUT',
55
            'endpoint'    => 'customers/%s.json',
56
            'resourceKey' => 'customer',
57
            'responseKey' => 'customer',
58
        ],
59
        'orders' => [
60
            'method'      => 'GET',
61
            'endpoint'    => 'customers/%s/orders.json',
62
            'responseKey' => 'orders',
63
        ],
64
        'delete' => [
65
            'method'   => 'DELETE',
66
            'endpoint' => 'customers/%s.json',
67
        ],
68
    ];
69
70
    protected $childResources = [
71
        'metafields' => CustomerMetaField::class,
72
        'addresses'  => CustomerAddress::class,
73
    ];
74
}
75