Passed
Push — master ( 825ba1...8f1cfc )
by Morten Poul
04:29 queued 02:02
created

ManagesOnlineStore::getBlog()   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\Shopify;
10
11
/** @mixin Shopify */
12
trait ManagesOnlineStore
13
{
14
    public function createRedirect(string $path, string $target): ApiResource
15
    {
16
        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

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

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

29
        return $this->/** @scrutinizer ignore-call */ cursor($this->getOrders($params));
Loading history...
Bug introduced by
It seems like getOrders() 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->cursor($this->/** @scrutinizer ignore-call */ getOrders($params));
Loading history...
30
    }
31
32
    public function getRedirects(array $params = []): Collection
33
    {
34
        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

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

39
        return $this->/** @scrutinizer ignore-call */ getResource('redirects', $redirectId);
Loading history...
40
    }
41
42
    public function updateRedirect($redirectId, $data): ApiResource
43
    {
44
        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

44
        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...
45
    }
46
47
    public function deleteRedirect($redirectId): void
48
    {
49
        $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

49
        $this->/** @scrutinizer ignore-call */ 
50
               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...
50
    }
51
52
    public function createBlog(array $data): BlogResource
53
    {
54
        return $this->createResource('blogs', $data);
55
    }
56
57
    public function getBlogsCount(array $params = []): int
58
    {
59
        return $this->getResourceCount('blogs', $params);
60
    }
61
62
    public function paginateBlogs(array $params = []): Cursor
63
    {
64
        return $this->cursor($this->getBlogs($params));
65
    }
66
67
    public function getBlogs(array $params = []): Collection
68
    {
69
        return $this->getResources('blogs', $params);
70
    }
71
72
    public function getBlog($blogId): BlogResource
73
    {
74
        return $this->getResource('blogs', $blogId);
75
    }
76
77
    public function updateBlog($blogId, $data): BlogResource
78
    {
79
        return $this->updateResource('blogs', $blogId, $data);
80
    }
81
82
    public function deleteBlog($blogId): void
83
    {
84
        $this->deleteResource('blogs', $blogId);
85
    }
86
}
87