| Total Complexity | 5 |
| Total Lines | 55 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class LanguageToolApiClient |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var string |
||
| 11 | */ |
||
| 12 | private $baseUrl; |
||
| 13 | |||
| 14 | 2 | public function __construct(string $baseUrl) |
|
| 17 | 2 | } |
|
| 18 | |||
| 19 | 1 | public function spellCheck(string $text, array $languages, array $options): array |
|
| 30 | ); |
||
| 31 | } |
||
| 32 | |||
| 33 | 1 | public function getSupportedLanguages(): array |
|
| 34 | { |
||
| 35 | 1 | return array_column( |
|
| 36 | 1 | $this->requestAPI( |
|
| 37 | 1 | '/v2/languages', |
|
| 38 | 1 | 'GET', |
|
| 39 | 1 | 'Accept: application/json' |
|
| 40 | ), |
||
| 41 | 1 | 'longCode' |
|
| 42 | ); |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @throws \RuntimeException |
||
| 47 | */ |
||
| 48 | 2 | public function requestAPI(string $endpoint, string $method, string $header, array $queryParams = []): array |
|
| 62 | 2 | } |
|
| 63 | } |
||
| 64 |