Passed
Branch master (792fcf)
by Mohammadreza
09:50
created
tgmethod.php 2 patches
Spacing   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 class tgmethod
8 8
 {
9 9
     // Telegram Token
10
-    protected $token=null;
10
+    protected $token = null;
11 11
 
12 12
     protected $ch;
13 13
 
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
      */
19 19
     public function  __construct($api_token)
20 20
     {
21
-        $this->token=$api_token;
22
-        if (strlen($this->token)==45 && count(explode(':',$this->token))==2){
21
+        $this->token = $api_token;
22
+        if (strlen($this->token) == 45 && count(explode(':', $this->token)) == 2) {
23 23
             $this->ch = curl_init();
24 24
             return true;
25 25
         }
@@ -41,19 +41,19 @@  discard block
 block discarded – undo
41 41
      * @param array $datas  Datas for Send to Telegram
42 42
      * @return object
43 43
      */
44
-    private function make_http_request($method,$datas=[]){
44
+    private function make_http_request($method, $datas = []) {
45 45
         $url = "https://api.telegram.org/bot".$this->token."/".$method;
46
-        curl_setopt($this->ch,CURLOPT_RETURNTRANSFER,true);
47
-        curl_setopt($this->ch,CURLOPT_POSTFIELDS,($datas));
48
-        curl_setopt($this->ch,CURLOPT_URL,$url);
46
+        curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
47
+        curl_setopt($this->ch, CURLOPT_POSTFIELDS, ($datas));
48
+        curl_setopt($this->ch, CURLOPT_URL, $url);
49 49
         $res = curl_exec($this->ch);
50
-        if(curl_error($this->ch)){
50
+        if (curl_error($this->ch)) {
51 51
             var_dump(curl_error($this->ch));
52
-        }else{
53
-            $res=json_decode($res);
54
-            if ($res->ok){
55
-                $res=$res->result;
56
-                $res->ok=true;
52
+        } else {
53
+            $res = json_decode($res);
54
+            if ($res->ok) {
55
+                $res = $res->result;
56
+                $res->ok = true;
57 57
             }
58 58
 
59 59
             return $res;
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      * A simple method for testing your bot's auth token
81 81
      * @return object
82 82
      */
83
-    public function getme(){
83
+    public function getme() {
84 84
         return $this->make_http_request(__FUNCTION__);
85 85
     }
86 86
 
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
      * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound.
98 98
      * @return object
99 99
      */
100
-    public function sendMessage($chat_id,$text,$reply_to_message_id=null,$reply_markup=null,$parse_mode=null,$disable_web_page_preview=null,$disable_notification=null){
101
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
100
+    public function sendMessage($chat_id, $text, $reply_to_message_id = null, $reply_markup = null, $parse_mode = null, $disable_web_page_preview = null, $disable_notification = null) {
101
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
102 102
     }
103 103
 
104 104
 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
      * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound.
112 112
      * @return object
113 113
      */
114
-    public function forwardMessage($chat_id,$from_chat_id,$message_id,$disable_notification=null){
115
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
114
+    public function forwardMessage($chat_id, $from_chat_id, $message_id, $disable_notification = null) {
115
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
116 116
     }
117 117
 
118 118
 
@@ -127,8 +127,8 @@  discard block
 block discarded – undo
127 127
      * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound.
128 128
      * @return object
129 129
      */
130
-    public function sendPhoto($chat_id,$photo,$caption=null,$reply_to_message_id=null,$reply_markup=null,$disable_notification=null){
131
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
130
+    public function sendPhoto($chat_id, $photo, $caption = null, $reply_to_message_id = null, $reply_markup = null, $disable_notification = null) {
131
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
132 132
     }
133 133
 
134 134
 
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
      * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound.
147 147
      * @return object
148 148
      */
149
-    public function sendAudio($chat_id,$audio,$caption=null,$reply_to_message_id=null,$reply_markup=null,$title=null,$duration=null,$performer=null,$disable_notification=null){
150
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
149
+    public function sendAudio($chat_id, $audio, $caption = null, $reply_to_message_id = null, $reply_markup = null, $title = null, $duration = null, $performer = null, $disable_notification = null) {
150
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
151 151
     }
152 152
 
153 153
 
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
      * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound.
163 163
      * @return object
164 164
      */
165
-    public function sendDocument($chat_id,$document,$caption=null,$reply_to_message_id=null,$reply_markup=null,$disable_notification=null){
166
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
165
+    public function sendDocument($chat_id, $document, $caption = null, $reply_to_message_id = null, $reply_markup = null, $disable_notification = null) {
166
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
167 167
     }
168 168
 
169 169
 
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
      * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound.
182 182
      * @return object
183 183
      */
184
-    public function sendVideo($chat_id,$video,$caption=null,$reply_to_message_id=null,$reply_markup=null,$duration=null,$width=null,$height=null,$disable_notification=null){
185
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
184
+    public function sendVideo($chat_id, $video, $caption = null, $reply_to_message_id = null, $reply_markup = null, $duration = null, $width = null, $height = null, $disable_notification = null) {
185
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
186 186
     }
187 187
 
188 188
 
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
      * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound.
199 199
      * @return object
200 200
      */
201
-    public function sendVoice($chat_id,$voice,$caption=null,$reply_to_message_id=null,$reply_markup=null,$duration=null,$disable_notification=null){
202
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
201
+    public function sendVoice($chat_id, $voice, $caption = null, $reply_to_message_id = null, $reply_markup = null, $duration = null, $disable_notification = null) {
202
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
203 203
     }
204 204
 
205 205
 
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
      * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound.
216 216
      * @return object
217 217
      */
218
-    public function sendVideoNote($chat_id,$video_note,$reply_to_message_id=null,$reply_markup=null,$duration=null,$length=null,$disable_notification=null){
219
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
218
+    public function sendVideoNote($chat_id, $video_note, $reply_to_message_id = null, $reply_markup = null, $duration = null, $length = null, $disable_notification = null) {
219
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
220 220
     }
221 221
 
222 222
 
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
      * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound.
230 230
      * @return object
231 231
      */
232
-    public function sendMediaGroup($chat_id,$media,$reply_to_message_id=null,$disable_notification=null){
233
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
232
+    public function sendMediaGroup($chat_id, $media, $reply_to_message_id = null, $disable_notification = null) {
233
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
234 234
     }
235 235
 
236 236
 
@@ -246,8 +246,8 @@  discard block
 block discarded – undo
246 246
      * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound.
247 247
      * @return object
248 248
      */
249
-    public function sendLocation($chat_id,$latitude,$longitude,$reply_to_message_id=null,$reply_markup=null,$live_period=null,$disable_notification=null){
250
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
249
+    public function sendLocation($chat_id, $latitude, $longitude, $reply_to_message_id = null, $reply_markup = null, $live_period = null, $disable_notification = null) {
250
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
251 251
     }
252 252
 
253 253
 
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
      * @param json $reply_markup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
263 263
      * @return object
264 264
      */
265
-    public function editMessageLiveLocation($chat_id=null,$message_id=null,$inline_message_id=null,$latitude,$longitude,$reply_markup=null){
266
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
265
+    public function editMessageLiveLocation($chat_id = null, $message_id = null, $inline_message_id = null, $latitude, $longitude, $reply_markup = null) {
266
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
267 267
     }
268 268
 
269 269
 
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
      * @param json $reply_markup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
277 277
      * @return object
278 278
      */
279
-    public function stopMessageLiveLocation($chat_id=null,$message_id=null,$inline_message_id=null,$reply_markup=null)
279
+    public function stopMessageLiveLocation($chat_id = null, $message_id = null, $inline_message_id = null, $reply_markup = null)
280 280
     {
281
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
281
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
282 282
     }
283 283
     
284 284
     
@@ -296,9 +296,9 @@  discard block
 block discarded – undo
296 296
      * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound.
297 297
      * @return object
298 298
      */
299
-    public function sendVenue($chat_id,$latitude,$longitude,$title,$address,$reply_to_message_id=null,$reply_markup=null,$foursquare_id=null,$disable_notification=null)
299
+    public function sendVenue($chat_id, $latitude, $longitude, $title, $address, $reply_to_message_id = null, $reply_markup = null, $foursquare_id = null, $disable_notification = null)
300 300
     {
301
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
301
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
302 302
     }
303 303
     
304 304
     
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
      * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound.
315 315
      * @return object
316 316
      */
317
-    public function sendContact($chat_id,$phone_number,$first_name,$last_name=null,$reply_to_message_id=null,$reply_markup=null,$disable_notification=null)
317
+    public function sendContact($chat_id, $phone_number, $first_name, $last_name = null, $reply_to_message_id = null, $reply_markup = null, $disable_notification = null)
318 318
     {
319
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
319
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
320 320
     }
321 321
 
322 322
 
@@ -327,9 +327,9 @@  discard block
 block discarded – undo
327 327
      * @param string $action
328 328
      * @return object
329 329
      */
330
-    public function sendChatAction($chat_id,$action)
330
+    public function sendChatAction($chat_id, $action)
331 331
     {
332
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
332
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
333 333
     }
334 334
 
335 335
 
@@ -341,9 +341,9 @@  discard block
 block discarded – undo
341 341
      * @param int $offset Sequential number of the first photo to be returned. By default, all photos are returned.
342 342
      * @return object
343 343
      */
344
-    public function getUserProfilePhotos($user_id,$limit=null,$offset=null)
344
+    public function getUserProfilePhotos($user_id, $limit = null, $offset = null)
345 345
     {
346
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
346
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
347 347
     }
348 348
 
349 349
 
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
      */
356 356
     public function getFile($file_id)
357 357
     {
358
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
358
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
359 359
     }
360 360
 
361 361
 
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
     public function getFileLink($file_path)
368 368
     {
369 369
         if (is_object($file_path))
370
-            $file_path=$file_path->file_path;
370
+            $file_path = $file_path->file_path;
371 371
         return 'https://api.telegram.org/file/bot'.$this->token.'/'.$file_path;
372 372
     }
373 373
 
@@ -380,9 +380,9 @@  discard block
 block discarded – undo
380 380
      * @param int $until_date Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever
381 381
      * @return object
382 382
      */
383
-    public function kickChatMember($chat_id,$user_id,$until_date=null)
383
+    public function kickChatMember($chat_id, $user_id, $until_date = null)
384 384
     {
385
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
385
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
386 386
     }
387 387
 
388 388
 
@@ -393,9 +393,9 @@  discard block
 block discarded – undo
393 393
      * @param int $user_id Unique identifier of the target user
394 394
      * @return object
395 395
      */
396
-    public function unbanChatMember($chat_id,$user_id)
396
+    public function unbanChatMember($chat_id, $user_id)
397 397
     {
398
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
398
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
399 399
     }
400 400
 
401 401
 
@@ -411,9 +411,9 @@  discard block
 block discarded – undo
411 411
      * @param int $until_date Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever
412 412
      * @return object
413 413
      */
414
-    public function restrictChatMember($chat_id,$user_id,$can_send_messages=null,$can_send_media_messages=null,$can_send_other_messages=null,$can_add_web_page_previews=null,$until_date=null)
414
+    public function restrictChatMember($chat_id, $user_id, $can_send_messages = null, $can_send_media_messages = null, $can_send_other_messages = null, $can_add_web_page_previews = null, $until_date = null)
415 415
     {
416
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
416
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
417 417
     }
418 418
 
419 419
 
@@ -432,9 +432,9 @@  discard block
 block discarded – undo
432 432
      * @param bool $can_restrict_members Pass True, if the administrator can restrict, ban or unban chat members
433 433
      * @return object
434 434
      */
435
-    public function promoteChatMember($chat_id,$user_id,$can_post_messages=null,$can_edit_messages=null,$can_delete_messages=null,$can_change_info=null,$can_pin_messages=null,$can_invite_users=null,$can_promote_members=null,$can_restrict_members=null)
435
+    public function promoteChatMember($chat_id, $user_id, $can_post_messages = null, $can_edit_messages = null, $can_delete_messages = null, $can_change_info = null, $can_pin_messages = null, $can_invite_users = null, $can_promote_members = null, $can_restrict_members = null)
436 436
     {
437
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
437
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
438 438
     }
439 439
 
440 440
 
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
      */
447 447
     public function exportChatInviteLink($chat_id)
448 448
     {
449
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
449
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
450 450
     }
451 451
 
452 452
 
@@ -457,9 +457,9 @@  discard block
 block discarded – undo
457 457
      * @param file $photo New chat photo, uploaded using multipart/form-data
458 458
      * @return object
459 459
      */
460
-    public function setChatPhoto($chat_id,$photo)
460
+    public function setChatPhoto($chat_id, $photo)
461 461
     {
462
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
462
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
463 463
     }
464 464
 
465 465
 
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
      */
472 472
     public function deleteChatPhoto($chat_id)
473 473
     {
474
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
474
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
475 475
     }
476 476
 
477 477
 
@@ -482,9 +482,9 @@  discard block
 block discarded – undo
482 482
      * @param string $title New chat title, 1-255 characters
483 483
      * @return object
484 484
      */
485
-    public function setChatTitle($chat_id,$title)
485
+    public function setChatTitle($chat_id, $title)
486 486
     {
487
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
487
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
488 488
     }
489 489
 
490 490
 
@@ -495,9 +495,9 @@  discard block
 block discarded – undo
495 495
      * @param string $description New chat description, 0-255 characters
496 496
      * @return object
497 497
      */
498
-    public function setChatDescription($chat_id,$description)
498
+    public function setChatDescription($chat_id, $description)
499 499
     {
500
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
500
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
501 501
     }
502 502
 
503 503
 
@@ -509,9 +509,9 @@  discard block
 block discarded – undo
509 509
      * @param bool $disable_notification Pass True, if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels
510 510
      * @return object
511 511
      */
512
-    public function pinChatMessage($chat_id,$message_id,$disable_notification=null)
512
+    public function pinChatMessage($chat_id, $message_id, $disable_notification = null)
513 513
     {
514
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
514
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
515 515
     }
516 516
 
517 517
 
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
      */
524 524
     public function unpinChatMessage($chat_id)
525 525
     {
526
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
526
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
527 527
     }
528 528
 
529 529
 
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
      */
536 536
     public function leaveChat($chat_id)
537 537
     {
538
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
538
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
539 539
     }
540 540
 
541 541
 
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
      */
548 548
     public function getChat($chat_id)
549 549
     {
550
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
550
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
551 551
     }
552 552
 
553 553
 
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
      */
560 560
     public function getChatAdministrators($chat_id)
561 561
     {
562
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
562
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
563 563
     }
564 564
 
565 565
 
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
      */
572 572
     public function getChatMembersCount($chat_id)
573 573
     {
574
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
574
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
575 575
     }
576 576
 
577 577
 
@@ -582,9 +582,9 @@  discard block
 block discarded – undo
582 582
      * @param int $user_id Unique identifier of the target user
583 583
      * @return object
584 584
      */
585
-    public function getChatMember($chat_id,$user_id)
585
+    public function getChatMember($chat_id, $user_id)
586 586
     {
587
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
587
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
588 588
     }
589 589
 
590 590
 
@@ -595,9 +595,9 @@  discard block
 block discarded – undo
595 595
      * @param int $sticker_set_name Name of the sticker set to be set as the group sticker set
596 596
      * @return object
597 597
      */
598
-    public function setChatStickerSet($chat_id,$sticker_set_name)
598
+    public function setChatStickerSet($chat_id, $sticker_set_name)
599 599
     {
600
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
600
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
601 601
     }
602 602
 
603 603
 
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
      */
610 610
     public function deleteChatStickerSet($chat_id)
611 611
     {
612
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
612
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
613 613
     }
614 614
 
615 615
 
@@ -623,9 +623,9 @@  discard block
 block discarded – undo
623 623
      * @param int $cache_time The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0.
624 624
      * @return object
625 625
      */
626
-    public function answerCallbackQuery($callback_query_id,$text=null,$show_alert=null,$url=null,$cache_time=null)
626
+    public function answerCallbackQuery($callback_query_id, $text = null, $show_alert = null, $url = null, $cache_time = null)
627 627
     {
628
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
628
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
629 629
     }
630 630
 
631 631
 
@@ -641,9 +641,9 @@  discard block
 block discarded – undo
641 641
      * @param string $switch_pm_parameter Deep-linking parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed.
642 642
      * @return object
643 643
      */
644
-    public function answerInlineQuery($inline_query_id,$results,$cache_time=null,$is_personal=null,$next_offset=null,$switch_pm_text=null,$switch_pm_parameter=null)
644
+    public function answerInlineQuery($inline_query_id, $results, $cache_time = null, $is_personal = null, $next_offset = null, $switch_pm_text = null, $switch_pm_parameter = null)
645 645
     {
646
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
646
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
647 647
     }
648 648
     
649 649
     
@@ -659,9 +659,9 @@  discard block
 block discarded – undo
659 659
      * @param bool $disable_web_page_preview Disables link previews for links in this message
660 660
      * @return object
661 661
      */
662
-    public function editMessageText($chat_id,$message_id,$text,$inline_message_id=null,$reply_markup=null,$parse_mode=null,$disable_web_page_preview=null)
662
+    public function editMessageText($chat_id, $message_id, $text, $inline_message_id = null, $reply_markup = null, $parse_mode = null, $disable_web_page_preview = null)
663 663
     {
664
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
664
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
665 665
     }
666 666
 
667 667
 
@@ -675,9 +675,9 @@  discard block
 block discarded – undo
675 675
      * @param json $reply_markup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
676 676
      * @return object
677 677
      */
678
-    public function editMessageCaption($chat_id,$message_id,$caption,$inline_message_id=null,$reply_markup=null)
678
+    public function editMessageCaption($chat_id, $message_id, $caption, $inline_message_id = null, $reply_markup = null)
679 679
     {
680
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
680
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
681 681
     }
682 682
 
683 683
 
@@ -690,9 +690,9 @@  discard block
 block discarded – undo
690 690
      * @param json $reply_markup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
691 691
      * @return object
692 692
      */
693
-    public function editMessageReplyMarkup($chat_id,$message_id,$inline_message_id=null,$reply_markup=null)
693
+    public function editMessageReplyMarkup($chat_id, $message_id, $inline_message_id = null, $reply_markup = null)
694 694
     {
695
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
695
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
696 696
     }
697 697
 
698 698
 
@@ -703,9 +703,9 @@  discard block
 block discarded – undo
703 703
      * @param int $message_id Identifier of the message to delete
704 704
      * @return object
705 705
      */
706
-    public function deleteMessage($chat_id,$message_id)
706
+    public function deleteMessage($chat_id, $message_id)
707 707
     {
708
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
708
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
709 709
     }
710 710
 
711 711
 
@@ -719,8 +719,8 @@  discard block
 block discarded – undo
719 719
      * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound.
720 720
      * @return object
721 721
      */
722
-    public function sendSticker($chat_id,$sticker,$reply_to_message_id=null,$reply_markup=null,$disable_notification=null){
723
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
722
+    public function sendSticker($chat_id, $sticker, $reply_to_message_id = null, $reply_markup = null, $disable_notification = null) {
723
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
724 724
     }
725 725
 
726 726
 
@@ -730,8 +730,8 @@  discard block
 block discarded – undo
730 730
      * @param string $name Name of the sticker set
731 731
      * @return object
732 732
      */
733
-    public function getStickerSet($name){
734
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
733
+    public function getStickerSet($name) {
734
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
735 735
     }
736 736
 
737 737
 
@@ -742,8 +742,8 @@  discard block
 block discarded – undo
742 742
      * @param file $png_sticker Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px
743 743
      * @return object
744 744
      */
745
-    public function uploadStickerFile($user_id,$png_sticker){
746
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
745
+    public function uploadStickerFile($user_id, $png_sticker) {
746
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
747 747
     }
748 748
 
749 749
 
@@ -759,8 +759,8 @@  discard block
 block discarded – undo
759 759
      * @param json $mask_position A JSON-serialized object for position where the mask should be placed on faces
760 760
      * @return object
761 761
      */
762
-    public function createNewStickerSet($user_id,$name,$title,$png_sticker,$emojis,$contains_masks=null,$mask_position=null){
763
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
762
+    public function createNewStickerSet($user_id, $name, $title, $png_sticker, $emojis, $contains_masks = null, $mask_position = null) {
763
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
764 764
     }
765 765
 
766 766
 
@@ -774,8 +774,8 @@  discard block
 block discarded – undo
774 774
      * @param json $mask_position A JSON-serialized object for position where the mask should be placed on faces
775 775
      * @return object
776 776
      */
777
-    public function addStickerToSet($user_id,$name,$png_sticker,$emojis,$mask_position=null){
778
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
777
+    public function addStickerToSet($user_id, $name, $png_sticker, $emojis, $mask_position = null) {
778
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
779 779
     }
780 780
 
781 781
 
@@ -786,8 +786,8 @@  discard block
 block discarded – undo
786 786
      * @param int $position New sticker position in the set, zero-based
787 787
      * @return object
788 788
      */
789
-    public function setStickerPositionInSet($sticker,$position){
790
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
789
+    public function setStickerPositionInSet($sticker, $position) {
790
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
791 791
     }
792 792
 
793 793
 
@@ -797,8 +797,8 @@  discard block
 block discarded – undo
797 797
      * @param string $sticker File identifier of the sticker
798 798
      * @return object
799 799
      */
800
-    public function deleteStickerFromSet($sticker){
801
-        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
800
+    public function deleteStickerFromSet($sticker) {
801
+        return $this->make_http_request(__FUNCTION__, (object) get_defined_vars());
802 802
     }
803 803
 
804 804
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
         if (strlen($this->token)==45 && count(explode(':',$this->token))==2){
23 23
             $this->ch = curl_init();
24 24
             return true;
25
+        } else {
26
+                    return false;
25 27
         }
26
-        else
27
-            return false;
28 28
     }
29 29
 
30 30
     /**
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         $res = curl_exec($this->ch);
50 50
         if(curl_error($this->ch)){
51 51
             var_dump(curl_error($this->ch));
52
-        }else{
52
+        } else{
53 53
             $res=json_decode($res);
54 54
             if ($res->ok){
55 55
                 $res=$res->result;
@@ -366,8 +366,9 @@  discard block
 block discarded – undo
366 366
      */
367 367
     public function getFileLink($file_path)
368 368
     {
369
-        if (is_object($file_path))
370
-            $file_path=$file_path->file_path;
369
+        if (is_object($file_path)) {
370
+                    $file_path=$file_path->file_path;
371
+        }
371 372
         return 'https://api.telegram.org/file/bot'.$this->token.'/'.$file_path;
372 373
     }
373 374
 
Please login to merge, or discard this patch.