1 | <?php |
||
23 | class ServerResponse extends Entity |
||
24 | { |
||
25 | /** |
||
26 | * ServerResponse constructor. |
||
27 | * |
||
28 | * @param array $data |
||
29 | * @param string $bot_name |
||
30 | * |
||
31 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
32 | */ |
||
33 | 14 | public function __construct(array $data, $bot_name) |
|
52 | |||
53 | /** |
||
54 | * Check if array is associative |
||
55 | * |
||
56 | * @link https://stackoverflow.com/a/4254008 |
||
57 | * |
||
58 | * @param array $array |
||
59 | * |
||
60 | * @return bool |
||
61 | */ |
||
62 | 11 | protected function isAssoc(array $array) |
|
66 | |||
67 | /** |
||
68 | * If response is ok |
||
69 | * |
||
70 | * @return bool |
||
71 | */ |
||
72 | 5 | public function isOk() |
|
76 | |||
77 | /** |
||
78 | * Print error |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | public function printError() |
||
86 | |||
87 | /** |
||
88 | * Create and return the object of the received result |
||
89 | * |
||
90 | * @param array $result |
||
91 | * @param string $bot_name |
||
92 | * |
||
93 | * @return \Longman\TelegramBot\Entities\Chat|\Longman\TelegramBot\Entities\ChatMember|\Longman\TelegramBot\Entities\File|\Longman\TelegramBot\Entities\Message|\Longman\TelegramBot\Entities\User|\Longman\TelegramBot\Entities\UserProfilePhotos|\Longman\TelegramBot\Entities\WebhookInfo |
||
94 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
95 | */ |
||
96 | 9 | private function createResultObject($result, $bot_name) |
|
120 | |||
121 | /** |
||
122 | * Create and return the objects array of the received result |
||
123 | * |
||
124 | * @param array $result |
||
125 | * @param string $bot_name |
||
126 | * |
||
127 | * @return null|\Longman\TelegramBot\Entities\ChatMember[]|\Longman\TelegramBot\Entities\Update[] |
||
128 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
129 | */ |
||
130 | 2 | private function createResultObjects($result, $bot_name) |
|
153 | } |
||
154 |