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|float |
24
|
|
|
*/ |
25
|
|
|
public $maxPrice = null; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var null|bool |
29
|
|
|
*/ |
30
|
|
|
public $provideFeedback = null; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var null|int |
34
|
|
|
*/ |
35
|
|
|
public $validityPeriod = null; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Get the from address of this message. |
39
|
|
|
* |
40
|
|
|
* @return null|string |
41
|
|
|
*/ |
42
|
|
|
public function getFrom() |
43
|
|
|
{ |
44
|
|
|
if ($this->from) { |
45
|
|
|
return $this->from; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
if ($this->alphaNumSender && strlen($this->alphaNumSender) > 0) { |
|
|
|
|
49
|
|
|
return $this->alphaNumSender; |
50
|
|
|
} |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Set the messaging service SID. |
55
|
|
|
* |
56
|
|
|
* @param string $messagingServiceSid |
57
|
|
|
* @return $this |
58
|
|
|
*/ |
59
|
|
|
public function messagingServiceSid($messagingServiceSid) |
60
|
|
|
{ |
61
|
|
|
$this->messagingServiceSid = $messagingServiceSid; |
62
|
|
|
|
63
|
|
|
return $this; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Get the messaging service SID of this message. |
68
|
|
|
* |
69
|
|
|
* @return null|string |
70
|
|
|
*/ |
71
|
|
|
public function getMessagingServiceSid() |
72
|
|
|
{ |
73
|
|
|
return $this->messagingServiceSid; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Set the alphanumeric sender. |
78
|
|
|
* |
79
|
|
|
* @param string $sender |
80
|
|
|
* @return $this |
81
|
|
|
*/ |
82
|
|
|
public function sender($sender) |
83
|
|
|
{ |
84
|
|
|
$this->alphaNumSender = $sender; |
85
|
|
|
|
86
|
|
|
return $this; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Set application SID for the message status callback. |
91
|
|
|
* |
92
|
|
|
* @param string $applicationSid |
93
|
|
|
* @return $this |
94
|
|
|
*/ |
95
|
|
|
public function applicationSid($applicationSid) |
96
|
|
|
{ |
97
|
|
|
$this->applicationSid = $applicationSid; |
98
|
|
|
|
99
|
|
|
return $this; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* Set the max price (in USD dollars). |
104
|
|
|
* |
105
|
|
|
* @param float $maxPrice |
106
|
|
|
* @return $this |
107
|
|
|
*/ |
108
|
|
|
public function maxPrice($maxPrice) |
109
|
|
|
{ |
110
|
|
|
$this->maxPrice = $maxPrice; |
111
|
|
|
|
112
|
|
|
return $this; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* Set the provide feedback option. |
117
|
|
|
* |
118
|
|
|
* @param bool $provideFeedback |
119
|
|
|
* @return $this |
120
|
|
|
*/ |
121
|
|
|
public function provideFeedback($provideFeedback) |
122
|
|
|
{ |
123
|
|
|
$this->provideFeedback = $provideFeedback; |
124
|
|
|
|
125
|
|
|
return $this; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* Set the validity period (in seconds). |
130
|
|
|
* |
131
|
|
|
* @param int $validityPeriod |
132
|
|
|
* @return $this |
133
|
|
|
*/ |
134
|
|
|
public function validityPeriod($validityPeriod) |
135
|
|
|
{ |
136
|
|
|
$this->validityPeriod = $validityPeriod; |
137
|
|
|
|
138
|
|
|
return $this; |
139
|
|
|
} |
140
|
|
|
} |
141
|
|
|
|
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: