@@ -801,7 +801,7 @@ |
||
801 | 801 | /** |
802 | 802 | * Delete any assigned webhook |
803 | 803 | * |
804 | - * @return mixed |
|
804 | + * @return ServerResponse |
|
805 | 805 | * @throws \Longman\TelegramBot\Exception\TelegramException |
806 | 806 | */ |
807 | 807 | public function deleteWebhook() |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | } |
354 | 354 | |
355 | 355 | if ($this->last_update_id !== null) { |
356 | - $offset = $this->last_update_id + 1; //As explained in the telegram bot API documentation |
|
356 | + $offset = $this->last_update_id + 1; //As explained in the telegram bot API documentation |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | $response = Request::getUpdates( |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | throw new TelegramException('Hook url is empty!'); |
817 | 817 | } |
818 | 818 | |
819 | - $data = array_intersect_key($data, array_flip([ |
|
819 | + $data = array_intersect_key($data, array_flip([ |
|
820 | 820 | 'certificate', |
821 | 821 | 'max_connections', |
822 | 822 | 'allowed_updates', |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | throw new TelegramException('No command(s) provided!'); |
930 | 930 | } |
931 | 931 | |
932 | - $this->run_commands = true; |
|
932 | + $this->run_commands = true; |
|
933 | 933 | |
934 | 934 | $result = Request::getMe(); |
935 | 935 | |
@@ -946,8 +946,8 @@ discard block |
||
946 | 946 | } |
947 | 947 | |
948 | 948 | |
949 | - $this->enableAdmin($bot_id); // Give bot access to admin commands |
|
950 | - $this->getCommandsList(); // Load full commands list |
|
949 | + $this->enableAdmin($bot_id); // Give bot access to admin commands |
|
950 | + $this->getCommandsList(); // Load full commands list |
|
951 | 951 | |
952 | 952 | foreach ($commands as $command) { |
953 | 953 | $this->update = new Update( |
@@ -46,13 +46,13 @@ |
||
46 | 46 | { |
47 | 47 | return is_array($data) && |
48 | 48 | array_key_exists('text', $data) && ( |
49 | - array_key_exists('url', $data) || |
|
49 | + array_key_exists('url', $data) || |
|
50 | 50 | array_key_exists('callback_data', $data) || |
51 | 51 | array_key_exists('switch_inline_query', $data) || |
52 | 52 | array_key_exists('switch_inline_query_current_chat', $data) || |
53 | 53 | array_key_exists('callback_game', $data) || |
54 | 54 | array_key_exists('pay', $data) |
55 | - ); |
|
55 | + ); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -128,7 +128,7 @@ |
||
128 | 128 | $notes['state'] = 0; |
129 | 129 | $this->conversation->update(); |
130 | 130 | |
131 | - $keyboard = array_map(function ($channel) { |
|
131 | + $keyboard = array_map(function($channel) { |
|
132 | 132 | return [$channel]; |
133 | 133 | }, $channels); |
134 | 134 |
@@ -61,7 +61,7 @@ |
||
61 | 61 | |
62 | 62 | /** @var ServerResponse[] $results */ |
63 | 63 | $results = Request::sendToActiveChats( |
64 | - 'sendMessage', //callback function to execute (see Request.php methods) |
|
64 | + 'sendMessage', //callback function to execute (see Request.php methods) |
|
65 | 65 | ['text' => $text], //Param to evaluate the request |
66 | 66 | [ |
67 | 67 | 'groups' => true, |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | * @param bool $has_resource |
373 | 373 | * @param array $multipart |
374 | 374 | * |
375 | - * @return mixed |
|
375 | + * @return string |
|
376 | 376 | */ |
377 | 377 | private static function mediaInputHelper($item, &$has_resource, array &$multipart) |
378 | 378 | { |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | * |
448 | 448 | * @param \Longman\TelegramBot\Entities\File $file |
449 | 449 | * |
450 | - * @return boolean |
|
450 | + * @return boolean|string |
|
451 | 451 | * @throws \Longman\TelegramBot\Exception\TelegramException |
452 | 452 | */ |
453 | 453 | public static function downloadFile(File $file) |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | 'first_name' => 'botname', |
304 | 304 | 'username' => 'namebot', |
305 | 305 | ]; |
306 | - $data['chat'] = ['id' => $data['chat_id']]; |
|
306 | + $data['chat'] = ['id' => $data['chat_id']]; |
|
307 | 307 | |
308 | 308 | $fake_response['result'] = $data; |
309 | 309 | } |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | |
338 | 338 | // Reformat data array in multipart way if it contains a resource |
339 | 339 | $has_resource |= (is_resource($item) || $item instanceof Stream); |
340 | - $multipart[] = ['name' => $key, 'contents' => $item]; |
|
340 | + $multipart[] = ['name' => $key, 'contents' => $item]; |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | if ($has_resource) { |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | '/bot' . self::$telegram->getApiKey() . '/' . $action, |
426 | 426 | $request_params |
427 | 427 | ); |
428 | - $result = (string) $response->getBody(); |
|
428 | + $result = (string) $response->getBody(); |
|
429 | 429 | |
430 | 430 | //Logging getUpdates Update |
431 | 431 | if ($action === 'getUpdates') { |
@@ -768,8 +768,8 @@ discard block |
||
768 | 768 | $requests = DB::getTelegramRequestCount($chat_id, $inline_message_id); |
769 | 769 | |
770 | 770 | $chat_per_second = ($requests['LIMIT_PER_SEC'] == 0); // No more than one message per second inside a particular chat |
771 | - $global_per_second = ($requests['LIMIT_PER_SEC_ALL'] < 30); // No more than 30 messages per second to different chats |
|
772 | - $groups_per_minute = (((is_numeric($chat_id) && $chat_id > 0) || !is_null($inline_message_id)) || ((!is_numeric($chat_id) || $chat_id < 0) && $requests['LIMIT_PER_MINUTE'] < 20)); // No more than 20 messages per minute in groups and channels |
|
771 | + $global_per_second = ($requests['LIMIT_PER_SEC_ALL'] < 30); // No more than 30 messages per second to different chats |
|
772 | + $groups_per_minute = (((is_numeric($chat_id) && $chat_id > 0) || !is_null($inline_message_id)) || ((!is_numeric($chat_id) || $chat_id < 0) && $requests['LIMIT_PER_MINUTE'] < 20)); // No more than 20 messages per minute in groups and channels |
|
773 | 773 | |
774 | 774 | if ($chat_per_second && $global_per_second && $groups_per_minute) { |
775 | 775 | break; |