1 | <?php |
||
2 | |||
3 | namespace NotificationChannels\TurboSms; |
||
4 | |||
5 | use Illuminate\Support\Arr; |
||
6 | |||
7 | class TurboSmsMessage |
||
8 | { |
||
9 | /** |
||
10 | * The phone number the message should be sent from. |
||
11 | * |
||
12 | * @var string |
||
13 | */ |
||
14 | public $from = ''; |
||
15 | /** |
||
16 | * The message content. |
||
17 | * |
||
18 | * @var string |
||
19 | */ |
||
20 | public $content = ''; |
||
21 | |||
22 | /** |
||
23 | * Time of sending a message. |
||
24 | * |
||
25 | * @var int |
||
26 | */ |
||
27 | public $time; |
||
28 | |||
29 | /** |
||
30 | * @var bool |
||
31 | */ |
||
32 | public $test; |
||
33 | |||
34 | |||
35 | /** |
||
36 | * Create a new message instance. |
||
37 | * |
||
38 | * @param string $content |
||
39 | * |
||
40 | * @return static |
||
41 | */ |
||
42 | public static function create($content = '') |
||
43 | { |
||
44 | return new static($content); |
||
45 | } |
||
46 | /** |
||
47 | * @param string $content |
||
48 | */ |
||
49 | public function __construct($content = '') |
||
50 | { |
||
51 | $this->content = $content; |
||
52 | } |
||
53 | /** |
||
54 | * Set the message content. |
||
55 | * |
||
56 | * @param string $content |
||
57 | * |
||
58 | * @return $this |
||
59 | */ |
||
60 | public function content($content) |
||
61 | { |
||
62 | $this->content = $content; |
||
63 | |||
64 | return $this; |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * Set the test SMS - imitation sending. |
||
69 | * |
||
70 | * @param string $from |
||
71 | * |
||
72 | * @return $this |
||
73 | */ |
||
74 | public function test(bool $test = false) |
||
75 | { |
||
76 | $this->test = $test; |
||
77 | |||
78 | return $this; |
||
79 | } |
||
80 | |||
81 | /** |
||
82 | * Set the phone number or sender name the message should be sent from. |
||
83 | * |
||
84 | * @param string $from |
||
85 | * |
||
86 | * @return $this |
||
87 | */ |
||
88 | public function from($from) |
||
89 | { |
||
90 | $this->from = $from; |
||
91 | |||
92 | return $this; |
||
93 | } |
||
94 | |||
95 | /** |
||
96 | * Postpone shipping for -n- sec. |
||
97 | * |
||
98 | * @param null $time |
||
0 ignored issues
–
show
Documentation
Bug
introduced
by
![]() |
|||
99 | * @return $this |
||
100 | */ |
||
101 | public function time(int $time = null) |
||
102 | { |
||
103 | $this->time = $time; |
||
104 | |||
105 | return $this; |
||
106 | } |
||
107 | } |
||
108 |