Completed
Push — feature/improve-code ( 2822ba...7d6b6d )
by Avtandil
04:16 queued 16s
created
utils/importFromLog.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 require __DIR__ . '/../vendor/autoload.php';
3 3
 
4
-$filename='logfile.log';
4
+$filename = 'logfile.log';
5 5
 $API_KEY = 'random'; 
6 6
 $BOT_NAME = 'bot_name';
7 7
                                                                                                                                                                                                                      
Please login to merge, or discard this patch.
src/Commands/UserCommands/SurveyCommand.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         if ($chat->isGroupChat() || $chat->isSuperGroup()) {
59 59
             //reply to message id is applied by default
60 60
             //Force reply is applied by default to so can work with privacy on
61
-            $data['reply_markup'] = new ForceReply([ 'selective' => true]);
61
+            $data['reply_markup'] = new ForceReply(['selective' => true]);
62 62
         }
63 63
         $data['chat_id'] = $chat_id;
64 64
 
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
                     $this->conversation->notes['state'] = 3;
125 125
                     $this->conversation->update();
126 126
 
127
-                    $keyboard = [['M','F']];
127
+                    $keyboard = [['M', 'F']];
128 128
                     $reply_keyboard_markup = new ReplyKeyboardMarkup(
129 129
                         [
130
-                            'keyboard' => $keyboard ,
130
+                            'keyboard' => $keyboard,
131 131
                             'resize_keyboard' => true,
132 132
                             'one_time_keyboard' => true,
133 133
                             'selective' => true
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
                     $this->conversation->update();
152 152
                     $data['reply_markup'] = new ReplyKeyboardMarkup([
153 153
                         'keyboard' => [[
154
-                            [ 'text' => 'Share Location', 'request_location' => true ],
154
+                            ['text' => 'Share Location', 'request_location' => true],
155 155
                         ]],
156 156
                         'resize_keyboard'   => true,
157 157
                         'one_time_keyboard' => true,
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
                     $data['text'] = 'Share your contact information:';
188 188
                     $data['reply_markup'] = new ReplyKeyboardMarkup([
189 189
                         'keyboard' => [[
190
-                            [ 'text' => 'Share Contact', 'request_contact' => true ],
190
+                            ['text' => 'Share Contact', 'request_contact' => true],
191 191
                         ]],
192 192
                         'resize_keyboard'   => true,
193 193
                         'one_time_keyboard' => true,
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
                 $out_text = '/Survey result:' . "\n";
205 205
                 unset($this->conversation->notes['state']);
206 206
                 foreach ($this->conversation->notes as $k => $v) {
207
-                    $out_text .= "\n" . ucfirst($k).': ' . $v;
207
+                    $out_text .= "\n" . ucfirst($k) . ': ' . $v;
208 208
                 }
209 209
 
210 210
                 $data['photo'] = $this->conversation->notes['photo_id'];
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
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
         $command = trim($message->getText(true));
40 40
 
41 41
         //Only get enabled Admin and User commands
42
-        $commands = array_filter($this->telegram->getCommandsList(), function ($command) {
42
+        $commands = array_filter($this->telegram->getCommandsList(), function($command) {
43 43
             return (!$command->isSystemCommand() && $command->isEnabled());
44 44
         });
45 45
 
Please login to merge, or discard this patch.
src/Commands/UserCommands/WhoamiCommand.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
         $limit = 10;
56 56
         $offset = null;
57 57
         $ServerResponse = Request::getUserProfilePhotos([
58
-            'user_id' => $user_id ,
58
+            'user_id' => $user_id,
59 59
             'limit'   => $limit,
60 60
             'offset'  => $offset,
61 61
         ]);
Please login to merge, or discard this patch.
src/Commands/AdminCommands/WhoisCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $command = $message->getCommand();
44 44
         $text = trim($message->getText(true));
45 45
 
46
-        $data = [ 'chat_id' => $chat_id ];
46
+        $data = ['chat_id' => $chat_id];
47 47
 
48 48
         //No point in replying to messages in private chats
49 49
         if (!$message->getChat()->isPrivateChat()) {
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                     $limit = 10;
118 118
                     $offset = null;
119 119
                     $ServerResponse = Request::getUserProfilePhotos([
120
-                        'user_id' => $user_id ,
120
+                        'user_id' => $user_id,
121 121
                         'limit'   => $limit,
122 122
                         'offset'  => $offset,
123 123
                     ]);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
                         return Request::sendPhoto($data);
141 141
                     }
142 142
                 } elseif ($chat->isGroupChat()) {
143
-                    $text = 'Chat ID: ' . $user_id . (!empty($old_id) ? ' (previously: '.$old_id.')' : ''). "\n";
143
+                    $text = 'Chat ID: ' . $user_id . (!empty($old_id) ? ' (previously: ' . $old_id . ')' : '') . "\n";
144 144
                     $text .= 'Type: ' . ucfirst($chat->getType()) . "\n";
145 145
                     $text .= 'Title: ' . $chat->getTitle() . "\n";
146 146
                     $text .= 'First time added to group: ' . $created_at . "\n";
Please login to merge, or discard this patch.
src/Commands/AdminCommands/ChatsCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@
 block discarded – undo
102 102
             $text_back .= "\n" . 'Total: ' . ($user_chats + $group_chats + $super_group_chats);
103 103
 
104 104
             if ($text === '') {
105
-                $text_back .= "\n\n" . 'List all chats: /' . $this->name .' *' . "\n" . 'Search for chats: /' . $this->name .' <search string>';
105
+                $text_back .= "\n\n" . 'List all chats: /' . $this->name . ' *' . "\n" . 'Search for chats: /' . $this->name . ' <search string>';
106 106
             }
107 107
         }
108 108
 
Please login to merge, or discard this patch.
src/Commands/AdminCommands/SendtochannelCommand.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
                     }
97 97
                     $reply_keyboard_markup = new ReplyKeyboardMarkup(
98 98
                         [
99
-                            'keyboard' => $keyboard ,
99
+                            'keyboard' => $keyboard,
100 100
                             'resize_keyboard' => true,
101 101
                             'one_time_keyboard' => true,
102 102
                             'selective' => true
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
                         $keyboard = [['Yes', 'No']];
140 140
                         $reply_keyboard_markup = new ReplyKeyboardMarkup(
141 141
                             [
142
-                                'keyboard' => $keyboard ,
142
+                                'keyboard' => $keyboard,
143 143
                                 'resize_keyboard' => true,
144 144
                                 'one_time_keyboard' => true,
145 145
                                 'selective' => true
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
                 $this->conversation->notes['last_message_id'] = $message->getMessageId();
163 163
                 // no break
164 164
             case 3:
165
-                if (($this->conversation->notes['last_message_id'] == $message->getMessageId() || $type != 'Message' ) && $this->conversation->notes['set_caption']) {
165
+                if (($this->conversation->notes['last_message_id'] == $message->getMessageId() || $type != 'Message') && $this->conversation->notes['set_caption']) {
166 166
                     $this->conversation->notes['state'] = 3;
167 167
                     $this->conversation->update();
168 168
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
                         $keyboard = [['Yes', 'No']];
196 196
                         $reply_keyboard_markup = new ReplyKeyboardMarkup(
197 197
                             [
198
-                                'keyboard' => $keyboard ,
198
+                                'keyboard' => $keyboard,
199 199
                                 'resize_keyboard' => true,
200 200
                                 'one_time_keyboard' => true,
201 201
                                 'selective' => true
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
         if ($this->sendBack($message, $data)->isOk()) {
274 274
             $response = 'Message sent successfully to: ' . $channel;
275 275
         } else {
276
-            $response = 'Message not sent to: ' .  $channel . "\n" .
276
+            $response = 'Message not sent to: ' . $channel . "\n" .
277 277
                     '- Does the channel exist?' . "\n" .
278 278
                     '- Is the bot an admin of the channel?';
279 279
         }
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
         }
324 324
         $callback_path = 'Longman\TelegramBot\Request';
325 325
         $callback_function = 'send' . $type;
326
-        if (! method_exists($callback_path, $callback_function)) {
326
+        if (!method_exists($callback_path, $callback_function)) {
327 327
             throw new TelegramException('Methods: ' . $callback_function . ' not found in class Request.');
328 328
         }
329 329
 
Please login to merge, or discard this patch.
src/Entities/Chat.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -118,11 +118,11 @@
 block discarded – undo
118 118
         if ($this->isPrivateChat()) {
119 119
             if (is_null($this->username)) {
120 120
                 if (!is_null($this->last_name)) {
121
-                    return $this->first_name.' '.$this->last_name;
121
+                    return $this->first_name . ' ' . $this->last_name;
122 122
                 }
123 123
                 return $this->first_name;
124 124
             }
125
-            return '@'.$this->username;
125
+            return '@' . $this->username;
126 126
         }
127 127
         return $this->getTitle();
128 128
     }
Please login to merge, or discard this patch.
src/Entities/Message.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@
 block discarded – undo
188 188
             $this->type = 'Voice';
189 189
         }
190 190
 
191
-        $this->caption = isset($data['caption']) ? $data['caption'] : null;//string
191
+        $this->caption = isset($data['caption']) ? $data['caption'] : null; //string
192 192
 
193 193
         $this->contact = isset($data['contact']) ? $data['contact'] : null;
194 194
         if (!empty($this->contact)) {
Please login to merge, or discard this patch.