Passed
Push — develop ( 0f04a2...a9858e )
by Edwin
03:49
created

Order::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 14
ccs 12
cts 12
cp 1
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 11
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/order
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 open(float $parentId)
17
 * @method close(float $parentId)
18
 * @method cancel(float $parentId)
19
 * @method delete(float $parentId)
20
 *
21
 * @property OrderMetaField $metafields
22
 * @property OrderRisk $risks
23
 * @property Fulfillment $fulfillments
24
 */
25
class Order extends AbstractResource implements Resource
26
{
27
    /**
28
     * @var array
29
     */
30
    protected $childResources = [
31
        'metafields'   => OrderMetaField::class,
32
        'risks'        => OrderRisk::class,
33
        'fulfillments' => Fulfillment::class,
34
    ];
35
36
    /**
37
     * Order constructor.
38
     * @param Request $request
39
     */
40 5
    public function __construct(Request $request)
41
    {
42 5
        parent::__construct($request);
43
44 5
        $this->actions->add('create', new Action(Request::METHOD_POST, 'orders.json', 'order', 'order'));
45 5
        $this->actions->add('get', new Action(Request::METHOD_GET, 'orders/%s.json', 'order', 'order'));
46 5
        $this->actions->add('all', new Action(Request::METHOD_GET, 'orders.json', 'orders', 'orders'));
47 5
        $this->actions->add('count', new Action(Request::METHOD_GET, 'orders/count.json', 'count', 'count'));
48 5
        $this->actions->add('update', new Action(Request::METHOD_PUT, 'orders/%s.json', 'order', 'order'));
49 5
        $this->actions->add('open', new Action(Request::METHOD_POST, 'orders/%s/open.json', 'order', 'order'));
50 5
        $this->actions->add('close', new Action(Request::METHOD_POST, 'orders/%s/close.json', 'order', 'order'));
51 5
        $this->actions->add('cancel', new Action(Request::METHOD_POST, 'orders/%s/cancel.json', 'order', 'order'));
52 5
        $this->actions->add('delete', new Action(Request::METHOD_DELETE, 'orders/%s.json'));
53 5
    }
54
55
56
}
57