Skip to content

Commit 4f2fb7c

Browse files
committed
new method empty response
1 parent d49436d commit 4f2fb7c

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

src/Request.php

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public static function getInput()
109109
* @todo Take log verbosity into account
110110
*
111111
* @param string $string
112+
*
112113
* @return mixed
113114
*/
114115
private static function log($string)
@@ -129,6 +130,7 @@ private static function log($string)
129130
* Generate general fake server response
130131
*
131132
* @param array $data Data to add to fake response
133+
*
132134
* @return array Fake response data
133135
*/
134136
public static function generateGeneralFakeServerResponse(array $data = null)
@@ -167,6 +169,7 @@ public static function generateGeneralFakeServerResponse(array $data = null)
167169
*
168170
* @param string $action Action to execute
169171
* @param array|null $data Data to attach to the execution
172+
*
170173
* @return mixed Result of the cURL call
171174
*/
172175
public static function executeCurl($action, array $data = null)
@@ -178,7 +181,6 @@ public static function executeCurl($action, array $data = null)
178181

179182
$curlConfig = [
180183
CURLOPT_URL => 'https://api.telegram.org/bot' . self::$telegram->getApiKey() . '/' . $action,
181-
CURLOPT_POST => true,
182184
CURLOPT_RETURNTRANSFER => true,
183185
CURLOPT_SAFE_UPLOAD => true,
184186
];
@@ -227,6 +229,7 @@ public static function executeCurl($action, array $data = null)
227229
* Download file
228230
*
229231
* @param Entities\File $file
232+
*
230233
* @return boolean
231234
*/
232235
public static function downloadFile(File $file)
@@ -281,6 +284,7 @@ public static function downloadFile(File $file)
281284
* Encode file
282285
*
283286
* @param string $file
287+
*
284288
* @return CURLFile
285289
*/
286290
protected static function encodeFile($file)
@@ -296,6 +300,7 @@ protected static function encodeFile($file)
296300
*
297301
* @param string $action
298302
* @param array|null $data
303+
*
299304
* @return Entities\ServerResponse
300305
*/
301306
public static function send($action, array $data = null)
@@ -331,6 +336,7 @@ public static function getMe()
331336
* @todo Could do with some cleaner recursion
332337
*
333338
* @param array $data
339+
*
334340
* @return mixed
335341
*/
336342
public static function sendMessage(array $data)
@@ -353,6 +359,7 @@ public static function sendMessage(array $data)
353359
* Forward message
354360
*
355361
* @param array $data
362+
*
356363
* @return mixed
357364
*/
358365
public static function forwardMessage(array $data)
@@ -369,6 +376,7 @@ public static function forwardMessage(array $data)
369376
*
370377
* @param array $data
371378
* @param string $file
379+
*
372380
* @return mixed
373381
*/
374382
public static function sendPhoto(array $data, $file = null)
@@ -389,6 +397,7 @@ public static function sendPhoto(array $data, $file = null)
389397
*
390398
* @param array $data
391399
* @param string $file
400+
*
392401
* @return mixed
393402
*/
394403
public static function sendAudio(array $data, $file = null)
@@ -409,6 +418,7 @@ public static function sendAudio(array $data, $file = null)
409418
*
410419
* @param array $data
411420
* @param string $file
421+
*
412422
* @return mixed
413423
*/
414424
public static function sendDocument(array $data, $file = null)
@@ -429,6 +439,7 @@ public static function sendDocument(array $data, $file = null)
429439
*
430440
* @param array $data
431441
* @param string $file
442+
*
432443
* @return mixed
433444
*/
434445
public static function sendSticker(array $data, $file = null)
@@ -449,6 +460,7 @@ public static function sendSticker(array $data, $file = null)
449460
*
450461
* @param array $data
451462
* @param string $file
463+
*
452464
* @return mixed
453465
*/
454466
public static function sendVideo(array $data, $file = null)
@@ -469,6 +481,7 @@ public static function sendVideo(array $data, $file = null)
469481
*
470482
* @param array $data
471483
* @param string $file
484+
*
472485
* @return mixed
473486
*/
474487
public static function sendVoice(array $data, $file = null)
@@ -488,6 +501,7 @@ public static function sendVoice(array $data, $file = null)
488501
* Send location
489502
*
490503
* @param array $data
504+
*
491505
* @return mixed
492506
*/
493507
public static function sendLocation(array $data)
@@ -503,6 +517,7 @@ public static function sendLocation(array $data)
503517
* Send chat action
504518
*
505519
* @param array $data
520+
*
506521
* @return mixed
507522
*/
508523
public static function sendChatAction(array $data)
@@ -518,6 +533,7 @@ public static function sendChatAction(array $data)
518533
* Get user profile photos
519534
*
520535
* @param array $data
536+
*
521537
* @return mixed
522538
*/
523539
public static function getUserProfilePhotos(array $data)
@@ -537,6 +553,7 @@ public static function getUserProfilePhotos(array $data)
537553
* Get updates
538554
*
539555
* @param array $data
556+
*
540557
* @return mixed
541558
*/
542559
public static function getUpdates(array $data)
@@ -549,6 +566,7 @@ public static function getUpdates(array $data)
549566
*
550567
* @param string $url
551568
* @param string $file
569+
*
552570
* @return mixed
553571
*/
554572
public static function setWebhook($url = '', $file = null)
@@ -566,6 +584,7 @@ public static function setWebhook($url = '', $file = null)
566584
* Get file
567585
*
568586
* @param array $data
587+
*
569588
* @return mixed
570589
*/
571590
public static function getFile(array $data)
@@ -581,6 +600,7 @@ public static function getFile(array $data)
581600
* Answer inline query
582601
*
583602
* @param array $data
603+
*
584604
* @return mixed
585605
*/
586606
public static function answerInlineQuery(array $data)
@@ -592,6 +612,19 @@ public static function answerInlineQuery(array $data)
592612
return self::send('answerInlineQuery', $data);
593613
}
594614

615+
/**
616+
* Return an empty Server Response
617+
*
618+
* No request to telegram are sent, this function is used in commands that
619+
* don't need to fire a message after execution
620+
*
621+
* @return Entities\ServerResponse
622+
*/
623+
public static function emptyResponse()
624+
{
625+
return new ServerResponse(['ok' => true, 'result' => true], null);
626+
}
627+
595628
/**
596629
* Send message to all active chats
597630
*
@@ -602,6 +635,7 @@ public static function answerInlineQuery(array $data)
602635
* @param boolean $send_users
603636
* @param string $date_from
604637
* @param string $date_to
638+
*
605639
* @return array
606640
*/
607641
public static function sendToActiveChats(

0 commit comments

Comments
 (0)