Completed
Pull Request — master (#7)
by
unknown
01:37
created
src/Smoqadam/Keyboard/Inline.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
   /**
14 14
   * Create new row.
15 15
   *
16
-  * @return object
16
+  * @return Inline
17 17
   */
18 18
   public function addRow(){
19 19
     $this->current_row++;
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
   * @param string $switch_inline_query Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot‘s username and the specified inline query in the input field. Can be empty, in which case just the bot’s username will be inserted.
31 31
   * @param string $switch_inline_query_current_chat Optional. If set, pressing the button will insert the bot‘s username and the specified inline query in the current chat's input field. Can be empty, in which case only the bot’s username will be inserted.
32 32
   * @param string $callback_game Optional. Description of the game that will be launched when the user presses the button. NOTE: This type of button must always be the first button in the first row.
33
-  * @return object
33
+  * @return Inline
34 34
   */
35 35
   public function addButton(string $text, string $url = '', string $callback_data = '', string $switch_inline_query = '', string $switch_inline_query_current_chat = '', string $callback_game = ''){
36 36
     $btn['text'] = $text;
Please login to merge, or discard this patch.
Braces   +13 added lines, -12 removed lines patch added patch discarded remove patch
@@ -34,18 +34,19 @@
 block discarded – undo
34 34
   */
35 35
   public function addButton(string $text, string $url = '', string $callback_data = '', string $switch_inline_query = '', string $switch_inline_query_current_chat = '', string $callback_game = ''){
36 36
     $btn['text'] = $text;
37
-    if($url != '')
38
-      $btn['url'] = $url;
39
-    elseif($callback_data != '')
40
-      $btn['callback_data'] = $callback_data;
41
-    elseif($switch_inline_query != '')
42
-     $btn['switch_inline_query'] = $switch_inline_query;
43
-    elseif($switch_inline_query_current_chat != '')
44
-      $btn['switch_inline_query_current_chat'] = $switch_inline_query_current_chat;
45
-    elseif($callback_game != '')
46
-      $btn['callback_game'] = $callback_game;
47
-    else
48
-      $btn['callback_data'] = $text;
37
+    if($url != '') {
38
+          $btn['url'] = $url;
39
+    } elseif($callback_data != '') {
40
+          $btn['callback_data'] = $callback_data;
41
+    } elseif($switch_inline_query != '') {
42
+         $btn['switch_inline_query'] = $switch_inline_query;
43
+    } elseif($switch_inline_query_current_chat != '') {
44
+          $btn['switch_inline_query_current_chat'] = $switch_inline_query_current_chat;
45
+    } elseif($callback_game != '') {
46
+          $btn['callback_game'] = $callback_game;
47
+    } else {
48
+          $btn['callback_data'] = $text;
49
+    }
49 50
       
50 51
     $this->inline_keyboard[$this->current_row][] = $btn;
51 52
     
Please login to merge, or discard this patch.
src/Smoqadam/Telegram.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 
220 220
     /**
221 221
      * execute telegram api commands
222
-     * @param $command
222
+     * @param string $command
223 223
      * @param array $params
224 224
      */
225 225
     private function exec($command, $params = []) {
@@ -254,9 +254,9 @@  discard block
 block discarded – undo
254 254
 
255 255
     /**
256 256
      * get the $url content with CURL
257
-     * @param $url
257
+     * @param string $url
258 258
      * @param $params
259
-     * @return mixed
259
+     * @return string
260 260
      */
261 261
     private function curl_get_contents($url, $params) {
262 262
         $ch = curl_init();
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
     }
299 299
 
300 300
     /**
301
-     * @param null $offset
301
+     * @param integer $offset
302 302
      * @param int $limit
303 303
      * @param int $timeout
304 304
      */
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 
454 454
     /**
455 455
      * send chat action : Telegram::ACTION_TYPING , ...
456
-     * @param $action
456
+     * @param string $action
457 457
      * @param null $chat_id
458 458
      */
459 459
     public function sendChatAction($action, $chat_id = null) {
Please login to merge, or discard this patch.
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -116,8 +116,7 @@  discard block
 block discarded – undo
116 116
             $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
117 117
 
118 118
             return $conn;
119
-        }
120
-        catch(PDOException $e)
119
+        } catch(PDOException $e)
121 120
         {
122 121
             return $e->getMessage();
123 122
         }
@@ -146,8 +145,9 @@  discard block
 block discarded – undo
146 145
 
147 146
             $this->processPayload($result);
148 147
 
149
-            if ($sleep !== false)
150
-                sleep($sleep);
148
+            if ($sleep !== false) {
149
+                            sleep($sleep);
150
+            }
151 151
         }
152 152
     }
153 153
 
@@ -301,8 +301,9 @@  discard block
 block discarded – undo
301 301
      */
302 302
     public function getChatId($chat_id = null) {
303 303
         try {
304
-            if ($chat_id)
305
-                return $chat_id;
304
+            if ($chat_id) {
305
+                            return $chat_id;
306
+            }
306 307
 
307 308
             if( isset($this->result->message) ) {
308 309
                 return $this->result->message->chat->id;
Please login to merge, or discard this patch.