| Conditions | 4 | 
| Paths | 6 | 
| Total Lines | 24 | 
| Code Lines | 14 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 17 | public static function generate(PaymentScheduleConfigInterface $paymentScheduleConfig): PaymentScheduleInterface  | 
            ||
| 18 |     { | 
            ||
| 19 | $schedule = new PaymentSchedule($paymentScheduleConfig);  | 
            ||
| 20 | |||
| 21 | $startDate = $paymentScheduleConfig->getStartDate();  | 
            ||
| 22 | $dateInterval = $paymentScheduleConfig->getDateInterval();  | 
            ||
| 23 | $noOfPayments = $paymentScheduleConfig->getNoOfPayments();  | 
            ||
| 24 | $firstPaymentDate = $paymentScheduleConfig->getFirstPaymentDate();  | 
            ||
| 25 | |||
| 26 |         if (!is_null($firstPaymentDate)){ | 
            ||
| 27 | $startDate = $firstPaymentDate;  | 
            ||
| 28 | $schedule->add($startDate, 1);  | 
            ||
| 29 | }  | 
            ||
| 30 | |||
| 31 | $period = new \DatePeriod($startDate, $dateInterval, ($noOfPayments - $schedule->getNoOfPayments()));  | 
            ||
| 32 | |||
| 33 |         foreach ($period as $iteration => $date) { | 
            ||
| 34 |             if ($date != $startDate) { | 
            ||
| 35 | $schedule->add($date, $schedule->getNoOfPayments() + 1);  | 
            ||
| 36 | }  | 
            ||
| 37 | }  | 
            ||
| 38 | |||
| 39 | return $schedule;  | 
            ||
| 40 | }  | 
            ||
| 41 | }  |