| Conditions | 5 | 
| Paths | 5 | 
| Total Lines | 23 | 
| Code Lines | 12 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 21 | public function create(Response $response) | ||
| 22 |     { | ||
| 23 | $jsonDecoder = new JsonDecoder(); | ||
| 24 | $collection = new ArrayCollection(); | ||
| 25 | |||
| 26 |         if ($response->getStatusCode() === 200) { | ||
| 27 | $data = (string)$response->getBody(); | ||
| 28 | |||
| 29 |             try { | ||
| 30 | $data = $jsonDecoder->decode($data); | ||
| 31 |             } catch (\Exception $e) { | ||
|  | |||
| 32 | |||
| 33 | } | ||
| 34 | |||
| 35 |             if (isset($data->results)) { | ||
| 36 |                 foreach ($data->results as $result) { | ||
| 37 | $collection->add(System::createFromApi($result)); | ||
| 38 | } | ||
| 39 | } | ||
| 40 | } | ||
| 41 | |||
| 42 | return new SystemsResponse($response, $collection); | ||
| 43 | } | ||
| 44 | } | ||
| 45 |