Apply fixes from StyleCI

This commit is contained in:
Daniil Gentili 2018-03-09 16:39:36 +00:00 committed by StyleCI Bot
parent 87f2ec50ac
commit 770c1c89d5
2 changed files with 19 additions and 7 deletions

View File

@ -216,8 +216,12 @@ class MTProto
if (isset($settings['authorization']['rsa_key'])) {
unset($settings['authorization']['rsa_key']);
}
if (!isset($this->full_chats)) $this->full_chats = [];
if (!isset($this->secret_chats)) $this->secret_chats = [];
if (!isset($this->full_chats)) {
$this->full_chats = [];
}
if (!isset($this->secret_chats)) {
$this->secret_chats = [];
}
foreach ($this->full_chats as $id => $full) {
$this->full_chats[$id] = ['full' => $full['full'], 'last_update' => $full['last_update']];

View File

@ -116,8 +116,13 @@ trait PeerHandler
try {
return isset($this->chats[$this->get_info($id)['bot_api_id']]);
} catch (\danog\MadelineProto\RPCErrorException $e) {
if ($e->rpc === 'CHAT_FORBIDDEN') return true;
if ($e->rpc === 'CHANNEL_PRIVATE') return true;
if ($e->rpc === 'CHAT_FORBIDDEN') {
return true;
}
if ($e->rpc === 'CHANNEL_PRIVATE') {
return true;
}
return false;
}
}
@ -194,7 +199,6 @@ trait PeerHandler
case 'chatForbidden':
case 'channelForbidden':
throw new \danog\MadelineProto\RPCErrorException('CHAT_FORBIDDEN');
default:
throw new \danog\MadelineProto\Exception('Invalid constructor given '.var_export($id, true));
break;
@ -224,7 +228,9 @@ trait PeerHandler
} catch (\danog\MadelineProto\Exception $e) {
if ($e->getMessage() === 'This peer is not present in the internal peer database') {
unset($this->chats[$id]);
} else throw $e;
} else {
throw $e;
}
}
}
if (!isset($this->settings['pwr']['requests']) || $this->settings['pwr']['requests'] === true && $recursive) {
@ -489,7 +495,9 @@ trait PeerHandler
}
}
if ($gres['_'] === 'channels.channelParticipantsNotModified') continue;
if ($gres['_'] === 'channels.channelParticipantsNotModified') {
continue;
}
$count = $gres['count'];
while ($offset <= $count) {