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.
Completed
Pull Request — master (#58)
by Lukas
01:54
created

ButtonHelpers   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 0
cbo 3
dl 0
loc 50
ccs 4
cts 4
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A webButton() 0 5 1
A webButtons() 0 5 1
A button() 0 4 1
A buttons() 0 4 1
1
<?php
2
3
namespace NotificationChannels\OneSignal\Traits\Categories;
4
5
6
use NotificationChannels\OneSignal\OneSignalWebButton;
7
use NotificationChannels\OneSignal\OneSignalButton;
8
9
trait ButtonHelpers
10
{
11
    /**
12
     * Add a web button to the message.
13
     *
14
     * @param OneSignalWebButton $button
15
     *
16
     * @return $this
17
     */
18 1
    public function webButton(OneSignalWebButton $button)
19
    {
20 1
        return $this->setParameter('web_buttons',[$button->toArray()]);
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...
21
22
    }
23
    /**
24
     * Adds more than one web button to the message.
25
     *
26
     * @param array[OnSignalWebButton] $buttons
0 ignored issues
show
Documentation introduced by
The doc-type array[OnSignalWebButton] could not be parsed: Expected "]" at position 2, but found "OnSignalWebButton". (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
27
     *
28
     * @return $this
29
     */
30
    public function webButtons(array $buttons)
31
    {
32
        return $this->setParameter('web_buttons',collect($buttons)->map(function($button) { return $button->toArray();}));
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...
33
34
    }
35
    /**
36
     * Add a native button to the message.
37
     *
38
     * @param OneSignalButton $button
39
     *
40
     * @return $this
41
     */
42 1
    public function button(OneSignalButton $button)
43
    {
44 1
        return $this->setParameter('buttons',[$button->toArray()]);
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...
45
    }
46
47
    /**
48
     * Adds more than one native button to the message.
49
     *
50
     * @param array $buttons
51
     *
52
     * @return $this
53
     */
54
    public function buttons(array $buttons)
55
    {
56
        return $this->setParameter('buttons',collect($buttons)->map(function($button) { return $button->toArray();}));
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...
57
    }
58
}