@@ -199,8 +199,8 @@ |
||
199 | 199 | public function escapeMarkdown($string) |
200 | 200 | { |
201 | 201 | return str_replace( |
202 | - ['[', '`', '*', '_',], |
|
203 | - ['\[', '\`', '\*', '\_',], |
|
202 | + ['[', '`', '*', '_', ], |
|
203 | + ['\[', '\`', '\*', '\_', ], |
|
204 | 204 | $string |
205 | 205 | ); |
206 | 206 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | // Convert numeric-only values to days. |
104 | - array_walk($clean_older_than, function (&$time) use ($custom_time) { |
|
104 | + array_walk($clean_older_than, function(&$time) use ($custom_time) { |
|
105 | 105 | if (!empty($custom_time)) { |
106 | 106 | $time = $custom_time; |
107 | 107 | } |
@@ -357,9 +357,9 @@ discard block |
||
357 | 357 | } |
358 | 358 | } |
359 | 359 | |
360 | - $pdo->commit(); // commit changes to the database and end transaction |
|
360 | + $pdo->commit(); // commit changes to the database and end transaction |
|
361 | 361 | } catch (PDOException $e) { |
362 | - $pdo->rollBack(); // rollback changes on exception (useful if you want to track down error - you can't replicate it when some of the data is already deleted...) |
|
362 | + $pdo->rollBack(); // rollback changes on exception (useful if you want to track down error - you can't replicate it when some of the data is already deleted...) |
|
363 | 363 | |
364 | 364 | $data['text'] = '*Database cleanup failed!* _(check your error logs)_'; |
365 | 365 | Request::sendMessage($data); |
@@ -856,7 +856,7 @@ |
||
856 | 856 | protected function ucfirstUnicode($str, $encoding = 'UTF-8') |
857 | 857 | { |
858 | 858 | return mb_strtoupper(mb_substr($str, 0, 1, $encoding), $encoding) |
859 | - . mb_strtolower(mb_substr($str, 1, mb_strlen($str), $encoding), $encoding); |
|
859 | + . mb_strtolower(mb_substr($str, 1, mb_strlen($str), $encoding), $encoding); |
|
860 | 860 | } |
861 | 861 | |
862 | 862 | /** |
@@ -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( |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | throw new TelegramException('Hook url is empty!'); |
806 | 806 | } |
807 | 807 | |
808 | - $data = array_intersect_key($data, array_flip([ |
|
808 | + $data = array_intersect_key($data, array_flip([ |
|
809 | 809 | 'certificate', |
810 | 810 | 'max_connections', |
811 | 811 | 'allowed_updates', |
@@ -919,8 +919,8 @@ discard block |
||
919 | 919 | } |
920 | 920 | |
921 | 921 | |
922 | - $this->enableAdmin($bot_id); // Give bot access to admin commands |
|
923 | - $this->getCommandsList(); // Load full commands list |
|
922 | + $this->enableAdmin($bot_id); // Give bot access to admin commands |
|
923 | + $this->getCommandsList(); // Load full commands list |
|
924 | 924 | |
925 | 925 | foreach ($commands as $command) { |
926 | 926 | $this->update = new Update( |
@@ -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 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | /** |
57 | 57 | * Command execute method |
58 | 58 | * |
59 | - * @return ServerResponse|mixed |
|
59 | + * @return ServerResponse |
|
60 | 60 | * @throws TelegramException |
61 | 61 | */ |
62 | 62 | public function execute() |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | * |
353 | 353 | * @todo Why send just to the first found channel? |
354 | 354 | * |
355 | - * @return mixed |
|
355 | + * @return ServerResponse |
|
356 | 356 | * @throws TelegramException |
357 | 357 | */ |
358 | 358 | public function executeNoDb() |
@@ -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, |
@@ -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; |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | * @param bool $has_resource |
421 | 421 | * @param array $multipart |
422 | 422 | * |
423 | - * @return mixed |
|
423 | + * @return string |
|
424 | 424 | * @throws TelegramException |
425 | 425 | */ |
426 | 426 | private static function mediaInputHelper($item, &$has_resource, array &$multipart) |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | * |
513 | 513 | * @param File $file |
514 | 514 | * |
515 | - * @return boolean |
|
515 | + * @return boolean|string |
|
516 | 516 | * @throws TelegramException |
517 | 517 | */ |
518 | 518 | public static function downloadFile(File $file) |