Daily.php
2 years ago
Hourly.php
5 months ago
Interval.php
1 year ago
Intervals.php
2 years ago
Monthly.php
1 year ago
Weekly.php
2 years ago
Daily.php
31 lines
| 1 | <?php |
| 2 | |
| 3 | namespace IAWP\Statistics\Intervals; |
| 4 | |
| 5 | /** @internal */ |
| 6 | class Daily extends \IAWP\Statistics\Intervals\Interval |
| 7 | { |
| 8 | public function id() : string |
| 9 | { |
| 10 | return 'daily'; |
| 11 | } |
| 12 | public function label() : string |
| 13 | { |
| 14 | return \__('Daily', 'independent-analytics'); |
| 15 | } |
| 16 | public function date_interval() : \DateInterval |
| 17 | { |
| 18 | return new \DateInterval('P1D'); |
| 19 | } |
| 20 | public function calculate_start_of_interval_for(\DateTime $original_date_time) : \DateTime |
| 21 | { |
| 22 | $date_time = clone $original_date_time; |
| 23 | $date_time->setTime(0, 0, 0); |
| 24 | return $date_time; |
| 25 | } |
| 26 | public function get_label_for(\DateTime $date_time) : array |
| 27 | { |
| 28 | return ['tick' => $this->format($date_time, 'M j'), 'tooltipLabel' => $this->format($date_time, 'F jS (l)')]; |
| 29 | } |
| 30 | } |
| 31 |