PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / trunk
Matomo Analytics – Powerful, Privacy-First Insights for WordPress vtrunk
5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / app / core / Period / Year.php
matomo / app / core / Period Last commit date
Day.php 1 month ago Factory.php 3 months ago Month.php 1 month ago PeriodValidator.php 2 years ago Range.php 1 month ago Week.php 1 month ago Year.php 1 month ago
Year.php
85 lines
1 <?php
2
3 /**
4 * Matomo - free/libre analytics platform
5 *
6 * @link https://matomo.org
7 * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
8 */
9 namespace Piwik\Period;
10
11 use Piwik\Date;
12 use Piwik\Period;
13 class Year extends Period
14 {
15 public const PERIOD_ID = 4;
16 protected $label = 'year';
17 /**
18 * Returns the current period as a localized short string
19 *
20 * @return string
21 */
22 public function getLocalizedShortString()
23 {
24 return $this->getLocalizedLongString();
25 }
26 /**
27 * Returns the current period as a localized long string
28 *
29 * @return string
30 */
31 public function getLocalizedLongString()
32 {
33 //"2009"
34 $out = $this->getDateStart()->getLocalized(Date::DATE_FORMAT_YEAR);
35 return $out;
36 }
37 /**
38 * Returns the current period as a string
39 *
40 * @return string
41 */
42 public function getPrettyString()
43 {
44 $out = $this->getDateStart()->toString('Y');
45 return $out;
46 }
47 /**
48 * Generates the subperiods (one for each month of the year)
49 */
50 protected function generate()
51 {
52 if ($this->subperiodsProcessed) {
53 return;
54 }
55 parent::generate();
56 $year = $this->date->toString("Y");
57 for ($i = 1; $i <= 12; $i++) {
58 $this->addSubperiod(new \Piwik\Period\Month(Date::factory("{$year}-{$i}-01")));
59 }
60 }
61 /**
62 * Returns the current period as a string
63 *
64 * @param string $format
65 * @return array
66 */
67 public function toString($format = 'ignored')
68 {
69 $this->generate();
70 $stringMonth = array();
71 foreach ($this->subperiods as $month) {
72 $stringMonth[] = $month->getDateStart()->toString("Y") . "-" . $month->getDateStart()->toString("m") . "-01";
73 }
74 return $stringMonth;
75 }
76 public function getImmediateChildPeriodLabel()
77 {
78 return 'month';
79 }
80 public function getParentPeriodLabel()
81 {
82 return null;
83 }
84 }
85