ManagesEvents   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
dl 0
loc 55
rs 10
c 1
b 0
f 0
wmc 11

11 Methods

Rating   Name   Duplication   Size   Complexity  
A getEventsCount() 0 3 1
A getEvents() 0 3 1
A deleteWebhook() 0 3 1
A paginateWebhooks() 0 3 1
A createWebhook() 0 3 1
A getWebhooks() 0 3 1
A getWebhooksCount() 0 3 1
A paginateEvents() 0 3 1
A updateWebhook() 0 3 1
A getWebhook() 0 3 1
A createEvent() 0 3 1
1
<?php
2
3
namespace Signifly\Shopify\REST\Actions;
4
5
use Illuminate\Support\Collection;
6
use Signifly\Shopify\REST\Cursor;
7
use Signifly\Shopify\REST\Resources\ApiResource;
8
use Signifly\Shopify\REST\Resources\WebhookResource;
9
use Signifly\Shopify\Shopify;
10
11
/** @mixin Shopify */
12
trait ManagesEvents
13
{
14
    public function createEvent(array $data): ApiResource
15
    {
16
        return $this->createResource('events', $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

16
        return $this->/** @scrutinizer ignore-call */ createResource('events', $data);
Loading history...
17
    }
18
19
    public function getEventsCount(array $params = []): int
20
    {
21
        return $this->getResourceCount('events', $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

21
        return $this->/** @scrutinizer ignore-call */ getResourceCount('events', $params);
Loading history...
22
    }
23
24
    public function paginateEvents(array $params = []): Cursor
25
    {
26
        return $this->cursor($this->getEvents($params));
0 ignored issues
show
Bug introduced by
It seems like cursor() 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

26
        return $this->/** @scrutinizer ignore-call */ cursor($this->getEvents($params));
Loading history...
27
    }
28
29
    public function getEvents(array $params = []): Collection
30
    {
31
        return $this->getResources('events', $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

31
        return $this->/** @scrutinizer ignore-call */ getResources('events', $params);
Loading history...
32
    }
33
34
    public function createWebhook(array $data): WebhookResource
35
    {
36
        return $this->createResource('webhooks', $data);
37
    }
38
39
    public function getWebhooksCount(array $params = []): int
40
    {
41
        return $this->getResourceCount('webhooks', $params);
42
    }
43
44
    public function paginateWebhooks(array $params = []): Cursor
45
    {
46
        return $this->cursor($this->getWebhooks($params));
47
    }
48
49
    public function getWebhooks(array $params = []): Collection
50
    {
51
        return $this->getResources('webhooks', $params);
52
    }
53
54
    public function getWebhook($webhookId): WebhookResource
55
    {
56
        return $this->getResource('webhooks', $webhookId);
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

56
        return $this->/** @scrutinizer ignore-call */ getResource('webhooks', $webhookId);
Loading history...
57
    }
58
59
    public function updateWebhook($webhookId, $data): WebhookResource
60
    {
61
        return $this->updateResource('webhooks', $webhookId, $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

61
        return $this->/** @scrutinizer ignore-call */ updateResource('webhooks', $webhookId, $data);
Loading history...
62
    }
63
64
    public function deleteWebhook($webhookId): void
65
    {
66
        $this->deleteResource('webhooks', $webhookId);
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

66
        $this->/** @scrutinizer ignore-call */ 
67
               deleteResource('webhooks', $webhookId);
Loading history...
67
    }
68
}
69