1 | <?php |
||
27 | class Response |
||
28 | { |
||
29 | /** @var bool */ |
||
30 | protected $ok = false; |
||
31 | |||
32 | /** @var string */ |
||
33 | protected $description; |
||
34 | |||
35 | /** @var array */ |
||
36 | protected $result; |
||
37 | 11 | ||
38 | /** @var int */ |
||
39 | protected $error_code; |
||
40 | 11 | ||
41 | 11 | /** @var array */ |
|
42 | protected $parameters; |
||
43 | 11 | ||
44 | 11 | /** @var array */ |
|
45 | protected $raw_data; |
||
46 | 11 | ||
47 | 6 | /** @var string */ |
|
48 | 4 | protected $bot_username; |
|
49 | |||
50 | 2 | /** |
|
51 | * Response constructor. |
||
52 | * |
||
53 | * @param array $data |
||
54 | * @param string $bot_username |
||
55 | 11 | * |
|
56 | 11 | * @throws \Longman\TelegramBot\Exception\TelegramException |
|
57 | 11 | */ |
|
58 | public function __construct(array $data, $bot_username = '') |
||
87 | |||
88 | /** |
||
89 | 6 | * Check if array is associative |
|
90 | * |
||
91 | 6 | * @link https://stackoverflow.com/a/4254008 |
|
92 | * |
||
93 | * @param array $array |
||
94 | * |
||
95 | * @return bool |
||
96 | */ |
||
97 | protected function isAssoc(array $array) |
||
101 | 5 | ||
102 | /** |
||
103 | * If response is ok |
||
104 | * |
||
105 | * @return bool |
||
106 | */ |
||
107 | public function isOk() |
||
111 | 5 | ||
112 | /** |
||
113 | * Return result |
||
114 | * |
||
115 | * @return array |
||
116 | */ |
||
117 | public function getResult() |
||
121 | 9 | ||
122 | /** |
||
123 | * Return error code |
||
124 | * |
||
125 | * @return int |
||
126 | */ |
||
127 | public function getErrorCode() |
||
131 | 5 | ||
132 | /** |
||
133 | * Return human-readable description of the result / unsuccessful request |
||
134 | * |
||
135 | * @return string |
||
136 | */ |
||
137 | public function getDescription() |
||
141 | 5 | ||
142 | /** |
||
143 | * Get error |
||
144 | * |
||
145 | * @see https://secure.php.net/manual/en/function.print-r.php |
||
146 | * |
||
147 | * @return string |
||
148 | */ |
||
149 | public function getError() |
||
155 | |||
156 | /** |
||
157 | * Create and return the object of the received result |
||
158 | * |
||
159 | * @param array $result |
||
160 | * @param string $bot_username |
||
161 | * |
||
162 | * @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 |
||
163 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
164 | */ |
||
165 | protected function createResultObject($result, $bot_username) |
||
184 | |||
185 | /** |
||
186 | * Create and return the objects array of the received result |
||
187 | * |
||
188 | 4 | * @param array $result |
|
189 | 4 | * @param string $bot_username |
|
190 | 4 | * |
|
191 | * @return null|\Longman\TelegramBot\Entities\ChatMember[]|\Longman\TelegramBot\Entities\Update[] |
||
192 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
193 | */ |
||
194 | protected function createResultObjects($result, $bot_username) |
||
217 | } |
||
218 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..