GitterMessage   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 87
Duplicated Lines 0 %

Coupling/Cohesion

Components 3
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 3
cbo 0
dl 0
loc 87
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 4 1
A __construct() 0 4 1
A room() 0 6 1
A from() 0 6 1
A content() 0 6 1
1
<?php
2
3
namespace NotificationChannels\Gitter;
4
5
class GitterMessage
6
{
7
    /**
8
     * Gitter room id.
9
     *
10
     * @var string
11
     */
12
    public $room = '';
13
14
    /**
15
     * A user or app access token.
16
     *
17
     * @var string
18
     */
19
    public $from = '';
20
21
    /**
22
     * The text content of the message.
23
     *
24
     * @var string
25
     */
26
    public $content = '';
27
28
    /**
29
     * Create a new instance of GitterMessage.
30
     *
31
     * @param  string  $content
32
     *
33
     * @return static
34
     */
35 4
    public static function create($content = '')
36
    {
37 4
        return new static($content);
38
    }
39
40
    /**
41
     * Create a new instance of GitterMessage.
42
     *
43
     * @param  string  $content
44
     */
45 8
    public function __construct(string $content = '')
46
    {
47 8
        $this->content($content);
48 8
    }
49
50
    /**
51
     * Set the Gitter room id to send message to.
52
     *
53
     * @param  string  $roomId
54
     *
55
     * @return $this
56
     */
57 4
    public function room(string $roomId)
58
    {
59 4
        $this->room = $roomId;
60
61 4
        return $this;
62
    }
63
64
    /**
65
     * Set the sender's access token.
66
     *
67
     * @param  string  $accessToken
68
     *
69
     * @return $this
70
     */
71 3
    public function from(string $accessToken)
72
    {
73 3
        $this->from = $accessToken;
74
75 3
        return $this;
76
    }
77
78
    /**
79
     * Set the content of the message. Supports GitHub flavoured markdown.
80
     *
81
     * @param  string  $content
82
     *
83
     * @return $this
84
     */
85 8
    public function content(string $content)
86
    {
87 8
        $this->content = $content;
88
89 8
        return $this;
90
    }
91
}
92