Passed
Push — master ( c410df...bbcf07 )
by Ro Kleine
08:10 queued 04:56
created

ManagesMetafields::getCustomerMetafieldsCount()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Signifly\Shopify\REST\Actions;
4
5
use Illuminate\Support\Collection;
6
use Signifly\Shopify\REST\Resources\MetafieldResource;
7
use Signifly\Shopify\Shopify;
8
9
/** @mixin Shopify */
10
trait ManagesMetafields
11
{
12
    public function createMetafield(array $data): MetafieldResource
13
    {
14
        return $this->createResource('metafields', $data);
0 ignored issues
show
Bug introduced by
It seems like createResource() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

14
        return $this->/** @scrutinizer ignore-call */ createResource('metafields', $data);
Loading history...
15
    }
16
17
    public function getMetafieldsCount(array $params = []): int
18
    {
19
        return $this->getResourceCount('metafields', $params);
0 ignored issues
show
Bug introduced by
It seems like getResourceCount() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

19
        return $this->/** @scrutinizer ignore-call */ getResourceCount('metafields', $params);
Loading history...
20
    }
21
22
    public function getMetafields(array $params = []): Collection
23
    {
24
        return $this->getResources('metafields', $params);
0 ignored issues
show
Bug introduced by
It seems like getResources() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
        return $this->/** @scrutinizer ignore-call */ getResources('metafields', $params);
Loading history...
25
    }
26
27
    public function getMetafield($metafieldId): MetafieldResource
28
    {
29
        return $this->getResource('metafields', $metafieldId);
0 ignored issues
show
Bug introduced by
It seems like getResource() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

29
        return $this->/** @scrutinizer ignore-call */ getResource('metafields', $metafieldId);
Loading history...
30
    }
31
32
    public function updateMetafield($metafieldId, array $data): MetafieldResource
33
    {
34
        return $this->updateResource('metafields', $metafieldId, $data);
0 ignored issues
show
Bug introduced by
It seems like updateResource() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

34
        return $this->/** @scrutinizer ignore-call */ updateResource('metafields', $metafieldId, $data);
Loading history...
35
    }
36
37
    public function deleteMetafield($metafieldId): void
38
    {
39
        $this->deleteResource('metafields', $metafieldId);
0 ignored issues
show
Bug introduced by
It seems like deleteResource() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

39
        $this->/** @scrutinizer ignore-call */ 
40
               deleteResource('metafields', $metafieldId);
Loading history...
40
    }
41
42
    public function createCustomerMetafield($customerId, array $data): MetafieldResource
43
    {
44
        return $this->createResource('metafields', $data, ['customers', $customerId]);
45
    }
46
47
    public function getCustomerMetafieldsCount($customerId, array $params = []): int
48
    {
49
        return $this->getResourceCount('metafields', $params, ['customers', $customerId]);
50
    }
51
52
    public function getCustomerMetafields($customerId, array $params = []): Collection
53
    {
54
        return $this->getResources('metafields', $params, ['customers', $customerId]);
55
    }
56
57
    public function createProductMetafield($productId, array $data): MetafieldResource
58
    {
59
        return $this->createResource('metafields', $data, ['products', $productId]);
60
    }
61
62
    public function getProductMetafieldsCount($productId, array $params = []): int
63
    {
64
        return $this->getResourceCount('metafields', $params, ['products', $productId]);
65
    }
66
67
    public function getProductMetafields($productId, array $params = []): Collection
68
    {
69
        return $this->getResources('metafields', $params, ['products', $productId]);
70
    }
71
72
    public function createVariantMetafield($variantId, array $data): MetafieldResource
73
    {
74
        return $this->createResource('metafields', $data, ['variants', $variantId]);
75
    }
76
77
    public function getVariantMetafieldsCount($variantId, array $params = []): int
78
    {
79
        return $this->getResourceCount('metafields', $params, ['variants', $variantId]);
80
    }
81
82
    public function getVariantMetafields($variantId, array $params = []): Collection
83
    {
84
        return $this->getResources('metafields', $params, ['variants', $variantId]);
85
    }
86
87
    public function createProductVariantMetafield($productId, $variantId, array $data): MetafieldResource
88
    {
89
        return $this->createResource('metafields', $data, ['products', $productId, 'variants', $variantId]);
90
    }
91
92
    public function getProductVariantMetafieldsCount($productId, $variantId, array $params = []): int
93
    {
94
        return $this->getResourceCount('metafields', $params, ['products', $productId, 'variants', $variantId]);
95
    }
96
97
    public function getProductVariantMetafields($productId, $variantId, array $params = []): Collection
98
    {
99
        return $this->getResources('metafields', $params, ['products', $productId, 'variants', $variantId]);
100
    }
101
102
    public function createDraftOrderMetafield($orderId, array $data): MetafieldResource
103
    {
104
        return $this->createResource('metafields', $data, ['draft_orders', $orderId]);
105
    }
106
107
    public function getDraftOrderMetafieldsCount($orderId, array $params = []): int
108
    {
109
        return $this->getResourceCount('metafields', $params, ['draft_orders', $orderId]);
110
    }
111
112
    public function getDraftOrderMetafields($orderId, array $params = []): Collection
113
    {
114
        return $this->getResources('metafields', $params, ['draft_orders', $orderId]);
115
    }
116
117
    public function createOrderMetafield($orderId, array $data): MetafieldResource
118
    {
119
        return $this->createResource('metafields', $data, ['orders', $orderId]);
120
    }
121
122
    public function getOrderMetafieldsCount($orderId, array $params = []): int
123
    {
124
        return $this->getResourceCount('metafields', $params, ['orders', $orderId]);
125
    }
126
127
    public function getOrderMetafields($orderId, array $params = []): Collection
128
    {
129
        return $this->getResources('metafields', $params, ['orders', $orderId]);
130
    }
131
132
    public function createCollectionMetafield($collectionId, array $data): MetafieldResource
133
    {
134
        return $this->createResource('metafields', $data, ['collections', $collectionId]);
135
    }
136
137
    public function getCollectionMetafieldsCount($collectionId, array $params = []): int
138
    {
139
        return $this->getResourceCount('metafields', $params, ['collections', $collectionId]);
140
    }
141
142
    public function getCollectionMetafields($collectionId, array $params = []): Collection
143
    {
144
        return $this->getResources('metafields', $params, ['collections', $collectionId]);
145
    }
146
}
147