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