Test Failed
Push — develop ( 1bc728...a00b17 )
by Edwin
03:32
created

PriceRule::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 48
Code Lines 35

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 36
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 48
ccs 36
cts 36
cp 1
rs 9.125
c 0
b 0
f 0
cc 1
eloc 35
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/pricerule
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 DiscountCode $discountCode
19
 */
20
class PriceRule extends AbstractResource implements Resource
21
{
22
    /**
23
     * @var array
24
     */
25
    protected $childResources = [
26
        'discountCodes' => DiscountCode::class,
27
    ];
28
29
    /**
30
     * PriceRule constructor.
31
     * @param Request $request
32
     */
33 5
    public function __construct(Request $request)
34
    {
35 5
        parent::__construct($request);
36
37 5
        $this->actions->add(
38 5
            'create',
39 5
            new Action(
40 5
                Request::METHOD_POST,
41 5
                'price_rules.json',
42 5
                'price_rule',
43 5
                'price_rule'
44
            )
45
        );
46 5
        $this->actions->add(
47 5
            'get',
48 5
            new Action(
49 5
                Request::METHOD_GET,
50 5
                'price_rules/%s.json',
51 5
                'price_rule',
52 5
                'price_rule'
53
            )
54
        );
55 5
        $this->actions->add(
56 5
            'all',
57 5
            new Action(
58 5
                Request::METHOD_GET,
59 5
                'price_rules.json',
60 5
                'price_rules',
61 5
                'price_rules'
62
            )
63
        );
64 5
        $this->actions->add(
65 5
            'update',
66 5
            new Action(
67 5
                Request::METHOD_PUT,
68 5
                'price_rules/%s.json',
69 5
                'price_rule',
70 5
                'price_rule'
71
            )
72
        );
73 5
        $this->actions->add(
74 5
            'delete',
75 5
            new Action(
76 5
                Request::METHOD_DELETE,
77 5
                'price_rules/%s.json'
78
            )
79
        );
80 5
    }
81
}
82