1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-30 09:58:59 +01:00

Apply fixes from StyleCI

This commit is contained in:
Daniil Gentili 2018-03-04 00:00:18 +00:00 committed by StyleCI Bot
parent 88c9e18517
commit 6604623188
3 changed files with 13 additions and 12 deletions

View File

@ -18,16 +18,18 @@ namespace danog\MadelineProto\MTProtoTools;
*/
trait PeerHandler
{
public function to_supergroup($id)
{
return -($id + pow(10, (int) floor(log($id, 10) + 3)));
}
public function is_supergroup($id)
{
$log = log(-$id, 10);
return ($log-intval($log))*1000<10;
return ($log - intval($log)) * 1000 < 10;
}
public function add_users($users)
{
foreach ($users as $key => $user) {
@ -581,5 +583,4 @@ trait PeerHandler
return false;
}
}

View File

@ -358,37 +358,37 @@ trait BotAPI
case 'b':
case 'strong':
$text = $this->html_entity_decode($node->textContent);
$length = $this->mb_strlen($text);
$entities[] = ['_' => 'messageEntityBold', 'offset' => $offset, 'length' => $length];
$new_message .= $text;
$offset += $length;
break;
case 'i':
case 'em':
$text = $this->html_entity_decode($node->textContent);
$length = $this->mb_strlen($text);
$entities[] = ['_' => 'messageEntityItalic', 'offset' => $offset, 'length' => $length];
$new_message .= $text;
$offset += $length;
break;
case 'code':
$text = $this->html_entity_decode($node->textContent);
$length = $this->mb_strlen($text);
$entities[] = ['_' => 'messageEntityCode', 'offset' => $offset, 'length' => $length];
$new_message .= $text;
$offset += $length;
break;
case 'pre':
$text = $this->html_entity_decode($node->textContent);
$length = $this->mb_strlen($text);
$language = $node->getAttribute('language');
if ($language === null) {
$language = '';

View File

@ -23,7 +23,7 @@ trait TLParams
$param['type'] = $matches[2];
}
if (preg_match('/^(v|V)ector\<(.*)\>$/', $param['type'], $matches)) {
$param['type'] = $matches[1] === 'v' ? 'vector': 'Vector t';
$param['type'] = $matches[1] === 'v' ? 'vector' : 'Vector t';
$param['subtype'] = $matches[2];
$param['subtype'] = ($mtproto && $param['subtype'] === 'Message' ? 'MT' : '').$param['subtype'];
$param['subtype'] = $mtproto && $param['subtype'] === '%Message' ? '%MTMessage' : $param['subtype'];