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

Product   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 73
ccs 43
cts 43
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 57 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/product
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 ProductVariant $variants
20
 * @property ProductImage $images
21
 */
22
class Product extends AbstractResource implements Resource
23
{
24
    /**
25
     * @var array
26
     */
27
    protected $childResources = [
28
        'metafields' => ProductMetaField::class,
29
        'variants'   => ProductVariant::class,
30
        'images'     => ProductImage::class,
31
    ];
32
33
    /**
34
     * Product constructor.
35
     * @param Request $request
36
     */
37 5
    public function __construct(Request $request)
38
    {
39 5
        parent::__construct($request);
40
41 5
        $this->actions->add(
42 5
            'create',
43 5
            new Action(
44 5
                Request::METHOD_POST,
45 5
                'products.json',
46 5
                'product',
47 5
                'product'
48
            )
49
        );
50 5
        $this->actions->add(
51 5
            'get',
52 5
            new Action(
53 5
                Request::METHOD_GET,
54 5
                'products/%s.json',
55 5
                'product',
56 5
                'product'
57
            )
58
        );
59 5
        $this->actions->add(
60 5
            'all',
61 5
            new Action(
62 5
                Request::METHOD_GET,
63 5
                'products.json',
64 5
                'products',
65 5
                'products'
66
            )
67
        );
68 5
        $this->actions->add(
69 5
            'count',
70 5
            new Action(
71 5
                Request::METHOD_GET,
72 5
                'products/count.json',
73 5
                'count',
74 5
                'count'
75
            )
76
        );
77 5
        $this->actions->add(
78 5
            'update',
79 5
            new Action(
80 5
                Request::METHOD_PUT,
81 5
                'products/%s.json',
82 5
                'product',
83 5
                'product'
84
            )
85
        );
86 5
        $this->actions->add(
87 5
            'delete',
88 5
            new Action(
89 5
                Request::METHOD_DELETE,
90 5
                'products/%s.json'
91
            )
92
        );
93 5
    }
94
}
95