1 | <?php |
||
15 | class WeekIntervalPoint extends BaseIntervalPoint |
||
16 | { |
||
17 | /** |
||
18 | * @var \DateTime |
||
19 | */ |
||
20 | private $week; |
||
21 | |||
22 | /** |
||
23 | * @param \DateTime $date |
||
24 | */ |
||
25 | 4 | public function __construct(\DateTime $date) |
|
29 | |||
30 | /** |
||
31 | * Bugfix for get monday of this week. |
||
32 | * |
||
33 | * @see https://bugs.php.net/bug.php?id=63740 |
||
34 | * |
||
35 | * @param \DateTime $date |
||
36 | * |
||
37 | * @return \DateTime |
||
38 | */ |
||
39 | 4 | private function getMondayThisWeek(\DateTime $date) |
|
40 | { |
||
41 | 4 | $monday = clone $date; |
|
42 | 4 | $number = $monday->format('N'); |
|
43 | 4 | if ($number != 1) { |
|
44 | 2 | $monday->modify('-'.($number - 1).' day'); |
|
45 | } |
||
46 | |||
47 | 4 | return $monday; |
|
48 | } |
||
49 | |||
50 | /** |
||
51 | * @return \DateTime |
||
52 | */ |
||
53 | 4 | public function value() |
|
57 | |||
58 | /** |
||
59 | * @return string |
||
60 | */ |
||
61 | 1 | public function __toString() |
|
65 | } |
||
66 |