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
Push — master ( 8475b5...49338a )
by Irfaq
04:00
created

HasButtons::buttons()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 2
eloc 5
nc 2
nop 1
1
<?php
2
3
namespace NotificationChannels\Facebook\Traits;
4
5
use NotificationChannels\Facebook\Exceptions\CouldNotCreateMessage;
6
7
trait HasButtons
8
{
9
    /**
10
     * Add up to 3 call to action buttons.
11
     *
12
     * @param array $buttons
13
     *
14
     * @return $this
15
     * @throws CouldNotCreateMessage
16
     */
17
    public function buttons(array $buttons = [])
18
    {
19
        if (count($buttons) > 3) {
20
            throw CouldNotCreateMessage::messageButtonsLimitExceeded();
21
        }
22
23
        $this->payload['buttons'] = $buttons;
0 ignored issues
show
Bug introduced by
The property payload does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
24
25
        return $this;
26
    }
27
}
28