| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 56 | 1 | public function search(String $term, $page = 1, $limit = 500): array |
|
| 57 | { |
||
| 58 | 1 | $response = $this->client->get($this->buildPath( |
|
| 59 | 1 | $this->path |
|
| 60 | 1 | . '/?search=' . $term |
|
| 61 | 1 | . '&page=' . $page |
|
| 62 | 1 | . '&limit=' . $limit |
|
| 63 | )); |
||
| 64 | |||
| 65 | 1 | $contents = $response->getBody()->getContents(); |
|
| 66 | |||
| 67 | 1 | $data = json_decode($contents, true); |
|
| 68 | |||
| 69 | 1 | $array = []; |
|
| 70 | 1 | foreach ($data['data'] as $object) { |
|
| 71 | 1 | $array[] = new Language($object); |
|
| 72 | } |
||
| 73 | |||
| 74 | 1 | return $array; |
|
| 75 | } |
||
| 76 | } |