Completed
Push — feature/improve-code ( 7d6b6d...e986a1 )
by Avtandil
15:08
created
examples/Commands/MarkdownCommand.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,6 @@
 block discarded – undo
12 12
 
13 13
 use Longman\TelegramBot\Commands\UserCommand;
14 14
 use Longman\TelegramBot\Request;
15
-use Longman\TelegramBot\Entities\ReplyKeyboardMarkup;
16 15
 
17 16
 /**
18 17
  * User "/markdown" command
Please login to merge, or discard this patch.
src/Commands/SystemCommands/GenericmessageCommand.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
     /**
32 32
      * Execution if MySQL is required but not available
33 33
      *
34
-     * @return boolean
34
+     * @return \Longman\TelegramBot\Entities\ServerResponse
35 35
      */
36 36
     public function executeNoDb()
37 37
     {
Please login to merge, or discard this patch.
src/Commands/UserCommands/SurveyCommand.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,6 @@
 block discarded – undo
14 14
 use Longman\TelegramBot\Conversation;
15 15
 use Longman\TelegramBot\Commands\UserCommand;
16 16
 use Longman\TelegramBot\Entities\ForceReply;
17
-use Longman\TelegramBot\Entities\ReplyKeyboardHide;
18 17
 use Longman\TelegramBot\Entities\ReplyKeyboardMarkup;
19 18
 
20 19
 /**
Please login to merge, or discard this 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/WeatherCommand.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
      *
69 69
      * @param array $data
70 70
      *
71
-     * @return bool|string
71
+     * @return false|string
72 72
      */
73 73
     private function getWeatherString(array $data)
74 74
     {
Please login to merge, or discard this patch.
src/Commands/UserCommands/WhoamiCommand.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,6 @@
 block discarded – undo
13 13
 namespace Longman\TelegramBot\Commands\UserCommands;
14 14
 
15 15
 use Longman\TelegramBot\Commands\UserCommand;
16
-use Longman\TelegramBot\Entities\File;
17 16
 use Longman\TelegramBot\Request;
18 17
 
19 18
 /**
Please login to merge, or discard this 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/Request.php 2 patches
Doc Comments   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      * @param string     $action Action to execute
166 166
      * @param array|null $data   Data to attach to the execution
167 167
      *
168
-     * @return mixed Result of the HTTP Request
168
+     * @return \Psr\Http\Message\StreamInterface Result of the HTTP Request
169 169
      */
170 170
     public static function execute($action, array $data = null)
171 171
     {
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
     /**
306 306
      * Get me
307 307
      *
308
-     * @return mixed
308
+     * @return ServerResponse
309 309
      */
310 310
     public static function getMe()
311 311
     {
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
      *
345 345
      * @param array $data
346 346
      *
347
-     * @return mixed
347
+     * @return ServerResponse
348 348
      */
349 349
     public static function forwardMessage(array $data)
350 350
     {
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
      * @param array $data
362 362
      * @param string $file
363 363
      *
364
-     * @return mixed
364
+     * @return ServerResponse
365 365
      */
366 366
     public static function sendPhoto(array $data, $file = null)
367 367
     {
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
      * @param array  $data
383 383
      * @param string $file
384 384
      *
385
-     * @return mixed
385
+     * @return ServerResponse
386 386
      */
387 387
     public static function sendAudio(array $data, $file = null)
388 388
     {
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
      * @param array  $data
404 404
      * @param string $file
405 405
      *
406
-     * @return mixed
406
+     * @return ServerResponse
407 407
      */
408 408
     public static function sendDocument(array $data, $file = null)
409 409
     {
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
      * @param array  $data
425 425
      * @param string $file
426 426
      *
427
-     * @return mixed
427
+     * @return ServerResponse
428 428
      */
429 429
     public static function sendSticker(array $data, $file = null)
430 430
     {
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
      * @param array  $data
446 446
      * @param string $file
447 447
      *
448
-     * @return mixed
448
+     * @return ServerResponse
449 449
      */
450 450
     public static function sendVideo(array $data, $file = null)
451 451
     {
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
      * @param array  $data
467 467
      * @param string $file
468 468
      *
469
-     * @return mixed
469
+     * @return ServerResponse
470 470
      */
471 471
     public static function sendVoice(array $data, $file = null)
472 472
     {
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
      *
487 487
      * @param array $data
488 488
      *
489
-     * @return mixed
489
+     * @return ServerResponse
490 490
      */
491 491
     public static function sendLocation(array $data)
492 492
     {
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
      *
503 503
      * @param array $data
504 504
      *
505
-     * @return mixed
505
+     * @return ServerResponse
506 506
      */
507 507
     public static function sendVenue(array $data)
508 508
     {
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
      *
519 519
      * @param array $data
520 520
      *
521
-     * @return mixed
521
+     * @return ServerResponse
522 522
      */
523 523
     public static function sendContact(array $data)
524 524
     {
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
      *
535 535
      * @param array $data
536 536
      *
537
-     * @return mixed
537
+     * @return ServerResponse
538 538
      */
539 539
     public static function sendChatAction(array $data)
540 540
     {
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
      *
551 551
      * @param array $data
552 552
      *
553
-     * @return mixed
553
+     * @return ServerResponse
554 554
      */
555 555
     public static function getUserProfilePhotos(array $data)
556 556
     {
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
      *
571 571
      * @param array $data
572 572
      *
573
-     * @return mixed
573
+     * @return ServerResponse
574 574
      */
575 575
     public static function getUpdates(array $data)
576 576
     {
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
      * @param string $url
584 584
      * @param string $file
585 585
      *
586
-     * @return mixed
586
+     * @return ServerResponse
587 587
      */
588 588
     public static function setWebhook($url = '', $file = null)
589 589
     {
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
      *
602 602
      * @param array $data
603 603
      *
604
-     * @return mixed
604
+     * @return ServerResponse
605 605
      */
606 606
     public static function getFile(array $data)
607 607
     {
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
      *
618 618
      * @param array $data
619 619
      *
620
-     * @return mixed
620
+     * @return ServerResponse
621 621
      */
622 622
     public static function kickChatMember(array $data)
623 623
     {
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
      *
634 634
      * @param array $data
635 635
      *
636
-     * @return mixed
636
+     * @return ServerResponse
637 637
      */
638 638
     public static function leaveChat(array $data)
639 639
     {
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
      *
650 650
      * @param array $data
651 651
      *
652
-     * @return mixed
652
+     * @return ServerResponse
653 653
      */
654 654
     public static function unbanChatMember(array $data)
655 655
     {
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
      *
668 668
      * @param array $data
669 669
      *
670
-     * @return mixed
670
+     * @return ServerResponse
671 671
      */
672 672
     public static function getChat(array $data)
673 673
     {
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
      *
686 686
      * @param array $data
687 687
      *
688
-     * @return mixed
688
+     * @return ServerResponse
689 689
      */
690 690
     public static function getChatAdministrators(array $data)
691 691
     {
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
      *
704 704
      * @param array $data
705 705
      *
706
-     * @return mixed
706
+     * @return ServerResponse
707 707
      */
708 708
     public static function getChatMembersCount(array $data)
709 709
     {
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
      *
722 722
      * @param array $data
723 723
      *
724
-     * @return mixed
724
+     * @return ServerResponse
725 725
      */
726 726
     public static function getChatMember(array $data)
727 727
     {
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
      *
738 738
      * @param array $data
739 739
      *
740
-     * @return mixed
740
+     * @return ServerResponse
741 741
      */
742 742
     public static function answerCallbackQuery(array $data)
743 743
     {
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
      *
754 754
      * @param array $data
755 755
      *
756
-     * @return mixed
756
+     * @return ServerResponse
757 757
      */
758 758
     public static function answerInlineQuery(array $data)
759 759
     {
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
      *
770 770
      * @param array $data
771 771
      *
772
-     * @return mixed
772
+     * @return ServerResponse
773 773
      */
774 774
     public static function editMessageText(array $data)
775 775
     {
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
      *
786 786
      * @param array $data
787 787
      *
788
-     * @return mixed
788
+     * @return ServerResponse
789 789
      */
790 790
     public static function editMessageCaption(array $data)
791 791
     {
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
      *
802 802
      * @param array $data
803 803
      *
804
-     * @return mixed
804
+     * @return ServerResponse
805 805
      */
806 806
     public static function editMessageReplyMarkup(array $data)
807 807
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@
 block discarded – undo
153 153
                 'first_name' => 'botname',
154 154
                 'username'   => 'namebot',
155 155
             ];
156
-            $data['chat']       = ['id' => $data['chat_id']];
156
+            $data['chat'] = ['id' => $data['chat_id']];
157 157
 
158 158
             $fake_response['result'] = $data;
159 159
         }
Please login to merge, or discard this patch.
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/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/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.