1 | <?php |
||
26 | class Sms |
||
27 | { |
||
28 | /** |
||
29 | * @var EasySms |
||
30 | */ |
||
31 | protected $easySms; |
||
32 | /** |
||
33 | * @var |
||
34 | */ |
||
35 | protected $storage; |
||
36 | |||
37 | /** |
||
38 | * @var |
||
39 | */ |
||
40 | protected $key; |
||
41 | |||
42 | /** |
||
43 | * @param mixed $key |
||
44 | */ |
||
45 | 30 | public function setKey($key) |
|
50 | |||
51 | /** |
||
52 | * @return mixed |
||
53 | */ |
||
54 | 4 | public function getKey() |
|
58 | |||
59 | /** |
||
60 | * Sms constructor. |
||
61 | * |
||
62 | * @param EasySms $easySms |
||
63 | */ |
||
64 | 39 | public function __construct(EasySms $easySms, StorageInterface $storage) |
|
69 | |||
70 | /** |
||
71 | * @param StorageInterface $storage |
||
72 | */ |
||
73 | 4 | public function setStorage(StorageInterface $storage) |
|
77 | |||
78 | /** |
||
79 | * @param $to |
||
80 | * @param null $data |
||
81 | * @param array $gateways |
||
82 | * |
||
83 | * @return bool |
||
84 | */ |
||
85 | 26 | public function send($to, $data = [], array $gateways = []) |
|
129 | |||
130 | /** |
||
131 | * check china mobile. |
||
132 | * |
||
133 | * @param $to |
||
134 | * |
||
135 | * @return false|int |
||
136 | */ |
||
137 | 2 | public function verifyMobile($to) |
|
141 | |||
142 | /** |
||
143 | * @param $to |
||
144 | * |
||
145 | * @return mixed |
||
146 | */ |
||
147 | 26 | public function getCodeFromStorage() |
|
151 | |||
152 | /** |
||
153 | * @param $code |
||
154 | * |
||
155 | * @return bool |
||
156 | */ |
||
157 | 26 | protected function needNewCode($code) |
|
165 | |||
166 | /** |
||
167 | * Check attempt times. |
||
168 | * |
||
169 | * @param $code |
||
170 | * |
||
171 | * @return bool |
||
172 | */ |
||
173 | 8 | private function checkAttempts($code) |
|
183 | |||
184 | /** |
||
185 | * @param $to |
||
186 | * |
||
187 | * @return Code |
||
188 | */ |
||
189 | 30 | public function getNewCode($to) |
|
197 | |||
198 | /** |
||
199 | * @param $to |
||
200 | * |
||
201 | * @return bool |
||
202 | */ |
||
203 | 6 | public function canSend($to) |
|
215 | |||
216 | /** |
||
217 | * @param $to |
||
218 | * |
||
219 | * @return Code |
||
220 | */ |
||
221 | 30 | public function generateCode($to) |
|
235 | |||
236 | /** |
||
237 | * @return CacheStorage|StorageInterface |
||
238 | */ |
||
239 | 5 | public function getStorage() |
|
243 | |||
244 | /** |
||
245 | * @param $to |
||
246 | * @param $inputCode |
||
247 | * |
||
248 | * @return bool |
||
249 | */ |
||
250 | 4 | public function checkCode($to, $inputCode) |
|
276 | } |
||
277 |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.