1 | <?php |
||
23 | class Dialog |
||
24 | { |
||
25 | const DEFAULT_COUNTRY_CODE = 280; |
||
26 | |||
27 | /** |
||
28 | * @var Connection |
||
29 | */ |
||
30 | protected $connection; |
||
31 | |||
32 | /** |
||
33 | * @var LoggerInterface |
||
34 | */ |
||
35 | protected $logger; |
||
36 | |||
37 | /** |
||
38 | * @var int |
||
39 | */ |
||
40 | protected $messageNumber = 1; |
||
41 | |||
42 | /** |
||
43 | * @var int |
||
44 | */ |
||
45 | protected $dialogId = 0; |
||
46 | |||
47 | /** |
||
48 | * @var int|string |
||
49 | */ |
||
50 | protected $systemId = 0; |
||
51 | |||
52 | /** |
||
53 | * @var string |
||
54 | */ |
||
55 | protected $bankCode; |
||
56 | |||
57 | /** |
||
58 | * @var string |
||
59 | */ |
||
60 | protected $username; |
||
61 | |||
62 | /** |
||
63 | * @var string |
||
64 | */ |
||
65 | protected $pin; |
||
66 | |||
67 | /** |
||
68 | * @var string |
||
69 | */ |
||
70 | protected $bankName; |
||
71 | |||
72 | /** |
||
73 | * @var array |
||
74 | */ |
||
75 | protected $supportedTanMechanisms = array(); |
||
76 | |||
77 | /** |
||
78 | * @var int |
||
79 | */ |
||
80 | protected $hksalVersion = 6; |
||
81 | |||
82 | /** |
||
83 | * @var int |
||
84 | */ |
||
85 | protected $hkkazVersion = 6; |
||
86 | |||
87 | /** |
||
88 | * Dialog constructor. |
||
89 | * |
||
90 | * @param Connection $connection |
||
91 | * @param string $bankCode |
||
92 | * @param string $username |
||
93 | * @param string $pin |
||
94 | * @param string $systemId |
||
95 | * @param LoggerInterface $logger |
||
96 | */ |
||
97 | public function __construct(Connection $connection, $bankCode, $username, $pin, $systemId, LoggerInterface $logger) |
||
106 | |||
107 | /** |
||
108 | * @param AbstractMessage $message |
||
109 | * @return Response |
||
110 | * @throws AdapterException |
||
111 | * @throws CurlException |
||
112 | * @throws FailedRequestException |
||
113 | */ |
||
114 | public function sendMessage(AbstractMessage $message) |
||
144 | |||
145 | /** |
||
146 | * @param Response $response |
||
147 | */ |
||
148 | protected function handleResponse(Response $response) |
||
161 | |||
162 | /** |
||
163 | * @param string $type |
||
164 | * @param string $code |
||
165 | * @param $message |
||
166 | */ |
||
167 | protected function logMessage($type, $code, $message) |
||
185 | |||
186 | /** |
||
187 | * Gets the dialog ID. |
||
188 | * |
||
189 | * @return integer |
||
190 | */ |
||
191 | public function getDialogId() |
||
195 | |||
196 | /** |
||
197 | * Gets the current message number. |
||
198 | * |
||
199 | * @return int |
||
200 | */ |
||
201 | public function getMessageNumber() |
||
205 | |||
206 | /** |
||
207 | * Gets the system ID. |
||
208 | * |
||
209 | * @return int|string |
||
210 | */ |
||
211 | public function getSystemId() |
||
215 | |||
216 | /** |
||
217 | * Gets all supported TAN mechanisms. |
||
218 | * |
||
219 | * @return array |
||
220 | */ |
||
221 | public function getSupportedPinTanMechanisms() |
||
225 | |||
226 | /** |
||
227 | * Gets the max possible HKSAL version. |
||
228 | * |
||
229 | * @return int |
||
230 | */ |
||
231 | public function getHksalMaxVersion() |
||
235 | |||
236 | /** |
||
237 | * Gets the max possible HKKAZ version. |
||
238 | * |
||
239 | * @return int |
||
240 | */ |
||
241 | public function getHkkazMaxVersion() |
||
245 | |||
246 | /** |
||
247 | * Gets the bank name. |
||
248 | * |
||
249 | * @return string |
||
250 | */ |
||
251 | public function getBankName() |
||
255 | |||
256 | /** |
||
257 | * Initializes a dialog. |
||
258 | * |
||
259 | * @return string|null |
||
260 | * @throws AdapterException |
||
261 | * @throws CurlException |
||
262 | * @throws FailedRequestException |
||
263 | * @throws \Exception |
||
264 | */ |
||
265 | public function initDialog() |
||
293 | |||
294 | /** |
||
295 | * Sends sync request. |
||
296 | * |
||
297 | * @return string |
||
298 | * @throws AdapterException |
||
299 | * @throws CurlException |
||
300 | * @throws FailedRequestException |
||
301 | * @throws \Exception |
||
302 | */ |
||
303 | public function syncDialog() |
||
349 | |||
350 | /** |
||
351 | * Ends a previous started dialog. |
||
352 | * |
||
353 | * @return string |
||
354 | * @throws AdapterException |
||
355 | * @throws CurlException |
||
356 | * @throws FailedRequestException |
||
357 | */ |
||
358 | public function endDialog() |
||
384 | } |
||
385 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.