1 | <?php |
||
26 | class ServerResponse extends Entity |
||
27 | { |
||
28 | /** |
||
29 | * ServerResponse constructor. |
||
30 | * |
||
31 | * @param array $data |
||
32 | * @param string $bot_username |
||
33 | * |
||
34 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
35 | */ |
||
36 | 10 | public function __construct(array $data, $bot_username) |
|
55 | |||
56 | /** |
||
57 | * Check if array is associative |
||
58 | * |
||
59 | * @link https://stackoverflow.com/a/4254008 |
||
60 | * |
||
61 | * @param array $array |
||
62 | * |
||
63 | * @return bool |
||
64 | */ |
||
65 | 7 | protected function isAssoc(array $array) |
|
69 | |||
70 | /** |
||
71 | * If response is ok |
||
72 | * |
||
73 | * @return bool |
||
74 | */ |
||
75 | 5 | public function isOk() |
|
79 | |||
80 | /** |
||
81 | * Print error |
||
82 | * |
||
83 | * @see https://secure.php.net/manual/en/function.print-r.php |
||
84 | * |
||
85 | * @param bool $return |
||
86 | * |
||
87 | * @return bool|string |
||
88 | */ |
||
89 | public function printError($return = false) |
||
101 | |||
102 | /** |
||
103 | * Create and return the object of the received result |
||
104 | * |
||
105 | * @param array $result |
||
106 | * @param string $bot_username |
||
107 | * |
||
108 | * @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 |
||
109 | */ |
||
110 | 5 | private function createResultObject(array $result, $bot_username) |
|
131 | |||
132 | /** |
||
133 | * Create and return the objects array of the received result |
||
134 | * |
||
135 | * @param array $result |
||
136 | * @param string $bot_username |
||
137 | * |
||
138 | * @return \Longman\TelegramBot\Entities\ChatMember[]|\Longman\TelegramBot\Entities\Games\GameHighScore[]|\Longman\TelegramBot\Entities\Message[]|\Longman\TelegramBot\Entities\Update[] |
||
139 | */ |
||
140 | 2 | private function createResultObjects(array $result, $bot_username) |
|
162 | } |
||
163 |