Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like BotApi often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use BotApi, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
23 | class BotApi |
||
24 | { |
||
25 | /** |
||
26 | * HTTP codes |
||
27 | * |
||
28 | * @var array |
||
29 | */ |
||
30 | public static $codes = [ |
||
31 | // Informational 1xx |
||
32 | 100 => 'Continue', |
||
33 | 101 => 'Switching Protocols', |
||
34 | 102 => 'Processing', // RFC2518 |
||
35 | // Success 2xx |
||
36 | 200 => 'OK', |
||
37 | 201 => 'Created', |
||
38 | 202 => 'Accepted', |
||
39 | 203 => 'Non-Authoritative Information', |
||
40 | 204 => 'No Content', |
||
41 | 205 => 'Reset Content', |
||
42 | 206 => 'Partial Content', |
||
43 | 207 => 'Multi-Status', // RFC4918 |
||
44 | 208 => 'Already Reported', // RFC5842 |
||
45 | 226 => 'IM Used', // RFC3229 |
||
46 | // Redirection 3xx |
||
47 | 300 => 'Multiple Choices', |
||
48 | 301 => 'Moved Permanently', |
||
49 | 302 => 'Found', // 1.1 |
||
50 | 303 => 'See Other', |
||
51 | 304 => 'Not Modified', |
||
52 | 305 => 'Use Proxy', |
||
53 | // 306 is deprecated but reserved |
||
54 | 307 => 'Temporary Redirect', |
||
55 | 308 => 'Permanent Redirect', // RFC7238 |
||
56 | // Client Error 4xx |
||
57 | 400 => 'Bad Request', |
||
58 | 401 => 'Unauthorized', |
||
59 | 402 => 'Payment Required', |
||
60 | 403 => 'Forbidden', |
||
61 | 404 => 'Not Found', |
||
62 | 405 => 'Method Not Allowed', |
||
63 | 406 => 'Not Acceptable', |
||
64 | 407 => 'Proxy Authentication Required', |
||
65 | 408 => 'Request Timeout', |
||
66 | 409 => 'Conflict', |
||
67 | 410 => 'Gone', |
||
68 | 411 => 'Length Required', |
||
69 | 412 => 'Precondition Failed', |
||
70 | 413 => 'Payload Too Large', |
||
71 | 414 => 'URI Too Long', |
||
72 | 415 => 'Unsupported Media Type', |
||
73 | 416 => 'Range Not Satisfiable', |
||
74 | 417 => 'Expectation Failed', |
||
75 | 422 => 'Unprocessable Entity', // RFC4918 |
||
76 | 423 => 'Locked', // RFC4918 |
||
77 | 424 => 'Failed Dependency', // RFC4918 |
||
78 | 425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817 |
||
79 | 426 => 'Upgrade Required', // RFC2817 |
||
80 | 428 => 'Precondition Required', // RFC6585 |
||
81 | 429 => 'Too Many Requests', // RFC6585 |
||
82 | 431 => 'Request Header Fields Too Large', // RFC6585 |
||
83 | // Server Error 5xx |
||
84 | 500 => 'Internal Server Error', |
||
85 | 501 => 'Not Implemented', |
||
86 | 502 => 'Bad Gateway', |
||
87 | 503 => 'Service Unavailable', |
||
88 | 504 => 'Gateway Timeout', |
||
89 | 505 => 'HTTP Version Not Supported', |
||
90 | 506 => 'Variant Also Negotiates (Experimental)', // RFC2295 |
||
91 | 507 => 'Insufficient Storage', // RFC4918 |
||
92 | 508 => 'Loop Detected', // RFC5842 |
||
93 | 510 => 'Not Extended', // RFC2774 |
||
94 | 511 => 'Network Authentication Required', // RFC6585 |
||
95 | ]; |
||
96 | |||
97 | private $proxySettings = []; |
||
98 | |||
99 | /** |
||
100 | * Default http status code |
||
101 | */ |
||
102 | const DEFAULT_STATUS_CODE = 200; |
||
103 | |||
104 | /** |
||
105 | * Not Modified http status code |
||
106 | */ |
||
107 | const NOT_MODIFIED_STATUS_CODE = 304; |
||
108 | |||
109 | /** |
||
110 | * Limits for tracked ids |
||
111 | */ |
||
112 | const MAX_TRACKED_EVENTS = 200; |
||
113 | |||
114 | /** |
||
115 | * Url prefixes |
||
116 | */ |
||
117 | const URL_PREFIX = 'https://api.telegram.org/bot'; |
||
118 | |||
119 | /** |
||
120 | * Url prefix for files |
||
121 | */ |
||
122 | const FILE_URL_PREFIX = 'https://api.telegram.org/file/bot'; |
||
123 | |||
124 | /** |
||
125 | * CURL object |
||
126 | * |
||
127 | * @var |
||
128 | */ |
||
129 | protected $curl; |
||
130 | |||
131 | /** |
||
132 | * CURL custom options |
||
133 | * |
||
134 | * @var array |
||
135 | */ |
||
136 | protected $customCurlOptions = []; |
||
137 | |||
138 | /** |
||
139 | * Bot token |
||
140 | * |
||
141 | * @var string |
||
142 | */ |
||
143 | protected $token; |
||
144 | |||
145 | /** |
||
146 | * Botan tracker |
||
147 | * |
||
148 | * @var \TelegramBot\Api\Botan |
||
149 | */ |
||
150 | protected $tracker; |
||
151 | |||
152 | /** |
||
153 | * list of event ids |
||
154 | * |
||
155 | * @var array |
||
156 | */ |
||
157 | protected $trackedEvents = []; |
||
158 | |||
159 | /** |
||
160 | * Check whether return associative array |
||
161 | * |
||
162 | * @var bool |
||
163 | */ |
||
164 | protected $returnArray = true; |
||
165 | |||
166 | /** |
||
167 | * Constructor |
||
168 | * |
||
169 | * @param string $token Telegram Bot API token |
||
170 | * @param string|null $trackerToken Yandex AppMetrica application api_key |
||
171 | */ |
||
172 | 9 | public function __construct($token, $trackerToken = null) |
|
181 | |||
182 | /** |
||
183 | * Set return array |
||
184 | * |
||
185 | * @param bool $mode |
||
186 | * |
||
187 | * @return $this |
||
188 | */ |
||
189 | public function setModeObject($mode = true) |
||
195 | |||
196 | |||
197 | /** |
||
198 | * Call method |
||
199 | * |
||
200 | * @param string $method |
||
201 | * @param array|null $data |
||
202 | * |
||
203 | * @return mixed |
||
204 | * @throws \TelegramBot\Api\Exception |
||
205 | * @throws \TelegramBot\Api\HttpException |
||
206 | * @throws \TelegramBot\Api\InvalidJsonException |
||
207 | */ |
||
208 | public function call($method, array $data = null) |
||
243 | |||
244 | /** |
||
245 | * curl_exec wrapper for response validation |
||
246 | * |
||
247 | * @param array $options |
||
248 | * |
||
249 | * @return string |
||
250 | * |
||
251 | * @throws \TelegramBot\Api\HttpException |
||
252 | */ |
||
253 | protected function executeCurl(array $options) |
||
265 | |||
266 | /** |
||
267 | * Response validation |
||
268 | * |
||
269 | * @param resource $curl |
||
270 | * @param string $response |
||
271 | * @throws HttpException |
||
272 | */ |
||
273 | public static function curlValidate($curl, $response = null) |
||
284 | |||
285 | /** |
||
286 | * JSON validation |
||
287 | * |
||
288 | * @param string $jsonString |
||
289 | * @param boolean $asArray |
||
290 | * |
||
291 | * @return object|array |
||
292 | * @throws \TelegramBot\Api\InvalidJsonException |
||
293 | */ |
||
294 | public static function jsonValidate($jsonString, $asArray) |
||
304 | |||
305 | /** |
||
306 | * Use this method to send text messages. On success, the sent \TelegramBot\Api\Types\Message is returned. |
||
307 | * |
||
308 | * @param int|string $chatId |
||
309 | * @param string $text |
||
310 | * @param string|null $parseMode |
||
311 | * @param bool $disablePreview |
||
312 | * @param int|null $replyToMessageId |
||
313 | * @param Types\ReplyKeyboardMarkup|Types\ReplyKeyboardHide|Types\ForceReply| |
||
314 | * Types\ReplyKeyboardRemove|null $replyMarkup |
||
315 | * @param bool $disableNotification |
||
316 | * |
||
317 | * @return \TelegramBot\Api\Types\Message |
||
318 | * @throws \TelegramBot\Api\InvalidArgumentException |
||
319 | * @throws \TelegramBot\Api\Exception |
||
320 | */ |
||
321 | public function sendMessage( |
||
322 | $chatId, |
||
323 | $text, |
||
324 | $parseMode = null, |
||
325 | $disablePreview = false, |
||
326 | $replyToMessageId = null, |
||
327 | $replyMarkup = null, |
||
328 | $disableNotification = false |
||
329 | ) { |
||
330 | return Message::fromResponse($this->call('sendMessage', [ |
||
331 | 'chat_id' => $chatId, |
||
332 | 'text' => $text, |
||
333 | 'parse_mode' => $parseMode, |
||
334 | 'disable_web_page_preview' => $disablePreview, |
||
335 | 'reply_to_message_id' => (int)$replyToMessageId, |
||
336 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
||
337 | 'disable_notification' => (bool)$disableNotification, |
||
338 | ])); |
||
339 | } |
||
340 | |||
341 | /** |
||
342 | * Use this method to send phone contacts |
||
343 | * |
||
344 | * @param int|string $chatId chat_id or @channel_name |
||
345 | * @param string $phoneNumber |
||
346 | * @param string $firstName |
||
347 | * @param string $lastName |
||
348 | * @param int|null $replyToMessageId |
||
349 | * @param Types\ReplyKeyboardMarkup|Types\ReplyKeyboardHide|Types\ForceReply| |
||
350 | * Types\ReplyKeyboardRemove|null $replyMarkup |
||
351 | * @param bool $disableNotification |
||
352 | * |
||
353 | * @return \TelegramBot\Api\Types\Message |
||
354 | * @throws \TelegramBot\Api\Exception |
||
355 | */ |
||
356 | public function sendContact( |
||
357 | $chatId, |
||
358 | $phoneNumber, |
||
359 | $firstName, |
||
360 | $lastName = null, |
||
361 | $replyToMessageId = null, |
||
362 | $replyMarkup = null, |
||
363 | $disableNotification = false |
||
364 | ) { |
||
365 | return Message::fromResponse($this->call('sendContact', [ |
||
366 | 'chat_id' => $chatId, |
||
367 | 'phone_number' => $phoneNumber, |
||
368 | 'first_name' => $firstName, |
||
369 | 'last_name' => $lastName, |
||
370 | 'reply_to_message_id' => $replyToMessageId, |
||
371 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
||
372 | 'disable_notification' => (bool)$disableNotification, |
||
373 | ])); |
||
374 | } |
||
375 | |||
376 | /** |
||
377 | * Use this method when you need to tell the user that something is happening on the bot's side. |
||
378 | * The status is set for 5 seconds or less (when a message arrives from your bot, |
||
379 | * Telegram clients clear its typing status). |
||
380 | * |
||
381 | * We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive. |
||
382 | * |
||
383 | * Type of action to broadcast. Choose one, depending on what the user is about to receive: |
||
384 | * `typing` for text messages, `upload_photo` for photos, `record_video` or `upload_video` for videos, |
||
385 | * `record_audio` or upload_audio for audio files, `upload_document` for general files, |
||
386 | * `find_location` for location data. |
||
387 | * |
||
388 | * @param int $chatId |
||
389 | * @param string $action |
||
390 | * |
||
391 | * @return bool |
||
392 | * @throws \TelegramBot\Api\Exception |
||
393 | */ |
||
394 | public function sendChatAction($chatId, $action) |
||
401 | |||
402 | /** |
||
403 | * Use this method to get a list of profile pictures for a user. |
||
404 | * |
||
405 | * @param int $userId |
||
406 | * @param int $offset |
||
407 | * @param int $limit |
||
408 | * |
||
409 | * @return \TelegramBot\Api\Types\UserProfilePhotos |
||
410 | * @throws \TelegramBot\Api\Exception |
||
411 | */ |
||
412 | public function getUserProfilePhotos($userId, $offset = 0, $limit = 100) |
||
420 | |||
421 | /** |
||
422 | * Use this method to specify a url and receive incoming updates via an outgoing webhook. |
||
423 | * Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, |
||
424 | * containing a JSON-serialized Update. |
||
425 | * In case of an unsuccessful request, we will give up after a reasonable amount of attempts. |
||
426 | * |
||
427 | * @param string $url HTTPS url to send updates to. Use an empty string to remove webhook integration |
||
428 | * @param \CURLFile|string $certificate Upload your public key certificate |
||
429 | * so that the root certificate in use can be checked |
||
430 | * |
||
431 | * @return string |
||
432 | * |
||
433 | * @throws \TelegramBot\Api\Exception |
||
434 | */ |
||
435 | public function setWebhook($url = '', $certificate = null) |
||
439 | |||
440 | /** |
||
441 | * A simple method for testing your bot's auth token.Requires no parameters. |
||
442 | * Returns basic information about the bot in form of a User object. |
||
443 | * |
||
444 | * @return \TelegramBot\Api\Types\User |
||
445 | * @throws \TelegramBot\Api\Exception |
||
446 | * @throws \TelegramBot\Api\InvalidArgumentException |
||
447 | */ |
||
448 | public function getMe() |
||
452 | |||
453 | /** |
||
454 | * Use this method to receive incoming updates using long polling. |
||
455 | * An Array of Update objects is returned. |
||
456 | * |
||
457 | * Notes |
||
458 | * 1. This method will not work if an outgoing webhook is set up. |
||
459 | * 2. In order to avoid getting duplicate updates, recalculate offset after each server response. |
||
460 | * |
||
461 | * @param int $offset |
||
462 | * @param int $limit |
||
463 | * @param int $timeout |
||
464 | * |
||
465 | * @return Update[] |
||
466 | * @throws \TelegramBot\Api\Exception |
||
467 | * @throws \TelegramBot\Api\InvalidArgumentException |
||
468 | */ |
||
469 | 2 | public function getUpdates($offset = 0, $limit = 100, $timeout = 0) |
|
485 | |||
486 | /** |
||
487 | * Use this method to send point on the map. On success, the sent Message is returned. |
||
488 | * |
||
489 | * @param int|string $chatId |
||
490 | * @param float $latitude |
||
491 | * @param float $longitude |
||
492 | * @param int|null $replyToMessageId |
||
493 | * @param Types\ReplyKeyboardMarkup|Types\ReplyKeyboardHide|Types\ForceReply| |
||
494 | * Types\ReplyKeyboardRemove|null $replyMarkup |
||
495 | * @param bool $disableNotification |
||
496 | * |
||
497 | * @param null|int $livePeriod |
||
498 | * @return \TelegramBot\Api\Types\Message |
||
499 | */ |
||
500 | public function sendLocation( |
||
501 | $chatId, |
||
502 | $latitude, |
||
503 | $longitude, |
||
504 | $replyToMessageId = null, |
||
505 | $replyMarkup = null, |
||
506 | $disableNotification = false, |
||
507 | $livePeriod = null |
||
508 | ) { |
||
509 | return Message::fromResponse($this->call('sendLocation', [ |
||
510 | 'chat_id' => $chatId, |
||
511 | 'latitude' => $latitude, |
||
512 | 'longitude' => $longitude, |
||
513 | 'live_period' => $livePeriod, |
||
514 | 'reply_to_message_id' => $replyToMessageId, |
||
515 | 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), |
||
516 | 'disable_notification' => (bool)$disableNotification, |
||
517 | ])); |
||
518 | } |
||
519 | |||
520 | /** |
||
521 | * Use this method to edit live location messages sent by the bot or via the bot (for inline bots). |
||
522 | * |
||
523 | * @param int|string $chatId |
||
524 | * @param int $messageId |
||
525 | * @param string $inlineMessageId |
||
526 | * @param float $latitude |
||
527 | * @param float $longitude |
||
528 | * @param Types\ReplyKeyboardMarkup|Types\ReplyKeyboardHide|Types\ForceReply| |
||
529 | * Types\ReplyKeyboardRemove|null $replyMarkup |
||
530 | * @return \TelegramBot\Api\Types\Message |
||
531 | */ |
||
532 | public function editMessageLiveLocation( |
||
549 | |||
550 | /** |
||
551 | * Use this method to stop updating a live location message sent by the bot or via the bot (for inline bots) before |
||
552 | * live_period expires. |
||
553 | * |
||
554 | * @param int|string $chatId |
||
555 | * @param int $messageId |
||
556 | * @param string $inlineMessageId |
||
557 | * @param Types\ReplyKeyboardMarkup|Types\ReplyKeyboardHide|Types\ForceReply| |
||
558 | * Types\ReplyKeyboardRemove|null $replyMarkup |
||
559 | * @return \TelegramBot\Api\Types\Message |
||
560 | */ |
||
561 | public function stopMessageLiveLocation( |
||
574 | |||
575 | /** |
||
576 | * Use this method to send information about a venue. On success, the sent Message is returned. |
||
577 | * |
||
578 | * @param int|string $chatId chat_id or @channel_name |
||
579 | * @param float $latitude |
||
580 | * @param float $longitude |
||
581 | * @param string $title |
||
582 | * @param string $address |
||
583 | * @param string|null $foursquareId |
||
584 | * @param int|null $replyToMessageId |
||
585 | * @param Types\ReplyKeyboardMarkup|Types\ReplyKeyboardHide|Types\ForceReply| |
||
586 | * Types\ReplyKeyboardRemove|null $replyMarkup |
||
587 | * @param bool $disableNotification |
||
588 | * |
||
589 | * @return \TelegramBot\Api\Types\Message |
||
590 | * @throws \TelegramBot\Api\Exception |
||
591 | */ |
||
592 | public function sendVenue( |
||
615 | |||
616 | /** |
||
617 | * Use this method to send .webp stickers. On success, the sent Message is returned. |
||
618 | * |
||
619 | * @param int|string $chatId chat_id or @channel_name |
||
620 | * @param \CURLFile|string $sticker |
||
621 | * @param int|null $replyToMessageId |
||
622 | * @param Types\ReplyKeyboardMarkup|Types\ReplyKeyboardHide|Types\ForceReply| |
||
623 | * Types\ReplyKeyboardRemove|null $replyMarkup |
||
624 | * @param bool $disableNotification |
||
625 | * |
||
626 | * @return \TelegramBot\Api\Types\Message |
||
627 | * @throws \TelegramBot\Api\InvalidArgumentException |
||
628 | * @throws \TelegramBot\Api\Exception |
||
629 | */ |
||
630 | View Code Duplication | public function sendSticker( |
|
645 | |||
646 | /** |
||
647 | * Use this method to send video files, |
||
648 | * Telegram clients support mp4 videos (other formats may be sent as Document). |
||
649 | * On success, the sent Message is returned. |
||
650 | * |
||
651 | * @param int|string $chatId chat_id or @channel_name |
||
652 | * @param \CURLFile|string $video |
||
653 | * @param int|null $duration |
||
654 | * @param string|null $caption |
||
655 | * @param int|null $replyToMessageId |
||
656 | * @param Types\ReplyKeyboardMarkup|Types\ReplyKeyboardHide|Types\ForceReply| |
||
657 | * Types\ReplyKeyboardRemove|null $replyMarkup |
||
658 | * @param bool $disableNotification |
||
659 | * @param bool $supportsStreaming Pass True, if the uploaded video is suitable for streaming |
||
660 | * @param string|null $parseMode |
||
661 | * |
||
662 | * @return \TelegramBot\Api\Types\Message |
||
663 | * @throws \TelegramBot\Api\InvalidArgumentException |
||
664 | * @throws \TelegramBot\Api\Exception |
||
665 | */ |
||
666 | View Code Duplication | public function sendVideo( |
|
689 | |||
690 | /** |
||
691 | * Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound), |
||
692 | * On success, the sent Message is returned. |
||
693 | * Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future. |
||
694 | * |
||
695 | * @param int|string $chatId chat_id or @channel_name |
||
696 | * @param \CURLFile|string $animation |
||
697 | * @param int|null $duration |
||
698 | * @param string|null $caption |
||
699 | * @param int|null $replyToMessageId |
||
700 | * @param Types\ReplyKeyboardMarkup|Types\ReplyKeyboardHide|Types\ForceReply| |
||
701 | * Types\ReplyKeyboardRemove|null $replyMarkup |
||
702 | * @param bool $disableNotification |
||
703 | * @param string|null $parseMode |
||
704 | * |
||
705 | * @return \TelegramBot\Api\Types\Message |
||
706 | * @throws \TelegramBot\Api\InvalidArgumentException |
||
707 | * @throws \TelegramBot\Api\Exception |
||
708 | */ |
||
709 | View Code Duplication | public function sendAnimation( |
|
730 | |||
731 | /** |
||
732 | * Use this method to send audio files, |
||
733 | * if you want Telegram clients to display the file as a playable voice message. |
||
734 | * For this to work, your audio must be in an .ogg file encoded with OPUS |
||
735 | * (other formats may be sent as Audio or Document). |
||
736 | * On success, the sent Message is returned. |
||
737 | * Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future. |
||
738 | * |
||
739 | * @param int|string $chatId chat_id or @channel_name |
||
740 | * @param \CURLFile|string $voice |
||
741 | * @param int|null $duration |
||
742 | * @param int|null $replyToMessageId |
||
743 | * @param Types\ReplyKeyboardMarkup|Types\ReplyKeyboardHide|Types\ForceReply| |
||
744 | * Types\ReplyKeyboardRemove|null $replyMarkup |
||
745 | * @param bool $disableNotification |
||
746 | * @param string|null $parseMode |
||
747 | * |
||
748 | * @return \TelegramBot\Api\Types\Message |
||
749 | * @throws \TelegramBot\Api\InvalidArgumentException |
||
750 | * @throws \TelegramBot\Api\Exception |
||
751 | */ |
||
752 | public function sendVoice( |
||
771 | |||
772 | /** |
||
773 | * Use this method to forward messages of any kind. On success, the sent Message is returned. |
||
774 | * |
||
775 | * @param int|string $chatId chat_id or @channel_name |
||
776 | * @param int $fromChatId |
||
777 | * @param int $messageId |
||
778 | * @param bool $disableNotification |
||
779 | * |
||
780 | * @return \TelegramBot\Api\Types\Message |
||
781 | * @throws \TelegramBot\Api\InvalidArgumentException |
||
782 | * @throws \TelegramBot\Api\Exception |
||
783 | */ |
||
784 | public function forwardMessage($chatId, $fromChatId, $messageId, $disableNotification = false) |
||
793 | |||
794 | /** |
||
795 | * Use this method to send audio files, |
||
796 | * if you want Telegram clients to display them in the music player. |
||
797 | * Your audio must be in the .mp3 format. |
||
798 | * On success, the sent Message is returned. |
||
799 | * Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. |
||
800 | * |
||
801 | * For backward compatibility, when the fields title and performer are both empty |
||
802 | * and the mime-type of the file to be sent is not audio/mpeg, the file will be sent as a playable voice message. |
||
803 | * For this to work, the audio must be in an .ogg file encoded with OPUS. |
||
804 | * This behavior will be phased out in the future. For sending voice messages, use the sendVoice method instead. |
||
805 | * |
||
806 | * @deprecated since 20th February. Removed backward compatibility from the method sendAudio. |
||
807 | * Voice messages now must be sent using the method sendVoice. |
||
808 | * There is no more need to specify a non-empty title or performer while sending the audio by file_id. |
||
809 | * |
||
810 | * @param int|string $chatId chat_id or @channel_name |
||
811 | * @param \CURLFile|string $audio |
||
812 | * @param int|null $duration |
||
813 | * @param string|null $performer |
||
814 | * @param string|null $title |
||
815 | * @param int|null $replyToMessageId |
||
816 | * @param Types\ReplyKeyboardMarkup|Types\ReplyKeyboardHide|Types\ForceReply| |
||
817 | * Types\ReplyKeyboardRemove|null $replyMarkup |
||
818 | * @param bool $disableNotification |
||
819 | * @param string|null $parseMode |
||
820 | * |
||
821 | * @return \TelegramBot\Api\Types\Message |
||
822 | * @throws \TelegramBot\Api\InvalidArgumentException |
||
823 | * @throws \TelegramBot\Api\Exception |
||
824 | */ |
||
825 | View Code Duplication | public function sendAudio( |
|
848 | |||
849 | /** |
||
850 | * Use this method to send photos. On success, the sent Message is returned. |
||
851 | * |
||
852 | * @param int|string $chatId chat_id or @channel_name |
||
853 | * @param \CURLFile|string $photo |
||
854 | * @param string|null $caption |
||
855 | * @param int|null $replyToMessageId |
||
856 | * @param Types\ReplyKeyboardMarkup|Types\ReplyKeyboardHide|Types\ForceReply| |
||
857 | * Types\ReplyKeyboardRemove|null $replyMarkup |
||
858 | * @param bool $disableNotification |
||
859 | * @param string|null $parseMode |
||
860 | * |
||
861 | * @return \TelegramBot\Api\Types\Message |
||
862 | * @throws \TelegramBot\Api\InvalidArgumentException |
||
863 | * @throws \TelegramBot\Api\Exception |
||
864 | */ |
||
865 | public function sendPhoto( |
||
884 | |||
885 | /** |
||
886 | * Use this method to send general files. On success, the sent Message is returned. |
||
887 | * Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future. |
||
888 | * |
||
889 | * @param int|string $chatId chat_id or @channel_name |
||
890 | * @param \CURLFile|string $document |
||
891 | * @param string|null $caption |
||
892 | * @param int|null $replyToMessageId |
||
893 | * @param Types\ReplyKeyboardMarkup|Types\ReplyKeyboardHide|Types\ForceReply| |
||
894 | * Types\ReplyKeyboardRemove|null $replyMarkup |
||
895 | * @param bool $disableNotification |
||
896 | * @param string|null $parseMode |
||
897 | * |
||
898 | * @return \TelegramBot\Api\Types\Message |
||
899 | * @throws \TelegramBot\Api\InvalidArgumentException |
||
900 | * @throws \TelegramBot\Api\Exception |
||
901 | */ |
||
902 | public function sendDocument( |
||
921 | |||
922 | /** |
||
923 | * Use this method to get basic info about a file and prepare it for downloading. |
||
924 | * For the moment, bots can download files of up to 20MB in size. |
||
925 | * On success, a File object is returned. |
||
926 | * The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, |
||
927 | * where <file_path> is taken from the response. |
||
928 | * It is guaranteed that the link will be valid for at least 1 hour. |
||
929 | * When the link expires, a new one can be requested by calling getFile again. |
||
930 | * |
||
931 | * @param $fileId |
||
932 | * |
||
933 | * @return \TelegramBot\Api\Types\File |
||
934 | * @throws \TelegramBot\Api\InvalidArgumentException |
||
935 | * @throws \TelegramBot\Api\Exception |
||
936 | */ |
||
937 | public function getFile($fileId) |
||
941 | |||
942 | /** |
||
943 | * Get file contents via cURL |
||
944 | * |
||
945 | * @param $fileId |
||
946 | * |
||
947 | * @return string |
||
948 | * |
||
949 | * @throws \TelegramBot\Api\HttpException |
||
950 | */ |
||
951 | public function downloadFile($fileId) |
||
963 | |||
964 | /** |
||
965 | * Use this method to send answers to an inline query. On success, True is returned. |
||
966 | * No more than 50 results per query are allowed. |
||
967 | * |
||
968 | * @param string $inlineQueryId |
||
969 | * @param AbstractInlineQueryResult[] $results |
||
970 | * @param int $cacheTime |
||
971 | * @param bool $isPersonal |
||
972 | * @param string $nextOffset |
||
973 | * @param string $switchPmText |
||
974 | * @param string $switchPmParameter |
||
975 | * |
||
976 | * @return mixed |
||
977 | * @throws Exception |
||
978 | */ |
||
979 | public function answerInlineQuery( |
||
1003 | |||
1004 | /** |
||
1005 | * Use this method to kick a user from a group or a supergroup. |
||
1006 | * In the case of supergroups, the user will not be able to return to the group |
||
1007 | * on their own using invite links, etc., unless unbanned first. |
||
1008 | * The bot must be an administrator in the group for this to work. Returns True on success. |
||
1009 | * |
||
1010 | * @param int|string $chatId Unique identifier for the target group |
||
1011 | * or username of the target supergroup (in the format @supergroupusername) |
||
1012 | * @param int $userId Unique identifier of the target user |
||
1013 | * @param null|int $untilDate Date when the user will be unbanned, unix time. |
||
1014 | * If user is banned for more than 366 days or less than 30 seconds from the current time |
||
1015 | * they are considered to be banned forever |
||
1016 | * |
||
1017 | * @return bool |
||
1018 | */ |
||
1019 | public function kickChatMember($chatId, $userId, $untilDate = null) |
||
1027 | |||
1028 | /** |
||
1029 | * Use this method to unban a previously kicked user in a supergroup. |
||
1030 | * The user will not return to the group automatically, but will be able to join via link, etc. |
||
1031 | * The bot must be an administrator in the group for this to work. Returns True on success. |
||
1032 | * |
||
1033 | * @param int|string $chatId Unique identifier for the target group |
||
1034 | * or username of the target supergroup (in the format @supergroupusername) |
||
1035 | * @param int $userId Unique identifier of the target user |
||
1036 | * |
||
1037 | * @return bool |
||
1038 | */ |
||
1039 | public function unbanChatMember($chatId, $userId) |
||
1046 | |||
1047 | /** |
||
1048 | * Use this method to send answers to callback queries sent from inline keyboards. |
||
1049 | * The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. |
||
1050 | * |
||
1051 | * @param $callbackQueryId |
||
1052 | * @param null $text |
||
1053 | * @param bool $showAlert |
||
1054 | * |
||
1055 | * @return bool |
||
1056 | */ |
||
1057 | public function answerCallbackQuery($callbackQueryId, $text = null, $showAlert = false) |
||
1065 | |||
1066 | |||
1067 | /** |
||
1068 | * Use this method to edit text messages sent by the bot or via the bot |
||
1069 | * |
||
1070 | * @param int|string $chatId |
||
1071 | * @param int $messageId |
||
1072 | * @param string $text |
||
1073 | * @param string $inlineMessageId |
||
1074 | * @param string|null $parseMode |
||
1075 | * @param bool $disablePreview |
||
1076 | * @param Types\ReplyKeyboardMarkup|Types\ReplyKeyboardHide|Types\ForceReply| |
||
1077 | * Types\ReplyKeyboardRemove|null $replyMarkup |
||
1078 | * @return Message |
||
1079 | */ |
||
1080 | public function editMessageText( |
||
1099 | |||
1100 | /** |
||
1101 | * Use this method to edit text messages sent by the bot or via the bot |
||
1102 | * |
||
1103 | * @param int|string $chatId |
||
1104 | * @param int $messageId |
||
1105 | * @param string|null $caption |
||
1106 | * @param Types\ReplyKeyboardMarkup|Types\ReplyKeyboardHide|Types\ForceReply| |
||
1107 | * Types\ReplyKeyboardRemove|null $replyMarkup |
||
1108 | * @param string $inlineMessageId |
||
1109 | * |
||
1110 | * @return \TelegramBot\Api\Types\Message |
||
1111 | * @throws \TelegramBot\Api\InvalidArgumentException |
||
1112 | * @throws \TelegramBot\Api\Exception |
||
1113 | */ |
||
1114 | View Code Duplication | public function editMessageCaption( |
|
1129 | |||
1130 | /** |
||
1131 | * Use this method to edit only the reply markup of messages sent by the bot or via the bot |
||
1132 | * |
||
1133 | * @param int|string $chatId |
||
1134 | * @param int $messageId |
||
1135 | * @param Types\ReplyKeyboardMarkup|Types\ReplyKeyboardHide|Types\ForceReply| |
||
1136 | * Types\ReplyKeyboardRemove|null $replyMarkup |
||
1137 | * @param string $inlineMessageId |
||
1138 | * |
||
1139 | * @return Message |
||
1140 | */ |
||
1141 | public function editMessageReplyMarkup( |
||
1154 | |||
1155 | /** |
||
1156 | * Use this method to delete a message, including service messages, with the following limitations: |
||
1157 | * - A message can only be deleted if it was sent less than 48 hours ago. |
||
1158 | * - Bots can delete outgoing messages in groups and supergroups. |
||
1159 | * - Bots granted can_post_messages permissions can delete outgoing messages in channels. |
||
1160 | * - If the bot is an administrator of a group, it can delete any message there. |
||
1161 | * - If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there. |
||
1162 | * |
||
1163 | * @param int|string $chatId |
||
1164 | * @param int $messageId |
||
1165 | * |
||
1166 | * @return bool |
||
1167 | */ |
||
1168 | public function deleteMessage($chatId, $messageId) |
||
1175 | |||
1176 | /** |
||
1177 | * Close curl |
||
1178 | */ |
||
1179 | 9 | public function __destruct() |
|
1183 | |||
1184 | /** |
||
1185 | * @return string |
||
1186 | */ |
||
1187 | public function getUrl() |
||
1191 | |||
1192 | /** |
||
1193 | * @return string |
||
1194 | */ |
||
1195 | public function getFileUrl() |
||
1199 | |||
1200 | /** |
||
1201 | * @param \TelegramBot\Api\Types\Update $update |
||
1202 | * @param string $eventName |
||
1203 | * |
||
1204 | * @throws \TelegramBot\Api\Exception |
||
1205 | */ |
||
1206 | public function trackUpdate(Update $update, $eventName = 'Message') |
||
1218 | |||
1219 | /** |
||
1220 | * Wrapper for tracker |
||
1221 | * |
||
1222 | * @param \TelegramBot\Api\Types\Message $message |
||
1223 | * @param string $eventName |
||
1224 | * |
||
1225 | * @throws \TelegramBot\Api\Exception |
||
1226 | */ |
||
1227 | public function track(Message $message, $eventName = 'Message') |
||
1233 | |||
1234 | /** |
||
1235 | * Use this method to send invoices. On success, the sent Message is returned. |
||
1236 | * |
||
1237 | * @param int|string $chatId |
||
1238 | * @param string $title |
||
1239 | * @param string $description |
||
1240 | * @param string $payload |
||
1241 | * @param string $providerToken |
||
1242 | * @param string $startParameter |
||
1243 | * @param string $currency |
||
1244 | * @param array $prices |
||
1245 | * @param string|null $photoUrl |
||
1246 | * @param int|null $photoSize |
||
1247 | * @param int|null $photoWidth |
||
1248 | * @param int|null $photoHeight |
||
1249 | * @param bool $needName |
||
1250 | * @param bool $needPhoneNumber |
||
1251 | * @param bool $needEmail |
||
1252 | * @param bool $needShippingAddress |
||
1253 | * @param bool $isFlexible |
||
1254 | * @param int|null $replyToMessageId |
||
1255 | * @param Types\ReplyKeyboardMarkup|Types\ReplyKeyboardHide|Types\ForceReply| |
||
1256 | * Types\ReplyKeyboardRemove|null $replyMarkup |
||
1257 | * @param bool $disableNotification |
||
1258 | * @param string|null $providerData |
||
1259 | * @param bool $sendPhoneNumberToProvider |
||
1260 | * @param bool $sendEmailToProvider |
||
1261 | * |
||
1262 | * @return Message |
||
1263 | */ |
||
1264 | public function sendInvoice( |
||
1315 | |||
1316 | /** |
||
1317 | * If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API |
||
1318 | * will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. |
||
1319 | * On success, True is returned. |
||
1320 | * |
||
1321 | * @param string $shippingQueryId |
||
1322 | * @param bool $ok |
||
1323 | * @param array $shipping_options |
||
1324 | * @param null|string $errorMessage |
||
1325 | * |
||
1326 | * @return bool |
||
1327 | * |
||
1328 | */ |
||
1329 | public function answerShippingQuery($shippingQueryId, $ok = true, $shipping_options = [], $errorMessage = null) |
||
1338 | |||
1339 | /** |
||
1340 | * Use this method to respond to such pre-checkout queries. On success, True is returned. |
||
1341 | * Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent. |
||
1342 | * |
||
1343 | * @param string $preCheckoutQueryId |
||
1344 | * @param bool $ok |
||
1345 | * @param null|string $errorMessage |
||
1346 | * |
||
1347 | * @return mixed |
||
1348 | */ |
||
1349 | public function answerPreCheckoutQuery($preCheckoutQueryId, $ok = true, $errorMessage = null) |
||
1357 | |||
1358 | /** |
||
1359 | * Use this method to restrict a user in a supergroup. |
||
1360 | * The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights. |
||
1361 | * Pass True for all boolean parameters to lift restrictions from a user. |
||
1362 | * |
||
1363 | * @param string|int $chatId Unique identifier for the target chat or username of the target supergroup |
||
1364 | * (in the format @supergroupusername) |
||
1365 | * @param int $userId Unique identifier of the target user |
||
1366 | * @param null|integer $untilDate Date when restrictions will be lifted for the user, unix time. |
||
1367 | * If user is restricted for more than 366 days or less than 30 seconds from the current time, |
||
1368 | * they are considered to be restricted forever |
||
1369 | * @param bool $canSendMessages Pass True, if the user can send text messages, contacts, locations and venues |
||
1370 | * @param bool $canSendMediaMessages No Pass True, if the user can send audios, documents, photos, videos, |
||
1371 | * video notes and voice notes, implies can_send_messages |
||
1372 | * @param bool $canSendOtherMessages Pass True, if the user can send animations, games, stickers and |
||
1373 | * use inline bots, implies can_send_media_messages |
||
1374 | * @param bool $canAddWebPagePreviews Pass True, if the user may add web page previews to their messages, |
||
1375 | * implies can_send_media_messages |
||
1376 | * |
||
1377 | * @return bool |
||
1378 | */ |
||
1379 | public function restrictChatMember( |
||
1398 | |||
1399 | /** |
||
1400 | * Use this method to promote or demote a user in a supergroup or a channel. |
||
1401 | * The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. |
||
1402 | * Pass False for all boolean parameters to demote a user. |
||
1403 | * |
||
1404 | * @param string|int $chatId Unique identifier for the target chat or username of the target supergroup |
||
1405 | * (in the format @supergroupusername) |
||
1406 | * @param int $userId Unique identifier of the target user |
||
1407 | * @param bool $canChangeInfo Pass True, if the administrator can change chat title, photo and other settings |
||
1408 | * @param bool $canPostMessages Pass True, if the administrator can create channel posts, channels only |
||
1409 | * @param bool $canEditMessages Pass True, if the administrator can edit messages of other users, channels only |
||
1410 | * @param bool $canDeleteMessages Pass True, if the administrator can delete messages of other users |
||
1411 | * @param bool $canInviteUsers Pass True, if the administrator can invite new users to the chat |
||
1412 | * @param bool $canRestrictMembers Pass True, if the administrator can restrict, ban or unban chat members |
||
1413 | * @param bool $canPinMessages Pass True, if the administrator can pin messages, supergroups only |
||
1414 | * @param bool $canPromoteMembers Pass True, if the administrator can add new administrators with a subset of his |
||
1415 | * own privileges or demote administrators that he has promoted,directly or |
||
1416 | * indirectly (promoted by administrators that were appointed by him) |
||
1417 | * |
||
1418 | * @return bool |
||
1419 | */ |
||
1420 | public function promoteChatMember( |
||
1445 | |||
1446 | /** |
||
1447 | * Use this method to export an invite link to a supergroup or a channel. |
||
1448 | * The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. |
||
1449 | * |
||
1450 | * @param string|int $chatId Unique identifier for the target chat or username of the target channel |
||
1451 | * (in the format @channelusername) |
||
1452 | * @return string |
||
1453 | */ |
||
1454 | public function exportChatInviteLink($chatId) |
||
1460 | |||
1461 | /** |
||
1462 | * Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. |
||
1463 | * The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. |
||
1464 | * |
||
1465 | * @param string|int $chatId Unique identifier for the target chat or username of the target channel |
||
1466 | * (in the format @channelusername) |
||
1467 | * @param \CURLFile|string $photo New chat photo, uploaded using multipart/form-data |
||
1468 | * |
||
1469 | * @return bool |
||
1470 | */ |
||
1471 | public function setChatPhoto($chatId, $photo) |
||
1478 | |||
1479 | /** |
||
1480 | * Use this method to delete a chat photo. Photos can't be changed for private chats. |
||
1481 | * The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. |
||
1482 | * |
||
1483 | * @param string|int $chatId Unique identifier for the target chat or username of the target channel |
||
1484 | * (in the format @channelusername) |
||
1485 | * |
||
1486 | * @return bool |
||
1487 | */ |
||
1488 | public function deleteChatPhoto($chatId) |
||
1494 | |||
1495 | /** |
||
1496 | * Use this method to change the title of a chat. Titles can't be changed for private chats. |
||
1497 | * The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. |
||
1498 | * |
||
1499 | * @param string|int $chatId Unique identifier for the target chat or username of the target channel |
||
1500 | * (in the format @channelusername) |
||
1501 | * @param string $title New chat title, 1-255 characters |
||
1502 | * |
||
1503 | * @return bool |
||
1504 | */ |
||
1505 | public function setChatTitle($chatId, $title) |
||
1512 | |||
1513 | /** |
||
1514 | * Use this method to change the description of a supergroup or a channel. |
||
1515 | * The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. |
||
1516 | * |
||
1517 | * @param string|int $chatId Unique identifier for the target chat or username of the target channel |
||
1518 | * (in the format @channelusername) |
||
1519 | * @param string|null $description New chat description, 0-255 characters |
||
1520 | * |
||
1521 | * @return bool |
||
1522 | */ |
||
1523 | public function setChatDescription($chatId, $description = null) |
||
1530 | |||
1531 | /** |
||
1532 | * Use this method to pin a message in a supergroup. |
||
1533 | * The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. |
||
1534 | * |
||
1535 | * @param string|int $chatId Unique identifier for the target chat or username of the target channel |
||
1536 | * (in the format @channelusername) |
||
1537 | * @param int $messageId Identifier of a message to pin |
||
1538 | * @param bool $disableNotification |
||
1539 | * |
||
1540 | * @return bool |
||
1541 | */ |
||
1542 | public function pinChatMessage($chatId, $messageId, $disableNotification = false) |
||
1550 | |||
1551 | /** |
||
1552 | * Use this method to unpin a message in a supergroup chat. |
||
1553 | * The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. |
||
1554 | * |
||
1555 | * @param string|int $chatId Unique identifier for the target chat or username of the target channel |
||
1556 | * (in the format @channelusername) |
||
1557 | * |
||
1558 | * @return bool |
||
1559 | */ |
||
1560 | public function unpinChatMessage($chatId) |
||
1566 | |||
1567 | /** |
||
1568 | * Use this method to get up to date information about the chat |
||
1569 | * (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). |
||
1570 | * |
||
1571 | * @param string|int $chatId Unique identifier for the target chat or username of the target channel |
||
1572 | * (in the format @channelusername) |
||
1573 | * |
||
1574 | * @return Chat |
||
1575 | */ |
||
1576 | public function getChat($chatId) |
||
1582 | |||
1583 | /** |
||
1584 | * Use this method to get information about a member of a chat. |
||
1585 | * |
||
1586 | * @param string|int $chatId Unique identifier for the target chat or username of the target channel |
||
1587 | * (in the format @channelusername) |
||
1588 | * @param int $userId |
||
1589 | * |
||
1590 | * @return ChatMember |
||
1591 | */ |
||
1592 | public function getChatMember($chatId, $userId) |
||
1599 | |||
1600 | /** |
||
1601 | * Use this method for your bot to leave a group, supergroup or channel. |
||
1602 | * |
||
1603 | * @param string|int $chatId Unique identifier for the target chat or username of the target channel |
||
1604 | * (in the format @channelusername) |
||
1605 | * |
||
1606 | * @return bool |
||
1607 | */ |
||
1608 | public function leaveChat($chatId) |
||
1614 | |||
1615 | /** |
||
1616 | * Use this method to get the number of members in a chat. |
||
1617 | * |
||
1618 | * @param string|int $chatId Unique identifier for the target chat or username of the target channel |
||
1619 | * (in the format @channelusername) |
||
1620 | * |
||
1621 | * @return int |
||
1622 | */ |
||
1623 | public function getChatMembersCount($chatId) |
||
1632 | |||
1633 | /** |
||
1634 | * Use this method to get a list of administrators in a chat. |
||
1635 | * |
||
1636 | * @param string|int $chatId Unique identifier for the target chat or username of the target channel |
||
1637 | * (in the format @channelusername) |
||
1638 | * |
||
1639 | * @return array |
||
1640 | */ |
||
1641 | public function getChatAdministrators($chatId) |
||
1652 | |||
1653 | /** |
||
1654 | * As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. |
||
1655 | * Use this method to send video messages. |
||
1656 | * On success, the sent Message is returned. |
||
1657 | * |
||
1658 | * @param int|string $chatId chat_id or @channel_name |
||
1659 | * @param \CURLFile|string $videoNote |
||
1660 | * @param int|null $duration |
||
1661 | * @param int|null $length |
||
1662 | * @param int|null $replyToMessageId |
||
1663 | * @param Types\ReplyKeyboardMarkup|Types\ReplyKeyboardHide|Types\ForceReply| |
||
1664 | * Types\ReplyKeyboardRemove|null $replyMarkup |
||
1665 | * @param bool $disableNotification |
||
1666 | * |
||
1667 | * @return \TelegramBot\Api\Types\Message |
||
1668 | * @throws \TelegramBot\Api\InvalidArgumentException |
||
1669 | * @throws \TelegramBot\Api\Exception |
||
1670 | */ |
||
1671 | public function sendVideoNote( |
||
1690 | |||
1691 | /** |
||
1692 | * Use this method to send a group of photos or videos as an album. |
||
1693 | * On success, the sent \TelegramBot\Api\Types\Message is returned. |
||
1694 | * |
||
1695 | * @param int|string $chatId |
||
1696 | * @param ArrayOfInputMedia $media |
||
1697 | * @param int|null $replyToMessageId |
||
1698 | * @param bool $disableNotification |
||
1699 | * |
||
1700 | * @return array |
||
1701 | * @throws \TelegramBot\Api\Exception |
||
1702 | */ |
||
1703 | public function sendMediaGroup( |
||
1716 | |||
1717 | /** |
||
1718 | * Enable proxy for curl requests. Empty string will disable proxy. |
||
1719 | * |
||
1720 | * @param string $proxyString |
||
1721 | * |
||
1722 | * @return BotApi |
||
1723 | */ |
||
1724 | public function setProxy($proxyString = '') |
||
1737 | |||
1738 | /** |
||
1739 | * Set an option for a cURL transfer |
||
1740 | * |
||
1741 | * @param int $option The CURLOPT_XXX option to set |
||
1742 | * @param mixed $value The value to be set on option |
||
1743 | */ |
||
1744 | public function setCurlOption($option, $value) |
||
1748 | |||
1749 | /** |
||
1750 | * Unset an option for a cURL transfer |
||
1751 | * |
||
1752 | * @param int $option The CURLOPT_XXX option to unset |
||
1753 | */ |
||
1754 | public function unsetCurlOption($option) |
||
1758 | |||
1759 | /** |
||
1760 | * Clean custom options |
||
1761 | */ |
||
1762 | public function resetCurlOptions() |
||
1766 | } |
||
1767 |