| Conditions | 5 |
| Paths | 9 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | public function __invoke(RequestInterface $request, ResponseInterface $response): ?string |
||
| 22 | { |
||
| 23 | $scriptData = ScraperUtil::extractScriptData($response->getBody()->getContents()); |
||
| 24 | |||
| 25 | $scriptDataApps = null; |
||
| 26 | foreach ($scriptData as $key => $scriptValue) { |
||
| 27 | if (isset($scriptValue[0][1][0][0][3][4][2])) { // ds:3 |
||
| 28 | $scriptDataApps = $scriptValue; |
||
| 29 | break; |
||
| 30 | } |
||
| 31 | } |
||
| 32 | |||
| 33 | if ($scriptDataApps === null) { |
||
| 34 | throw (new GooglePlayException('Error fetch cluster page')) |
||
| 35 | ->setUrl($request->getUri()->__toString()); |
||
| 36 | } |
||
| 37 | |||
| 38 | if (isset($scriptDataApps[0][1][0][0][3][4][2])) { |
||
| 39 | return GPlayApps::GOOGLE_PLAY_URL . $scriptDataApps[0][1][0][0][3][4][2]; |
||
| 40 | } |
||
| 41 | return null; |
||
| 42 | } |
||
| 44 |