@@ -10,9 +10,9 @@ |
||
10 | 10 | */ |
11 | 11 | public static function fromResponse($data) |
12 | 12 | { |
13 | - $arrayOfUpdates = []; |
|
13 | + $arrayOfUpdates = [ ]; |
|
14 | 14 | foreach ($data as $update) { |
15 | - $arrayOfUpdates[] = Update::fromResponse($update); |
|
15 | + $arrayOfUpdates[ ] = Update::fromResponse($update); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | return $arrayOfUpdates; |
@@ -10,9 +10,9 @@ |
||
10 | 10 | */ |
11 | 11 | public static function fromResponse($data) |
12 | 12 | { |
13 | - $arrayOfChatMemberEntity = []; |
|
13 | + $arrayOfChatMemberEntity = [ ]; |
|
14 | 14 | foreach ($data as $chatMemberEntity) { |
15 | - $arrayOfChatMemberEntity[] = ChatMember::fromResponse($chatMemberEntity); |
|
15 | + $arrayOfChatMemberEntity[ ] = ChatMember::fromResponse($chatMemberEntity); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | return $arrayOfChatMemberEntity; |
@@ -10,9 +10,9 @@ |
||
10 | 10 | */ |
11 | 11 | public static function fromResponse($data) |
12 | 12 | { |
13 | - $arrayOfStickers = []; |
|
13 | + $arrayOfStickers = [ ]; |
|
14 | 14 | foreach ($data as $sticker) { |
15 | - $arrayOfStickers[] = Sticker::fromResponse($sticker); |
|
15 | + $arrayOfStickers[ ] = Sticker::fromResponse($sticker); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | return $arrayOfStickers; |
@@ -10,9 +10,9 @@ |
||
10 | 10 | */ |
11 | 11 | public static function fromResponse($data) |
12 | 12 | { |
13 | - $arrayOfLabeledPrice = []; |
|
13 | + $arrayOfLabeledPrice = [ ]; |
|
14 | 14 | foreach ($data as $labeledPrice) { |
15 | - $arrayOfLabeledPrice[] = LabeledPrice::fromResponse($labeledPrice); |
|
15 | + $arrayOfLabeledPrice[ ] = LabeledPrice::fromResponse($labeledPrice); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | return $arrayOfLabeledPrice; |
@@ -12,7 +12,7 @@ |
||
12 | 12 | * |
13 | 13 | * @var array |
14 | 14 | */ |
15 | - protected static $requiredParams = []; |
|
15 | + protected static $requiredParams = [ ]; |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * {@inheritdoc} |
@@ -12,7 +12,7 @@ |
||
12 | 12 | * |
13 | 13 | * @var array |
14 | 14 | */ |
15 | - protected static $requiredParams = ['data', 'button_text']; |
|
15 | + protected static $requiredParams = [ 'data', 'button_text' ]; |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * {@inheritdoc} |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * |
18 | 18 | * @var array |
19 | 19 | */ |
20 | - protected static $requiredParams = ['keyboard']; |
|
20 | + protected static $requiredParams = [ 'keyboard' ]; |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * {@inheritdoc} |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param bool|null $isPersistent |
91 | 91 | * @param string|null $inputFieldPlaceholder |
92 | 92 | */ |
93 | - public function __construct($keyboard = [], $oneTimeKeyboard = null, $resizeKeyboard = null, $selective = null, $isPersistent = null, $inputFieldPlaceholder = null) |
|
93 | + public function __construct($keyboard = [ ], $oneTimeKeyboard = null, $resizeKeyboard = null, $selective = null, $isPersistent = null, $inputFieldPlaceholder = null) |
|
94 | 94 | { |
95 | 95 | $this->keyboard = $keyboard; |
96 | 96 | $this->oneTimeKeyboard = $oneTimeKeyboard; |
@@ -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 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | // Informational 1xx |
50 | 50 | 100 => 'Continue', |
51 | 51 | 101 => 'Switching Protocols', |
52 | - 102 => 'Processing', // RFC2518 |
|
52 | + 102 => 'Processing', // RFC2518 |
|
53 | 53 | // Success 2xx |
54 | 54 | 200 => 'OK', |
55 | 55 | 201 => 'Created', |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | 204 => 'No Content', |
59 | 59 | 205 => 'Reset Content', |
60 | 60 | 206 => 'Partial Content', |
61 | - 207 => 'Multi-Status', // RFC4918 |
|
62 | - 208 => 'Already Reported', // RFC5842 |
|
63 | - 226 => 'IM Used', // RFC3229 |
|
61 | + 207 => 'Multi-Status', // RFC4918 |
|
62 | + 208 => 'Already Reported', // RFC5842 |
|
63 | + 226 => 'IM Used', // RFC3229 |
|
64 | 64 | // Redirection 3xx |
65 | 65 | 300 => 'Multiple Choices', |
66 | 66 | 301 => 'Moved Permanently', |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | 305 => 'Use Proxy', |
71 | 71 | // 306 is deprecated but reserved |
72 | 72 | 307 => 'Temporary Redirect', |
73 | - 308 => 'Permanent Redirect', // RFC7238 |
|
73 | + 308 => 'Permanent Redirect', // RFC7238 |
|
74 | 74 | // Client Error 4xx |
75 | 75 | 400 => 'Bad Request', |
76 | 76 | 401 => 'Unauthorized', |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | 415 => 'Unsupported Media Type', |
91 | 91 | 416 => 'Range Not Satisfiable', |
92 | 92 | 417 => 'Expectation Failed', |
93 | - 422 => 'Unprocessable Entity', // RFC4918 |
|
94 | - 423 => 'Locked', // RFC4918 |
|
95 | - 424 => 'Failed Dependency', // RFC4918 |
|
96 | - 425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817 |
|
97 | - 426 => 'Upgrade Required', // RFC2817 |
|
98 | - 428 => 'Precondition Required', // RFC6585 |
|
99 | - 429 => 'Too Many Requests', // RFC6585 |
|
100 | - 431 => 'Request Header Fields Too Large', // RFC6585 |
|
93 | + 422 => 'Unprocessable Entity', // RFC4918 |
|
94 | + 423 => 'Locked', // RFC4918 |
|
95 | + 424 => 'Failed Dependency', // RFC4918 |
|
96 | + 425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817 |
|
97 | + 426 => 'Upgrade Required', // RFC2817 |
|
98 | + 428 => 'Precondition Required', // RFC6585 |
|
99 | + 429 => 'Too Many Requests', // RFC6585 |
|
100 | + 431 => 'Request Header Fields Too Large', // RFC6585 |
|
101 | 101 | // Server Error 5xx |
102 | 102 | 500 => 'Internal Server Error', |
103 | 103 | 501 => 'Not Implemented', |
@@ -105,17 +105,17 @@ discard block |
||
105 | 105 | 503 => 'Service Unavailable', |
106 | 106 | 504 => 'Gateway Timeout', |
107 | 107 | 505 => 'HTTP Version Not Supported', |
108 | - 506 => 'Variant Also Negotiates (Experimental)', // RFC2295 |
|
109 | - 507 => 'Insufficient Storage', // RFC4918 |
|
110 | - 508 => 'Loop Detected', // RFC5842 |
|
111 | - 510 => 'Not Extended', // RFC2774 |
|
112 | - 511 => 'Network Authentication Required', // RFC6585 |
|
108 | + 506 => 'Variant Also Negotiates (Experimental)', // RFC2295 |
|
109 | + 507 => 'Insufficient Storage', // RFC4918 |
|
110 | + 508 => 'Loop Detected', // RFC5842 |
|
111 | + 510 => 'Not Extended', // RFC2774 |
|
112 | + 511 => 'Network Authentication Required', // RFC6585 |
|
113 | 113 | ]; |
114 | 114 | |
115 | 115 | /** |
116 | 116 | * @var array |
117 | 117 | */ |
118 | - private $proxySettings = []; |
|
118 | + private $proxySettings = [ ]; |
|
119 | 119 | |
120 | 120 | /** |
121 | 121 | * Default http status code |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * |
155 | 155 | * @var array |
156 | 156 | */ |
157 | - protected $customCurlOptions = []; |
|
157 | + protected $customCurlOptions = [ ]; |
|
158 | 158 | |
159 | 159 | /** |
160 | 160 | * Bot token |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @var array |
177 | 177 | */ |
178 | - protected $trackedEvents = []; |
|
178 | + protected $trackedEvents = [ ]; |
|
179 | 179 | |
180 | 180 | /** |
181 | 181 | * Check whether return associative array |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | public function call($method, array $data = null, $timeout = 10) |
232 | 232 | { |
233 | 233 | $options = $this->proxySettings + [ |
234 | - CURLOPT_URL => $this->getUrl().'/'.$method, |
|
234 | + CURLOPT_URL => $this->getUrl() . '/' . $method, |
|
235 | 235 | CURLOPT_RETURNTRANSFER => true, |
236 | 236 | CURLOPT_POST => null, |
237 | 237 | CURLOPT_POSTFIELDS => null, |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | ]; |
240 | 240 | |
241 | 241 | if ($data) { |
242 | - $options[CURLOPT_POST] = true; |
|
243 | - $options[CURLOPT_POSTFIELDS] = $data; |
|
242 | + $options[ CURLOPT_POST ] = true; |
|
243 | + $options[ CURLOPT_POSTFIELDS ] = $data; |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | if (!empty($this->customCurlOptions)) { |
@@ -250,11 +250,11 @@ discard block |
||
250 | 250 | $response = self::jsonValidate($this->executeCurl($options), $this->returnArray); |
251 | 251 | |
252 | 252 | if (\is_array($response)) { |
253 | - if (!isset($response['ok']) || !$response['ok']) { |
|
254 | - throw new Exception($response['description'], $response['error_code']); |
|
253 | + if (!isset($response[ 'ok' ]) || !$response[ 'ok' ]) { |
|
254 | + throw new Exception($response[ 'description' ], $response[ 'error_code' ]); |
|
255 | 255 | } |
256 | 256 | |
257 | - return $response['result']; |
|
257 | + return $response[ 'result' ]; |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | if (!$response->ok) { |
@@ -300,15 +300,15 @@ discard block |
||
300 | 300 | public static function curlValidate($curl, $response = null) |
301 | 301 | { |
302 | 302 | if ($response) { |
303 | - $json = json_decode($response, true) ?: []; |
|
303 | + $json = json_decode($response, true) ?: [ ]; |
|
304 | 304 | } else { |
305 | - $json = []; |
|
305 | + $json = [ ]; |
|
306 | 306 | } |
307 | 307 | if (($httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE)) |
308 | - && !in_array($httpCode, [self::DEFAULT_STATUS_CODE, self::NOT_MODIFIED_STATUS_CODE]) |
|
308 | + && !in_array($httpCode, [ self::DEFAULT_STATUS_CODE, self::NOT_MODIFIED_STATUS_CODE ]) |
|
309 | 309 | ) { |
310 | - $errorDescription = array_key_exists('description', $json) ? $json['description'] : self::$codes[$httpCode]; |
|
311 | - $errorParameters = array_key_exists('parameters', $json) ? $json['parameters'] : []; |
|
310 | + $errorDescription = array_key_exists('description', $json) ? $json[ 'description' ] : self::$codes[ $httpCode ]; |
|
311 | + $errorParameters = array_key_exists('parameters', $json) ? $json[ 'parameters' ] : [ ]; |
|
312 | 312 | throw new HttpException($errorDescription, $httpCode, null, $errorParameters); |
313 | 313 | } |
314 | 314 | } |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | */ |
576 | 576 | public function deleteWebhook($dropPendingUpdates = false) |
577 | 577 | { |
578 | - return $this->call('deleteWebhook', ['drop_pending_updates' => $dropPendingUpdates]); |
|
578 | + return $this->call('deleteWebhook', [ 'drop_pending_updates' => $dropPendingUpdates ]); |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | /** |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | * |
863 | 863 | * @author bernard-ng <[email protected]> |
864 | 864 | */ |
865 | - public function getCustomEmojiStickers($customEmojiIds = []) |
|
865 | + public function getCustomEmojiStickers($customEmojiIds = [ ]) |
|
866 | 866 | { |
867 | 867 | return StickerSet::fromResponse($this->call('getCustomEmojiStickers', [ |
868 | 868 | 'custom_emoji_ids' => $customEmojiIds, |
@@ -934,7 +934,7 @@ discard block |
||
934 | 934 | $webmSticker = null, |
935 | 935 | $stickerType = null, |
936 | 936 | $maskPosition = null, |
937 | - $attachments = [] |
|
937 | + $attachments = [ ] |
|
938 | 938 | ) { |
939 | 939 | return $this->call('createNewStickerSet', [ |
940 | 940 | 'user_id' => $userId, |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | $tgsSticker = null, |
979 | 979 | $webmSticker = null, |
980 | 980 | $maskPosition = null, |
981 | - $attachments = [] |
|
981 | + $attachments = [ ] |
|
982 | 982 | ) { |
983 | 983 | return $this->call('addStickerToSet', [ |
984 | 984 | 'user_id' => $userId, |
@@ -1423,7 +1423,7 @@ discard block |
||
1423 | 1423 | */ |
1424 | 1424 | public function getFile($fileId) |
1425 | 1425 | { |
1426 | - return File::fromResponse($this->call('getFile', ['file_id' => $fileId])); |
|
1426 | + return File::fromResponse($this->call('getFile', [ 'file_id' => $fileId ])); |
|
1427 | 1427 | } |
1428 | 1428 | |
1429 | 1429 | /** |
@@ -1443,7 +1443,7 @@ discard block |
||
1443 | 1443 | CURLOPT_HEADER => 0, |
1444 | 1444 | CURLOPT_HTTPGET => 1, |
1445 | 1445 | CURLOPT_RETURNTRANSFER => 1, |
1446 | - CURLOPT_URL => $this->getFileUrl().'/'.$file->getFilePath(), |
|
1446 | + CURLOPT_URL => $this->getFileUrl() . '/' . $file->getFilePath(), |
|
1447 | 1447 | ]; |
1448 | 1448 | |
1449 | 1449 | return $this->executeCurl($options); |
@@ -1478,7 +1478,7 @@ discard block |
||
1478 | 1478 | * @param AbstractInlineQueryResult $item |
1479 | 1479 | * @return array |
1480 | 1480 | */ |
1481 | - function ($item) { |
|
1481 | + function($item) { |
|
1482 | 1482 | /** @var array $array */ |
1483 | 1483 | $array = $item->toJson(true); |
1484 | 1484 | |
@@ -1713,7 +1713,7 @@ discard block |
||
1713 | 1713 | InputMedia $media, |
1714 | 1714 | $inlineMessageId = null, |
1715 | 1715 | $replyMarkup = null, |
1716 | - $attachments = [] |
|
1716 | + $attachments = [ ] |
|
1717 | 1717 | ) { |
1718 | 1718 | $response = $this->call('editMessageMedia', [ |
1719 | 1719 | 'chat_id' => $chatId, |
@@ -1795,7 +1795,7 @@ discard block |
||
1795 | 1795 | */ |
1796 | 1796 | public function getUrl() |
1797 | 1797 | { |
1798 | - return self::URL_PREFIX.$this->token; |
|
1798 | + return self::URL_PREFIX . $this->token; |
|
1799 | 1799 | } |
1800 | 1800 | |
1801 | 1801 | /** |
@@ -1803,7 +1803,7 @@ discard block |
||
1803 | 1803 | */ |
1804 | 1804 | public function getFileUrl() |
1805 | 1805 | { |
1806 | - return self::FILE_URL_PREFIX.$this->token; |
|
1806 | + return self::FILE_URL_PREFIX . $this->token; |
|
1807 | 1807 | } |
1808 | 1808 | |
1809 | 1809 | /** |
@@ -1821,7 +1821,7 @@ discard block |
||
1821 | 1821 | if (!$message) { |
1822 | 1822 | return; |
1823 | 1823 | } |
1824 | - $this->trackedEvents[] = $update->getUpdateId(); |
|
1824 | + $this->trackedEvents[ ] = $update->getUpdateId(); |
|
1825 | 1825 | |
1826 | 1826 | $this->track($message, $eventName); |
1827 | 1827 | |
@@ -1952,7 +1952,7 @@ discard block |
||
1952 | 1952 | * @return bool |
1953 | 1953 | * @throws Exception |
1954 | 1954 | */ |
1955 | - public function answerShippingQuery($shippingQueryId, $ok = true, $shippingOptions = [], $errorMessage = null) |
|
1955 | + public function answerShippingQuery($shippingQueryId, $ok = true, $shippingOptions = [ ], $errorMessage = null) |
|
1956 | 1956 | { |
1957 | 1957 | return $this->call('answerShippingQuery', [ |
1958 | 1958 | 'shipping_query_id' => $shippingQueryId, |
@@ -2373,7 +2373,7 @@ discard block |
||
2373 | 2373 | $messageThreadId = null, |
2374 | 2374 | $protectContent = null, |
2375 | 2375 | $allowSendingWithoutReply = null, |
2376 | - $attachments = [] |
|
2376 | + $attachments = [ ] |
|
2377 | 2377 | ) { |
2378 | 2378 | return ArrayOfMessages::fromResponse($this->call('sendMediaGroup', [ |
2379 | 2379 | 'chat_id' => $chatId, |
@@ -2397,7 +2397,7 @@ discard block |
||
2397 | 2397 | public function setProxy($proxyString = '', $socks5 = false) |
2398 | 2398 | { |
2399 | 2399 | if (empty($proxyString)) { |
2400 | - $this->proxySettings = []; |
|
2400 | + $this->proxySettings = [ ]; |
|
2401 | 2401 | return $this; |
2402 | 2402 | } |
2403 | 2403 | |
@@ -2407,7 +2407,7 @@ discard block |
||
2407 | 2407 | ]; |
2408 | 2408 | |
2409 | 2409 | if ($socks5) { |
2410 | - $this->proxySettings[CURLOPT_PROXYTYPE] = CURLPROXY_SOCKS5; |
|
2410 | + $this->proxySettings[ CURLOPT_PROXYTYPE ] = CURLPROXY_SOCKS5; |
|
2411 | 2411 | } |
2412 | 2412 | return $this; |
2413 | 2413 | } |
@@ -2733,7 +2733,7 @@ discard block |
||
2733 | 2733 | */ |
2734 | 2734 | public function setCurlOption($option, $value) |
2735 | 2735 | { |
2736 | - $this->customCurlOptions[$option] = $value; |
|
2736 | + $this->customCurlOptions[ $option ] = $value; |
|
2737 | 2737 | } |
2738 | 2738 | |
2739 | 2739 | /** |
@@ -2745,7 +2745,7 @@ discard block |
||
2745 | 2745 | */ |
2746 | 2746 | public function unsetCurlOption($option) |
2747 | 2747 | { |
2748 | - unset($this->customCurlOptions[$option]); |
|
2748 | + unset($this->customCurlOptions[ $option ]); |
|
2749 | 2749 | } |
2750 | 2750 | |
2751 | 2751 | /** |
@@ -2755,6 +2755,6 @@ discard block |
||
2755 | 2755 | */ |
2756 | 2756 | public function resetCurlOptions() |
2757 | 2757 | { |
2758 | - $this->customCurlOptions = []; |
|
2758 | + $this->customCurlOptions = [ ]; |
|
2759 | 2759 | } |
2760 | 2760 | } |