1 | <?php |
||
23 | class ServerResponse extends Entity |
||
24 | { |
||
25 | /** |
||
26 | * ServerResponse constructor. |
||
27 | * |
||
28 | * @param array $data |
||
29 | * @param string $bot_username |
||
30 | * |
||
31 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
32 | */ |
||
33 | 9 | public function __construct(array $data, $bot_username) |
|
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 | 6 | 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 | * @see https://secure.php.net/manual/en/function.print-r.php |
||
81 | * |
||
82 | * @param bool $return |
||
83 | * |
||
84 | * @return bool|string |
||
85 | */ |
||
86 | public function printError($return = false) |
||
98 | |||
99 | /** |
||
100 | * Create and return the object of the received result |
||
101 | * |
||
102 | * @param array $result |
||
103 | * @param string $bot_username |
||
104 | * |
||
105 | * @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 |
||
106 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
107 | */ |
||
108 | 4 | private function createResultObject($result, $bot_username) |
|
132 | |||
133 | /** |
||
134 | * Create and return the objects array of the received result |
||
135 | * |
||
136 | * @param array $result |
||
137 | * @param string $bot_username |
||
138 | * |
||
139 | * @return null|\Longman\TelegramBot\Entities\ChatMember[]|\Longman\TelegramBot\Entities\Update[] |
||
140 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
141 | */ |
||
142 | 2 | private function createResultObjects($result, $bot_username) |
|
165 | } |
||
166 |