|
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
|
12 |
|
public function getFrom() |
|
43
|
|
|
{ |
|
44
|
12 |
|
if ($this->from) { |
|
45
|
4 |
|
return $this->from; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
8 |
|
if ($this->alphaNumSender && strlen($this->alphaNumSender) > 0) { |
|
|
|
|
|
|
49
|
2 |
|
return $this->alphaNumSender; |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
6 |
|
return null; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* Set the messaging service SID. |
|
57
|
|
|
* |
|
58
|
|
|
* @param string $messagingServiceSid |
|
59
|
|
|
* @return $this |
|
60
|
|
|
*/ |
|
61
|
|
|
public function messagingServiceSid($messagingServiceSid) |
|
62
|
|
|
{ |
|
63
|
|
|
$this->messagingServiceSid = $messagingServiceSid; |
|
64
|
|
|
|
|
65
|
|
|
return $this; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* Get the messaging service SID of this message. |
|
70
|
|
|
* |
|
71
|
|
|
* @return null|string |
|
72
|
|
|
*/ |
|
73
|
8 |
|
public function getMessagingServiceSid() |
|
74
|
|
|
{ |
|
75
|
8 |
|
return $this->messagingServiceSid; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* Set the alphanumeric sender. |
|
80
|
|
|
* |
|
81
|
|
|
* @param string $sender |
|
82
|
|
|
* @return $this |
|
83
|
|
|
*/ |
|
84
|
4 |
|
public function sender($sender) |
|
85
|
|
|
{ |
|
86
|
4 |
|
$this->alphaNumSender = $sender; |
|
87
|
|
|
|
|
88
|
4 |
|
return $this; |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* Set application SID for the message status callback. |
|
93
|
|
|
* |
|
94
|
|
|
* @param string $applicationSid |
|
95
|
|
|
* @return $this |
|
96
|
|
|
*/ |
|
97
|
4 |
|
public function applicationSid($applicationSid) |
|
98
|
|
|
{ |
|
99
|
4 |
|
$this->applicationSid = $applicationSid; |
|
100
|
|
|
|
|
101
|
4 |
|
return $this; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* Set the max price (in USD dollars). |
|
106
|
|
|
* |
|
107
|
|
|
* @param float $maxPrice |
|
108
|
|
|
* @return $this |
|
109
|
|
|
*/ |
|
110
|
4 |
|
public function maxPrice($maxPrice) |
|
111
|
|
|
{ |
|
112
|
4 |
|
$this->maxPrice = $maxPrice; |
|
113
|
|
|
|
|
114
|
4 |
|
return $this; |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
|
|
/** |
|
118
|
|
|
* Set the provide feedback option. |
|
119
|
|
|
* |
|
120
|
|
|
* @param bool $provideFeedback |
|
121
|
|
|
* @return $this |
|
122
|
|
|
*/ |
|
123
|
4 |
|
public function provideFeedback($provideFeedback) |
|
124
|
|
|
{ |
|
125
|
4 |
|
$this->provideFeedback = $provideFeedback; |
|
126
|
|
|
|
|
127
|
4 |
|
return $this; |
|
128
|
|
|
} |
|
129
|
|
|
|
|
130
|
|
|
/** |
|
131
|
|
|
* Set the validity period (in seconds). |
|
132
|
|
|
* |
|
133
|
|
|
* @param int $validityPeriod |
|
134
|
|
|
* @return $this |
|
135
|
|
|
*/ |
|
136
|
4 |
|
public function validityPeriod($validityPeriod) |
|
137
|
|
|
{ |
|
138
|
4 |
|
$this->validityPeriod = $validityPeriod; |
|
139
|
|
|
|
|
140
|
4 |
|
return $this; |
|
141
|
|
|
} |
|
142
|
|
|
} |
|
143
|
|
|
|
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
stringvalues, the empty string''is a special case, in particular the following results might be unexpected: