Skip to content

Commit d5464bc

Browse files
authored
Merge pull request #214 from Eleirbag89/analysis-lKYMmr
Apply fixes from StyleCI
2 parents 1a3956b + 2ceaf20 commit d5464bc

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

Telegram.php

+14-12
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function __construct($bot_token, $log_errors = true, array $proxy = [])
106106
*/
107107
public function endpoint($api, array $content, $post = true)
108108
{
109-
$url = 'https://api.telegram.org/bot' . $this->bot_token . '/' . $api;
109+
$url = 'https://api.telegram.org/bot'.$this->bot_token.'/'.$api;
110110
if ($post) {
111111
$reply = $this->sendAPIRequest($url, $content);
112112
} else {
@@ -1684,7 +1684,7 @@ public function editMessageReplyMarkup(array $content)
16841684
*/
16851685
public function downloadFile($telegram_file_path, $local_file_path)
16861686
{
1687-
$file_url = 'https://api.telegram.org/file/bot' . $this->bot_token . '/' . $telegram_file_path;
1687+
$file_url = 'https://api.telegram.org/file/bot'.$this->bot_token.'/'.$telegram_file_path;
16881688
$in = fopen($file_url, 'rb');
16891689
$out = fopen($local_file_path, 'wb');
16901690

@@ -1776,6 +1776,7 @@ public function Caption()
17761776
if ($type == self::CHANNEL_POST) {
17771777
return @$this->data['channel_post']['caption'];
17781778
}
1779+
17791780
return @$this->data['message']['caption'];
17801781
}
17811782

@@ -2041,6 +2042,7 @@ public function messageFromGroupTitle()
20412042
if ($this->data['message']['chat']['type'] != 'private') {
20422043
return $this->data['message']['chat']['title'];
20432044
}
2045+
20442046
return '';
20452047
}
20462048

@@ -2056,10 +2058,10 @@ public function messageFromGroupTitle()
20562058
public function buildKeyBoard(array $options, $onetime = false, $resize = false, $selective = true)
20572059
{
20582060
$replyMarkup = [
2059-
'keyboard' => $options,
2061+
'keyboard' => $options,
20602062
'one_time_keyboard' => $onetime,
2061-
'resize_keyboard' => $resize,
2062-
'selective' => $selective,
2063+
'resize_keyboard' => $resize,
2064+
'selective' => $selective,
20632065
];
20642066
$encodedMarkup = json_encode($replyMarkup, true);
20652067

@@ -2134,8 +2136,8 @@ public function buildInlineKeyboardButton(
21342136
public function buildKeyboardButton($text, $request_contact = false, $request_location = false)
21352137
{
21362138
$replyMarkup = [
2137-
'text' => $text,
2138-
'request_contact' => $request_contact,
2139+
'text' => $text,
2140+
'request_contact' => $request_contact,
21392141
'request_location' => $request_location,
21402142
];
21412143

@@ -2152,7 +2154,7 @@ public function buildKeyBoardHide($selective = true)
21522154
{
21532155
$replyMarkup = [
21542156
'remove_keyboard' => true,
2155-
'selective' => $selective,
2157+
'selective' => $selective,
21562158
];
21572159
$encodedMarkup = json_encode($replyMarkup, true);
21582160

@@ -2168,7 +2170,7 @@ public function buildForceReply($selective = true)
21682170
{
21692171
$replyMarkup = [
21702172
'force_reply' => true,
2171-
'selective' => $selective,
2173+
'selective' => $selective,
21722174
];
21732175
$encodedMarkup = json_encode($replyMarkup, true);
21742176

@@ -3169,7 +3171,7 @@ public function getUpdateType()
31693171
private function sendAPIRequest($url, array $content, $post = true)
31703172
{
31713173
if (isset($content['chat_id'])) {
3172-
$url = $url . '?chat_id=' . $content['chat_id'];
3174+
$url = $url.'?chat_id='.$content['chat_id'];
31733175
unset($content['chat_id']);
31743176
}
31753177
$ch = curl_init();
@@ -3225,7 +3227,7 @@ private function sendAPIRequest($url, array $content, $post = true)
32253227
function curl_file_create($filename, $mimetype = '', $postname = '')
32263228
{
32273229
return "@$filename;filename="
3228-
. ($postname ?: basename($filename))
3229-
. ($mimetype ? ";type=$mimetype" : '');
3230+
.($postname ?: basename($filename))
3231+
.($mimetype ? ";type=$mimetype" : '');
32303232
}
32313233
}

TelegramErrorLogger.php

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22

3-
43
/**
54
* Telegram Error Logger Class.
65
*

bot examples/webhook/update.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@
8585
} elseif ($text == '/inlinekeyboard') {
8686
// Shows the Inline Keyboard and Trigger a callback on a button press
8787
$option = [
88-
[
88+
[
8989
$telegram->buildInlineKeyBoardButton('Callback 1', $url = '', $callback_data = '1'),
9090
$telegram->buildInlineKeyBoardButton('Callback 2', $url = '', $callback_data = '2'),
91-
],
92-
];
91+
],
92+
];
9393

9494
$keyb = $telegram->buildInlineKeyBoard($option);
9595
$content = ['chat_id' => $chat_id, 'reply_markup' => $keyb, 'text' => 'This is an InlineKeyboard Test with Callbacks'];

0 commit comments

Comments
 (0)