Advertisement
Guest User

Untitled

a guest
Jul 24th, 2020
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.48 KB | None | 0 0
  1. public static function create(TelegramResponse $response): self
  2.     {
  3.         $data = $response->getDecodedBody();
  4.  
  5.         $code = null;
  6.         $message = null;
  7.         if (isset($data['ok'], $data['error_code']) && $data['ok'] === false) {
  8.             $code = $data['error_code'];
  9.             $message = $data['description'] ?? 'Unknown error from API.';
  10.         }
  11.  
  12.         // Others
  13.         return new static($response, new TelegramOtherException($message, $code));
  14.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement