| Conditions | 6 | 
| Paths | 4 | 
| Total Lines | 16 | 
| Code Lines | 8 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 7 | 
| CRAP Score | 6 | 
| Changes | 0 | ||
| 1 | <?php | ||
| 19 | public static function validate(Recurrence $recurrence) | ||
| 20 |     { | ||
| 21 | 1 |         if (!$recurrence->getFrequency()) { | |
| 22 | 1 |             throw new InvalidRecurrenceException('Frequency is required'); | |
| 23 | } | ||
| 24 | |||
| 25 | 1 |         if ($recurrence->hasCount() && $recurrence->getPeriodEndAt()) { | |
| 26 | 1 |             throw new InvalidRecurrenceException('Recurrence cannot have [COUNT] and [UNTIL] option at the same time'); | |
| 27 | } | ||
| 28 | |||
| 29 | 1 |         if (!$recurrence->hasCount() && !$recurrence->getPeriodEndAt()) { | |
| 30 | 1 |             throw new InvalidRecurrenceException('Recurrence required [COUNT] or [UNTIL] option'); | |
| 31 | } | ||
| 32 | |||
| 33 | 1 | return true; | |
| 34 | } | ||
| 35 | } | ||
| 36 |