Skip to content

Commit b7e5fc3

Browse files
committed
Apply fixes from StyleCI
1 parent a4a43cc commit b7e5fc3

File tree

1 file changed

+32
-14
lines changed

1 file changed

+32
-14
lines changed

Telegram.php

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function __construct($bot_token, $log_errors = true, array $proxy = [])
119119
*/
120120
public function endpoint($api, array $content, $post = true)
121121
{
122-
$url = 'https://api.telegram.org/bot' . $this->bot_token . '/' . $api;
122+
$url = 'https://api.telegram.org/bot'.$this->bot_token.'/'.$api;
123123
if ($post) {
124124
$reply = $this->sendAPIRequest($url, $content);
125125
} else {
@@ -741,7 +741,7 @@ public function stopPoll(array $content)
741741
*/
742742
public function downloadFile($telegram_file_path, $local_file_path)
743743
{
744-
$file_url = 'https://api.telegram.org/file/bot' . $this->bot_token . '/' . $telegram_file_path;
744+
$file_url = 'https://api.telegram.org/file/bot'.$this->bot_token.'/'.$telegram_file_path;
745745
$in = fopen($file_url, 'rb');
746746
$out = fopen($local_file_path, 'wb');
747747

@@ -845,6 +845,7 @@ public function Caption()
845845
public function ChatID()
846846
{
847847
$chat = $this->Chat();
848+
848849
return $chat['id'];
849850
}
850851

@@ -1151,10 +1152,10 @@ public function messageFromGroupTitle()
11511152
public function buildKeyBoard(array $options, $onetime = false, $resize = false, $selective = true)
11521153
{
11531154
$replyMarkup = [
1154-
'keyboard' => $options,
1155+
'keyboard' => $options,
11551156
'one_time_keyboard' => $onetime,
1156-
'resize_keyboard' => $resize,
1157-
'selective' => $selective,
1157+
'resize_keyboard' => $resize,
1158+
'selective' => $selective,
11581159
];
11591160
$encodedMarkup = json_encode($replyMarkup, true);
11601161

@@ -1197,8 +1198,7 @@ public function buildInlineKeyboardButton(
11971198
$switch_inline_query_current_chat = null,
11981199
$callback_game = '',
11991200
$pay = ''
1200-
)
1201-
{
1201+
) {
12021202
$replyMarkup = [
12031203
'text' => $text,
12041204
];
@@ -1230,8 +1230,8 @@ public function buildInlineKeyboardButton(
12301230
public function buildKeyboardButton($text, $request_contact = false, $request_location = false)
12311231
{
12321232
$replyMarkup = [
1233-
'text' => $text,
1234-
'request_contact' => $request_contact,
1233+
'text' => $text,
1234+
'request_contact' => $request_contact,
12351235
'request_location' => $request_location,
12361236
];
12371237

@@ -1248,7 +1248,7 @@ public function buildKeyBoardHide($selective = true)
12481248
{
12491249
$replyMarkup = [
12501250
'remove_keyboard' => true,
1251-
'selective' => $selective,
1251+
'selective' => $selective,
12521252
];
12531253
$encodedMarkup = json_encode($replyMarkup, true);
12541254

@@ -1264,7 +1264,7 @@ public function buildForceReply($selective = true)
12641264
{
12651265
$replyMarkup = [
12661266
'force_reply' => true,
1267-
'selective' => $selective,
1267+
'selective' => $selective,
12681268
];
12691269
$encodedMarkup = json_encode($replyMarkup, true);
12701270

@@ -1718,74 +1718,92 @@ public function getUpdateType()
17181718
$update = $this->data;
17191719
if (isset($update['inline_query'])) {
17201720
$this->update_type = self::INLINE_QUERY;
1721+
17211722
return $this->update_type;
17221723
}
17231724
if (isset($update['callback_query'])) {
17241725
$this->update_type = self::CALLBACK_QUERY;
1726+
17251727
return $this->update_type;
17261728
}
17271729
if (isset($update['edited_message'])) {
17281730
$this->update_type = self::EDITED_MESSAGE;
1731+
17291732
return $this->update_type;
17301733
}
17311734
if (isset($update['message']['text'])) {
17321735
$this->update_type = self::MESSAGE;
1736+
17331737
return $this->update_type;
17341738
}
17351739
if (isset($update['message']['photo'])) {
17361740
$this->update_type = self::PHOTO;
1741+
17371742
return $this->update_type;
17381743
}
17391744
if (isset($update['message']['video'])) {
17401745
$this->update_type = self::VIDEO;
1746+
17411747
return $this->update_type;
17421748
}
17431749
if (isset($update['message']['audio'])) {
17441750
$this->update_type = self::AUDIO;
1751+
17451752
return $this->update_type;
17461753
}
17471754
if (isset($update['message']['voice'])) {
17481755
$this->update_type = self::VOICE;
1756+
17491757
return $this->update_type;
17501758
}
17511759
if (isset($update['message']['contact'])) {
17521760
$this->update_type = self::CONTACT;
1761+
17531762
return $this->update_type;
17541763
}
17551764
if (isset($update['message']['location'])) {
17561765
$this->update_type = self::LOCATION;
1766+
17571767
return $this->update_type;
17581768
}
17591769
if (isset($update['message']['reply_to_message'])) {
17601770
$this->update_type = self::REPLY;
1771+
17611772
return $this->update_type;
17621773
}
17631774
if (isset($update['message']['animation'])) {
17641775
$this->update_type = self::ANIMATION;
1776+
17651777
return $this->update_type;
17661778
}
17671779
if (isset($update['message']['sticker'])) {
17681780
$this->update_type = self::STICKER;
1781+
17691782
return $this->update_type;
17701783
}
17711784
if (isset($update['message']['document'])) {
17721785
$this->update_type = self::DOCUMENT;
1786+
17731787
return $this->update_type;
17741788
}
17751789
if (isset($update['message']['new_chat_member'])) {
17761790
$this->update_type = self::NEW_CHAT_MEMBER;
1791+
17771792
return $this->update_type;
17781793
}
17791794
if (isset($update['message']['left_chat_member'])) {
17801795
$this->update_type = self::LEFT_CHAT_MEMBER;
1796+
17811797
return $this->update_type;
17821798
}
17831799
if (isset($update['my_chat_member'])) {
17841800
$this->update_type = self::MY_CHAT_MEMBER;
1801+
17851802
return $this->update_type;
17861803
}
17871804
if (isset($update['channel_post'])) {
17881805
$this->update_type = self::CHANNEL_POST;
1806+
17891807
return $this->update_type;
17901808
}
17911809

@@ -1795,7 +1813,7 @@ public function getUpdateType()
17951813
private function sendAPIRequest($url, array $content, $post = true)
17961814
{
17971815
if (isset($content['chat_id'])) {
1798-
$url = $url . '?chat_id=' . $content['chat_id'];
1816+
$url = $url.'?chat_id='.$content['chat_id'];
17991817
unset($content['chat_id']);
18001818
}
18011819
$ch = curl_init();
@@ -1851,7 +1869,7 @@ private function sendAPIRequest($url, array $content, $post = true)
18511869
function curl_file_create($filename, $mimetype = '', $postname = '')
18521870
{
18531871
return "@$filename;filename="
1854-
. ($postname ?: basename($filename))
1855-
. ($mimetype ? ";type=$mimetype" : '');
1872+
.($postname ?: basename($filename))
1873+
.($mimetype ? ";type=$mimetype" : '');
18561874
}
18571875
}

0 commit comments

Comments
 (0)