| Conditions | 5 |
| Paths | 2 |
| Total Lines | 25 |
| Code Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 6.7117 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | 6 | public function parse(\stdClass $object, int $index): Period |
|
| 14 | { |
||
| 15 | 6 | if ($repeatingAt = $object->repeatingAt ?? null) { |
|
| 16 | $repeatingAt = new Week( |
||
| 17 | $repeatingAt[0], |
||
| 18 | $repeatingAt[1], |
||
| 19 | $repeatingAt[2], |
||
| 20 | $repeatingAt[3], |
||
| 21 | $repeatingAt[4], |
||
| 22 | $repeatingAt[5], |
||
| 23 | $repeatingAt[6] |
||
| 24 | ); |
||
| 25 | } |
||
| 26 | |||
| 27 | 6 | return new Period( |
|
| 28 | 6 | $object->id, |
|
| 29 | 6 | ($object->name ?? '') ?: sprintf('Uitvoerperiode %d', $index + 1), |
|
| 30 | 6 | new \DateTime($object->startDateActual ?? $object->startDate, new \DateTimeZone('UTC')), |
|
| 31 | 6 | ($endDate = $object->endDateActual ?? $object->endDate ?? null) ? new \DateTime($endDate, new \DateTimeZone('UTC')) : null, |
|
| 32 | 6 | ($object->repeating ?? '') === 'WEEKLY', |
|
| 33 | 3 | $repeatingAt, |
|
| 34 | 6 | ($object->status ?? null) ? PeriodStatus::from($object->status) : null, |
|
| 35 | 6 | $object->overrunning ?? null, |
|
| 36 | 6 | $object->order ?? $index, |
|
| 37 | 6 | $object->parentId ?? null |
|
| 38 | 3 | ); |
|
| 41 |