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.

MsTeamsMessage::to()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace NotificationChannels\MsTeams;
4
5
class MsTeamsMessage
6
{
7
    private $payload = [];
8
9 2
    public function __construct($content = '')
10
    {
11 2
        $this->content($content);
12 2
    }
13
14 2
    public static function create($content = ''): self
15
    {
16 2
        return new static($content);
17
    }
18
19 1
    public function to($url): self
20
    {
21 1
        $this->payload['url'] = $url;
22
23 1
        return $this;
24
    }
25
26 2
    public function toUnknown(): bool
27
    {
28 2
        return empty($this->payload['url']);
29
    }
30
31 2
    public function title($title): self
32
    {
33 2
        $this->payload['title'] = $title;
34
35 2
        return $this;
36
    }
37
38 2
    public function content($content): self
39
    {
40 2
        if (! empty($content)) {
41 2
            $this->payload['text'] = $content;
42
        }
43
44 2
        return $this;
45
    }
46
47
    public function code($content): self
48
    {
49
        if (! empty($content)) {
50
            $this->payload['code'][] = $content;
51
        }
52
53
        return $this;
54
    }
55
56
    public function type($type): self
57
    {
58
        $this->payload['type'] = $type;
59
60
        return $this;
61
    }
62
63
    public function button($text, $url): self
64
    {
65
        $this->payload['buttons'][] = compact('text', 'url');
66
67
        return $this;
68
    }
69
70
    public function image($image): self
71
    {
72
        if (! empty($image)) {
73
            $this->payload['images'][] = $image;
74
        }
75
76
        return $this;
77
    }
78
79 1
    public function toArray()
80
    {
81 1
        return $this->payload;
82
    }
83
}
84