Customer::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 13
ccs 11
cts 11
cp 1
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 10
nc 1
nop 1
crap 1
1
<?php
2
3
namespace ShopifyClient\Resource;
4
5
use ShopifyClient\Action\Action;
6
use ShopifyClient\Request;
7
8
/**
9
 * https://help.shopify.com/api/reference/customer
10
 *
11
 * @method create(array $parameters = [])
12
 * @method get(float $parentId)
13
 * @method all(float $parentId)
14
 * @method count(float $parentId)
15
 * @method update(float $parentId, array $parameters = [])
16
 * @method delete(float $parentId)
17
 *
18
 * @property ProductMetaField $metafields
19
 * @property CustomerAddress $addresses
20
 */
21
class Customer extends AbstractResource implements Resource
22
{
23
    /**
24
     * @var array
25
     */
26
    protected $childResources = [
27
        'metafields' => CustomerMetaField::class,
28
        'addresses'  => CustomerAddress::class,
29
    ];
30
31
    /**
32
     * Customer constructor.
33
     * @param Request $request
34
     */
35 5
    public function __construct(Request $request)
36
    {
37 5
        parent::__construct($request);
38
39 5
        $this->actions->add('create', new Action(Request::METHOD_POST, 'customers.json', 'customer', 'customer'));
40 5
        $this->actions->add('get', new Action(Request::METHOD_GET, 'customers/%s.json', 'customer', 'customer'));
41 5
        $this->actions->add('search', new Action(Request::METHOD_GET, 'customers/search.json', 'customers', 'customers'));
42 5
        $this->actions->add('all', new Action(Request::METHOD_GET, 'customers.json', 'customers', 'customers'));
43 5
        $this->actions->add('count', new Action(Request::METHOD_GET, 'customers/count.json', 'count', 'count'));
44 5
        $this->actions->add('update', new Action(Request::METHOD_PUT, 'customers/%s.json', 'customer', 'customer'));
45 5
        $this->actions->add('orders', new Action(Request::METHOD_GET, 'customers/%s/orders.json', 'orders', 'orders'));
46 5
        $this->actions->add('delete', new Action(Request::METHOD_DELETE, 'customers/%s.json'));
47 5
    }
48
}
49