Completed
Pull Request — master (#4)
by Owen
08:56
created

GitterMessage::from()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
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
    public static function create($content = '')
36
    {
37
        return new static($content);
38
    }
39
40
    /**
41
     * Create a new instance of GitterMessage.
42
     *
43
     * @param $content
44
     */
45
    public function __construct($content = '')
46
    {
47
        $this->content($content);
48
    }
49
50
    /**
51
     * Set the Gitter room id to send message to.
52
     *
53
     * @param  string  $roomId
54
     *
55
     * @return $this
56
     */
57
    public function room($roomId)
58
    {
59
        $this->room = $roomId;
60
61
        return $this;
62
    }
63
64
    /**
65
     * Set the sender's access token.
66
     *
67
     * @param  string  $accessToken
68
     *
69
     * @return $this
70
     */
71
    public function from($accessToken)
72
    {
73
        $this->from = $accessToken;
74
75
        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
    public function content($content)
86
    {
87
        $this->content = $content;
88
89
        return $this;
90
    }
91
}
92