GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

AttachmentHelpers::setUrl()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace NotificationChannels\OneSignal\Traits\Categories;
4
5
trait AttachmentHelpers
6
{
7
    /**
8
     * Set an Image/more than one Image only for iOS.
9
     *
10
     * @param string|array $imageUrl
11
     *
12
     * @return $this
13
     */
14 1
    public function setIosAttachment($imageUrl)
15
    {
16 1
        $imageUrl = is_array($imageUrl) ? $imageUrl : ['id1' => $imageUrl];
17
18 1
        return $this->setParameter('ios_attachments', $imageUrl);
0 ignored issues
show
Bug introduced by
It seems like setParameter() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
19
    }
20
21
    /**
22
     * Set the Big Picture Image only for Android.
23
     *
24
     * @param string $imageUrl
25
     *
26
     * @return $this
27
     */
28 1
    public function setAndroidBigPicture(string $imageUrl)
29
    {
30 1
        return $this->setParameter('big_picture', $imageUrl);
0 ignored issues
show
Bug introduced by
It seems like setParameter() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
31
    }
32
33
    /**
34
     * Set the Big Picture Image only for FireOS (Amazon).
35
     *
36
     * @param string $imageUrl
37
     *
38
     * @return $this
39
     */
40 1
    public function setAmazonBigPicture(string $imageUrl)
41
    {
42 1
        return $this->setParameter('adm_big_picture', $imageUrl);
0 ignored issues
show
Bug introduced by
It seems like setParameter() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
43
    }
44
45
    /**
46
     * Set the Big Picture Image only for Chrome.
47
     *
48
     * @param string $imageUrl
49
     *
50
     * @return $this
51
     */
52 1
    public function setChromeBigPicture(string $imageUrl)
53
    {
54 1
        return $this->setParameter('chrome_big_picture', $imageUrl);
0 ignored issues
show
Bug introduced by
It seems like setParameter() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
55
    }
56
57
    /**
58
     * Set the Web Image only for Chrome.
59
     *
60
     * @param string $imageUrl
61
     *
62
     * @return $this
63
     */
64 1
    public function setChromeWebImage(string $imageUrl)
65
    {
66 1
        return $this->setParameter('chrome_web_image', $imageUrl);
0 ignored issues
show
Bug introduced by
It seems like setParameter() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
67
    }
68
69
    /**
70
     * Set the additional URL for all Platforms.
71
     *
72
     * @param string $url
73
     *
74
     * @return $this
75
     */
76 10
    public function setUrl(string $url)
77
    {
78 10
        return $this->setParameter('url', $url);
0 ignored issues
show
Bug introduced by
It seems like setParameter() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
79
    }
80
81
    /**
82
     * Set an image to all possible attachment variables.
83
     *
84
     * @param string $imageUrl
85
     *
86
     * @return $this
87
     */
88 1
    public function setImageAttachments(string $imageUrl)
89
    {
90 1
        return $this->setIosAttachment($imageUrl)
91 1
            ->setAndroidBigPicture($imageUrl)
92 1
            ->setAmazonBigPicture($imageUrl)
93 1
            ->setChromeBigPicture($imageUrl)
94 1
            ->setChromeWebImage($imageUrl);
95
    }
96
}
97