Conditions | 5 |
Paths | 8 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
30 | 4 | public static function create(array $data): self |
|
31 | { |
||
32 | 4 | $stats = []; |
|
33 | 4 | if (isset($data['stats'])) { |
|
34 | 4 | foreach ($data['stats'] as $s) { |
|
35 | 4 | $stats[] = TotalResponseItem::create($s); |
|
36 | } |
||
37 | } |
||
38 | |||
39 | 4 | $model = new self(); |
|
40 | 4 | $model->start = isset($data['start']) ? new \DateTimeImmutable($data['start']) : null; |
|
41 | 4 | $model->end = isset($data['end']) ? new \DateTimeImmutable($data['end']) : null; |
|
42 | 4 | $model->resolution = $data['resolution'] ?? null; |
|
43 | 4 | $model->stats = $stats; |
|
44 | |||
45 | 4 | return $model; |
|
46 | } |
||
47 | |||
71 |