Total Complexity | 8 |
Total Lines | 130 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
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 = '') |
||
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) |
||
110 | } |
||
111 | |||
112 | /** |
||
113 | * @param string|null $url |
||
114 | * @return $this |
||
115 | */ |
||
116 | public function webhook(string $url = null) |
||
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) |
||
135 | } |
||
136 | } |
||
137 |