1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace NotificationChannels\SmscRu; |
4
|
|
|
|
5
|
|
|
class SmscRuMessage |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* The phone number the message should be sent from. |
9
|
|
|
* |
10
|
|
|
* @var string |
11
|
|
|
*/ |
12
|
|
|
public $from = ''; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* The message content. |
16
|
|
|
* |
17
|
|
|
* @var string |
18
|
|
|
*/ |
19
|
|
|
public $content = ''; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Time of sending a message. |
23
|
|
|
* |
24
|
|
|
* @var \DateTimeInterface |
25
|
|
|
*/ |
26
|
|
|
public $sendAt; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Sign of a voice message. |
30
|
|
|
* When forming a voice message, you can transfer both text and attach files. |
31
|
|
|
* Files added to the message must be transferred using the POST method in the body of the http request. |
32
|
|
|
* 0 (default) is a regular message. |
33
|
|
|
* 1 - voice message. |
34
|
|
|
* |
35
|
|
|
* @var boolean |
36
|
|
|
*/ |
37
|
|
|
public $call; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Voice used to read text (for voice messages only). |
41
|
|
|
* m (default) - male voice. |
42
|
|
|
* m2 is a male alternative voice. |
43
|
|
|
* w is a female voice. |
44
|
|
|
* w2 is a female alternative voice. |
45
|
|
|
* |
46
|
|
|
* @var string |
47
|
|
|
*/ |
48
|
|
|
public $voice; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Create a new message instance. |
52
|
|
|
* |
53
|
|
|
* @param string $content |
54
|
|
|
* |
55
|
|
|
* @return static |
56
|
|
|
*/ |
57
|
4 |
|
public static function create($content = '') |
58
|
|
|
{ |
59
|
4 |
|
return new static($content); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @param string $content |
64
|
|
|
*/ |
65
|
8 |
|
public function __construct($content = '') |
66
|
|
|
{ |
67
|
8 |
|
$this->content = $content; |
68
|
8 |
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Set the message content. |
72
|
|
|
* |
73
|
|
|
* @param string $content |
74
|
|
|
* |
75
|
|
|
* @return $this |
76
|
|
|
*/ |
77
|
1 |
|
public function content($content) |
78
|
|
|
{ |
79
|
1 |
|
$this->content = $content; |
80
|
|
|
|
81
|
1 |
|
return $this; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Set the phone number or sender name the message should be sent from. |
86
|
|
|
* |
87
|
|
|
* @param string $from |
88
|
|
|
* |
89
|
|
|
* @return $this |
90
|
|
|
*/ |
91
|
4 |
|
public function from($from) |
92
|
|
|
{ |
93
|
4 |
|
$this->from = $from; |
94
|
|
|
|
95
|
4 |
|
return $this; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Set the time the message should be sent. |
100
|
|
|
* |
101
|
|
|
* @param \DateTimeInterface|null $sendAt |
102
|
|
|
* |
103
|
|
|
* @return $this |
104
|
|
|
*/ |
105
|
2 |
|
public function sendAt(\DateTimeInterface $sendAt = null) |
106
|
|
|
{ |
107
|
2 |
|
$this->sendAt = $sendAt; |
108
|
|
|
|
109
|
2 |
|
return $this; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Set the sign of a voice message. |
114
|
|
|
* |
115
|
|
|
* @param boolean|null $call |
116
|
|
|
* |
117
|
|
|
* @return $this |
118
|
|
|
*/ |
119
|
|
|
public function call($call = null) |
120
|
|
|
{ |
121
|
|
|
$this->call = filter_var($call, FILTER_VALIDATE_BOOLEAN); |
122
|
|
|
|
123
|
|
|
return $this; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* Set the voice used to read text (for voice messages only). |
128
|
|
|
* |
129
|
|
|
* @param string $call |
|
|
|
|
130
|
|
|
* |
131
|
|
|
* @return $this |
132
|
|
|
*/ |
133
|
|
|
public function voice($voice = null) |
134
|
|
|
{ |
135
|
|
|
$this->voice = $voice; |
136
|
|
|
|
137
|
|
|
return $this; |
138
|
|
|
} |
139
|
|
|
} |
140
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.