| Conditions | 3 | 
| Paths | 3 | 
| Total Lines | 16 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php | ||
| 49 | public static function fromApi(array $data): self | ||
| 50 |     { | ||
| 51 |         $fromDate = \DateTime::createFromFormat('U', $data['from']); | ||
| 52 | |||
| 53 |         if (false === $fromDate) { | ||
| 54 |             throw new ApiException('Error fetching from date'); | ||
| 55 | } | ||
| 56 | |||
| 57 |         $toDate = \DateTime::createFromFormat('U', $data['to']); | ||
| 58 | |||
| 59 |         if (false === $toDate) { | ||
| 60 |             throw new ApiException('Error fetching to date'); | ||
| 61 | } | ||
| 62 | |||
| 63 | return new self($fromDate, $toDate); | ||
| 64 | } | ||
| 65 | } | ||
| 66 |