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 ( 2a2204...c03bc3 )
by Peter
15s
created

MessagebirdMessage   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
wmc 10
lcom 1
cbo 0
dl 0
loc 63
ccs 20
cts 25
cp 0.8
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 4 1
A setBody() 0 6 1
A setOriginator() 0 6 1
A setReference() 0 6 1
A __construct() 0 6 2
A setRecipients() 0 10 2
A setDatacoding() 0 6 1
A toJson() 0 4 1
1
<?php
2
3
namespace NotificationChannels\Messagebird;
4
5
class MessagebirdMessage
6
{
7
    public $body;
8
    public $originator;
9
    public $recipients;
10
    public $reference;
11
12 2
    public static function create($body = '')
13
    {
14 2
        return new static($body);
15
    }
16
17 12
    public function __construct($body = '')
18
    {
19 12
        if (! empty($body)) {
20 6
            $this->body = trim($body);
21
        }
22 12
    }
23
24 1
    public function setBody($body)
25
    {
26 1
        $this->body = trim($body);
27
28 1
        return $this;
29
    }
30
31 4
    public function setOriginator($originator)
32
    {
33 4
        $this->originator = $originator;
34
35 4
        return $this;
36
    }
37
38 7
    public function setRecipients($recipients)
39
    {
40 7
        if (is_array($recipients)) {
41 1
            $recipients = implode(',', $recipients);
42
        }
43
44 7
        $this->recipients = $recipients;
45
46 7
        return $this;
47
    }
48
49 2
    public function setReference($reference)
50
    {
51 2
        $this->reference = $reference;
52
53 2
        return $this;
54
    }
55
56
    public function setDatacoding($datacoding)
57
    {
58
        $this->datacoding = $datacoding;
0 ignored issues
show
Bug introduced by
The property datacoding 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...
59
60
        return $this;
61
    }
62
63
    public function toJson()
64
    {
65
        return json_encode($this);
66
    }
67
}
68