File tree 2 files changed +10
-14
lines changed
2 files changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -166,11 +166,7 @@ public static function track(Update $update, $command = '')
166
166
}
167
167
168
168
// In case there is no from field assign id = 0
169
- if (isset ($ data ['from ' ]['id ' ])) {
170
- $ uid = $ data ['from ' ]['id ' ];
171
- } else {
172
- $ uid = 0 ;
173
- }
169
+ $ uid = (isset ($ data ['from ' ]['id ' ])) ? $ data ['from ' ]['id ' ] : 0 ;
174
170
175
171
try {
176
172
$ response = self ::$ client ->post (
@@ -222,7 +218,7 @@ public static function shortenUrl($url, $user_id)
222
218
throw new TelegramException ('User id is empty! ' );
223
219
}
224
220
225
- if ($ cached = BotanDB::selectShortUrl ($ user_id , $ url )) {
221
+ if ($ cached = BotanDB::selectShortUrl ($ url , $ user_id )) {
226
222
return $ cached ;
227
223
}
228
224
@@ -240,7 +236,7 @@ public static function shortenUrl($url, $user_id)
240
236
$ result = $ e ->getMessage ();
241
237
} finally {
242
238
if (filter_var ($ result , FILTER_VALIDATE_URL ) !== false ) {
243
- BotanDB::insertShortUrl ($ user_id , $ url , $ result );
239
+ BotanDB::insertShortUrl ($ url , $ user_id , $ result );
244
240
return $ result ;
245
241
} else {
246
242
TelegramLog::debug ('Botan.io URL shortening failed for \'' . $ url . '\': ' . ($ result ?: 'empty response ' ) . "\n\n" );
Original file line number Diff line number Diff line change @@ -32,13 +32,13 @@ public static function initializeBotanDb()
32
32
/**
33
33
* Select cached shortened URL from the database
34
34
*
35
- * @param $user_id
36
- * @param $url
35
+ * @param string $url
36
+ * @param integer $user_id
37
37
*
38
38
* @return array|bool
39
39
* @throws \Longman\TelegramBot\Exception\TelegramException
40
40
*/
41
- public static function selectShortUrl ($ user_id , $ url )
41
+ public static function selectShortUrl ($ url , $ user_id )
42
42
{
43
43
if (!self ::isDbConnected ()) {
44
44
return false ;
@@ -65,14 +65,14 @@ public static function selectShortUrl($user_id, $url)
65
65
/**
66
66
* Insert shortened URL into the database
67
67
*
68
- * @param $user_id
69
- * @param $url
70
- * @param $short_url
68
+ * @param string $url
69
+ * @param integer $user_id
70
+ * @param string $short_url
71
71
*
72
72
* @return bool
73
73
* @throws \Longman\TelegramBot\Exception\TelegramException
74
74
*/
75
- public static function insertShortUrl ($ user_id , $ url , $ short_url )
75
+ public static function insertShortUrl ($ url , $ user_id , $ short_url )
76
76
{
77
77
if (!self ::isDbConnected ()) {
78
78
return false ;
You can’t perform that action at this time.
0 commit comments