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 ( fa59c1...11e3d9 )
by Talv
03:33 queued 12s
created

MsTeamsMessage   A

Complexity

Total Complexity 14

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 57.58%

Importance

Changes 0
Metric Value
wmc 14
lcom 1
cbo 0
dl 0
loc 79
ccs 19
cts 33
cp 0.5758
rs 10
c 0
b 0
f 0

11 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A create() 0 4 1
A to() 0 6 1
A toUnknown() 0 4 1
A title() 0 6 1
A content() 0 8 2
A code() 0 8 2
A type() 0 6 1
A button() 0 6 1
A image() 0 8 2
A toArray() 0 4 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