From 770c1c89d52c9d5ce546cf0862ba27e66049035b Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Fri, 9 Mar 2018 16:39:36 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/danog/MadelineProto/MTProto.php | 8 ++++++-- .../MadelineProto/MTProtoTools/PeerHandler.php | 18 +++++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/danog/MadelineProto/MTProto.php b/src/danog/MadelineProto/MTProto.php index e777b79c..42de7454 100644 --- a/src/danog/MadelineProto/MTProto.php +++ b/src/danog/MadelineProto/MTProto.php @@ -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']]; diff --git a/src/danog/MadelineProto/MTProtoTools/PeerHandler.php b/src/danog/MadelineProto/MTProtoTools/PeerHandler.php index 8f7456db..c39671ce 100644 --- a/src/danog/MadelineProto/MTProtoTools/PeerHandler.php +++ b/src/danog/MadelineProto/MTProtoTools/PeerHandler.php @@ -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) {