Completed
Push — develop ( ec4905...70198f )
by Armando
04:31
created
src/Request.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -238,7 +238,7 @@
 block discarded – undo
238 238
      *
239 239
      * @param \Longman\TelegramBot\Entities\File $file
240 240
      *
241
-     * @return boolean
241
+     * @return boolean|string
242 242
      * @throws \Longman\TelegramBot\Exception\TelegramException
243 243
      */
244 244
     public static function downloadFile(File $file)
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
                 'first_name' => 'botname',
261 261
                 'username'   => 'namebot',
262 262
             ];
263
-            $data['chat']       = ['id' => $data['chat_id']];
263
+            $data['chat'] = ['id' => $data['chat_id']];
264 264
 
265 265
             $fake_response['result'] = $data;
266 266
         }
@@ -284,14 +284,14 @@  discard block
 block discarded – undo
284 284
         $multipart    = [];
285 285
 
286 286
         // Convert any nested arrays into JSON strings.
287
-        array_walk($data, function (&$item) {
287
+        array_walk($data, function(&$item) {
288 288
             is_array($item) && $item = json_encode($item);
289 289
         });
290 290
 
291 291
         //Reformat data array in multipart way if it contains a resource
292 292
         foreach ($data as $key => $item) {
293 293
             $has_resource |= (is_resource($item) || $item instanceof \GuzzleHttp\Psr7\Stream);
294
-            $multipart[]  = ['name' => $key, 'contents' => $item];
294
+            $multipart[] = ['name' => $key, 'contents' => $item];
295 295
         }
296 296
         if ($has_resource) {
297 297
             return ['multipart' => $multipart];
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
                 '/bot' . self::$telegram->getApiKey() . '/' . $action,
326 326
                 $request_params
327 327
             );
328
-            $result   = (string) $response->getBody();
328
+            $result = (string) $response->getBody();
329 329
 
330 330
             //Logging getUpdates Update
331 331
             if ($action === 'getUpdates') {
@@ -651,8 +651,8 @@  discard block
 block discarded – undo
651 651
                     $requests = DB::getTelegramRequestCount($chat_id, $inline_message_id);
652 652
 
653 653
                     $chat_per_second   = ($requests['LIMIT_PER_SEC'] == 0); // No more than one message per second inside a particular chat
654
-                    $global_per_second = ($requests['LIMIT_PER_SEC_ALL'] < 30);    // No more than 30 messages per second to different chats
655
-                    $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
654
+                    $global_per_second = ($requests['LIMIT_PER_SEC_ALL'] < 30); // No more than 30 messages per second to different chats
655
+                    $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
656 656
 
657 657
                     if ($chat_per_second && $global_per_second && $groups_per_minute) {
658 658
                         break;
Please login to merge, or discard this patch.
src/Telegram.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -856,7 +856,7 @@
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
             }
361 361
 
362 362
             if ($this->last_update_id !== null) {
363
-                $offset = $this->last_update_id + 1;    //As explained in the telegram bot API documentation
363
+                $offset = $this->last_update_id + 1; //As explained in the telegram bot API documentation
364 364
             }
365 365
 
366 366
             $response = Request::getUpdates(
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
             throw new TelegramException('Hook url is empty!');
834 834
         }
835 835
 
836
-        $data        = array_intersect_key($data, array_flip([
836
+        $data = array_intersect_key($data, array_flip([
837 837
             'certificate',
838 838
             'max_connections',
839 839
             'allowed_updates',
@@ -947,7 +947,7 @@  discard block
 block discarded – undo
947 947
         }
948 948
 
949 949
         $this->run_commands  = true;
950
-        $this->botan_enabled = false;   // Force disable Botan.io integration, we don't want to track self-executed commands!
950
+        $this->botan_enabled = false; // Force disable Botan.io integration, we don't want to track self-executed commands!
951 951
 
952 952
         $result = Request::getMe();
953 953
 
@@ -964,8 +964,8 @@  discard block
 block discarded – undo
964 964
         }
965 965
 
966 966
 
967
-        $this->enableAdmin($bot_id);    // Give bot access to admin commands
968
-        $this->getCommandsList();       // Load full commands list
967
+        $this->enableAdmin($bot_id); // Give bot access to admin commands
968
+        $this->getCommandsList(); // Load full commands list
969 969
 
970 970
         foreach ($commands as $command) {
971 971
             $this->update = new Update(
Please login to merge, or discard this patch.