SendberryMessage::from()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace NotificationChannels\Sendberry;
4
5
class SendberryMessage
6
{
7
    /**
8
     * The phone number the message should be sent from.
9
     *
10
     * @var string
11
     */
12
    public $from = '';
13
    /**
14
     * The message content.
15
     *
16
     * @var string
17
     */
18
    public $content = '';
19
20
    /**
21
     * Time of sending a message.
22
     *
23
     * @var string
24
     */
25
    public $time;
26
27
    /**
28
     * @var string
29
     */
30
    public $date;
31
32
    /**
33
     * @var string
34
     */
35
    public $webhook = '';
36
37
    /**
38
     * @var bool
39
     */
40
    public $test;
41
42
    /**
43
     * @param  string  $content
44
     */
45
    public function __construct($content = '')
46
    {
47
        $this->content = $content;
48
    }
49
50
    /**
51
     * Create a new message instance.
52
     *
53
     * @param  string $content
54
     *
55
     * @return static
56
     */
57
    public static function create($content = '')
58
    {
59
        return new static($content);
60
    }
61
62
    /**
63
     * Set the message content.
64
     *
65
     * @param  string  $content
66
     *
67
     * @return $this
68
     */
69
    public function content($content)
70
    {
71
        $this->content = $content;
72
73
        return $this;
74
    }
75
76
    /**
77
     * Set the phone number or sender name the message should be sent from.
78
     *
79
     * @param  string  $from
80
     *
81
     * @return $this
82
     */
83
    public function from($from)
84
    {
85
        $this->from = $from;
86
87
        return $this;
88
    }
89
90
    /**
91
     * @param string|null $time
92
     * @return $this
93
     */
94
    public function time(string $time = null)
95
    {
96
        $this->time = $time;
97
98
        return $this;
99
    }
100
101
    /**
102
     * @param string|null $time
103
     * @return $this
104
     */
105
    public function date(string $date = null)
106
    {
107
        $this->date = $date;
108
109
        return $this;
110
    }
111
112
    /**
113
     * @param string|null $url
114
     * @return $this
115
     */
116
    public function webhook(string $url = null)
117
    {
118
        $this->webhook = $url;
119
120
        return $this;
121
    }
122
123
    /**
124
     * Set the test SMS - imitation sending.
125
     *
126
     * @param  string  $from
127
     *
128
     * @return $this
129
     */
130
    public function test(bool $test = false)
131
    {
132
        $this->test = $test;
133
134
        return $this;
135
    }
136
}
137