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 | public function __construct(array $data, $bot_name) |
||
52 | |||
53 | /** |
||
54 | * Check if array is associative |
||
55 | * |
||
56 | 9 | * @link https://stackoverflow.com/a/4254008 |
|
57 | 9 | * |
|
58 | * @param array $array |
||
59 | 1 | * |
|
60 | 8 | * @return bool |
|
61 | */ |
||
62 | 1 | protected function isAssoc(array $array) |
|
66 | 7 | ||
67 | /** |
||
68 | * If response is ok |
||
69 | 7 | * |
|
70 | * @return bool |
||
71 | */ |
||
72 | 7 | public function isOk() |
|
76 | |||
77 | 7 | /** |
|
78 | * Print error |
||
79 | * |
||
80 | * @return string |
||
81 | 11 | */ |
|
82 | 11 | public function printError() |
|
86 | |||
87 | 2 | /** |
|
88 | 2 | * Create and return the object of the received result |
|
89 | 2 | * |
|
90 | 2 | * @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 | private function createResultObject($result, $bot_name) |
||
120 | 11 | ||
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 | 5 | * @throws \Longman\TelegramBot\Exception\TelegramException |
|
129 | */ |
||
130 | 5 | private function createResultObjects($result, $bot_name) |
|
153 | } |
||
154 |