Passed
Push — develop ( a00b17...ac969d )
by Edwin
03:44
created

Fulfillment::__construct()   A

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
c 1
b 0
f 0
dl 0
loc 13
ccs 11
cts 11
cp 1
rs 9.4285
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/fulfillment
10
 *
11
 * @method create(array $parameters = [])
12
 * @method get(float $parentId, float $childId, array $parameters = [])
13
 * @method all(float $parentId, array $parameters = [])
14
 * @method count(float $parentId)
15
 * @method update(float $parentId, float $childId, array $parameters = [])
16
 * @method complete(float $parentId, float $childId)
17
 * @method open(float $parentId, float $childId)
18
 * @method cancel(float $parentId, float $childId)
19
 *
20
 * @property FulfillmentEvent $events
21
 */
22
class Fulfillment extends AbstractResource implements Resource
23
{
24
    /**
25
     * @var array
26
     */
27
    protected $childResources = [
28
        'events' => FulfillmentEvent::class,
29
    ];
30
31
    /**
32
     * Fulfillment 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, 'orders/%s/fulfillments.json', 'fulfillment', 'fulfillment'));
40 5
        $this->actions->add('get', new Action(Request::METHOD_GET, 'orders/%s/fulfillments/%s.json', 'fulfillment', 'fulfillment'));
41 5
        $this->actions->add('all', new Action(Request::METHOD_GET, 'orders/%s/fulfillments.json', 'fulfillments', 'fulfillments'));
42 5
        $this->actions->add('count', new Action(Request::METHOD_GET, 'orders/%s/fulfillments/count.json', 'count', 'count'));
43 5
        $this->actions->add('update', new Action(Request::METHOD_PUT, 'orders/%s/fulfillments/%s.json', 'fulfillment', 'fulfillment'));
44 5
        $this->actions->add('complete', new Action(Request::METHOD_POST, 'orders/%s/fulfillments/%s/complete.json', 'fulfillment', 'fulfillment'));
45 5
        $this->actions->add('open', new Action(Request::METHOD_POST, 'orders/%s/fulfillments/%s/open.json', 'fulfillment', 'fulfillment'));
46 5
        $this->actions->add('cancel', new Action(Request::METHOD_POST, 'orders/%s/fulfillments/%s/cancel.json', 'fulfillment', 'fulfillment'));
47 5
    }
48
}
49