| Conditions | 5 |
| Paths | 1 |
| Total Lines | 19 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function __invoke(RequestInterface $request, ResponseInterface $response) |
||
| 19 | { |
||
| 20 | $contents = substr($response->getBody()->getContents(), 5); |
||
| 21 | $json = \GuzzleHttp\json_decode($contents, true); |
||
| 22 | $data = $json[0][2][0][65]['42656262'][1] ?? []; |
||
| 23 | |||
| 24 | $parsePermissions = static function (array $items) use (&$parsePermissions) { |
||
| 25 | return array_reduce($items, static function ($results, $item) use (&$parsePermissions) { |
||
| 26 | if (is_array($item)) { |
||
| 27 | if (count($item) === 3 && is_string($item[0]) && is_string($item[1])) { |
||
| 28 | $results[] = new Permission($item[0], $item[1]); |
||
| 29 | } else { |
||
| 30 | $results = array_merge($results, $parsePermissions($item)); |
||
| 31 | } |
||
| 32 | } |
||
| 33 | return $results; |
||
| 34 | }, []); |
||
| 35 | }; |
||
| 36 | return $parsePermissions($data); |
||
| 37 | } |
||
| 39 |