@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | // Informational 1xx |
54 | 54 | 100 => 'Continue', |
55 | 55 | 101 => 'Switching Protocols', |
56 | - 102 => 'Processing', // RFC2518 |
|
56 | + 102 => 'Processing', // RFC2518 |
|
57 | 57 | // Success 2xx |
58 | 58 | 200 => 'OK', |
59 | 59 | 201 => 'Created', |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | 204 => 'No Content', |
63 | 63 | 205 => 'Reset Content', |
64 | 64 | 206 => 'Partial Content', |
65 | - 207 => 'Multi-Status', // RFC4918 |
|
66 | - 208 => 'Already Reported', // RFC5842 |
|
67 | - 226 => 'IM Used', // RFC3229 |
|
65 | + 207 => 'Multi-Status', // RFC4918 |
|
66 | + 208 => 'Already Reported', // RFC5842 |
|
67 | + 226 => 'IM Used', // RFC3229 |
|
68 | 68 | // Redirection 3xx |
69 | 69 | 300 => 'Multiple Choices', |
70 | 70 | 301 => 'Moved Permanently', |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | 305 => 'Use Proxy', |
75 | 75 | // 306 is deprecated but reserved |
76 | 76 | 307 => 'Temporary Redirect', |
77 | - 308 => 'Permanent Redirect', // RFC7238 |
|
77 | + 308 => 'Permanent Redirect', // RFC7238 |
|
78 | 78 | // Client Error 4xx |
79 | 79 | 400 => 'Bad Request', |
80 | 80 | 401 => 'Unauthorized', |
@@ -94,14 +94,14 @@ discard block |
||
94 | 94 | 415 => 'Unsupported Media Type', |
95 | 95 | 416 => 'Range Not Satisfiable', |
96 | 96 | 417 => 'Expectation Failed', |
97 | - 422 => 'Unprocessable Entity', // RFC4918 |
|
98 | - 423 => 'Locked', // RFC4918 |
|
99 | - 424 => 'Failed Dependency', // RFC4918 |
|
100 | - 425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817 |
|
101 | - 426 => 'Upgrade Required', // RFC2817 |
|
102 | - 428 => 'Precondition Required', // RFC6585 |
|
103 | - 429 => 'Too Many Requests', // RFC6585 |
|
104 | - 431 => 'Request Header Fields Too Large', // RFC6585 |
|
97 | + 422 => 'Unprocessable Entity', // RFC4918 |
|
98 | + 423 => 'Locked', // RFC4918 |
|
99 | + 424 => 'Failed Dependency', // RFC4918 |
|
100 | + 425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817 |
|
101 | + 426 => 'Upgrade Required', // RFC2817 |
|
102 | + 428 => 'Precondition Required', // RFC6585 |
|
103 | + 429 => 'Too Many Requests', // RFC6585 |
|
104 | + 431 => 'Request Header Fields Too Large', // RFC6585 |
|
105 | 105 | // Server Error 5xx |
106 | 106 | 500 => 'Internal Server Error', |
107 | 107 | 501 => 'Not Implemented', |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | 503 => 'Service Unavailable', |
110 | 110 | 504 => 'Gateway Timeout', |
111 | 111 | 505 => 'HTTP Version Not Supported', |
112 | - 506 => 'Variant Also Negotiates (Experimental)', // RFC2295 |
|
113 | - 507 => 'Insufficient Storage', // RFC4918 |
|
114 | - 508 => 'Loop Detected', // RFC5842 |
|
115 | - 510 => 'Not Extended', // RFC2774 |
|
116 | - 511 => 'Network Authentication Required', // RFC6585 |
|
112 | + 506 => 'Variant Also Negotiates (Experimental)', // RFC2295 |
|
113 | + 507 => 'Insufficient Storage', // RFC4918 |
|
114 | + 508 => 'Loop Detected', // RFC5842 |
|
115 | + 510 => 'Not Extended', // RFC2774 |
|
116 | + 511 => 'Network Authentication Required', // RFC6585 |
|
117 | 117 | ]; |
118 | 118 | |
119 | 119 | /** |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @var array |
185 | 185 | */ |
186 | - protected $trackedEvents = []; |
|
186 | + protected $trackedEvents = [ ]; |
|
187 | 187 | |
188 | 188 | /** |
189 | 189 | * @param string $token Telegram Bot API token |
@@ -214,10 +214,10 @@ discard block |
||
214 | 214 | { |
215 | 215 | parse_str($rawData, $data); |
216 | 216 | |
217 | - $sign = $data['hash']; |
|
218 | - unset($data['hash']); |
|
217 | + $sign = $data[ 'hash' ]; |
|
218 | + unset($data[ 'hash' ]); |
|
219 | 219 | |
220 | - if ($authDateDiff && (time() - $data['auth_date'] > $authDateDiff)) { |
|
220 | + if ($authDateDiff && (time() - $data[ 'auth_date' ] > $authDateDiff)) { |
|
221 | 221 | return false; |
222 | 222 | } |
223 | 223 | |
@@ -314,15 +314,15 @@ discard block |
||
314 | 314 | @trigger_error(sprintf('Method "%s::%s" is deprecated', __CLASS__, __METHOD__), \E_USER_DEPRECATED); |
315 | 315 | |
316 | 316 | if ($response) { |
317 | - $json = json_decode($response, true) ?: []; |
|
317 | + $json = json_decode($response, true) ?: [ ]; |
|
318 | 318 | } else { |
319 | - $json = []; |
|
319 | + $json = [ ]; |
|
320 | 320 | } |
321 | 321 | if (($httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE)) |
322 | - && !in_array($httpCode, [self::DEFAULT_STATUS_CODE, self::NOT_MODIFIED_STATUS_CODE]) |
|
322 | + && !in_array($httpCode, [ self::DEFAULT_STATUS_CODE, self::NOT_MODIFIED_STATUS_CODE ]) |
|
323 | 323 | ) { |
324 | - $errorDescription = array_key_exists('description', $json) ? $json['description'] : self::$codes[$httpCode]; |
|
325 | - $errorParameters = array_key_exists('parameters', $json) ? $json['parameters'] : []; |
|
324 | + $errorDescription = array_key_exists('description', $json) ? $json[ 'description' ] : self::$codes[ $httpCode ]; |
|
325 | + $errorParameters = array_key_exists('parameters', $json) ? $json[ 'parameters' ] : [ ]; |
|
326 | 326 | throw new HttpException($errorDescription, $httpCode, null, $errorParameters); |
327 | 327 | } |
328 | 328 | } |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | */ |
590 | 590 | public function deleteWebhook($dropPendingUpdates = false) |
591 | 591 | { |
592 | - return $this->call('deleteWebhook', ['drop_pending_updates' => $dropPendingUpdates]); |
|
592 | + return $this->call('deleteWebhook', [ 'drop_pending_updates' => $dropPendingUpdates ]); |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | /** |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | * |
877 | 877 | * @author bernard-ng <[email protected]> |
878 | 878 | */ |
879 | - public function getCustomEmojiStickers($customEmojiIds = []) |
|
879 | + public function getCustomEmojiStickers($customEmojiIds = [ ]) |
|
880 | 880 | { |
881 | 881 | return StickerSet::fromResponse($this->call('getCustomEmojiStickers', [ |
882 | 882 | 'custom_emoji_ids' => $customEmojiIds, |
@@ -948,7 +948,7 @@ discard block |
||
948 | 948 | $webmSticker = null, |
949 | 949 | $stickerType = null, |
950 | 950 | $maskPosition = null, |
951 | - $attachments = [] |
|
951 | + $attachments = [ ] |
|
952 | 952 | ) { |
953 | 953 | return $this->call('createNewStickerSet', [ |
954 | 954 | 'user_id' => $userId, |
@@ -992,7 +992,7 @@ discard block |
||
992 | 992 | $tgsSticker = null, |
993 | 993 | $webmSticker = null, |
994 | 994 | $maskPosition = null, |
995 | - $attachments = [] |
|
995 | + $attachments = [ ] |
|
996 | 996 | ) { |
997 | 997 | return $this->call('addStickerToSet', [ |
998 | 998 | 'user_id' => $userId, |
@@ -1437,7 +1437,7 @@ discard block |
||
1437 | 1437 | */ |
1438 | 1438 | public function getFile($fileId) |
1439 | 1439 | { |
1440 | - return File::fromResponse($this->call('getFile', ['file_id' => $fileId])); |
|
1440 | + return File::fromResponse($this->call('getFile', [ 'file_id' => $fileId ])); |
|
1441 | 1441 | } |
1442 | 1442 | |
1443 | 1443 | /** |
@@ -1469,7 +1469,7 @@ discard block |
||
1469 | 1469 | * @param AbstractInlineQueryResult $item |
1470 | 1470 | * @return array |
1471 | 1471 | */ |
1472 | - function ($item) { |
|
1472 | + function($item) { |
|
1473 | 1473 | /** @var array $array */ |
1474 | 1474 | $array = $item->toJson(true); |
1475 | 1475 | |
@@ -1735,7 +1735,7 @@ discard block |
||
1735 | 1735 | InputMedia $media, |
1736 | 1736 | $inlineMessageId = null, |
1737 | 1737 | $replyMarkup = null, |
1738 | - $attachments = [] |
|
1738 | + $attachments = [ ] |
|
1739 | 1739 | ) { |
1740 | 1740 | $response = $this->call('editMessageMedia', [ |
1741 | 1741 | 'chat_id' => $chatId, |
@@ -1823,7 +1823,7 @@ discard block |
||
1823 | 1823 | if (!$message) { |
1824 | 1824 | return; |
1825 | 1825 | } |
1826 | - $this->trackedEvents[] = $update->getUpdateId(); |
|
1826 | + $this->trackedEvents[ ] = $update->getUpdateId(); |
|
1827 | 1827 | |
1828 | 1828 | $this->track($message, $eventName); |
1829 | 1829 | |
@@ -1958,7 +1958,7 @@ discard block |
||
1958 | 1958 | * @return bool |
1959 | 1959 | * @throws Exception |
1960 | 1960 | */ |
1961 | - public function answerShippingQuery($shippingQueryId, $ok = true, $shippingOptions = [], $errorMessage = null) |
|
1961 | + public function answerShippingQuery($shippingQueryId, $ok = true, $shippingOptions = [ ], $errorMessage = null) |
|
1962 | 1962 | { |
1963 | 1963 | return $this->call('answerShippingQuery', [ |
1964 | 1964 | 'shipping_query_id' => $shippingQueryId, |
@@ -2507,7 +2507,7 @@ discard block |
||
2507 | 2507 | $messageThreadId = null, |
2508 | 2508 | $protectContent = null, |
2509 | 2509 | $allowSendingWithoutReply = null, |
2510 | - $attachments = [] |
|
2510 | + $attachments = [ ] |
|
2511 | 2511 | ) { |
2512 | 2512 | return ArrayOfMessages::fromResponse($this->call('sendMediaGroup', [ |
2513 | 2513 | 'chat_id' => $chatId, |
@@ -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 \Throwable|\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, $previous = null, $parameters = []) |
|
26 | + public function __construct($message = '', $code = 0, $previous = null, $parameters = [ ]) |
|
27 | 27 | { |
28 | 28 | $this->parameters = $parameters; |
29 | 29 |
@@ -23,10 +23,10 @@ |
||
23 | 23 | */ |
24 | 24 | protected function doRequest($url, array $data = null) |
25 | 25 | { |
26 | - $options = []; |
|
26 | + $options = [ ]; |
|
27 | 27 | if ($data) { |
28 | 28 | $method = 'POST'; |
29 | - $options['body'] = $data; |
|
29 | + $options[ 'body' ] = $data; |
|
30 | 30 | } else { |
31 | 31 | $method = 'GET'; |
32 | 32 | } |
@@ -10,11 +10,11 @@ |
||
10 | 10 | { |
11 | 11 | $response = $this->doRequest($url, $data); |
12 | 12 | |
13 | - if (!isset($response['ok']) || !$response['ok']) { |
|
14 | - throw new Exception($response['description'], $response['error_code']); |
|
13 | + if (!isset($response[ 'ok' ]) || !$response[ 'ok' ]) { |
|
14 | + throw new Exception($response[ 'description' ], $response[ 'error_code' ]); |
|
15 | 15 | } |
16 | 16 | |
17 | - return $response['result']; |
|
17 | + return $response[ 'result' ]; |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | public function download($url) |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | // Informational 1xx |
17 | 17 | 100 => 'Continue', |
18 | 18 | 101 => 'Switching Protocols', |
19 | - 102 => 'Processing', // RFC2518 |
|
19 | + 102 => 'Processing', // RFC2518 |
|
20 | 20 | // Success 2xx |
21 | 21 | 200 => 'OK', |
22 | 22 | 201 => 'Created', |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | 204 => 'No Content', |
26 | 26 | 205 => 'Reset Content', |
27 | 27 | 206 => 'Partial Content', |
28 | - 207 => 'Multi-Status', // RFC4918 |
|
29 | - 208 => 'Already Reported', // RFC5842 |
|
30 | - 226 => 'IM Used', // RFC3229 |
|
28 | + 207 => 'Multi-Status', // RFC4918 |
|
29 | + 208 => 'Already Reported', // RFC5842 |
|
30 | + 226 => 'IM Used', // RFC3229 |
|
31 | 31 | // Redirection 3xx |
32 | 32 | 300 => 'Multiple Choices', |
33 | 33 | 301 => 'Moved Permanently', |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 305 => 'Use Proxy', |
38 | 38 | // 306 is deprecated but reserved |
39 | 39 | 307 => 'Temporary Redirect', |
40 | - 308 => 'Permanent Redirect', // RFC7238 |
|
40 | + 308 => 'Permanent Redirect', // RFC7238 |
|
41 | 41 | // Client Error 4xx |
42 | 42 | 400 => 'Bad Request', |
43 | 43 | 401 => 'Unauthorized', |
@@ -57,14 +57,14 @@ discard block |
||
57 | 57 | 415 => 'Unsupported Media Type', |
58 | 58 | 416 => 'Range Not Satisfiable', |
59 | 59 | 417 => 'Expectation Failed', |
60 | - 422 => 'Unprocessable Entity', // RFC4918 |
|
61 | - 423 => 'Locked', // RFC4918 |
|
62 | - 424 => 'Failed Dependency', // RFC4918 |
|
63 | - 425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817 |
|
64 | - 426 => 'Upgrade Required', // RFC2817 |
|
65 | - 428 => 'Precondition Required', // RFC6585 |
|
66 | - 429 => 'Too Many Requests', // RFC6585 |
|
67 | - 431 => 'Request Header Fields Too Large', // RFC6585 |
|
60 | + 422 => 'Unprocessable Entity', // RFC4918 |
|
61 | + 423 => 'Locked', // RFC4918 |
|
62 | + 424 => 'Failed Dependency', // RFC4918 |
|
63 | + 425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817 |
|
64 | + 426 => 'Upgrade Required', // RFC2817 |
|
65 | + 428 => 'Precondition Required', // RFC6585 |
|
66 | + 429 => 'Too Many Requests', // RFC6585 |
|
67 | + 431 => 'Request Header Fields Too Large', // RFC6585 |
|
68 | 68 | // Server Error 5xx |
69 | 69 | 500 => 'Internal Server Error', |
70 | 70 | 501 => 'Not Implemented', |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | 503 => 'Service Unavailable', |
73 | 73 | 504 => 'Gateway Timeout', |
74 | 74 | 505 => 'HTTP Version Not Supported', |
75 | - 506 => 'Variant Also Negotiates (Experimental)', // RFC2295 |
|
76 | - 507 => 'Insufficient Storage', // RFC4918 |
|
77 | - 508 => 'Loop Detected', // RFC5842 |
|
78 | - 510 => 'Not Extended', // RFC2774 |
|
79 | - 511 => 'Network Authentication Required', // RFC6585 |
|
75 | + 506 => 'Variant Also Negotiates (Experimental)', // RFC2295 |
|
76 | + 507 => 'Insufficient Storage', // RFC4918 |
|
77 | + 508 => 'Loop Detected', // RFC5842 |
|
78 | + 510 => 'Not Extended', // RFC2774 |
|
79 | + 511 => 'Network Authentication Required', // RFC6585 |
|
80 | 80 | ]; |
81 | 81 | |
82 | 82 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | private $options; |
103 | 103 | |
104 | - public function __construct(array $options = []) |
|
104 | + public function __construct(array $options = [ ]) |
|
105 | 105 | { |
106 | 106 | $this->curl = curl_init(); |
107 | 107 | $this->options = $options; |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | ]; |
119 | 119 | |
120 | 120 | if ($data) { |
121 | - $options[CURLOPT_POST] = true; |
|
122 | - $options[CURLOPT_POSTFIELDS] = $data; |
|
121 | + $options[ CURLOPT_POST ] = true; |
|
122 | + $options[ CURLOPT_POSTFIELDS ] = $data; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | return self::jsonValidate($this->execute($options)); |
@@ -185,13 +185,13 @@ discard block |
||
185 | 185 | */ |
186 | 186 | private static function curlValidate($curl, $response = null) |
187 | 187 | { |
188 | - $json = json_decode((string) $response, true) ?: []; |
|
188 | + $json = json_decode((string) $response, true) ?: [ ]; |
|
189 | 189 | |
190 | 190 | if (($httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE)) |
191 | - && !in_array($httpCode, [self::DEFAULT_STATUS_CODE, self::NOT_MODIFIED_STATUS_CODE]) |
|
191 | + && !in_array($httpCode, [ self::DEFAULT_STATUS_CODE, self::NOT_MODIFIED_STATUS_CODE ]) |
|
192 | 192 | ) { |
193 | - $errorDescription = array_key_exists('description', $json) ? $json['description'] : self::$codes[$httpCode]; |
|
194 | - $errorParameters = array_key_exists('parameters', $json) ? $json['parameters'] : []; |
|
193 | + $errorDescription = array_key_exists('description', $json) ? $json[ 'description' ] : self::$codes[ $httpCode ]; |
|
194 | + $errorParameters = array_key_exists('parameters', $json) ? $json[ 'parameters' ] : [ ]; |
|
195 | 195 | |
196 | 196 | throw new HttpException($errorDescription, $httpCode, null, $errorParameters); |
197 | 197 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public function setOption($option, $value) |
206 | 206 | { |
207 | - $this->options[$option] = $value; |
|
207 | + $this->options[ $option ] = $value; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function unsetOption($option) |
215 | 215 | { |
216 | - unset($this->options[$option]); |
|
216 | + unset($this->options[ $option ]); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | /** |
@@ -221,6 +221,6 @@ discard block |
||
221 | 221 | */ |
222 | 222 | public function resetOptions() |
223 | 223 | { |
224 | - $this->options = []; |
|
224 | + $this->options = [ ]; |
|
225 | 225 | } |
226 | 226 | } |
@@ -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 | return $this; |
54 | 54 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | if ($event->executeAction($update) === false) { |
65 | 65 | if ($this->tracker && ($message = $update->getMessage())) { |
66 | 66 | $checker = new ReflectionFunction($event->getChecker()); |
67 | - $this->tracker->track($message, $checker->getStaticVariables()['name']); |
|
67 | + $this->tracker->track($message, $checker->getStaticVariables()[ 'name' ]); |
|
68 | 68 | } |
69 | 69 | break; |
70 | 70 | } |