| Conditions | 4 |
| Paths | 3 |
| Total Lines | 11 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | public static function parseResponse(Response $response, Friend $friend) |
||
| 35 | { |
||
| 36 | $jsonData = \GuzzleHttp\json_decode($response->getBody(), true); |
||
| 37 | if ($jsonData && $jsonData['retcode'] == 0) { |
||
| 38 | $info = (new Collection($jsonData['result']))->filter(function($info) use($friend){ |
||
| 39 | return $info['uin'] == $friend->getUin(); |
||
| 40 | })->first(); |
||
| 41 | return $info ? $info['lnick'] : null; |
||
| 42 | } |
||
| 43 | throw new ResponseException($jsonData['retcode'], $response); |
||
| 44 | } |
||
| 45 | } |
||
| 46 |