ProductVariant   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 71
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 71
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_variant
10
 *
11
 * @method create(float $parentId, array $parameters = [])
12
 * @method get(float $childId)
13
 * @method all(float $parentId, array $parameters = [])
14
 * @method count(float $parentId)
15
 * @method update(float $childId, array $parameters = [])
16
 * @method delete(float $parentId, float $childId)
17
 *
18
 * @property ProductVariantMetaField $metafields
19
 */
20
class ProductVariant extends AbstractResource implements Resource
21
{
22
    /**
23
     * @var array
24
     */
25
    protected $childResources = [
26
        'metafields' => ProductVariantMetaField::class,
27
    ];
28
29
    /**
30
     * ProductVariant 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
                'products/%s/variants.json',
42 5
                'variant',
43 5
                'variant'
44
            )
45
        );
46 5
        $this->actions->add(
47 5
            'get',
48 5
            new Action(
49 5
                Request::METHOD_GET,
50 5
                'variants/%s.json',
51 5
                'variant',
52 5
                'variant'
53
            )
54
        );
55 5
        $this->actions->add(
56 5
            'all',
57 5
            new Action(
58 5
                Request::METHOD_GET,
59 5
                'products/%s/variants.json',
60 5
                'variants',
61 5
                'variants'
62
            )
63
        );
64 5
        $this->actions->add(
65 5
            'count',
66 5
            new Action(
67 5
                Request::METHOD_GET,
68 5
                'products/%s/variants/count.json',
69 5
                'count',
70 5
                'count'
71
            )
72
        );
73 5
        $this->actions->add(
74 5
            'update',
75 5
            new Action(
76 5
                Request::METHOD_PUT,
77 5
                'variants/%s.json',
78 5
                'variant',
79 5
                'variant'
80
            )
81
        );
82 5
        $this->actions->add(
83 5
            'delete',
84 5
            new Action(
85 5
                Request::METHOD_DELETE,
86 5
                'products/%s/variants/%s.json'
87
            )
88
        );
89 5
    }
90
}
91