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 | |||
38 | /** @var int */ |
||
39 | protected $error_code; |
||
40 | |||
41 | /** @var array */ |
||
42 | protected $parameters; |
||
43 | |||
44 | /** @var array */ |
||
45 | protected $raw_data; |
||
46 | |||
47 | /** @var string */ |
||
48 | protected $bot_username; |
||
49 | |||
50 | /** |
||
51 | * Response constructor. |
||
52 | * |
||
53 | * @param array $data |
||
54 | * @param string $bot_username |
||
55 | * |
||
56 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
57 | */ |
||
58 | 12 | public function __construct(array $data, $bot_username = '') |
|
87 | |||
88 | /** |
||
89 | * Check if array is associative |
||
90 | * |
||
91 | * @link https://stackoverflow.com/a/4254008 |
||
92 | * |
||
93 | * @param array $array |
||
94 | * |
||
95 | * @return bool |
||
96 | */ |
||
97 | 6 | protected function isAssoc(array $array) |
|
101 | |||
102 | /** |
||
103 | * If response is ok |
||
104 | * |
||
105 | * @return bool |
||
106 | */ |
||
107 | 6 | public function isOk() |
|
111 | |||
112 | /** |
||
113 | * Return result |
||
114 | * |
||
115 | * @return array |
||
116 | */ |
||
117 | 10 | public function getResult() |
|
121 | |||
122 | /** |
||
123 | * Return error code |
||
124 | * |
||
125 | * @return int |
||
126 | */ |
||
127 | 5 | public function getErrorCode() |
|
131 | |||
132 | /** |
||
133 | * Return human-readable description of the result / unsuccessful request |
||
134 | * |
||
135 | * @return string |
||
136 | */ |
||
137 | 5 | public function getDescription() |
|
141 | |||
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 | 4 | protected function createResultObject($result, $bot_username) |
|
184 | |||
185 | /** |
||
186 | * Create and return the objects array of the received result |
||
187 | * |
||
188 | * @param array $result |
||
189 | * @param string $bot_username |
||
190 | * |
||
191 | * @return null|\Longman\TelegramBot\Entities\ChatMember[]|\Longman\TelegramBot\Entities\Update[] |
||
192 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
193 | */ |
||
194 | 2 | 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..