From 2a303fe21de983cbfb571859049071337b8adab8 Mon Sep 17 00:00:00 2001 From: Setiawan Hu Date: Thu, 20 May 2021 21:34:00 +0700 Subject: [PATCH] Code cleaning --- src/MadelineProto.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/MadelineProto.php b/src/MadelineProto.php index a372adc..6cfa284 100644 --- a/src/MadelineProto.php +++ b/src/MadelineProto.php @@ -46,11 +46,12 @@ class MadelineProto { $response = new TelegramObject($this->client->completePhoneLogin($code)); - switch ($response->return_type) { - case Account::PASSWORD: - throw new NeedTwoFactorAuthException($response); - case Account::NEED_SIGN_UP: - throw new SignUpNeededException(); + if ($response->return_type == Account::PASSWORD) { + throw new NeedTwoFactorAuthException($response); + } + + if ($response->return_type == Account::NEED_SIGN_UP) { + throw new SignUpNeededException(); } return $response; @@ -145,7 +146,7 @@ class MadelineProto * * @return ClientMessages */ - public function messages() + public function messages(): ClientMessages { return new ClientMessages($this->client->messages); }