| Conditions | 4 | 
| Paths | 8 | 
| Total Lines | 26 | 
| Code Lines | 13 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 0 | 
| CRAP Score | 20 | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 18 | public function provide(Recurrence $recurrence)  | 
            ||
| 19 |     { | 
            ||
| 20 | $interval = $recurrence->getFrequency()->convertToDateIntervalFormat();  | 
            ||
| 21 | |||
| 22 | $periodEndAt = ($recurrence->hasPeriodEndAt())? $recurrence->getPeriodEndAt() : $this->estimatePeriodEndAt($recurrence) ;  | 
            ||
| 23 | |||
| 24 | // Transform interval in Datetime interval expression  | 
            ||
| 25 |         if ($recurrence->getInterval() !== 1) { | 
            ||
| 26 |             $interval = str_replace('1', $recurrence->getInterval(), $interval); | 
            ||
| 27 | }  | 
            ||
| 28 | |||
| 29 | $dateInterval = new \DateInterval($interval);  | 
            ||
| 30 | |||
| 31 | $recurrences = iterator_to_array(new \DatePeriod(  | 
            ||
| 32 | $recurrence->getPeriodStartAt(),  | 
            ||
| 33 | $dateInterval,  | 
            ||
| 34 | $periodEndAt  | 
            ||
| 35 | ));  | 
            ||
| 36 | |||
| 37 | // When having count option, return only amount of recurrences requested  | 
            ||
| 38 |         if ($recurrence->hasCount()) { | 
            ||
| 39 | return array_slice($recurrences, 0, $recurrence->getCount());  | 
            ||
| 40 | }  | 
            ||
| 41 | |||
| 42 | return $recurrences;  | 
            ||
| 43 | }  | 
            ||
| 44 | }  | 
            ||
| 45 |