Completed
Pull Request — develop (#397)
by
unknown
02:55
created
src/ConversationDB.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@
 block discarded – undo
84 84
         }
85 85
 
86 86
         try {
87
-            $sth    = self::$pdo->prepare('INSERT INTO `' . TB_CONVERSATION . '`
87
+            $sth = self::$pdo->prepare('INSERT INTO `' . TB_CONVERSATION . '`
88 88
                 (
89 89
                 `status`, `user_id`, `chat_id`, `command`, `notes`, `created_at`, `updated_at`
90 90
                 )
Please login to merge, or discard this patch.
src/Commands/AdminCommands/SendtochannelCommand.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     /**
56 56
      * Command execute method
57 57
      *
58
-     * @return \Longman\TelegramBot\Entities\ServerResponse|mixed
58
+     * @return \Longman\TelegramBot\Entities\ServerResponse
59 59
      * @throws \Longman\TelegramBot\Exception\TelegramException
60 60
      */
61 61
     public function execute()
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
      *
330 330
      * @todo Why send just to the first found channel?
331 331
      *
332
-     * @return mixed
332
+     * @return \Longman\TelegramBot\Entities\ServerResponse
333 333
      * @throws \Longman\TelegramBot\Exception\TelegramException
334 334
      */
335 335
     public function executeNoDb()
Please login to merge, or discard this patch.
src/DB.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -251,7 +251,7 @@
 block discarded – undo
251 251
      * @todo Find a better way, as json_* functions are very heavy
252 252
      *
253 253
      * @param array|null $entities
254
-     * @param mixed      $default
254
+     * @param string|null      $default
255 255
      *
256 256
      * @return mixed
257 257
      */
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -262,7 +262,7 @@
 block discarded – undo
262 262
         }
263 263
 
264 264
         //Convert each Entity item into an object based on its JSON reflection
265
-        $json_entities = array_map(function ($entity) {
265
+        $json_entities = array_map(function($entity) {
266 266
             return json_decode($entity, true);
267 267
         }, $entities);
268 268
 
Please login to merge, or discard this patch.
src/Commands/UserCommands/HelpCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
 
56 56
         //Only get enabled Admin and User commands
57 57
         /** @var Command[] $command_objs */
58
-        $command_objs = array_filter($this->telegram->getCommandsList(), function ($command_obj) {
58
+        $command_objs = array_filter($this->telegram->getCommandsList(), function($command_obj) {
59 59
             /** @var Command $command_obj */
60 60
             return !$command_obj->isSystemCommand() && $command_obj->isEnabled();
61 61
         });
Please login to merge, or discard this patch.
src/Telegram.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
      *
758 758
      * This is kept for backwards compatibility!
759 759
      *
760
-     * @return mixed
760
+     * @return ServerResponse
761 761
      * @throws \Longman\TelegramBot\Exception\TelegramException
762 762
      */
763 763
     public function unsetWebhook()
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
     /**
769 769
      * Delete any assigned webhook
770 770
      *
771
-     * @return mixed
771
+     * @return ServerResponse
772 772
      * @throws \Longman\TelegramBot\Exception\TelegramException
773 773
      */
774 774
     public function deleteWebhook()
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -844,7 +844,7 @@  discard block
 block discarded – undo
844 844
             throw new TelegramException('No command(s) provided!');
845 845
         }
846 846
 
847
-        $this->botan_enabled = false;   // Force disable Botan.io integration, we don't want to track self-executed commands!
847
+        $this->botan_enabled = false; // Force disable Botan.io integration, we don't want to track self-executed commands!
848 848
 
849 849
         $result = Request::getMe()->getResult();
850 850
 
@@ -856,8 +856,8 @@  discard block
 block discarded – undo
856 856
         $bot_name     = $result->getFirstName();
857 857
         $bot_username = $result->getUsername();
858 858
 
859
-        $this->enableAdmin($bot_id);    // Give bot access to admin commands
860
-        $this->getCommandsList();       // Load full commands list
859
+        $this->enableAdmin($bot_id); // Give bot access to admin commands
860
+        $this->getCommandsList(); // Load full commands list
861 861
 
862 862
         foreach ($commands as $command) {
863 863
             $this->update = new Update(
Please login to merge, or discard this patch.
src/Commands/UserCommands/WeatherCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@
 block discarded – undo
92 92
             }
93 93
 
94 94
             //http://openweathermap.org/weather-conditions
95
-            $conditions     = [
95
+            $conditions = [
96 96
                 'clear'        => ' ☀️',
97 97
                 'clouds'       => ' ☁️',
98 98
                 'rain'         => ' ☔',
Please login to merge, or discard this patch.
src/Entities/ServerResponse.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -100,11 +100,11 @@
 block discarded – undo
100 100
 
101 101
         $result_object_types = [
102 102
             'total_count' => 'UserProfilePhotos', //Response from getUserProfilePhotos
103
-            'file_id'     => 'File',              //Response from getFile
104
-            'title'       => 'Chat',              //Response from getChat
105
-            'username'    => 'User',              //Response from getMe
106
-            'user'        => 'ChatMember',        //Response from getChatMember
107
-            'url'         => 'WebhookInfo',       //Response from getWebhookInfo
103
+            'file_id'     => 'File', //Response from getFile
104
+            'title'       => 'Chat', //Response from getChat
105
+            'username'    => 'User', //Response from getMe
106
+            'user'        => 'ChatMember', //Response from getChatMember
107
+            'url'         => 'WebhookInfo', //Response from getWebhookInfo
108 108
         ];
109 109
         foreach ($result_object_types as $type => $object_class) {
110 110
             if (isset($result[$type])) {
Please login to merge, or discard this patch.
src/Entities/Entity.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -199,8 +199,8 @@
 block discarded – undo
199 199
     public function escapeMarkdown($string)
200 200
     {
201 201
         return str_replace(
202
-            ['[', '`', '*', '_',],
203
-            ['\[', '\`', '\*', '\_',],
202
+            ['[', '`', '*', '_', ],
203
+            ['\[', '\`', '\*', '\_', ],
204 204
             $string
205 205
         );
206 206
     }
Please login to merge, or discard this patch.
src/Request.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
                 'first_name' => 'botname',
165 165
                 'username'   => 'namebot',
166 166
             ];
167
-            $data['chat']       = ['id' => $data['chat_id']];
167
+            $data['chat'] = ['id' => $data['chat_id']];
168 168
 
169 169
             $fake_response['result'] = $data;
170 170
         }
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         $multipart = [];
189 189
 
190 190
         // Convert any nested arrays into JSON strings.
191
-        array_walk($data, function (&$item) {
191
+        array_walk($data, function(&$item) {
192 192
             is_array($item) && $item = json_encode($item);
193 193
         });
194 194
 
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
      */
822 822
     public static function setWebhook($url = '', array $data = [])
823 823
     {
824
-        $data        = array_intersect_key($data, array_flip([
824
+        $data = array_intersect_key($data, array_flip([
825 825
             'certificate',
826 826
             'max_connections',
827 827
             'allowed_updates',
@@ -1043,9 +1043,9 @@  discard block
 block discarded – undo
1043 1043
                     $requests = DB::getTelegramRequestCount($chat_id, $inline_message_id);
1044 1044
 
1045 1045
                     if (
1046
-                        $requests['LIMIT_PER_SEC'] == 0 &&  // No more than one message per second inside a particular chat
1046
+                        $requests['LIMIT_PER_SEC'] == 0 && // No more than one message per second inside a particular chat
1047 1047
                         (
1048
-                            (($chat_id > 0 || $inline_message_id) && $requests['LIMIT_PER_SEC_ALL'] < 30) ||  // No more than 30 messages per second globally
1048
+                            (($chat_id > 0 || $inline_message_id) && $requests['LIMIT_PER_SEC_ALL'] < 30) || // No more than 30 messages per second globally
1049 1049
                             ($chat_id < 0 && $requests['LIMIT_PER_MINUTE'] < 20)  // No more than 20 messages per minute for group chats
1050 1050
                         )
1051 1051
                     ) {
Please login to merge, or discard this patch.