PluginProbe
Independent Analytics – WordPress Analytics Plugin / 2.11.6
Independent Analytics – WordPress Analytics Plugin v2.11.6
2.15.5 2.15.4 2.15.3 2.15.2 2.15.1 2.15.0 2.14.10 trunk 1.1 1.10 1.10.1 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.17.1 1.17.2 1.17.3 1.17.4 1.18 1.18.1 1.19.0 All 120 releases
independent-analytics / IAWP / Statistics / Intervals / Monthly.php
Monthly.php
32 lines 914 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace IAWP\Statistics\Intervals;
4
5 /** @internal */
6 class Monthly extends \IAWP\Statistics\Intervals\Interval
7 {
8 public function id() : string
9 {
10 return 'monthly';
11 }
12 public function label() : string
13 {
14 return \__('Monthly', 'independent-analytics');
15 }
16 public function date_interval() : \DateInterval
17 {
18 return new \DateInterval('P01M');
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->setDate(\intval($date_time->format('Y')), \intval($date_time->format('m')), 1);
24 $date_time->setTime(0, 0, 0);
25 return $date_time;
26 }
27 public function get_label_for(\DateTime $date_time) : array
28 {
29 return ['tick' => $this->format($date_time, 'F'), 'tooltipLabel' => $this->format($date_time, 'F Y')];
30 }
31 }
32