| @@ 282-297 (lines=16) @@ | ||
| 279 | * @throws DictionaryException |
|
| 280 | * @throws ForbiddenException |
|
| 281 | */ |
|
| 282 | public function lookup($text) |
|
| 283 | { |
|
| 284 | $url = $this->getLookupUrl($text); |
|
| 285 | $response = $this->sendRequest( |
|
| 286 | 'GET', |
|
| 287 | $url, |
|
| 288 | [ |
|
| 289 | 'version' => $this->serviceProtocolVersion |
|
| 290 | ] |
|
| 291 | ); |
|
| 292 | if ($response->getStatusCode() === 200) { |
|
| 293 | $definitions = $this->parseLookupResponse($response); |
|
| 294 | return $definitions; |
|
| 295 | } |
|
| 296 | return false; |
|
| 297 | } |
|
| 298 | ||
| 299 | /** |
|
| 300 | * @return array|bool |
|
| @@ 305-320 (lines=16) @@ | ||
| 302 | * @throws DictionaryException |
|
| 303 | * @throws ForbiddenException |
|
| 304 | */ |
|
| 305 | public function getLanguages() |
|
| 306 | { |
|
| 307 | $url = $this->getGetLanguagesUrl(); |
|
| 308 | $response = $this->sendRequest( |
|
| 309 | 'GET', |
|
| 310 | $url, |
|
| 311 | [ |
|
| 312 | 'version' => $this->serviceProtocolVersion |
|
| 313 | ] |
|
| 314 | ); |
|
| 315 | if ($response->getStatusCode() === 200) { |
|
| 316 | $languages = $this->parseGetLanguagesResponse($response); |
|
| 317 | return $languages; |
|
| 318 | } |
|
| 319 | return false; |
|
| 320 | } |
|
| 321 | ||
| 322 | /** |
|
| 323 | * @param Response $response |
|