Passed
Pull Request — master (#15)
by Morten Poul
03:09
created

ManagesOnlineStore::deletePage()   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
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
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\BlogResource;
9
use Signifly\Shopify\REST\Resources\PageResource;
10
use Signifly\Shopify\Shopify;
11
12
/** @mixin Shopify */
13
trait ManagesOnlineStore
14
{
15
    public function createRedirect(string $path, string $target): ApiResource
16
    {
17
        return $this->createResource('redirects', [
0 ignored issues
show
Bug introduced by
The method createResource() does not exist on Signifly\Shopify\REST\Actions\ManagesOnlineStore. Did you maybe mean createRedirect()? ( Ignorable by Annotation )

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

17
        return $this->/** @scrutinizer ignore-call */ createResource('redirects', [

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
18
            'path' => $path,
19
            'target' => $target,
20
        ]);
21
    }
22
23
    public function getRedirectsCount(array $params = []): int
24
    {
25
        return $this->getResourceCount('redirects', $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

25
        return $this->/** @scrutinizer ignore-call */ getResourceCount('redirects', $params);
Loading history...
26
    }
27
28
    public function paginateRedirects(array $params = []): Cursor
29
    {
30
        return $this->cursor($this->getRedirects($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

30
        return $this->/** @scrutinizer ignore-call */ cursor($this->getRedirects($params));
Loading history...
31
    }
32
33
    public function getRedirects(array $params = []): Collection
34
    {
35
        return $this->getResources('redirects', $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

35
        return $this->/** @scrutinizer ignore-call */ getResources('redirects', $params);
Loading history...
36
    }
37
38
    public function getRedirect($redirectId): ApiResource
39
    {
40
        return $this->getResource('redirects', $redirectId);
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

40
        return $this->/** @scrutinizer ignore-call */ getResource('redirects', $redirectId);
Loading history...
41
    }
42
43
    public function updateRedirect($redirectId, $data): ApiResource
44
    {
45
        return $this->updateResource('redirects', $redirectId, $data);
0 ignored issues
show
Bug introduced by
The method updateResource() does not exist on Signifly\Shopify\REST\Actions\ManagesOnlineStore. Did you maybe mean updateRedirect()? ( Ignorable by Annotation )

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

45
        return $this->/** @scrutinizer ignore-call */ updateResource('redirects', $redirectId, $data);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
46
    }
47
48
    public function deleteRedirect($redirectId): void
49
    {
50
        $this->deleteResource('redirects', $redirectId);
0 ignored issues
show
Bug introduced by
The method deleteResource() does not exist on Signifly\Shopify\REST\Actions\ManagesOnlineStore. Did you maybe mean deleteRedirect()? ( Ignorable by Annotation )

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

50
        $this->/** @scrutinizer ignore-call */ 
51
               deleteResource('redirects', $redirectId);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
51
    }
52
53
    public function createBlog(array $data): BlogResource
54
    {
55
        return $this->createResource('blogs', $data);
56
    }
57
58
    public function getBlogsCount(array $params = []): int
59
    {
60
        return $this->getResourceCount('blogs', $params);
61
    }
62
63
    public function paginateBlogs(array $params = []): Cursor
64
    {
65
        return $this->cursor($this->getBlogs($params));
66
    }
67
68
    public function getBlogs(array $params = []): Collection
69
    {
70
        return $this->getResources('blogs', $params);
71
    }
72
73
    public function getBlog($blogId): BlogResource
74
    {
75
        return $this->getResource('blogs', $blogId);
76
    }
77
78
    public function updateBlog($blogId, $data): BlogResource
79
    {
80
        return $this->updateResource('blogs', $blogId, $data);
81
    }
82
83
    public function deleteBlog($blogId): void
84
    {
85
        $this->deleteResource('blogs', $blogId);
86
    }
87
88
    public function createPage(array $data): PageResource
89
    {
90
        return $this->createResource('pages', $data);
91
    }
92
93
    public function getPagesCount(array $params = []): int
94
    {
95
        return $this->getResourceCount('pages', $params);
96
    }
97
98
    public function paginatePages(array $params = []): Cursor
99
    {
100
        return $this->cursor($this->getPages($params));
101
    }
102
103
    public function getPages(array $params = []): Collection
104
    {
105
        return $this->getResources('pages', $params);
106
    }
107
108
    public function getPage($pageId): PageResource
109
    {
110
        return $this->getResource('pages', $pageId);
111
    }
112
113
    public function updatePage($pageId, $data): PageResource
114
    {
115
        return $this->updateResource('pages', $pageId, $data);
116
    }
117
118
    public function deletePage($pageId): void
119
    {
120
        $this->deleteResource('pages', $pageId);
121
    }
122
}
123