| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | 35 | public static function getMondayThisWeek(\DateTime $date) |
|
| 24 | { |
||
| 25 | 35 | $monday = clone $date; |
|
| 26 | |||
| 27 | 35 | if ($monday->format('N') != 1) { |
|
| 28 | 18 | $monday->modify('Monday this week'); |
|
| 29 | |||
| 30 | 18 | if ($date->format('Y W') != $monday->format('Y W')) { |
|
| 31 | 1 | $monday->modify('-7 day'); |
|
| 32 | 1 | } |
|
| 33 | 18 | } |
|
| 34 | |||
| 35 | 35 | return $monday; |
|
| 36 | } |
||
| 37 | |||
| 51 |