1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace NotificationChannels\Twilio; |
4
|
|
|
|
5
|
|
|
class TwilioSmsMessage extends TwilioMessage |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* @var null|string |
9
|
|
|
*/ |
10
|
|
|
public $alphaNumSender = null; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @var null|string |
14
|
|
|
*/ |
15
|
|
|
public $messagingServiceSid = null; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @var null|string |
19
|
|
|
*/ |
20
|
|
|
public $applicationSid = null; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var null|bool |
24
|
|
|
*/ |
25
|
|
|
public $forceDelivery = null; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var null|float |
29
|
|
|
*/ |
30
|
|
|
public $maxPrice = null; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var null|bool |
34
|
|
|
*/ |
35
|
|
|
public $provideFeedback = null; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var null|int |
39
|
|
|
*/ |
40
|
|
|
public $validityPeriod = null; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Get the from address of this message. |
44
|
|
|
* |
45
|
|
|
* @return null|string |
46
|
|
|
*/ |
47
|
12 |
|
public function getFrom() |
48
|
|
|
{ |
49
|
12 |
|
if ($this->from) { |
50
|
4 |
|
return $this->from; |
51
|
|
|
} |
52
|
|
|
|
53
|
8 |
|
if ($this->alphaNumSender && strlen($this->alphaNumSender) > 0) { |
|
|
|
|
54
|
2 |
|
return $this->alphaNumSender; |
55
|
|
|
} |
56
|
6 |
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Set the messaging service SID. |
60
|
|
|
* |
61
|
|
|
* @param string $messagingServiceSid |
62
|
|
|
* @return $this |
63
|
|
|
*/ |
64
|
|
|
public function messagingServiceSid($messagingServiceSid) |
65
|
|
|
{ |
66
|
|
|
$this->messagingServiceSid = $messagingServiceSid; |
67
|
|
|
|
68
|
|
|
return $this; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Get the messaging service SID of this message. |
73
|
|
|
* |
74
|
|
|
* @return null|string |
75
|
|
|
*/ |
76
|
8 |
|
public function getMessagingServiceSid() |
77
|
|
|
{ |
78
|
8 |
|
return $this->messagingServiceSid; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Set the alphanumeric sender. |
83
|
|
|
* |
84
|
|
|
* @param string $sender |
85
|
|
|
* @return $this |
86
|
|
|
*/ |
87
|
4 |
|
public function sender($sender) |
88
|
|
|
{ |
89
|
4 |
|
$this->alphaNumSender = $sender; |
90
|
|
|
|
91
|
4 |
|
return $this; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Set application SID for the message status callback. |
96
|
|
|
* |
97
|
|
|
* @param string $applicationSid |
98
|
|
|
* @return $this |
99
|
|
|
*/ |
100
|
4 |
|
public function applicationSid($applicationSid) |
101
|
|
|
{ |
102
|
4 |
|
$this->applicationSid = $applicationSid; |
103
|
|
|
|
104
|
4 |
|
return $this; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* Set force delivery (Deliver message without validation). |
109
|
|
|
* |
110
|
|
|
* @param bool $forceDelivery |
111
|
|
|
* @return $this |
112
|
|
|
*/ |
113
|
1 |
|
public function forceDelivery($forceDelivery) |
114
|
|
|
{ |
115
|
1 |
|
$this->forceDelivery = $forceDelivery; |
116
|
|
|
|
117
|
1 |
|
return $this; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* Set the max price (in USD dollars). |
122
|
|
|
* |
123
|
|
|
* @param float $maxPrice |
124
|
|
|
* @return $this |
125
|
|
|
*/ |
126
|
4 |
|
public function maxPrice($maxPrice) |
127
|
|
|
{ |
128
|
4 |
|
$this->maxPrice = $maxPrice; |
129
|
|
|
|
130
|
4 |
|
return $this; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* Set the provide feedback option. |
135
|
|
|
* |
136
|
|
|
* @param bool $provideFeedback |
137
|
|
|
* @return $this |
138
|
|
|
*/ |
139
|
4 |
|
public function provideFeedback($provideFeedback) |
140
|
|
|
{ |
141
|
4 |
|
$this->provideFeedback = $provideFeedback; |
142
|
|
|
|
143
|
4 |
|
return $this; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* Set the validity period (in seconds). |
148
|
|
|
* |
149
|
|
|
* @param int $validityPeriod |
150
|
|
|
* @return $this |
151
|
|
|
*/ |
152
|
4 |
|
public function validityPeriod($validityPeriod) |
153
|
|
|
{ |
154
|
4 |
|
$this->validityPeriod = $validityPeriod; |
155
|
|
|
|
156
|
4 |
|
return $this; |
157
|
|
|
} |
158
|
|
|
} |
159
|
|
|
|
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: