Completed
Push — feature/improve-code ( 7d6b6d...e986a1 )
by Avtandil
15:08
created
src/Commands/AdminCommands/SendtochannelCommand.php 2 patches
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.
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.
src/Entities/Message.php 2 patches
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.
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
     /**
476 476
      * Get date
477 477
      *
478
-     * @return mixed
478
+     * @return integer|null
479 479
      */
480 480
     public function getDate()
481 481
     {
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
     /**
516 516
      * Get forward date
517 517
      *
518
-     * @return mixed
518
+     * @return integer|null
519 519
      */
520 520
     public function getForwardDate()
521 521
     {
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
     /**
526 526
      * Get edit date
527 527
      *
528
-     * @return mixed
528
+     * @return integer|null
529 529
      */
530 530
     public function getEditDate()
531 531
     {
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
     /**
667 667
      * Get new chat participant
668 668
      *
669
-     * @return mixed
669
+     * @return User|null
670 670
      */
671 671
     public function getNewChatParticipant()
672 672
     {
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
     /**
677 677
      * Get left chat participant
678 678
      *
679
-     * @return mixed
679
+     * @return User|null
680 680
      */
681 681
     public function getLeftChatParticipant()
682 682
     {
Please login to merge, or discard this patch.
examples/Commands/ImageCommand.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,8 +47,8 @@
 block discarded – undo
47 47
     //return random picture from the telegram->getUploadPath();
48 48
     
49 49
     private function ShowRandomImage($dir) {
50
-		$image_list = scandir($dir);
51
-		return $dir . "/" . $image_list[mt_rand(2, count($image_list) - 1)];
52
-	}
50
+        $image_list = scandir($dir);
51
+        return $dir . "/" . $image_list[mt_rand(2, count($image_list) - 1)];
52
+    }
53 53
 
54 54
 }
Please login to merge, or discard this patch.
examples/Commands/KeyboardCommand.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -45,19 +45,19 @@  discard block
 block discarded – undo
45 45
         $keyboards = [];
46 46
 
47 47
         //0
48
-        $keyboard[] = ['7','8','9'];
49
-        $keyboard[] = ['4','5','6'];
50
-        $keyboard[] = ['1','2','3'];
51
-        $keyboard[] = [' ','0',' '];
48
+        $keyboard[] = ['7', '8', '9'];
49
+        $keyboard[] = ['4', '5', '6'];
50
+        $keyboard[] = ['1', '2', '3'];
51
+        $keyboard[] = [' ', '0', ' '];
52 52
 
53 53
         $keyboards[] = $keyboard;
54 54
         unset($keyboard);
55 55
 
56 56
         //1
57
-        $keyboard[] = ['7','8','9','+'];
58
-        $keyboard[] = ['4','5','6','-'];
59
-        $keyboard[] = ['1','2','3','*'];
60
-        $keyboard[] = [' ','0',' ','/'];
57
+        $keyboard[] = ['7', '8', '9', '+'];
58
+        $keyboard[] = ['4', '5', '6', '-'];
59
+        $keyboard[] = ['1', '2', '3', '*'];
60
+        $keyboard[] = [' ', '0', ' ', '/'];
61 61
 
62 62
         $keyboards[] = $keyboard;
63 63
         unset($keyboard);
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         //3
74 74
         $keyboard[] = ['A'];
75 75
         $keyboard[] = ['B'];
76
-        $keyboard[] = ['C','D'];
76
+        $keyboard[] = ['C', 'D'];
77 77
 
78 78
         $keyboards[] = $keyboard;
79 79
         unset($keyboard);
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
         $data['reply_markup'] = new ReplyKeyboardMarkup(
97 97
             [
98
-                'keyboard' => $keyboards[1] ,
98
+                'keyboard' => $keyboards[1],
99 99
                 'resize_keyboard' => true,
100 100
                 'one_time_keyboard' => false,
101 101
                 'selective' => false
Please login to merge, or discard this patch.
examples/getUpdatesCLI.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,10 +21,10 @@
 block discarded – undo
21 21
 
22 22
 // Enter your MySQL database credentials
23 23
 $mysql_credentials = [
24
-   'host'     => 'localhost',
25
-   'user'     => 'dbuser',
26
-   'password' => 'dbpass',
27
-   'database' => 'dbname',
24
+    'host'     => 'localhost',
25
+    'user'     => 'dbuser',
26
+    'password' => 'dbpass',
27
+    'database' => 'dbname',
28 28
 ];
29 29
 
30 30
 try {
Please login to merge, or discard this patch.
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/Telegram.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -729,7 +729,7 @@
 block discarded – undo
729 729
     /**
730 730
      * Unset Webhook for bot
731 731
      *
732
-     * @return mixed
732
+     * @return ServerResponse
733 733
      * @throws \Longman\TelegramBot\Exception\TelegramException
734 734
      */
735 735
     public function unsetWebHook()
Please login to merge, or discard this patch.
src/Entities/Entity.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
     /**
46 46
      * Reflect
47 47
      *
48
-     * @param null $object
48
+     * @param Entity $object
49 49
      * @return array
50 50
      */
51 51
     public function reflect($object = null)
Please login to merge, or discard this patch.
src/Entities/ServerResponse.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
      * ServerResponse constructor.
35 35
      *
36 36
      * @param array $data
37
-     * @param       $bot_name
37
+     * @param       string|null $bot_name
38 38
      */
39 39
     public function __construct(array $data, $bot_name)
40 40
     {
Please login to merge, or discard this patch.