Skip to content

Commit

Permalink
Code cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
setiawanhu committed May 20, 2021
1 parent 3f89407 commit 2a303fe
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/MadelineProto.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@ public function completePhoneLogin(string $code): TelegramObject
{
$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;
Expand Down Expand Up @@ -145,7 +146,7 @@ public function isLoggedIn(): bool
*
* @return ClientMessages
*/
public function messages()
public function messages(): ClientMessages
{
return new ClientMessages($this->client->messages);
}
Expand Down

0 comments on commit 2a303fe

Please sign in to comment.