@@ -19,7 +19,7 @@ |
||
19 | 19 | * |
20 | 20 | * @var array |
21 | 21 | */ |
22 | - protected static $requiredParams = ['latitude', 'longitude']; |
|
22 | + protected static $requiredParams = [ 'latitude', 'longitude' ]; |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * {@inheritdoc} |
@@ -18,7 +18,7 @@ |
||
18 | 18 | * |
19 | 19 | * @var array |
20 | 20 | */ |
21 | - protected static $requiredParams = ['phone_number', 'first_name']; |
|
21 | + protected static $requiredParams = [ 'phone_number', 'first_name' ]; |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * {@inheritdoc} |
@@ -19,7 +19,7 @@ |
||
19 | 19 | * |
20 | 20 | * @var array |
21 | 21 | */ |
22 | - protected static $requiredParams = ['file_id', 'file_unique_id', 'duration']; |
|
22 | + protected static $requiredParams = [ 'file_id', 'file_unique_id', 'duration' ]; |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * {@inheritdoc} |
@@ -15,7 +15,7 @@ |
||
15 | 15 | * |
16 | 16 | * @var array |
17 | 17 | */ |
18 | - protected static $requiredParams = ['message_id']; |
|
18 | + protected static $requiredParams = [ 'message_id' ]; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * {@inheritdoc} |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * @param CollectionItemInterface[] $items |
19 | 19 | */ |
20 | - public function __construct(array $items = []) |
|
20 | + public function __construct(array $items = [ ]) |
|
21 | 21 | { |
22 | 22 | parent::__construct($items); |
23 | 23 | } |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function toJson($inner = false) |
78 | 78 | { |
79 | - $output = []; |
|
79 | + $output = [ ]; |
|
80 | 80 | foreach ($this as $item) { |
81 | - $output[] = $item->toJson(true); |
|
81 | + $output[ ] = $item->toJson(true); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | return $inner === false ? json_encode($output) : $output; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | { |
170 | 170 | if ($data = BotApi::jsonValidate((string) $this->getRawBody(), true)) { |
171 | 171 | /** @var array $data */ |
172 | - $this->handle([Update::fromResponse($data)]); |
|
172 | + $this->handle([ Update::fromResponse($data) ]); |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | */ |
191 | 191 | protected static function getEvent(Closure $action) |
192 | 192 | { |
193 | - return function (Update $update) use ($action) { |
|
193 | + return function(Update $update) use ($action) { |
|
194 | 194 | $message = $update->getMessage(); |
195 | 195 | if (!$message) { |
196 | 196 | return true; |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | |
199 | 199 | preg_match(self::REGEXP, (string) $message->getText(), $matches); |
200 | 200 | |
201 | - if (isset($matches[3]) && !empty($matches[3])) { |
|
202 | - $parameters = str_getcsv($matches[3], chr(32)); |
|
201 | + if (isset($matches[ 3 ]) && !empty($matches[ 3 ])) { |
|
202 | + $parameters = str_getcsv($matches[ 3 ], chr(32)); |
|
203 | 203 | } else { |
204 | - $parameters = []; |
|
204 | + $parameters = [ ]; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | array_unshift($parameters, $message); |
@@ -221,13 +221,13 @@ discard block |
||
221 | 221 | */ |
222 | 222 | protected static function getEditedMessageEvent(Closure $action) |
223 | 223 | { |
224 | - return function (Update $update) use ($action) { |
|
224 | + return function(Update $update) use ($action) { |
|
225 | 225 | if (!$update->getEditedMessage()) { |
226 | 226 | return true; |
227 | 227 | } |
228 | 228 | |
229 | 229 | $reflectionAction = new ReflectionFunction($action); |
230 | - $reflectionAction->invokeArgs([$update->getEditedMessage()]); |
|
230 | + $reflectionAction->invokeArgs([ $update->getEditedMessage() ]); |
|
231 | 231 | return false; |
232 | 232 | }; |
233 | 233 | } |
@@ -239,13 +239,13 @@ discard block |
||
239 | 239 | */ |
240 | 240 | protected static function getChannelPostEvent(Closure $action) |
241 | 241 | { |
242 | - return function (Update $update) use ($action) { |
|
242 | + return function(Update $update) use ($action) { |
|
243 | 243 | if (!$update->getChannelPost()) { |
244 | 244 | return true; |
245 | 245 | } |
246 | 246 | |
247 | 247 | $reflectionAction = new ReflectionFunction($action); |
248 | - $reflectionAction->invokeArgs([$update->getChannelPost()]); |
|
248 | + $reflectionAction->invokeArgs([ $update->getChannelPost() ]); |
|
249 | 249 | return false; |
250 | 250 | }; |
251 | 251 | } |
@@ -255,13 +255,13 @@ discard block |
||
255 | 255 | */ |
256 | 256 | protected static function getCallbackQueryEvent(Closure $action) |
257 | 257 | { |
258 | - return function (Update $update) use ($action) { |
|
258 | + return function(Update $update) use ($action) { |
|
259 | 259 | if (!$update->getCallbackQuery()) { |
260 | 260 | return true; |
261 | 261 | } |
262 | 262 | |
263 | 263 | $reflectionAction = new ReflectionFunction($action); |
264 | - $reflectionAction->invokeArgs([$update->getCallbackQuery()]); |
|
264 | + $reflectionAction->invokeArgs([ $update->getCallbackQuery() ]); |
|
265 | 265 | return false; |
266 | 266 | }; |
267 | 267 | } |
@@ -273,13 +273,13 @@ discard block |
||
273 | 273 | */ |
274 | 274 | protected static function getEditedChannelPostEvent(Closure $action) |
275 | 275 | { |
276 | - return function (Update $update) use ($action) { |
|
276 | + return function(Update $update) use ($action) { |
|
277 | 277 | if (!$update->getEditedChannelPost()) { |
278 | 278 | return true; |
279 | 279 | } |
280 | 280 | |
281 | 281 | $reflectionAction = new ReflectionFunction($action); |
282 | - $reflectionAction->invokeArgs([$update->getEditedChannelPost()]); |
|
282 | + $reflectionAction->invokeArgs([ $update->getEditedChannelPost() ]); |
|
283 | 283 | return false; |
284 | 284 | }; |
285 | 285 | } |
@@ -289,13 +289,13 @@ discard block |
||
289 | 289 | */ |
290 | 290 | protected static function getInlineQueryEvent(Closure $action) |
291 | 291 | { |
292 | - return function (Update $update) use ($action) { |
|
292 | + return function(Update $update) use ($action) { |
|
293 | 293 | if (!$update->getInlineQuery()) { |
294 | 294 | return true; |
295 | 295 | } |
296 | 296 | |
297 | 297 | $reflectionAction = new ReflectionFunction($action); |
298 | - $reflectionAction->invokeArgs([$update->getInlineQuery()]); |
|
298 | + $reflectionAction->invokeArgs([ $update->getInlineQuery() ]); |
|
299 | 299 | return false; |
300 | 300 | }; |
301 | 301 | } |
@@ -307,13 +307,13 @@ discard block |
||
307 | 307 | */ |
308 | 308 | protected static function getChosenInlineResultEvent(Closure $action) |
309 | 309 | { |
310 | - return function (Update $update) use ($action) { |
|
310 | + return function(Update $update) use ($action) { |
|
311 | 311 | if (!$update->getChosenInlineResult()) { |
312 | 312 | return true; |
313 | 313 | } |
314 | 314 | |
315 | 315 | $reflectionAction = new ReflectionFunction($action); |
316 | - $reflectionAction->invokeArgs([$update->getChosenInlineResult()]); |
|
316 | + $reflectionAction->invokeArgs([ $update->getChosenInlineResult() ]); |
|
317 | 317 | return false; |
318 | 318 | }; |
319 | 319 | } |
@@ -323,13 +323,13 @@ discard block |
||
323 | 323 | */ |
324 | 324 | protected static function getShippingQueryEvent(Closure $action) |
325 | 325 | { |
326 | - return function (Update $update) use ($action) { |
|
326 | + return function(Update $update) use ($action) { |
|
327 | 327 | if (!$update->getShippingQuery()) { |
328 | 328 | return true; |
329 | 329 | } |
330 | 330 | |
331 | 331 | $reflectionAction = new ReflectionFunction($action); |
332 | - $reflectionAction->invokeArgs([$update->getShippingQuery()]); |
|
332 | + $reflectionAction->invokeArgs([ $update->getShippingQuery() ]); |
|
333 | 333 | return false; |
334 | 334 | }; |
335 | 335 | } |
@@ -341,13 +341,13 @@ discard block |
||
341 | 341 | */ |
342 | 342 | protected static function getPreCheckoutQueryEvent(Closure $action) |
343 | 343 | { |
344 | - return function (Update $update) use ($action) { |
|
344 | + return function(Update $update) use ($action) { |
|
345 | 345 | if (!$update->getPreCheckoutQuery()) { |
346 | 346 | return true; |
347 | 347 | } |
348 | 348 | |
349 | 349 | $reflectionAction = new ReflectionFunction($action); |
350 | - $reflectionAction->invokeArgs([$update->getPreCheckoutQuery()]); |
|
350 | + $reflectionAction->invokeArgs([ $update->getPreCheckoutQuery() ]); |
|
351 | 351 | return false; |
352 | 352 | }; |
353 | 353 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | */ |
362 | 362 | protected static function getChecker($name) |
363 | 363 | { |
364 | - return function (Update $update) use ($name) { |
|
364 | + return function(Update $update) use ($name) { |
|
365 | 365 | $message = $update->getMessage(); |
366 | 366 | if (!$message) { |
367 | 367 | return false; |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | |
374 | 374 | preg_match(self::REGEXP, $text, $matches); |
375 | 375 | |
376 | - return !empty($matches) && $matches[1] == $name; |
|
376 | + return !empty($matches) && $matches[ 1 ] == $name; |
|
377 | 377 | }; |
378 | 378 | } |
379 | 379 | |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | */ |
385 | 385 | protected static function getEditedMessageChecker() |
386 | 386 | { |
387 | - return function (Update $update) { |
|
387 | + return function(Update $update) { |
|
388 | 388 | return !is_null($update->getEditedMessage()); |
389 | 389 | }; |
390 | 390 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | */ |
397 | 397 | protected static function getChannelPostChecker() |
398 | 398 | { |
399 | - return function (Update $update) { |
|
399 | + return function(Update $update) { |
|
400 | 400 | return !is_null($update->getChannelPost()); |
401 | 401 | }; |
402 | 402 | } |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | */ |
409 | 409 | protected static function getCallbackQueryChecker() |
410 | 410 | { |
411 | - return function (Update $update) { |
|
411 | + return function(Update $update) { |
|
412 | 412 | return !is_null($update->getCallbackQuery()); |
413 | 413 | }; |
414 | 414 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | */ |
421 | 421 | protected static function getEditedChannelPostChecker() |
422 | 422 | { |
423 | - return function (Update $update) { |
|
423 | + return function(Update $update) { |
|
424 | 424 | return !is_null($update->getEditedChannelPost()); |
425 | 425 | }; |
426 | 426 | } |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | */ |
433 | 433 | protected static function getChosenInlineResultChecker() |
434 | 434 | { |
435 | - return function (Update $update) { |
|
435 | + return function(Update $update) { |
|
436 | 436 | return !is_null($update->getChosenInlineResult()); |
437 | 437 | }; |
438 | 438 | } |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | */ |
445 | 445 | protected static function getInlineQueryChecker() |
446 | 446 | { |
447 | - return function (Update $update) { |
|
447 | + return function(Update $update) { |
|
448 | 448 | return !is_null($update->getInlineQuery()); |
449 | 449 | }; |
450 | 450 | } |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | */ |
457 | 457 | protected static function getShippingQueryChecker() |
458 | 458 | { |
459 | - return function (Update $update) { |
|
459 | + return function(Update $update) { |
|
460 | 460 | return !is_null($update->getShippingQuery()); |
461 | 461 | }; |
462 | 462 | } |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | */ |
469 | 469 | protected static function getPreCheckoutQueryChecker() |
470 | 470 | { |
471 | - return function (Update $update) { |
|
471 | + return function(Update $update) { |
|
472 | 472 | return !is_null($update->getPreCheckoutQuery()); |
473 | 473 | }; |
474 | 474 | } |
@@ -482,9 +482,9 @@ discard block |
||
482 | 482 | public function __call($name, array $arguments) |
483 | 483 | { |
484 | 484 | if (method_exists($this, $name)) { |
485 | - return call_user_func_array([$this, $name], $arguments); |
|
485 | + return call_user_func_array([ $this, $name ], $arguments); |
|
486 | 486 | } elseif (method_exists($this->api, $name)) { |
487 | - return call_user_func_array([$this->api, $name], $arguments); |
|
487 | + return call_user_func_array([ $this->api, $name ], $arguments); |
|
488 | 488 | } |
489 | 489 | throw new BadMethodCallException("Method {$name} not exists"); |
490 | 490 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | // Informational 1xx |
49 | 49 | 100 => 'Continue', |
50 | 50 | 101 => 'Switching Protocols', |
51 | - 102 => 'Processing', // RFC2518 |
|
51 | + 102 => 'Processing', // RFC2518 |
|
52 | 52 | // Success 2xx |
53 | 53 | 200 => 'OK', |
54 | 54 | 201 => 'Created', |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | 204 => 'No Content', |
58 | 58 | 205 => 'Reset Content', |
59 | 59 | 206 => 'Partial Content', |
60 | - 207 => 'Multi-Status', // RFC4918 |
|
61 | - 208 => 'Already Reported', // RFC5842 |
|
62 | - 226 => 'IM Used', // RFC3229 |
|
60 | + 207 => 'Multi-Status', // RFC4918 |
|
61 | + 208 => 'Already Reported', // RFC5842 |
|
62 | + 226 => 'IM Used', // RFC3229 |
|
63 | 63 | // Redirection 3xx |
64 | 64 | 300 => 'Multiple Choices', |
65 | 65 | 301 => 'Moved Permanently', |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | 305 => 'Use Proxy', |
70 | 70 | // 306 is deprecated but reserved |
71 | 71 | 307 => 'Temporary Redirect', |
72 | - 308 => 'Permanent Redirect', // RFC7238 |
|
72 | + 308 => 'Permanent Redirect', // RFC7238 |
|
73 | 73 | // Client Error 4xx |
74 | 74 | 400 => 'Bad Request', |
75 | 75 | 401 => 'Unauthorized', |
@@ -89,14 +89,14 @@ discard block |
||
89 | 89 | 415 => 'Unsupported Media Type', |
90 | 90 | 416 => 'Range Not Satisfiable', |
91 | 91 | 417 => 'Expectation Failed', |
92 | - 422 => 'Unprocessable Entity', // RFC4918 |
|
93 | - 423 => 'Locked', // RFC4918 |
|
94 | - 424 => 'Failed Dependency', // RFC4918 |
|
95 | - 425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817 |
|
96 | - 426 => 'Upgrade Required', // RFC2817 |
|
97 | - 428 => 'Precondition Required', // RFC6585 |
|
98 | - 429 => 'Too Many Requests', // RFC6585 |
|
99 | - 431 => 'Request Header Fields Too Large', // RFC6585 |
|
92 | + 422 => 'Unprocessable Entity', // RFC4918 |
|
93 | + 423 => 'Locked', // RFC4918 |
|
94 | + 424 => 'Failed Dependency', // RFC4918 |
|
95 | + 425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817 |
|
96 | + 426 => 'Upgrade Required', // RFC2817 |
|
97 | + 428 => 'Precondition Required', // RFC6585 |
|
98 | + 429 => 'Too Many Requests', // RFC6585 |
|
99 | + 431 => 'Request Header Fields Too Large', // RFC6585 |
|
100 | 100 | // Server Error 5xx |
101 | 101 | 500 => 'Internal Server Error', |
102 | 102 | 501 => 'Not Implemented', |
@@ -104,17 +104,17 @@ discard block |
||
104 | 104 | 503 => 'Service Unavailable', |
105 | 105 | 504 => 'Gateway Timeout', |
106 | 106 | 505 => 'HTTP Version Not Supported', |
107 | - 506 => 'Variant Also Negotiates (Experimental)', // RFC2295 |
|
108 | - 507 => 'Insufficient Storage', // RFC4918 |
|
109 | - 508 => 'Loop Detected', // RFC5842 |
|
110 | - 510 => 'Not Extended', // RFC2774 |
|
111 | - 511 => 'Network Authentication Required', // RFC6585 |
|
107 | + 506 => 'Variant Also Negotiates (Experimental)', // RFC2295 |
|
108 | + 507 => 'Insufficient Storage', // RFC4918 |
|
109 | + 508 => 'Loop Detected', // RFC5842 |
|
110 | + 510 => 'Not Extended', // RFC2774 |
|
111 | + 511 => 'Network Authentication Required', // RFC6585 |
|
112 | 112 | ]; |
113 | 113 | |
114 | 114 | /** |
115 | 115 | * @var array |
116 | 116 | */ |
117 | - private $proxySettings = []; |
|
117 | + private $proxySettings = [ ]; |
|
118 | 118 | |
119 | 119 | /** |
120 | 120 | * Default http status code |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * |
154 | 154 | * @var array |
155 | 155 | */ |
156 | - protected $customCurlOptions = []; |
|
156 | + protected $customCurlOptions = [ ]; |
|
157 | 157 | |
158 | 158 | /** |
159 | 159 | * Bot token |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * |
175 | 175 | * @var array |
176 | 176 | */ |
177 | - protected $trackedEvents = []; |
|
177 | + protected $trackedEvents = [ ]; |
|
178 | 178 | |
179 | 179 | /** |
180 | 180 | * Check whether return associative array |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | public function call($method, array $data = null, $timeout = 10) |
231 | 231 | { |
232 | 232 | $options = $this->proxySettings + [ |
233 | - CURLOPT_URL => $this->getUrl().'/'.$method, |
|
233 | + CURLOPT_URL => $this->getUrl() . '/' . $method, |
|
234 | 234 | CURLOPT_RETURNTRANSFER => true, |
235 | 235 | CURLOPT_POST => null, |
236 | 236 | CURLOPT_POSTFIELDS => null, |
@@ -238,8 +238,8 @@ discard block |
||
238 | 238 | ]; |
239 | 239 | |
240 | 240 | if ($data) { |
241 | - $options[CURLOPT_POST] = true; |
|
242 | - $options[CURLOPT_POSTFIELDS] = $data; |
|
241 | + $options[ CURLOPT_POST ] = true; |
|
242 | + $options[ CURLOPT_POSTFIELDS ] = $data; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | if (!empty($this->customCurlOptions)) { |
@@ -249,11 +249,11 @@ discard block |
||
249 | 249 | $response = self::jsonValidate($this->executeCurl($options), $this->returnArray); |
250 | 250 | |
251 | 251 | if (\is_array($response)) { |
252 | - if (!isset($response['ok']) || !$response['ok']) { |
|
253 | - throw new Exception($response['description'], $response['error_code']); |
|
252 | + if (!isset($response[ 'ok' ]) || !$response[ 'ok' ]) { |
|
253 | + throw new Exception($response[ 'description' ], $response[ 'error_code' ]); |
|
254 | 254 | } |
255 | 255 | |
256 | - return $response['result']; |
|
256 | + return $response[ 'result' ]; |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | if (!$response->ok) { |
@@ -299,15 +299,15 @@ discard block |
||
299 | 299 | public static function curlValidate($curl, $response = null) |
300 | 300 | { |
301 | 301 | if ($response) { |
302 | - $json = json_decode($response, true) ?: []; |
|
302 | + $json = json_decode($response, true) ?: [ ]; |
|
303 | 303 | } else { |
304 | - $json = []; |
|
304 | + $json = [ ]; |
|
305 | 305 | } |
306 | 306 | if (($httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE)) |
307 | - && !in_array($httpCode, [self::DEFAULT_STATUS_CODE, self::NOT_MODIFIED_STATUS_CODE]) |
|
307 | + && !in_array($httpCode, [ self::DEFAULT_STATUS_CODE, self::NOT_MODIFIED_STATUS_CODE ]) |
|
308 | 308 | ) { |
309 | - $errorDescription = array_key_exists('description', $json) ? $json['description'] : self::$codes[$httpCode]; |
|
310 | - $errorParameters = array_key_exists('parameters', $json) ? $json['parameters'] : []; |
|
309 | + $errorDescription = array_key_exists('description', $json) ? $json[ 'description' ] : self::$codes[ $httpCode ]; |
|
310 | + $errorParameters = array_key_exists('parameters', $json) ? $json[ 'parameters' ] : [ ]; |
|
311 | 311 | throw new HttpException($errorDescription, $httpCode, null, $errorParameters); |
312 | 312 | } |
313 | 313 | } |
@@ -364,9 +364,9 @@ discard block |
||
364 | 364 | 'message_thread_id' => $messageThreadId, |
365 | 365 | 'parse_mode' => $parseMode, |
366 | 366 | 'disable_web_page_preview' => $disablePreview, |
367 | - 'reply_to_message_id' => (int)$replyToMessageId, |
|
367 | + 'reply_to_message_id' => (int) $replyToMessageId, |
|
368 | 368 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
369 | - 'disable_notification' => (bool)$disableNotification, |
|
369 | + 'disable_notification' => (bool) $disableNotification, |
|
370 | 370 | ])); |
371 | 371 | } |
372 | 372 | |
@@ -404,14 +404,14 @@ discard block |
||
404 | 404 | return MessageId::fromResponse($this->call('copyMessage', [ |
405 | 405 | 'chat_id' => $chatId, |
406 | 406 | 'from_chat_id' => $fromChatId, |
407 | - 'message_id' => (int)$messageId, |
|
407 | + 'message_id' => (int) $messageId, |
|
408 | 408 | 'caption' => $caption, |
409 | 409 | 'parse_mode' => $parseMode, |
410 | 410 | 'caption_entities' => $captionEntities, |
411 | - 'disable_notification' => (bool)$disableNotification, |
|
411 | + 'disable_notification' => (bool) $disableNotification, |
|
412 | 412 | 'message_thread_id' => $messageThreadId, |
413 | - 'reply_to_message_id' => (int)$replyToMessageId, |
|
414 | - 'allow_sending_without_reply' => (bool)$allowSendingWithoutReply, |
|
413 | + 'reply_to_message_id' => (int) $replyToMessageId, |
|
414 | + 'allow_sending_without_reply' => (bool) $allowSendingWithoutReply, |
|
415 | 415 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
416 | 416 | ])); |
417 | 417 | } |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | 'message_thread_id' => $messageThreadId, |
450 | 450 | 'reply_to_message_id' => $replyToMessageId, |
451 | 451 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
452 | - 'disable_notification' => (bool)$disableNotification, |
|
452 | + 'disable_notification' => (bool) $disableNotification, |
|
453 | 453 | ])); |
454 | 454 | } |
455 | 455 | |
@@ -492,9 +492,9 @@ discard block |
||
492 | 492 | public function getUserProfilePhotos($userId, $offset = 0, $limit = 100) |
493 | 493 | { |
494 | 494 | return UserProfilePhotos::fromResponse($this->call('getUserProfilePhotos', [ |
495 | - 'user_id' => (int)$userId, |
|
496 | - 'offset' => (int)$offset, |
|
497 | - 'limit' => (int)$limit, |
|
495 | + 'user_id' => (int) $userId, |
|
496 | + 'offset' => (int) $offset, |
|
497 | + 'limit' => (int) $limit, |
|
498 | 498 | ])); |
499 | 499 | } |
500 | 500 | |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | */ |
560 | 560 | public function deleteWebhook($dropPendingUpdates = false) |
561 | 561 | { |
562 | - return $this->call('deleteWebhook', ['drop_pending_updates' => $dropPendingUpdates]); |
|
562 | + return $this->call('deleteWebhook', [ 'drop_pending_updates' => $dropPendingUpdates ]); |
|
563 | 563 | } |
564 | 564 | |
565 | 565 | /** |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | 'message_thread_id' => $messageThreadId, |
658 | 658 | 'reply_to_message_id' => $replyToMessageId, |
659 | 659 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
660 | - 'disable_notification' => (bool)$disableNotification, |
|
660 | + 'disable_notification' => (bool) $disableNotification, |
|
661 | 661 | ])); |
662 | 662 | } |
663 | 663 | |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | 'message_thread_id' => $messageThreadId, |
772 | 772 | 'reply_to_message_id' => $replyToMessageId, |
773 | 773 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
774 | - 'disable_notification' => (bool)$disableNotification, |
|
774 | + 'disable_notification' => (bool) $disableNotification, |
|
775 | 775 | ])); |
776 | 776 | } |
777 | 777 | |
@@ -807,9 +807,9 @@ discard block |
||
807 | 807 | 'message_thread_id' => $messageThreadId, |
808 | 808 | 'reply_to_message_id' => $replyToMessageId, |
809 | 809 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
810 | - 'disable_notification' => (bool)$disableNotification, |
|
811 | - 'protect_content' => (bool)$protectContent, |
|
812 | - 'allow_sending_without_reply' => (bool)$allowSendingWithoutReply, |
|
810 | + 'disable_notification' => (bool) $disableNotification, |
|
811 | + 'protect_content' => (bool) $protectContent, |
|
812 | + 'allow_sending_without_reply' => (bool) $allowSendingWithoutReply, |
|
813 | 813 | ])); |
814 | 814 | } |
815 | 815 | |
@@ -835,7 +835,7 @@ discard block |
||
835 | 835 | * |
836 | 836 | * @author bernard-ng <[email protected]> |
837 | 837 | */ |
838 | - public function getCustomEmojiStickers($customEmojiIds = []) |
|
838 | + public function getCustomEmojiStickers($customEmojiIds = [ ]) |
|
839 | 839 | { |
840 | 840 | return StickerSet::fromResponse($this->call('getCustomEmojiStickers', [ |
841 | 841 | 'custom_emoji_ids' => $customEmojiIds, |
@@ -1043,8 +1043,8 @@ discard block |
||
1043 | 1043 | 'message_thread_id' => $messageThreadId, |
1044 | 1044 | 'reply_to_message_id' => $replyToMessageId, |
1045 | 1045 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
1046 | - 'disable_notification' => (bool)$disableNotification, |
|
1047 | - 'supports_streaming' => (bool)$supportsStreaming, |
|
1046 | + 'disable_notification' => (bool) $disableNotification, |
|
1047 | + 'supports_streaming' => (bool) $supportsStreaming, |
|
1048 | 1048 | 'parse_mode' => $parseMode |
1049 | 1049 | ])); |
1050 | 1050 | } |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | 'message_thread_id' => $messageThreadId, |
1088 | 1088 | 'reply_to_message_id' => $replyToMessageId, |
1089 | 1089 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
1090 | - 'disable_notification' => (bool)$disableNotification, |
|
1090 | + 'disable_notification' => (bool) $disableNotification, |
|
1091 | 1091 | 'parse_mode' => $parseMode |
1092 | 1092 | ])); |
1093 | 1093 | } |
@@ -1136,7 +1136,7 @@ discard block |
||
1136 | 1136 | 'message_thread_id' => $messageThreadId, |
1137 | 1137 | 'reply_to_message_id' => $replyToMessageId, |
1138 | 1138 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
1139 | - 'disable_notification' => (bool)$disableNotification, |
|
1139 | + 'disable_notification' => (bool) $disableNotification, |
|
1140 | 1140 | 'allow_sending_without_reply' => $allowSendingWithoutReply, |
1141 | 1141 | 'parse_mode' => $parseMode |
1142 | 1142 | ])); |
@@ -1172,7 +1172,7 @@ discard block |
||
1172 | 1172 | 'message_id' => $messageId, |
1173 | 1173 | 'message_thread_id' => $messageThreadId, |
1174 | 1174 | 'protect_content' => $protectContent, |
1175 | - 'disable_notification' => (bool)$disableNotification, |
|
1175 | + 'disable_notification' => (bool) $disableNotification, |
|
1176 | 1176 | ])); |
1177 | 1177 | } |
1178 | 1178 | |
@@ -1225,7 +1225,7 @@ discard block |
||
1225 | 1225 | 'title' => $title, |
1226 | 1226 | 'reply_to_message_id' => $replyToMessageId, |
1227 | 1227 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
1228 | - 'disable_notification' => (bool)$disableNotification, |
|
1228 | + 'disable_notification' => (bool) $disableNotification, |
|
1229 | 1229 | 'parse_mode' => $parseMode |
1230 | 1230 | ])); |
1231 | 1231 | } |
@@ -1263,7 +1263,7 @@ discard block |
||
1263 | 1263 | 'message_thread_id' => $messageThreadId, |
1264 | 1264 | 'reply_to_message_id' => $replyToMessageId, |
1265 | 1265 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
1266 | - 'disable_notification' => (bool)$disableNotification, |
|
1266 | + 'disable_notification' => (bool) $disableNotification, |
|
1267 | 1267 | 'parse_mode' => $parseMode |
1268 | 1268 | ])); |
1269 | 1269 | } |
@@ -1302,7 +1302,7 @@ discard block |
||
1302 | 1302 | 'message_thread_id' => $messageThreadId, |
1303 | 1303 | 'reply_to_message_id' => $replyToMessageId, |
1304 | 1304 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
1305 | - 'disable_notification' => (bool)$disableNotification, |
|
1305 | + 'disable_notification' => (bool) $disableNotification, |
|
1306 | 1306 | 'parse_mode' => $parseMode |
1307 | 1307 | ])); |
1308 | 1308 | } |
@@ -1324,7 +1324,7 @@ discard block |
||
1324 | 1324 | */ |
1325 | 1325 | public function getFile($fileId) |
1326 | 1326 | { |
1327 | - return File::fromResponse($this->call('getFile', ['file_id' => $fileId])); |
|
1327 | + return File::fromResponse($this->call('getFile', [ 'file_id' => $fileId ])); |
|
1328 | 1328 | } |
1329 | 1329 | |
1330 | 1330 | /** |
@@ -1344,7 +1344,7 @@ discard block |
||
1344 | 1344 | CURLOPT_HEADER => 0, |
1345 | 1345 | CURLOPT_HTTPGET => 1, |
1346 | 1346 | CURLOPT_RETURNTRANSFER => 1, |
1347 | - CURLOPT_URL => $this->getFileUrl().'/'.$file->getFilePath(), |
|
1347 | + CURLOPT_URL => $this->getFileUrl() . '/' . $file->getFilePath(), |
|
1348 | 1348 | ]; |
1349 | 1349 | |
1350 | 1350 | return $this->executeCurl($options); |
@@ -1379,7 +1379,7 @@ discard block |
||
1379 | 1379 | * @param AbstractInlineQueryResult $item |
1380 | 1380 | * @return array |
1381 | 1381 | */ |
1382 | - function ($item) { |
|
1382 | + function($item) { |
|
1383 | 1383 | /** @var array $array */ |
1384 | 1384 | $array = $item->toJson(true); |
1385 | 1385 | |
@@ -1462,7 +1462,7 @@ discard block |
||
1462 | 1462 | return $this->call('answerCallbackQuery', [ |
1463 | 1463 | 'callback_query_id' => $callbackQueryId, |
1464 | 1464 | 'text' => $text, |
1465 | - 'show_alert' => (bool)$showAlert, |
|
1465 | + 'show_alert' => (bool) $showAlert, |
|
1466 | 1466 | 'url' => $url, |
1467 | 1467 | 'cache_time' => $cacheTime |
1468 | 1468 | ]); |
@@ -1693,7 +1693,7 @@ discard block |
||
1693 | 1693 | */ |
1694 | 1694 | public function getUrl() |
1695 | 1695 | { |
1696 | - return self::URL_PREFIX.$this->token; |
|
1696 | + return self::URL_PREFIX . $this->token; |
|
1697 | 1697 | } |
1698 | 1698 | |
1699 | 1699 | /** |
@@ -1701,7 +1701,7 @@ discard block |
||
1701 | 1701 | */ |
1702 | 1702 | public function getFileUrl() |
1703 | 1703 | { |
1704 | - return self::FILE_URL_PREFIX.$this->token; |
|
1704 | + return self::FILE_URL_PREFIX . $this->token; |
|
1705 | 1705 | } |
1706 | 1706 | |
1707 | 1707 | /** |
@@ -1719,7 +1719,7 @@ discard block |
||
1719 | 1719 | if (!$message) { |
1720 | 1720 | return; |
1721 | 1721 | } |
1722 | - $this->trackedEvents[] = $update->getUpdateId(); |
|
1722 | + $this->trackedEvents[ ] = $update->getUpdateId(); |
|
1723 | 1723 | |
1724 | 1724 | $this->track($message, $eventName); |
1725 | 1725 | |
@@ -1823,10 +1823,10 @@ discard block |
||
1823 | 1823 | 'need_shipping_address' => $needShippingAddress, |
1824 | 1824 | 'reply_to_message_id' => $replyToMessageId, |
1825 | 1825 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
1826 | - 'disable_notification' => (bool)$disableNotification, |
|
1826 | + 'disable_notification' => (bool) $disableNotification, |
|
1827 | 1827 | 'provider_data' => $providerData, |
1828 | - 'send_phone_number_to_provider' => (bool)$sendPhoneNumberToProvider, |
|
1829 | - 'send_email_to_provider' => (bool)$sendEmailToProvider |
|
1828 | + 'send_phone_number_to_provider' => (bool) $sendPhoneNumberToProvider, |
|
1829 | + 'send_email_to_provider' => (bool) $sendEmailToProvider |
|
1830 | 1830 | ])); |
1831 | 1831 | } |
1832 | 1832 | |
@@ -1843,11 +1843,11 @@ discard block |
||
1843 | 1843 | * @return bool |
1844 | 1844 | * @throws Exception |
1845 | 1845 | */ |
1846 | - public function answerShippingQuery($shippingQueryId, $ok = true, $shippingOptions = [], $errorMessage = null) |
|
1846 | + public function answerShippingQuery($shippingQueryId, $ok = true, $shippingOptions = [ ], $errorMessage = null) |
|
1847 | 1847 | { |
1848 | 1848 | return $this->call('answerShippingQuery', [ |
1849 | 1849 | 'shipping_query_id' => $shippingQueryId, |
1850 | - 'ok' => (bool)$ok, |
|
1850 | + 'ok' => (bool) $ok, |
|
1851 | 1851 | 'shipping_options' => json_encode($shippingOptions), |
1852 | 1852 | 'error_message' => $errorMessage |
1853 | 1853 | ]); |
@@ -1868,7 +1868,7 @@ discard block |
||
1868 | 1868 | { |
1869 | 1869 | return $this->call('answerPreCheckoutQuery', [ |
1870 | 1870 | 'pre_checkout_query_id' => $preCheckoutQueryId, |
1871 | - 'ok' => (bool)$ok, |
|
1871 | + 'ok' => (bool) $ok, |
|
1872 | 1872 | 'error_message' => $errorMessage |
1873 | 1873 | ]); |
1874 | 1874 | } |
@@ -2227,7 +2227,7 @@ discard block |
||
2227 | 2227 | 'message_thread_id' => $messageThreadId, |
2228 | 2228 | 'reply_to_message_id' => $replyToMessageId, |
2229 | 2229 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
2230 | - 'disable_notification' => (bool)$disableNotification |
|
2230 | + 'disable_notification' => (bool) $disableNotification |
|
2231 | 2231 | ])); |
2232 | 2232 | } |
2233 | 2233 | |
@@ -2255,8 +2255,8 @@ discard block |
||
2255 | 2255 | 'chat_id' => $chatId, |
2256 | 2256 | 'media' => $media->toJson(), |
2257 | 2257 | 'message_thread_id' => $messageThreadId, |
2258 | - 'reply_to_message_id' => (int)$replyToMessageId, |
|
2259 | - 'disable_notification' => (bool)$disableNotification |
|
2258 | + 'reply_to_message_id' => (int) $replyToMessageId, |
|
2259 | + 'disable_notification' => (bool) $disableNotification |
|
2260 | 2260 | ])); |
2261 | 2261 | } |
2262 | 2262 | |
@@ -2271,7 +2271,7 @@ discard block |
||
2271 | 2271 | public function setProxy($proxyString = '', $socks5 = false) |
2272 | 2272 | { |
2273 | 2273 | if (empty($proxyString)) { |
2274 | - $this->proxySettings = []; |
|
2274 | + $this->proxySettings = [ ]; |
|
2275 | 2275 | return $this; |
2276 | 2276 | } |
2277 | 2277 | |
@@ -2281,7 +2281,7 @@ discard block |
||
2281 | 2281 | ]; |
2282 | 2282 | |
2283 | 2283 | if ($socks5) { |
2284 | - $this->proxySettings[CURLOPT_PROXYTYPE] = CURLPROXY_SOCKS5; |
|
2284 | + $this->proxySettings[ CURLOPT_PROXYTYPE ] = CURLPROXY_SOCKS5; |
|
2285 | 2285 | } |
2286 | 2286 | return $this; |
2287 | 2287 | } |
@@ -2580,7 +2580,7 @@ discard block |
||
2580 | 2580 | */ |
2581 | 2581 | public function setCurlOption($option, $value) |
2582 | 2582 | { |
2583 | - $this->customCurlOptions[$option] = $value; |
|
2583 | + $this->customCurlOptions[ $option ] = $value; |
|
2584 | 2584 | } |
2585 | 2585 | |
2586 | 2586 | /** |
@@ -2592,7 +2592,7 @@ discard block |
||
2592 | 2592 | */ |
2593 | 2593 | public function unsetCurlOption($option) |
2594 | 2594 | { |
2595 | - unset($this->customCurlOptions[$option]); |
|
2595 | + unset($this->customCurlOptions[ $option ]); |
|
2596 | 2596 | } |
2597 | 2597 | |
2598 | 2598 | /** |
@@ -2602,6 +2602,6 @@ discard block |
||
2602 | 2602 | */ |
2603 | 2603 | public function resetCurlOptions() |
2604 | 2604 | { |
2605 | - $this->customCurlOptions = []; |
|
2605 | + $this->customCurlOptions = [ ]; |
|
2606 | 2606 | } |
2607 | 2607 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function __construct($trackerToken = null) |
32 | 32 | { |
33 | - $this->events = []; |
|
33 | + $this->events = [ ]; |
|
34 | 34 | if ($trackerToken) { |
35 | 35 | @trigger_error(sprintf('Passing $trackerToken to %s is deprecated', self::class), \E_USER_DEPRECATED); |
36 | 36 | $this->tracker = new Botan($trackerToken); |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function add(Closure $event, $checker = null) |
49 | 49 | { |
50 | - $this->events[] = !is_null($checker) ? new Event($event, $checker) |
|
51 | - : new Event($event, function () { |
|
50 | + $this->events[ ] = !is_null($checker) ? new Event($event, $checker) |
|
51 | + : new Event($event, function() { |
|
52 | 52 | }); |
53 | 53 | |
54 | 54 | return $this; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | if ($event->executeAction($update) === false) { |
66 | 66 | if ($this->tracker && ($message = $update->getMessage())) { |
67 | 67 | $checker = new ReflectionFunction($event->getChecker()); |
68 | - $this->tracker->track($message, $checker->getStaticVariables()['name']); |
|
68 | + $this->tracker->track($message, $checker->getStaticVariables()[ 'name' ]); |
|
69 | 69 | } |
70 | 70 | break; |
71 | 71 | } |
@@ -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 |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | public function map($data) |
50 | 50 | { |
51 | 51 | foreach (static::$map as $key => $item) { |
52 | - if (isset($data[$key]) && (!is_array($data[$key]) || !empty($data[$key]))) { |
|
52 | + if (isset($data[ $key ]) && (!is_array($data[ $key ]) || !empty($data[ $key ]))) { |
|
53 | 53 | $method = 'set' . self::toCamelCase($key); |
54 | 54 | if ($item === true) { |
55 | - $this->$method($data[$key]); |
|
55 | + $this->$method($data[ $key ]); |
|
56 | 56 | } else { |
57 | - $this->$method($item::fromResponse($data[$key])); |
|
57 | + $this->$method($item::fromResponse($data[ $key ])); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | } |
@@ -75,24 +75,24 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function toJson($inner = false) |
77 | 77 | { |
78 | - $output = []; |
|
78 | + $output = [ ]; |
|
79 | 79 | |
80 | 80 | foreach (static::$map as $key => $item) { |
81 | 81 | $property = lcfirst(self::toCamelCase($key)); |
82 | 82 | if (!is_null($this->$property)) { |
83 | 83 | if (is_array($this->$property)) { |
84 | - $output[$key] = array_map( |
|
84 | + $output[ $key ] = array_map( |
|
85 | 85 | /** |
86 | 86 | * @param mixed $v |
87 | 87 | * @return array|false|string |
88 | 88 | */ |
89 | - function ($v) { |
|
89 | + function($v) { |
|
90 | 90 | return is_object($v) ? $v->toJson(true) : $v; |
91 | 91 | }, |
92 | 92 | $this->$property |
93 | 93 | ); |
94 | 94 | } else { |
95 | - $output[$key] = $item === true ? $this->$property : $this->$property->toJson(true); |
|
95 | + $output[ $key ] = $item === true ? $this->$property : $this->$property->toJson(true); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | } |