@@ -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 | } |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | */ |
575 | 575 | public function deleteWebhook($dropPendingUpdates = false) |
576 | 576 | { |
577 | - return $this->call('deleteWebhook', ['drop_pending_updates' => $dropPendingUpdates]); |
|
577 | + return $this->call('deleteWebhook', [ 'drop_pending_updates' => $dropPendingUpdates ]); |
|
578 | 578 | } |
579 | 579 | |
580 | 580 | /** |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | * |
862 | 862 | * @author bernard-ng <[email protected]> |
863 | 863 | */ |
864 | - public function getCustomEmojiStickers($customEmojiIds = []) |
|
864 | + public function getCustomEmojiStickers($customEmojiIds = [ ]) |
|
865 | 865 | { |
866 | 866 | return StickerSet::fromResponse($this->call('getCustomEmojiStickers', [ |
867 | 867 | 'custom_emoji_ids' => $customEmojiIds, |
@@ -933,7 +933,7 @@ discard block |
||
933 | 933 | $webmSticker = null, |
934 | 934 | $stickerType = null, |
935 | 935 | $maskPosition = null, |
936 | - $attachments = [] |
|
936 | + $attachments = [ ] |
|
937 | 937 | ) { |
938 | 938 | return $this->call('createNewStickerSet', [ |
939 | 939 | 'user_id' => $userId, |
@@ -977,7 +977,7 @@ discard block |
||
977 | 977 | $tgsSticker = null, |
978 | 978 | $webmSticker = null, |
979 | 979 | $maskPosition = null, |
980 | - $attachments = [] |
|
980 | + $attachments = [ ] |
|
981 | 981 | ) { |
982 | 982 | return $this->call('addStickerToSet', [ |
983 | 983 | 'user_id' => $userId, |
@@ -1422,7 +1422,7 @@ discard block |
||
1422 | 1422 | */ |
1423 | 1423 | public function getFile($fileId) |
1424 | 1424 | { |
1425 | - return File::fromResponse($this->call('getFile', ['file_id' => $fileId])); |
|
1425 | + return File::fromResponse($this->call('getFile', [ 'file_id' => $fileId ])); |
|
1426 | 1426 | } |
1427 | 1427 | |
1428 | 1428 | /** |
@@ -1442,7 +1442,7 @@ discard block |
||
1442 | 1442 | CURLOPT_HEADER => 0, |
1443 | 1443 | CURLOPT_HTTPGET => 1, |
1444 | 1444 | CURLOPT_RETURNTRANSFER => 1, |
1445 | - CURLOPT_URL => $this->getFileUrl().'/'.$file->getFilePath(), |
|
1445 | + CURLOPT_URL => $this->getFileUrl() . '/' . $file->getFilePath(), |
|
1446 | 1446 | ]; |
1447 | 1447 | |
1448 | 1448 | return $this->executeCurl($options); |
@@ -1477,7 +1477,7 @@ discard block |
||
1477 | 1477 | * @param AbstractInlineQueryResult $item |
1478 | 1478 | * @return array |
1479 | 1479 | */ |
1480 | - function ($item) { |
|
1480 | + function($item) { |
|
1481 | 1481 | /** @var array $array */ |
1482 | 1482 | $array = $item->toJson(true); |
1483 | 1483 | |
@@ -1712,7 +1712,7 @@ discard block |
||
1712 | 1712 | InputMedia $media, |
1713 | 1713 | $inlineMessageId = null, |
1714 | 1714 | $replyMarkup = null, |
1715 | - $attachments = [] |
|
1715 | + $attachments = [ ] |
|
1716 | 1716 | ) { |
1717 | 1717 | $response = $this->call('editMessageMedia', [ |
1718 | 1718 | 'chat_id' => $chatId, |
@@ -1794,7 +1794,7 @@ discard block |
||
1794 | 1794 | */ |
1795 | 1795 | public function getUrl() |
1796 | 1796 | { |
1797 | - return self::URL_PREFIX.$this->token; |
|
1797 | + return self::URL_PREFIX . $this->token; |
|
1798 | 1798 | } |
1799 | 1799 | |
1800 | 1800 | /** |
@@ -1802,7 +1802,7 @@ discard block |
||
1802 | 1802 | */ |
1803 | 1803 | public function getFileUrl() |
1804 | 1804 | { |
1805 | - return self::FILE_URL_PREFIX.$this->token; |
|
1805 | + return self::FILE_URL_PREFIX . $this->token; |
|
1806 | 1806 | } |
1807 | 1807 | |
1808 | 1808 | /** |
@@ -1820,7 +1820,7 @@ discard block |
||
1820 | 1820 | if (!$message) { |
1821 | 1821 | return; |
1822 | 1822 | } |
1823 | - $this->trackedEvents[] = $update->getUpdateId(); |
|
1823 | + $this->trackedEvents[ ] = $update->getUpdateId(); |
|
1824 | 1824 | |
1825 | 1825 | $this->track($message, $eventName); |
1826 | 1826 | |
@@ -1951,7 +1951,7 @@ discard block |
||
1951 | 1951 | * @return bool |
1952 | 1952 | * @throws Exception |
1953 | 1953 | */ |
1954 | - public function answerShippingQuery($shippingQueryId, $ok = true, $shippingOptions = [], $errorMessage = null) |
|
1954 | + public function answerShippingQuery($shippingQueryId, $ok = true, $shippingOptions = [ ], $errorMessage = null) |
|
1955 | 1955 | { |
1956 | 1956 | return $this->call('answerShippingQuery', [ |
1957 | 1957 | 'shipping_query_id' => $shippingQueryId, |
@@ -2207,8 +2207,8 @@ discard block |
||
2207 | 2207 | 'chat_id' => $chatId, |
2208 | 2208 | ]; |
2209 | 2209 | |
2210 | - if ( ! empty($messageId)) { |
|
2211 | - $params['message_id'] = $messageId; |
|
2210 | + if (!empty($messageId)) { |
|
2211 | + $params[ 'message_id' ] = $messageId; |
|
2212 | 2212 | } |
2213 | 2213 | |
2214 | 2214 | return $this->call('unpinChatMessage', $params); |
@@ -2379,7 +2379,7 @@ discard block |
||
2379 | 2379 | $messageThreadId = null, |
2380 | 2380 | $protectContent = null, |
2381 | 2381 | $allowSendingWithoutReply = null, |
2382 | - $attachments = [] |
|
2382 | + $attachments = [ ] |
|
2383 | 2383 | ) { |
2384 | 2384 | return ArrayOfMessages::fromResponse($this->call('sendMediaGroup', [ |
2385 | 2385 | 'chat_id' => $chatId, |
@@ -2403,7 +2403,7 @@ discard block |
||
2403 | 2403 | public function setProxy($proxyString = '', $socks5 = false) |
2404 | 2404 | { |
2405 | 2405 | if (empty($proxyString)) { |
2406 | - $this->proxySettings = []; |
|
2406 | + $this->proxySettings = [ ]; |
|
2407 | 2407 | return $this; |
2408 | 2408 | } |
2409 | 2409 | |
@@ -2413,7 +2413,7 @@ discard block |
||
2413 | 2413 | ]; |
2414 | 2414 | |
2415 | 2415 | if ($socks5) { |
2416 | - $this->proxySettings[CURLOPT_PROXYTYPE] = CURLPROXY_SOCKS5; |
|
2416 | + $this->proxySettings[ CURLOPT_PROXYTYPE ] = CURLPROXY_SOCKS5; |
|
2417 | 2417 | } |
2418 | 2418 | return $this; |
2419 | 2419 | } |
@@ -2739,7 +2739,7 @@ discard block |
||
2739 | 2739 | */ |
2740 | 2740 | public function setCurlOption($option, $value) |
2741 | 2741 | { |
2742 | - $this->customCurlOptions[$option] = $value; |
|
2742 | + $this->customCurlOptions[ $option ] = $value; |
|
2743 | 2743 | } |
2744 | 2744 | |
2745 | 2745 | /** |
@@ -2751,7 +2751,7 @@ discard block |
||
2751 | 2751 | */ |
2752 | 2752 | public function unsetCurlOption($option) |
2753 | 2753 | { |
2754 | - unset($this->customCurlOptions[$option]); |
|
2754 | + unset($this->customCurlOptions[ $option ]); |
|
2755 | 2755 | } |
2756 | 2756 | |
2757 | 2757 | /** |
@@ -2761,6 +2761,6 @@ discard block |
||
2761 | 2761 | */ |
2762 | 2762 | public function resetCurlOptions() |
2763 | 2763 | { |
2764 | - $this->customCurlOptions = []; |
|
2764 | + $this->customCurlOptions = [ ]; |
|
2765 | 2765 | } |
2766 | 2766 | } |