@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | /** |
91 | 91 | * Returns the start date. |
92 | 92 | * |
93 | - * @return DateTime |
|
93 | + * @return \DateTime |
|
94 | 94 | */ |
95 | 95 | public function getStartDate() { |
96 | 96 | return clone($this->start_date); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | /** |
108 | 108 | * Set the start date. |
109 | 109 | * |
110 | - * @param DateTime $start_date |
|
110 | + * @param \DateTime $start_date |
|
111 | 111 | */ |
112 | 112 | public function setStartDate(\DateTime $start_date) { |
113 | 113 | $this->start_date = clone($start_date); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | /** |
117 | 117 | * Returns the end date. |
118 | 118 | * |
119 | - * @return DateTime |
|
119 | + * @return \DateTime |
|
120 | 120 | */ |
121 | 121 | public function getEndDate() { |
122 | 122 | return clone($this->end_date); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | /** |
134 | 134 | * Set the end date. |
135 | 135 | * |
136 | - * @param DateTime $end_date |
|
136 | + * @param \DateTime $end_date |
|
137 | 137 | */ |
138 | 138 | public function setEndDate(\DateTime $end_date) { |
139 | 139 | $this->end_date = clone($end_date); |
@@ -451,6 +451,7 @@ discard block |
||
451 | 451 | /** |
452 | 452 | * Transforms the event in a breakdown of days, hours and minutes with associated states. |
453 | 453 | * |
454 | + * @param EventItemizer $itemizer |
|
454 | 455 | * @return array |
455 | 456 | */ |
456 | 457 | public function itemize($itemizer, $granularity = AbstractEvent::BAT_HOURLY) { |
@@ -461,7 +462,7 @@ discard block |
||
461 | 462 | /** |
462 | 463 | * Saves an event using the Store object |
463 | 464 | * |
464 | - * @param \Roomify\Bat\\Store\Store $store |
|
465 | + * @param Store $store |
|
465 | 466 | * @param string $granularity |
466 | 467 | * |
467 | 468 | * @return boolean |
@@ -16,27 +16,27 @@ |
||
16 | 16 | */ |
17 | 17 | class EventInterval { |
18 | 18 | |
19 | - /** |
|
20 | - * Return the number of times a duration fits into the start and end date taking into account |
|
21 | - * BAT's consideration that the end time for a BAT event includes that last minute. |
|
22 | - * |
|
23 | - * @param \DateTime $start_date |
|
24 | - * @param \DateTime $end_date |
|
25 | - * @param \DateInterval $duration |
|
26 | - * |
|
27 | - * @return float |
|
28 | - */ |
|
29 | - public static function divide(\DateTime $start_date, \DateTime $end_date, \DateInterval $duration) { |
|
30 | - // Clone so that we don't change the original object. We are not using ImmutableDateTime to support PHP5.4 |
|
31 | - $temp_end_date = clone($end_date); |
|
32 | - |
|
33 | - // Add a minute to deal with the fact that BAT considers the last minute included |
|
34 | - $temp_end_date->add(new \DateInterval('PT1M')); |
|
35 | - |
|
36 | - // Convert everything to seconds and calculate exactly how many times the duration fits in our event length |
|
37 | - $duration_seconds = $duration->d * 86400 + $duration->h * 3600 + $duration->i * 60 + $duration->s; |
|
38 | - |
|
39 | - return ($temp_end_date->getTimestamp() - $start_date->getTimestamp()) / $duration_seconds; |
|
40 | - } |
|
19 | + /** |
|
20 | + * Return the number of times a duration fits into the start and end date taking into account |
|
21 | + * BAT's consideration that the end time for a BAT event includes that last minute. |
|
22 | + * |
|
23 | + * @param \DateTime $start_date |
|
24 | + * @param \DateTime $end_date |
|
25 | + * @param \DateInterval $duration |
|
26 | + * |
|
27 | + * @return float |
|
28 | + */ |
|
29 | + public static function divide(\DateTime $start_date, \DateTime $end_date, \DateInterval $duration) { |
|
30 | + // Clone so that we don't change the original object. We are not using ImmutableDateTime to support PHP5.4 |
|
31 | + $temp_end_date = clone($end_date); |
|
32 | + |
|
33 | + // Add a minute to deal with the fact that BAT considers the last minute included |
|
34 | + $temp_end_date->add(new \DateInterval('PT1M')); |
|
35 | + |
|
36 | + // Convert everything to seconds and calculate exactly how many times the duration fits in our event length |
|
37 | + $duration_seconds = $duration->d * 86400 + $duration->h * 3600 + $duration->i * 60 + $duration->s; |
|
38 | + |
|
39 | + return ($temp_end_date->getTimestamp() - $start_date->getTimestamp()) / $duration_seconds; |
|
40 | + } |
|
41 | 41 | |
42 | 42 | } |