| Conditions | 4 |
| Paths | 4 |
| Total Lines | 25 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | protected function createResourcesFromJsonData(array $data, ResponseInterface $response, ApiResourceInterface $owner) |
||
| 28 | { |
||
| 29 | $items = []; |
||
| 30 | $className = $this->resourceClass(); |
||
| 31 | |||
| 32 | foreach ($data as $datum) { |
||
| 33 | $types = [ |
||
| 34 | 'daily' => $datum['daily'] ?? null, |
||
| 35 | 'weekly' => $datum['weekly'] ?? null, |
||
| 36 | 'current_snapshot' => $datum['snapshot']['current'] ?? null, |
||
| 37 | 'in_progress_snapshot' => $datum['snapshot']['in_progress'] ?? null, |
||
| 38 | ]; |
||
| 39 | |||
| 40 | foreach ($types as $type => $item) { |
||
| 41 | if (is_null($item)) { |
||
| 42 | continue; |
||
| 43 | } |
||
| 44 | |||
| 45 | $item['backup_type'] = $type; |
||
| 46 | |||
| 47 | $items[] = new $className($owner->getApi(), $item, $owner); |
||
| 48 | } |
||
| 49 | } |
||
| 50 | |||
| 51 | return $items; |
||
| 52 | } |
||
| 54 |