UnisenderMessage::silent()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace NotificationChannels\Unisender;
4
5
class UnisenderMessage
6
{
7
    public $to;
8
    public $from;
9
    public $content;
10
    public $token;
11
    public $silent = false;
12
13
    /**
14
     * Set API Token.
15
     *
16
     * @param string $token
17
     *
18
     * @return UnisenderMessage
19
     */
20
    public function usingApiToken(string $token)
21
    {
22
        $this->token = $token;
23
24
        return $this;
25
    }
26
27
    /**
28
     * Send message silently (without raising any exceptions).
29
     *
30
     * @param bool $flag
31
     *
32
     * @return UnisenderMessage
33
     */
34
    public function silent(bool $flag = true)
35
    {
36
        $this->silent = $flag;
37
38
        return $this;
39
    }
40
41
    /**
42
     * Set the message's receivers.
43
     *
44
     * @param array|string $to
45
     *
46
     * @return UnisenderMessage
47
     */
48
    public function to($to)
49
    {
50
        if (is_array($to)) {
51
            $to = implode(',', $to);
52
        }
53
54
        $this->to = $to;
55
56
        return $this;
57
    }
58
59
    /**
60
     * Set the message's sender.
61
     *
62
     * @param string $from
63
     *
64
     * @return UnisenderMessage
65
     */
66
    public function from(string $from)
67
    {
68
        $this->from = $from;
69
70
        return $this;
71
    }
72
73
    /**
74
     * Set the message's content.
75
     *
76
     * @param string $content
77
     *
78
     * @return UnisenderMessage
79
     */
80
    public function content(string $content)
81
    {
82
        $this->content = $content;
83
84
        return $this;
85
    }
86
}
87