Conditions | 2 |
Paths | 2 |
Total Lines | 9 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | public function apply(Recurrence $recurrence, \Datetime $datetime) |
||
21 | { |
||
22 | 1 | if ($this->isWeekend($datetime)) { |
|
23 | // Add 1 or 2 days to skip weekend (we didn't use `next monday` pattern of \Datetime::format cause it remove time) |
||
24 | 1 | $days = (7 - (int) $datetime->format('N') + 1); |
|
25 | 1 | $datetime->modify(sprintf('+%d days', $days)); |
|
26 | } |
||
27 | |||
28 | 1 | return $datetime; |
|
29 | } |
||
39 |