@@ 27-45 (lines=19) @@ | ||
24 | * @return array |
|
25 | * @throws FailedToParseException |
|
26 | */ |
|
27 | public function index($page = 1, $limit = 500): array |
|
28 | { |
|
29 | $response = $this->client->get( |
|
30 | $this->buildPath($this->path) |
|
31 | . '/?page=' . $page |
|
32 | . '&limit=' . $limit |
|
33 | ); |
|
34 | ||
35 | $contents = $response->getBody()->getContents(); |
|
36 | ||
37 | $data = json_decode($contents, true); |
|
38 | ||
39 | $array = []; |
|
40 | foreach ($data['data'] as $object) { |
|
41 | $array[] = new Language($object); |
|
42 | } |
|
43 | ||
44 | return $array; |
|
45 | } |
|
46 | ||
47 | /** |
|
48 | * search |
|
@@ 56-75 (lines=20) @@ | ||
53 | * @return array |
|
54 | * @throws FailedToParseException |
|
55 | */ |
|
56 | public function search(String $term, $page = 1, $limit = 500): array |
|
57 | { |
|
58 | $response = $this->client->get($this->buildPath( |
|
59 | $this->path |
|
60 | . '/?search=' . $term |
|
61 | . '&page=' . $page |
|
62 | . '&limit=' . $limit |
|
63 | )); |
|
64 | ||
65 | $contents = $response->getBody()->getContents(); |
|
66 | ||
67 | $data = json_decode($contents, true); |
|
68 | ||
69 | $array = []; |
|
70 | foreach ($data['data'] as $object) { |
|
71 | $array[] = new Language($object); |
|
72 | } |
|
73 | ||
74 | return $array; |
|
75 | } |
|
76 | } |
@@ 26-38 (lines=13) @@ | ||
23 | * @return array |
|
24 | * @throws FailedToParseException |
|
25 | */ |
|
26 | public function index(string $platform): array |
|
27 | { |
|
28 | $response = $this->client->get($this->buildPath($this->path . '/' . $platform . '/languages')); |
|
29 | $contents = $response->getBody()->getContents(); |
|
30 | $data = json_decode($contents, true); |
|
31 | ||
32 | $array = []; |
|
33 | foreach ($data['data'] as $object) { |
|
34 | $array[] = new Language($object); |
|
35 | } |
|
36 | ||
37 | return $array; |
|
38 | } |
|
39 | ||
40 | /** |
|
41 | * bestFit |