Conditions | 4 |
Paths | 4 |
Total Lines | 21 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
20 | public function __invoke(RequestInterface $request, ResponseInterface $response): array |
||
21 | { |
||
22 | $contents = substr($response->getBody()->getContents(), 5); |
||
23 | $json = \GuzzleHttp\json_decode($contents, true); |
||
24 | if (empty($json[0][2])) { |
||
25 | return [[], null]; |
||
26 | } |
||
27 | $json = \GuzzleHttp\json_decode($json[0][2], true); |
||
28 | if (empty($json[0][0][0])) { |
||
29 | return [[], null]; |
||
30 | } |
||
31 | |||
32 | $locale = parse_query($request->getUri()->getQuery())[GPlayApps::REQ_PARAM_LOCALE] ?? GPlayApps::DEFAULT_LOCALE; |
||
33 | |||
34 | $apps = []; |
||
35 | foreach ($json[0][0][0] as $data) { |
||
36 | $apps[] = AppsExtractor::extractApp($data, $locale); |
||
37 | } |
||
38 | |||
39 | $nextToken = $json[0][0][7][1] ?? null; |
||
40 | return [$apps, $nextToken]; |
||
41 | } |
||
43 |