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 $applicationSid = null; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @var null|float |
19
|
|
|
*/ |
20
|
|
|
public $maxPrice = null; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var null|boolean |
24
|
|
|
*/ |
25
|
|
|
public $provideFeedback = null; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var null|integer |
29
|
|
|
*/ |
30
|
|
|
public $validityPeriod = null; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Get the from address of this message. |
34
|
|
|
* |
35
|
|
|
* @return null|string |
36
|
|
|
*/ |
37
|
|
|
public function getFrom() |
38
|
|
|
{ |
39
|
|
|
if ($this->from) { |
40
|
|
|
return $this->from; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
if ($this->alphaNumSender && strlen($this->alphaNumSender) > 0) { |
|
|
|
|
44
|
|
|
return $this->alphaNumSender; |
45
|
|
|
} |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Set the alphanumeric sender. |
50
|
|
|
* |
51
|
|
|
* @param string $sender |
52
|
|
|
* @return $this |
53
|
|
|
*/ |
54
|
|
|
public function sender($sender) |
55
|
|
|
{ |
56
|
|
|
$this->alphaNumSender = $sender; |
57
|
|
|
|
58
|
|
|
return $this; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Set application SID for the message status callback. |
63
|
|
|
* |
64
|
|
|
* @param string $applicationSid |
65
|
|
|
* @return $this |
66
|
|
|
*/ |
67
|
|
|
public function applicationSid($applicationSid) |
68
|
|
|
{ |
69
|
|
|
$this->applicationSid = $applicationSid; |
70
|
|
|
|
71
|
|
|
return $this; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Set the max price (in USD dollars). |
76
|
|
|
* |
77
|
|
|
* @param float $maxPrice |
78
|
|
|
* @return $this |
79
|
|
|
*/ |
80
|
|
|
public function maxPrice($maxPrice) |
81
|
|
|
{ |
82
|
|
|
$this->maxPrice = $maxPrice; |
83
|
|
|
|
84
|
|
|
return $this; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Set the provide feedback option. |
89
|
|
|
* |
90
|
|
|
* @param boolean $provideFeedback |
91
|
|
|
* @return $this |
92
|
|
|
*/ |
93
|
|
|
public function provideFeedback($provideFeedback) |
94
|
|
|
{ |
95
|
|
|
$this->provideFeedback = $provideFeedback; |
96
|
|
|
|
97
|
|
|
return $this; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* Set the validity period (in seconds). |
102
|
|
|
* |
103
|
|
|
* @param integer $validityPeriod |
104
|
|
|
* @return $this |
105
|
|
|
*/ |
106
|
|
|
public function validityPeriod($validityPeriod) |
107
|
|
|
{ |
108
|
|
|
$this->validityPeriod = $validityPeriod; |
109
|
|
|
|
110
|
|
|
return $this; |
111
|
|
|
} |
112
|
|
|
} |
113
|
|
|
|
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: