@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | public function run() |
140 | 140 | { |
141 | 141 | if ($data = BotApi::jsonValidate($this->getRawBody(), true)) { |
142 | - $this->handle([Update::fromResponse($data)]); |
|
142 | + $this->handle([ Update::fromResponse($data) ]); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | protected static function getEvent(Closure $action) |
159 | 159 | { |
160 | - return function (Update $update) use ($action) { |
|
160 | + return function(Update $update) use ($action) { |
|
161 | 161 | $message = $update->getMessage(); |
162 | 162 | if (!$message) { |
163 | 163 | return true; |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | |
166 | 166 | preg_match(self::REGEXP, $message->getText(), $matches); |
167 | 167 | |
168 | - if (isset($matches[3]) && !empty($matches[3])) { |
|
169 | - $parameters = str_getcsv($matches[3], chr(32)); |
|
168 | + if (isset($matches[ 3 ]) && !empty($matches[ 3 ])) { |
|
169 | + $parameters = str_getcsv($matches[ 3 ], chr(32)); |
|
170 | 170 | } else { |
171 | - $parameters = []; |
|
171 | + $parameters = [ ]; |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | array_unshift($parameters, $message); |
@@ -185,104 +185,104 @@ discard block |
||
185 | 185 | |
186 | 186 | protected static function getEditedMessageEvent(Closure $action) |
187 | 187 | { |
188 | - return function (Update $update) use ($action) { |
|
188 | + return function(Update $update) use ($action) { |
|
189 | 189 | if (!$update->getEditedMessage()) { |
190 | 190 | return true; |
191 | 191 | } |
192 | 192 | |
193 | 193 | $reflectionAction = new ReflectionFunction($action); |
194 | - $reflectionAction->invokeArgs([$update->getEditedMessage()]); |
|
194 | + $reflectionAction->invokeArgs([ $update->getEditedMessage() ]); |
|
195 | 195 | return false; |
196 | 196 | }; |
197 | 197 | } |
198 | 198 | |
199 | 199 | protected static function getChannelPostEvent(Closure $action) |
200 | 200 | { |
201 | - return function (Update $update) use ($action) { |
|
201 | + return function(Update $update) use ($action) { |
|
202 | 202 | if (!$update->getChannelPost()) { |
203 | 203 | return true; |
204 | 204 | } |
205 | 205 | |
206 | 206 | $reflectionAction = new ReflectionFunction($action); |
207 | - $reflectionAction->invokeArgs([$update->getChannelPost()]); |
|
207 | + $reflectionAction->invokeArgs([ $update->getChannelPost() ]); |
|
208 | 208 | return false; |
209 | 209 | }; |
210 | 210 | } |
211 | 211 | |
212 | 212 | protected static function getCallbackQueryEvent(Closure $action) |
213 | 213 | { |
214 | - return function (Update $update) use ($action) { |
|
214 | + return function(Update $update) use ($action) { |
|
215 | 215 | if (!$update->getCallbackQuery()) { |
216 | 216 | return true; |
217 | 217 | } |
218 | 218 | |
219 | 219 | $reflectionAction = new ReflectionFunction($action); |
220 | - $reflectionAction->invokeArgs([$update->getCallbackQuery()]); |
|
220 | + $reflectionAction->invokeArgs([ $update->getCallbackQuery() ]); |
|
221 | 221 | return false; |
222 | 222 | }; |
223 | 223 | } |
224 | 224 | |
225 | 225 | protected static function getEditedChannelPostEvent(Closure $action) |
226 | 226 | { |
227 | - return function (Update $update) use ($action) { |
|
227 | + return function(Update $update) use ($action) { |
|
228 | 228 | if (!$update->getEditedChannelPost()) { |
229 | 229 | return true; |
230 | 230 | } |
231 | 231 | |
232 | 232 | $reflectionAction = new ReflectionFunction($action); |
233 | - $reflectionAction->invokeArgs([$update->getEditedChannelPost()]); |
|
233 | + $reflectionAction->invokeArgs([ $update->getEditedChannelPost() ]); |
|
234 | 234 | return false; |
235 | 235 | }; |
236 | 236 | } |
237 | 237 | |
238 | 238 | protected static function getInlineQueryEvent(Closure $action) |
239 | 239 | { |
240 | - return function (Update $update) use ($action) { |
|
240 | + return function(Update $update) use ($action) { |
|
241 | 241 | if (!$update->getInlineQuery()) { |
242 | 242 | return true; |
243 | 243 | } |
244 | 244 | |
245 | 245 | $reflectionAction = new ReflectionFunction($action); |
246 | - $reflectionAction->invokeArgs([$update->getInlineQuery()]); |
|
246 | + $reflectionAction->invokeArgs([ $update->getInlineQuery() ]); |
|
247 | 247 | return false; |
248 | 248 | }; |
249 | 249 | } |
250 | 250 | |
251 | 251 | protected static function getChosenInlineResultEvent(Closure $action) |
252 | 252 | { |
253 | - return function (Update $update) use ($action) { |
|
253 | + return function(Update $update) use ($action) { |
|
254 | 254 | if (!$update->getChosenInlineResult()) { |
255 | 255 | return true; |
256 | 256 | } |
257 | 257 | |
258 | 258 | $reflectionAction = new ReflectionFunction($action); |
259 | - $reflectionAction->invokeArgs([$update->getChosenInlineResult()]); |
|
259 | + $reflectionAction->invokeArgs([ $update->getChosenInlineResult() ]); |
|
260 | 260 | return false; |
261 | 261 | }; |
262 | 262 | } |
263 | 263 | |
264 | 264 | protected static function getShippingQueryEvent(Closure $action) |
265 | 265 | { |
266 | - return function (Update $update) use ($action) { |
|
266 | + return function(Update $update) use ($action) { |
|
267 | 267 | if (!$update->getShippingQuery()) { |
268 | 268 | return true; |
269 | 269 | } |
270 | 270 | |
271 | 271 | $reflectionAction = new ReflectionFunction($action); |
272 | - $reflectionAction->invokeArgs([$update->getShippingQuery()]); |
|
272 | + $reflectionAction->invokeArgs([ $update->getShippingQuery() ]); |
|
273 | 273 | return false; |
274 | 274 | }; |
275 | 275 | } |
276 | 276 | |
277 | 277 | protected static function getPreCheckoutQueryEvent(Closure $action) |
278 | 278 | { |
279 | - return function (Update $update) use ($action) { |
|
279 | + return function(Update $update) use ($action) { |
|
280 | 280 | if (!$update->getPreCheckoutQuery()) { |
281 | 281 | return true; |
282 | 282 | } |
283 | 283 | |
284 | 284 | $reflectionAction = new ReflectionFunction($action); |
285 | - $reflectionAction->invokeArgs([$update->getPreCheckoutQuery()]); |
|
285 | + $reflectionAction->invokeArgs([ $update->getPreCheckoutQuery() ]); |
|
286 | 286 | return false; |
287 | 287 | }; |
288 | 288 | } |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | */ |
297 | 297 | protected static function getChecker($name) |
298 | 298 | { |
299 | - return function (Update $update) use ($name) { |
|
299 | + return function(Update $update) use ($name) { |
|
300 | 300 | $message = $update->getMessage(); |
301 | 301 | if (is_null($message) || !strlen($message->getText())) { |
302 | 302 | return false; |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | |
305 | 305 | preg_match(self::REGEXP, $message->getText(), $matches); |
306 | 306 | |
307 | - return !empty($matches) && $matches[1] == $name; |
|
307 | + return !empty($matches) && $matches[ 1 ] == $name; |
|
308 | 308 | }; |
309 | 309 | } |
310 | 310 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | */ |
316 | 316 | protected static function getEditedMessageChecker() |
317 | 317 | { |
318 | - return function (Update $update) { |
|
318 | + return function(Update $update) { |
|
319 | 319 | return !is_null($update->getEditedMessage()); |
320 | 320 | }; |
321 | 321 | } |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | */ |
328 | 328 | protected static function getChannelPostChecker() |
329 | 329 | { |
330 | - return function (Update $update) { |
|
330 | + return function(Update $update) { |
|
331 | 331 | return !is_null($update->getChannelPost()); |
332 | 332 | }; |
333 | 333 | } |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | */ |
340 | 340 | protected static function getCallbackQueryChecker() |
341 | 341 | { |
342 | - return function (Update $update) { |
|
342 | + return function(Update $update) { |
|
343 | 343 | return !is_null($update->getCallbackQuery()); |
344 | 344 | }; |
345 | 345 | } |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | */ |
352 | 352 | protected static function getEditedChannelPostChecker() |
353 | 353 | { |
354 | - return function (Update $update) { |
|
354 | + return function(Update $update) { |
|
355 | 355 | return !is_null($update->getEditedChannelPost()); |
356 | 356 | }; |
357 | 357 | } |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | */ |
364 | 364 | protected static function getChosenInlineResultChecker() |
365 | 365 | { |
366 | - return function (Update $update) { |
|
366 | + return function(Update $update) { |
|
367 | 367 | return !is_null($update->getChosenInlineResult()); |
368 | 368 | }; |
369 | 369 | } |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | */ |
376 | 376 | protected static function getInlineQueryChecker() |
377 | 377 | { |
378 | - return function (Update $update) { |
|
378 | + return function(Update $update) { |
|
379 | 379 | return !is_null($update->getInlineQuery()); |
380 | 380 | }; |
381 | 381 | } |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | */ |
388 | 388 | protected static function getShippingQueryChecker() |
389 | 389 | { |
390 | - return function (Update $update) { |
|
390 | + return function(Update $update) { |
|
391 | 391 | return !is_null($update->getShippingQuery()); |
392 | 392 | }; |
393 | 393 | } |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | */ |
400 | 400 | protected static function getPreCheckoutQueryChecker() |
401 | 401 | { |
402 | - return function (Update $update) { |
|
402 | + return function(Update $update) { |
|
403 | 403 | return !is_null($update->getPreCheckoutQuery()); |
404 | 404 | }; |
405 | 405 | } |
@@ -407,9 +407,9 @@ discard block |
||
407 | 407 | public function __call($name, array $arguments) |
408 | 408 | { |
409 | 409 | if (method_exists($this, $name)) { |
410 | - return call_user_func_array([$this, $name], $arguments); |
|
410 | + return call_user_func_array([ $this, $name ], $arguments); |
|
411 | 411 | } elseif (method_exists($this->api, $name)) { |
412 | - return call_user_func_array([$this->api, $name], $arguments); |
|
412 | + return call_user_func_array([ $this->api, $name ], $arguments); |
|
413 | 413 | } |
414 | 414 | throw new BadMethodCallException("Method {$name} not exists"); |
415 | 415 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | // Informational 1xx |
47 | 47 | 100 => 'Continue', |
48 | 48 | 101 => 'Switching Protocols', |
49 | - 102 => 'Processing', // RFC2518 |
|
49 | + 102 => 'Processing', // RFC2518 |
|
50 | 50 | // Success 2xx |
51 | 51 | 200 => 'OK', |
52 | 52 | 201 => 'Created', |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | 204 => 'No Content', |
56 | 56 | 205 => 'Reset Content', |
57 | 57 | 206 => 'Partial Content', |
58 | - 207 => 'Multi-Status', // RFC4918 |
|
59 | - 208 => 'Already Reported', // RFC5842 |
|
60 | - 226 => 'IM Used', // RFC3229 |
|
58 | + 207 => 'Multi-Status', // RFC4918 |
|
59 | + 208 => 'Already Reported', // RFC5842 |
|
60 | + 226 => 'IM Used', // RFC3229 |
|
61 | 61 | // Redirection 3xx |
62 | 62 | 300 => 'Multiple Choices', |
63 | 63 | 301 => 'Moved Permanently', |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | 305 => 'Use Proxy', |
68 | 68 | // 306 is deprecated but reserved |
69 | 69 | 307 => 'Temporary Redirect', |
70 | - 308 => 'Permanent Redirect', // RFC7238 |
|
70 | + 308 => 'Permanent Redirect', // RFC7238 |
|
71 | 71 | // Client Error 4xx |
72 | 72 | 400 => 'Bad Request', |
73 | 73 | 401 => 'Unauthorized', |
@@ -87,14 +87,14 @@ discard block |
||
87 | 87 | 415 => 'Unsupported Media Type', |
88 | 88 | 416 => 'Range Not Satisfiable', |
89 | 89 | 417 => 'Expectation Failed', |
90 | - 422 => 'Unprocessable Entity', // RFC4918 |
|
91 | - 423 => 'Locked', // RFC4918 |
|
92 | - 424 => 'Failed Dependency', // RFC4918 |
|
93 | - 425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817 |
|
94 | - 426 => 'Upgrade Required', // RFC2817 |
|
95 | - 428 => 'Precondition Required', // RFC6585 |
|
96 | - 429 => 'Too Many Requests', // RFC6585 |
|
97 | - 431 => 'Request Header Fields Too Large', // RFC6585 |
|
90 | + 422 => 'Unprocessable Entity', // RFC4918 |
|
91 | + 423 => 'Locked', // RFC4918 |
|
92 | + 424 => 'Failed Dependency', // RFC4918 |
|
93 | + 425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817 |
|
94 | + 426 => 'Upgrade Required', // RFC2817 |
|
95 | + 428 => 'Precondition Required', // RFC6585 |
|
96 | + 429 => 'Too Many Requests', // RFC6585 |
|
97 | + 431 => 'Request Header Fields Too Large', // RFC6585 |
|
98 | 98 | // Server Error 5xx |
99 | 99 | 500 => 'Internal Server Error', |
100 | 100 | 501 => 'Not Implemented', |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | 503 => 'Service Unavailable', |
103 | 103 | 504 => 'Gateway Timeout', |
104 | 104 | 505 => 'HTTP Version Not Supported', |
105 | - 506 => 'Variant Also Negotiates (Experimental)', // RFC2295 |
|
106 | - 507 => 'Insufficient Storage', // RFC4918 |
|
107 | - 508 => 'Loop Detected', // RFC5842 |
|
108 | - 510 => 'Not Extended', // RFC2774 |
|
109 | - 511 => 'Network Authentication Required', // RFC6585 |
|
105 | + 506 => 'Variant Also Negotiates (Experimental)', // RFC2295 |
|
106 | + 507 => 'Insufficient Storage', // RFC4918 |
|
107 | + 508 => 'Loop Detected', // RFC5842 |
|
108 | + 510 => 'Not Extended', // RFC2774 |
|
109 | + 511 => 'Network Authentication Required', // RFC6585 |
|
110 | 110 | ]; |
111 | 111 | |
112 | - private $proxySettings = []; |
|
112 | + private $proxySettings = [ ]; |
|
113 | 113 | |
114 | 114 | /** |
115 | 115 | * Default http status code |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @var array |
150 | 150 | */ |
151 | - protected $customCurlOptions = []; |
|
151 | + protected $customCurlOptions = [ ]; |
|
152 | 152 | |
153 | 153 | /** |
154 | 154 | * Bot token |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @var array |
171 | 171 | */ |
172 | - protected $trackedEvents = []; |
|
172 | + protected $trackedEvents = [ ]; |
|
173 | 173 | |
174 | 174 | /** |
175 | 175 | * Check whether return associative array |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | public function call($method, array $data = null, $timeout = 10) |
225 | 225 | { |
226 | 226 | $options = $this->proxySettings + [ |
227 | - CURLOPT_URL => $this->getUrl().'/'.$method, |
|
227 | + CURLOPT_URL => $this->getUrl() . '/' . $method, |
|
228 | 228 | CURLOPT_RETURNTRANSFER => true, |
229 | 229 | CURLOPT_POST => null, |
230 | 230 | CURLOPT_POSTFIELDS => null, |
@@ -232,8 +232,8 @@ discard block |
||
232 | 232 | ]; |
233 | 233 | |
234 | 234 | if ($data) { |
235 | - $options[CURLOPT_POST] = true; |
|
236 | - $options[CURLOPT_POSTFIELDS] = $data; |
|
235 | + $options[ CURLOPT_POST ] = true; |
|
236 | + $options[ CURLOPT_POSTFIELDS ] = $data; |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | if (!empty($this->customCurlOptions) && is_array($this->customCurlOptions)) { |
@@ -243,11 +243,11 @@ discard block |
||
243 | 243 | $response = self::jsonValidate($this->executeCurl($options), $this->returnArray); |
244 | 244 | |
245 | 245 | if ($this->returnArray) { |
246 | - if (!isset($response['ok']) || !$response['ok']) { |
|
247 | - throw new Exception($response['description'], $response['error_code']); |
|
246 | + if (!isset($response[ 'ok' ]) || !$response[ 'ok' ]) { |
|
247 | + throw new Exception($response[ 'description' ], $response[ 'error_code' ]); |
|
248 | 248 | } |
249 | 249 | |
250 | - return $response['result']; |
|
250 | + return $response[ 'result' ]; |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | if (!$response->ok) { |
@@ -288,12 +288,12 @@ discard block |
||
288 | 288 | */ |
289 | 289 | public static function curlValidate($curl, $response = null) |
290 | 290 | { |
291 | - $json = json_decode($response, true)?: []; |
|
291 | + $json = json_decode($response, true) ?: [ ]; |
|
292 | 292 | if (($httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE)) |
293 | - && !in_array($httpCode, [self::DEFAULT_STATUS_CODE, self::NOT_MODIFIED_STATUS_CODE]) |
|
293 | + && !in_array($httpCode, [ self::DEFAULT_STATUS_CODE, self::NOT_MODIFIED_STATUS_CODE ]) |
|
294 | 294 | ) { |
295 | - $errorDescription = array_key_exists('description', $json) ? $json['description'] : self::$codes[$httpCode]; |
|
296 | - $errorParameters = array_key_exists('parameters', $json) ? $json['parameters'] : []; |
|
295 | + $errorDescription = array_key_exists('description', $json) ? $json[ 'description' ] : self::$codes[ $httpCode ]; |
|
296 | + $errorParameters = array_key_exists('parameters', $json) ? $json[ 'parameters' ] : [ ]; |
|
297 | 297 | throw new HttpException($errorDescription, $httpCode, null, $errorParameters); |
298 | 298 | } |
299 | 299 | } |
@@ -350,9 +350,9 @@ discard block |
||
350 | 350 | 'message_thread_id' => $messageThreadId, |
351 | 351 | 'parse_mode' => $parseMode, |
352 | 352 | 'disable_web_page_preview' => $disablePreview, |
353 | - 'reply_to_message_id' => (int)$replyToMessageId, |
|
353 | + 'reply_to_message_id' => (int) $replyToMessageId, |
|
354 | 354 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
355 | - 'disable_notification' => (bool)$disableNotification, |
|
355 | + 'disable_notification' => (bool) $disableNotification, |
|
356 | 356 | ])); |
357 | 357 | } |
358 | 358 | |
@@ -390,14 +390,14 @@ discard block |
||
390 | 390 | return Message::fromResponse($this->call('copyMessage', [ |
391 | 391 | 'chat_id' => $chatId, |
392 | 392 | 'from_chat_id' => $fromChatId, |
393 | - 'message_id' => (int)$messageId, |
|
393 | + 'message_id' => (int) $messageId, |
|
394 | 394 | 'caption' => $caption, |
395 | 395 | 'parse_mode' => $parseMode, |
396 | 396 | 'caption_entities' => $captionEntities, |
397 | - 'disable_notification' => (bool)$disableNotification, |
|
397 | + 'disable_notification' => (bool) $disableNotification, |
|
398 | 398 | 'message_thread_id' => $messageThreadId, |
399 | - 'reply_to_message_id' => (int)$replyToMessageId, |
|
400 | - 'allow_sending_without_reply' => (bool)$allowSendingWithoutReply, |
|
399 | + 'reply_to_message_id' => (int) $replyToMessageId, |
|
400 | + 'allow_sending_without_reply' => (bool) $allowSendingWithoutReply, |
|
401 | 401 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
402 | 402 | ])); |
403 | 403 | } |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | 'message_thread_id' => $messageThreadId, |
436 | 436 | 'reply_to_message_id' => $replyToMessageId, |
437 | 437 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
438 | - 'disable_notification' => (bool)$disableNotification, |
|
438 | + 'disable_notification' => (bool) $disableNotification, |
|
439 | 439 | ])); |
440 | 440 | } |
441 | 441 | |
@@ -478,9 +478,9 @@ discard block |
||
478 | 478 | public function getUserProfilePhotos($userId, $offset = 0, $limit = 100) |
479 | 479 | { |
480 | 480 | return UserProfilePhotos::fromResponse($this->call('getUserProfilePhotos', [ |
481 | - 'user_id' => (int)$userId, |
|
482 | - 'offset' => (int)$offset, |
|
483 | - 'limit' => (int)$limit, |
|
481 | + 'user_id' => (int) $userId, |
|
482 | + 'offset' => (int) $offset, |
|
483 | + 'limit' => (int) $limit, |
|
484 | 484 | ])); |
485 | 485 | } |
486 | 486 | |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | */ |
547 | 547 | public function deleteWebhook($drop_pending_updates = false) |
548 | 548 | { |
549 | - return $this->call('deleteWebhook', ['drop_pending_updates' => $drop_pending_updates]); |
|
549 | + return $this->call('deleteWebhook', [ 'drop_pending_updates' => $drop_pending_updates ]); |
|
550 | 550 | } |
551 | 551 | |
552 | 552 | /** |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | 'message_thread_id' => $messageThreadId, |
645 | 645 | 'reply_to_message_id' => $replyToMessageId, |
646 | 646 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
647 | - 'disable_notification' => (bool)$disableNotification, |
|
647 | + 'disable_notification' => (bool) $disableNotification, |
|
648 | 648 | ])); |
649 | 649 | } |
650 | 650 | |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | 'message_thread_id' => $messageThreadId, |
747 | 747 | 'reply_to_message_id' => $replyToMessageId, |
748 | 748 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
749 | - 'disable_notification' => (bool)$disableNotification, |
|
749 | + 'disable_notification' => (bool) $disableNotification, |
|
750 | 750 | ])); |
751 | 751 | } |
752 | 752 | |
@@ -781,9 +781,9 @@ discard block |
||
781 | 781 | 'message_thread_id' => $messageThreadId, |
782 | 782 | 'reply_to_message_id' => $replyToMessageId, |
783 | 783 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
784 | - 'disable_notification' => (bool)$disableNotification, |
|
785 | - 'protect_content' => (bool)$protectContent, |
|
786 | - 'allow_sending_without_reply' => (bool)$allowSendingWithoutReply, |
|
784 | + 'disable_notification' => (bool) $disableNotification, |
|
785 | + 'protect_content' => (bool) $protectContent, |
|
786 | + 'allow_sending_without_reply' => (bool) $allowSendingWithoutReply, |
|
787 | 787 | ])); |
788 | 788 | } |
789 | 789 | |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | * |
810 | 810 | * @author bernard-ng <[email protected]> |
811 | 811 | */ |
812 | - public function getCustomEmojiStickers($customEmojiIds = []) |
|
812 | + public function getCustomEmojiStickers($customEmojiIds = [ ]) |
|
813 | 813 | { |
814 | 814 | return StickerSet::fromResponse($this->call('getCustomEmojiStickers', [ |
815 | 815 | 'custom_emoji_ids' => $customEmojiIds, |
@@ -1006,8 +1006,8 @@ discard block |
||
1006 | 1006 | 'message_thread_id' => $messageThreadId, |
1007 | 1007 | 'reply_to_message_id' => $replyToMessageId, |
1008 | 1008 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
1009 | - 'disable_notification' => (bool)$disableNotification, |
|
1010 | - 'supports_streaming' => (bool)$supportsStreaming, |
|
1009 | + 'disable_notification' => (bool) $disableNotification, |
|
1010 | + 'supports_streaming' => (bool) $supportsStreaming, |
|
1011 | 1011 | 'parse_mode' => $parseMode |
1012 | 1012 | ])); |
1013 | 1013 | } |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | 'message_thread_id' => $messageThreadId, |
1051 | 1051 | 'reply_to_message_id' => $replyToMessageId, |
1052 | 1052 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
1053 | - 'disable_notification' => (bool)$disableNotification, |
|
1053 | + 'disable_notification' => (bool) $disableNotification, |
|
1054 | 1054 | 'parse_mode' => $parseMode |
1055 | 1055 | ])); |
1056 | 1056 | } |
@@ -1099,7 +1099,7 @@ discard block |
||
1099 | 1099 | 'message_thread_id' => $messageThreadId, |
1100 | 1100 | 'reply_to_message_id' => $replyToMessageId, |
1101 | 1101 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
1102 | - 'disable_notification' => (bool)$disableNotification, |
|
1102 | + 'disable_notification' => (bool) $disableNotification, |
|
1103 | 1103 | 'allow_sending_without_reply' => $allowSendingWithoutReply, |
1104 | 1104 | 'parse_mode' => $parseMode |
1105 | 1105 | ])); |
@@ -1135,7 +1135,7 @@ discard block |
||
1135 | 1135 | 'message_id' => $messageId, |
1136 | 1136 | 'message_thread_id' => $messageThreadId, |
1137 | 1137 | 'protect_content' => $protectContent, |
1138 | - 'disable_notification' => (bool)$disableNotification, |
|
1138 | + 'disable_notification' => (bool) $disableNotification, |
|
1139 | 1139 | ])); |
1140 | 1140 | } |
1141 | 1141 | |
@@ -1188,7 +1188,7 @@ discard block |
||
1188 | 1188 | 'title' => $title, |
1189 | 1189 | 'reply_to_message_id' => $replyToMessageId, |
1190 | 1190 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
1191 | - 'disable_notification' => (bool)$disableNotification, |
|
1191 | + 'disable_notification' => (bool) $disableNotification, |
|
1192 | 1192 | 'parse_mode' => $parseMode |
1193 | 1193 | ])); |
1194 | 1194 | } |
@@ -1226,7 +1226,7 @@ discard block |
||
1226 | 1226 | 'message_thread_id' => $messageThreadId, |
1227 | 1227 | 'reply_to_message_id' => $replyToMessageId, |
1228 | 1228 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
1229 | - 'disable_notification' => (bool)$disableNotification, |
|
1229 | + 'disable_notification' => (bool) $disableNotification, |
|
1230 | 1230 | 'parse_mode' => $parseMode |
1231 | 1231 | ])); |
1232 | 1232 | } |
@@ -1265,7 +1265,7 @@ discard block |
||
1265 | 1265 | 'message_thread_id' => $messageThreadId, |
1266 | 1266 | 'reply_to_message_id' => $replyToMessageId, |
1267 | 1267 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
1268 | - 'disable_notification' => (bool)$disableNotification, |
|
1268 | + 'disable_notification' => (bool) $disableNotification, |
|
1269 | 1269 | 'parse_mode' => $parseMode |
1270 | 1270 | ])); |
1271 | 1271 | } |
@@ -1287,7 +1287,7 @@ discard block |
||
1287 | 1287 | */ |
1288 | 1288 | public function getFile($fileId) |
1289 | 1289 | { |
1290 | - return File::fromResponse($this->call('getFile', ['file_id' => $fileId])); |
|
1290 | + return File::fromResponse($this->call('getFile', [ 'file_id' => $fileId ])); |
|
1291 | 1291 | } |
1292 | 1292 | |
1293 | 1293 | /** |
@@ -1307,7 +1307,7 @@ discard block |
||
1307 | 1307 | CURLOPT_HEADER => 0, |
1308 | 1308 | CURLOPT_HTTPGET => 1, |
1309 | 1309 | CURLOPT_RETURNTRANSFER => 1, |
1310 | - CURLOPT_URL => $this->getFileUrl().'/'.$file->getFilePath(), |
|
1310 | + CURLOPT_URL => $this->getFileUrl() . '/' . $file->getFilePath(), |
|
1311 | 1311 | ]; |
1312 | 1312 | |
1313 | 1313 | return $this->executeCurl($options); |
@@ -1337,7 +1337,7 @@ discard block |
||
1337 | 1337 | $switchPmText = null, |
1338 | 1338 | $switchPmParameter = null |
1339 | 1339 | ) { |
1340 | - $results = array_map(function ($item) { |
|
1340 | + $results = array_map(function($item) { |
|
1341 | 1341 | /* @var AbstractInlineQueryResult $item */ |
1342 | 1342 | return json_decode($item->toJson(), true); |
1343 | 1343 | }, $results); |
@@ -1416,7 +1416,7 @@ discard block |
||
1416 | 1416 | return $this->call('answerCallbackQuery', [ |
1417 | 1417 | 'callback_query_id' => $callbackQueryId, |
1418 | 1418 | 'text' => $text, |
1419 | - 'show_alert' => (bool)$showAlert, |
|
1419 | + 'show_alert' => (bool) $showAlert, |
|
1420 | 1420 | 'url' => $url, |
1421 | 1421 | 'cache_time' => $cacheTime |
1422 | 1422 | ]); |
@@ -1618,7 +1618,7 @@ discard block |
||
1618 | 1618 | */ |
1619 | 1619 | public function getUrl() |
1620 | 1620 | { |
1621 | - return self::URL_PREFIX.$this->token; |
|
1621 | + return self::URL_PREFIX . $this->token; |
|
1622 | 1622 | } |
1623 | 1623 | |
1624 | 1624 | /** |
@@ -1626,7 +1626,7 @@ discard block |
||
1626 | 1626 | */ |
1627 | 1627 | public function getFileUrl() |
1628 | 1628 | { |
1629 | - return self::FILE_URL_PREFIX.$this->token; |
|
1629 | + return self::FILE_URL_PREFIX . $this->token; |
|
1630 | 1630 | } |
1631 | 1631 | |
1632 | 1632 | /** |
@@ -1638,7 +1638,7 @@ discard block |
||
1638 | 1638 | public function trackUpdate(Update $update, $eventName = 'Message') |
1639 | 1639 | { |
1640 | 1640 | if (!in_array($update->getUpdateId(), $this->trackedEvents)) { |
1641 | - $this->trackedEvents[] = $update->getUpdateId(); |
|
1641 | + $this->trackedEvents[ ] = $update->getUpdateId(); |
|
1642 | 1642 | |
1643 | 1643 | $this->track($update->getMessage(), $eventName); |
1644 | 1644 | |
@@ -1740,10 +1740,10 @@ discard block |
||
1740 | 1740 | 'need_shipping_address' => $needShippingAddress, |
1741 | 1741 | 'reply_to_message_id' => $replyToMessageId, |
1742 | 1742 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
1743 | - 'disable_notification' => (bool)$disableNotification, |
|
1743 | + 'disable_notification' => (bool) $disableNotification, |
|
1744 | 1744 | 'provider_data' => $providerData, |
1745 | - 'send_phone_number_to_provider' => (bool)$sendPhoneNumberToProvider, |
|
1746 | - 'send_email_to_provider' => (bool)$sendEmailToProvider |
|
1745 | + 'send_phone_number_to_provider' => (bool) $sendPhoneNumberToProvider, |
|
1746 | + 'send_email_to_provider' => (bool) $sendEmailToProvider |
|
1747 | 1747 | ])); |
1748 | 1748 | } |
1749 | 1749 | |
@@ -1760,11 +1760,11 @@ discard block |
||
1760 | 1760 | * @return bool |
1761 | 1761 | * @throws Exception |
1762 | 1762 | */ |
1763 | - public function answerShippingQuery($shippingQueryId, $ok = true, $shipping_options = [], $errorMessage = null) |
|
1763 | + public function answerShippingQuery($shippingQueryId, $ok = true, $shipping_options = [ ], $errorMessage = null) |
|
1764 | 1764 | { |
1765 | 1765 | return $this->call('answerShippingQuery', [ |
1766 | 1766 | 'shipping_query_id' => $shippingQueryId, |
1767 | - 'ok' => (bool)$ok, |
|
1767 | + 'ok' => (bool) $ok, |
|
1768 | 1768 | 'shipping_options' => json_encode($shipping_options), |
1769 | 1769 | 'error_message' => $errorMessage |
1770 | 1770 | ]); |
@@ -1785,7 +1785,7 @@ discard block |
||
1785 | 1785 | { |
1786 | 1786 | return $this->call('answerPreCheckoutQuery', [ |
1787 | 1787 | 'pre_checkout_query_id' => $preCheckoutQueryId, |
1788 | - 'ok' => (bool)$ok, |
|
1788 | + 'ok' => (bool) $ok, |
|
1789 | 1789 | 'error_message' => $errorMessage |
1790 | 1790 | ]); |
1791 | 1791 | } |
@@ -2144,7 +2144,7 @@ discard block |
||
2144 | 2144 | 'message_thread_id' => $messageThreadId, |
2145 | 2145 | 'reply_to_message_id' => $replyToMessageId, |
2146 | 2146 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
2147 | - 'disable_notification' => (bool)$disableNotification |
|
2147 | + 'disable_notification' => (bool) $disableNotification |
|
2148 | 2148 | ])); |
2149 | 2149 | } |
2150 | 2150 | |
@@ -2172,8 +2172,8 @@ discard block |
||
2172 | 2172 | 'chat_id' => $chatId, |
2173 | 2173 | 'media' => $media->toJson(), |
2174 | 2174 | 'message_thread_id' => $messageThreadId, |
2175 | - 'reply_to_message_id' => (int)$replyToMessageId, |
|
2176 | - 'disable_notification' => (bool)$disableNotification |
|
2175 | + 'reply_to_message_id' => (int) $replyToMessageId, |
|
2176 | + 'disable_notification' => (bool) $disableNotification |
|
2177 | 2177 | ])); |
2178 | 2178 | } |
2179 | 2179 | |
@@ -2187,7 +2187,7 @@ discard block |
||
2187 | 2187 | public function setProxy($proxyString = '', $socks5 = false) |
2188 | 2188 | { |
2189 | 2189 | if (empty($proxyString)) { |
2190 | - $this->proxySettings = []; |
|
2190 | + $this->proxySettings = [ ]; |
|
2191 | 2191 | return $this; |
2192 | 2192 | } |
2193 | 2193 | |
@@ -2197,7 +2197,7 @@ discard block |
||
2197 | 2197 | ]; |
2198 | 2198 | |
2199 | 2199 | if ($socks5) { |
2200 | - $this->proxySettings[CURLOPT_PROXYTYPE] = CURLPROXY_SOCKS5; |
|
2200 | + $this->proxySettings[ CURLOPT_PROXYTYPE ] = CURLPROXY_SOCKS5; |
|
2201 | 2201 | } |
2202 | 2202 | return $this; |
2203 | 2203 | } |
@@ -2497,7 +2497,7 @@ discard block |
||
2497 | 2497 | */ |
2498 | 2498 | public function setCurlOption($option, $value) |
2499 | 2499 | { |
2500 | - $this->customCurlOptions[$option] = $value; |
|
2500 | + $this->customCurlOptions[ $option ] = $value; |
|
2501 | 2501 | } |
2502 | 2502 | |
2503 | 2503 | /** |
@@ -2507,7 +2507,7 @@ discard block |
||
2507 | 2507 | */ |
2508 | 2508 | public function unsetCurlOption($option) |
2509 | 2509 | { |
2510 | - unset($this->customCurlOptions[$option]); |
|
2510 | + unset($this->customCurlOptions[ $option ]); |
|
2511 | 2511 | } |
2512 | 2512 | |
2513 | 2513 | /** |
@@ -2515,6 +2515,6 @@ discard block |
||
2515 | 2515 | */ |
2516 | 2516 | public function resetCurlOptions() |
2517 | 2517 | { |
2518 | - $this->customCurlOptions = []; |
|
2518 | + $this->customCurlOptions = [ ]; |
|
2519 | 2519 | } |
2520 | 2520 | } |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function add(Closure $event, $checker = null) |
48 | 48 | { |
49 | - $this->events[] = !is_null($checker) ? new Event($event, $checker) |
|
50 | - : new Event($event, function () { |
|
49 | + $this->events[ ] = !is_null($checker) ? new Event($event, $checker) |
|
50 | + : new Event($event, function() { |
|
51 | 51 | }); |
52 | 52 | |
53 | 53 | return $this; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | if (false === $event->executeAction($update)) { |
65 | 65 | if (!is_null($this->tracker)) { |
66 | 66 | $checker = new ReflectionFunction($event->getChecker()); |
67 | - $this->tracker->track($update->getMessage(), $checker->getStaticVariables()['name']); |
|
67 | + $this->tracker->track($update->getMessage(), $checker->getStaticVariables()[ 'name' ]); |
|
68 | 68 | } |
69 | 69 | break; |
70 | 70 | } |
@@ -15,14 +15,14 @@ discard block |
||
15 | 15 | * |
16 | 16 | * @var array |
17 | 17 | */ |
18 | - protected static $requiredParams = []; |
|
18 | + protected static $requiredParams = [ ]; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Map of input data |
22 | 22 | * |
23 | 23 | * @var array |
24 | 24 | */ |
25 | - protected static $map = []; |
|
25 | + protected static $map = [ ]; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Validate input data |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | public function map($data) |
46 | 46 | { |
47 | 47 | foreach (static::$map as $key => $item) { |
48 | - if (isset($data[$key]) && (!is_array($data[$key]) || (is_array($data[$key]) && !empty($data[$key])))) { |
|
48 | + if (isset($data[ $key ]) && (!is_array($data[ $key ]) || (is_array($data[ $key ]) && !empty($data[ $key ])))) { |
|
49 | 49 | $method = 'set' . self::toCamelCase($key); |
50 | 50 | if ($item === true) { |
51 | - $this->$method($data[$key]); |
|
51 | + $this->$method($data[ $key ]); |
|
52 | 52 | } else { |
53 | - $this->$method($item::fromResponse($data[$key])); |
|
53 | + $this->$method($item::fromResponse($data[ $key ])); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
@@ -63,20 +63,20 @@ discard block |
||
63 | 63 | |
64 | 64 | public function toJson($inner = false) |
65 | 65 | { |
66 | - $output = []; |
|
66 | + $output = [ ]; |
|
67 | 67 | |
68 | 68 | foreach (static::$map as $key => $item) { |
69 | 69 | $property = lcfirst(self::toCamelCase($key)); |
70 | 70 | if (!is_null($this->$property)) { |
71 | 71 | if (is_array($this->$property)) { |
72 | - $output[$key] = array_map( |
|
73 | - function ($v) { |
|
72 | + $output[ $key ] = array_map( |
|
73 | + function($v) { |
|
74 | 74 | return is_object($v) ? $v->toJson(true) : $v; |
75 | 75 | }, |
76 | 76 | $this->$property |
77 | 77 | ); |
78 | 78 | } else { |
79 | - $output[$key] = $item === true ? $this->$property : $this->$property->toJson(true); |
|
79 | + $output[ $key ] = $item === true ? $this->$property : $this->$property->toJson(true); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | } |
@@ -77,7 +77,7 @@ |
||
77 | 77 | |
78 | 78 | BotApi::curlValidate($this->curl); |
79 | 79 | |
80 | - if ($result['status'] !== 'accepted') { |
|
80 | + if ($result[ 'status' ] !== 'accepted') { |
|
81 | 81 | throw new Exception('Error Processing Request'); |
82 | 82 | } |
83 | 83 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * @var array |
15 | 15 | */ |
16 | - protected $parameters = []; |
|
16 | + protected $parameters = [ ]; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * HttpException constructor. |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @param Exception $previous [optional] The previous throwable used for the exception chaining. |
24 | 24 | * @param array $parameters [optional] Array of parameters returned from API. |
25 | 25 | */ |
26 | - public function __construct($message = '', $code = 0, Exception $previous = null, $parameters = []) |
|
26 | + public function __construct($message = '', $code = 0, Exception $previous = null, $parameters = [ ]) |
|
27 | 27 | { |
28 | 28 | $this->parameters = $parameters; |
29 | 29 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | /** |
13 | 13 | * @var array |
14 | 14 | */ |
15 | - protected $items = []; |
|
15 | + protected $items = [ ]; |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * @var int Max items count, if set 0 - unlimited |
@@ -33,12 +33,12 @@ discard block |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | if ($key == null) { |
36 | - $this->items[] = $item; |
|
36 | + $this->items[ ] = $item; |
|
37 | 37 | } else { |
38 | - if (isset($this->items[$key])) { |
|
38 | + if (isset($this->items[ $key ])) { |
|
39 | 39 | throw new KeyHasUseException("Key $key already in use."); |
40 | 40 | } |
41 | - $this->items[$key] = $item; |
|
41 | + $this->items[ $key ] = $item; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | { |
52 | 52 | $this->checkItemKey($key); |
53 | 53 | |
54 | - unset($this->items[$key]); |
|
54 | + unset($this->items[ $key ]); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | { |
65 | 65 | $this->checkItemKey($key); |
66 | 66 | |
67 | - return $this->items[$key]; |
|
67 | + return $this->items[ $key ]; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function toJson($inner = false) |
83 | 83 | { |
84 | - $output = []; |
|
84 | + $output = [ ]; |
|
85 | 85 | foreach ($this->items as $item) { |
86 | - $output[] = $item->toJson(true); |
|
86 | + $output[ ] = $item->toJson(true); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | return $inner === false ? json_encode($output) : $output; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | private function checkItemKey($key) |
106 | 106 | { |
107 | - if (!isset($this->items[$key])) { |
|
107 | + if (!isset($this->items[ $key ])) { |
|
108 | 108 | throw new KeyInvalidException("Invalid key $key."); |
109 | 109 | } |
110 | 110 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | */ |
15 | 15 | class MaskPosition extends BaseType implements TypeInterface |
16 | 16 | { |
17 | - protected static $requiredParams = ['point', 'x_shift', 'y_shift', 'scale']; |
|
17 | + protected static $requiredParams = [ 'point', 'x_shift', 'y_shift', 'scale' ]; |
|
18 | 18 | |
19 | 19 | protected static $map = [ |
20 | 20 | 'point' => true, |
@@ -22,7 +22,7 @@ |
||
22 | 22 | * |
23 | 23 | * @var array |
24 | 24 | */ |
25 | - static protected $requiredParams = ['file_id']; |
|
25 | + static protected $requiredParams = [ 'file_id' ]; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * {@inheritdoc} |