diff options
author | diosmosis <benaka@piwik.pro> | 2015-09-23 07:51:35 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-10-12 21:05:36 +0300 |
commit | 51d7e6a653b63d083c75770c19746180cb8f0c93 (patch) | |
tree | 7bd300059358243a70b4a176d6683ba59faa8788 /core | |
parent | cbfb62c94243b496856770090cb4fd6130ae1e08 (diff) |
Don't use switch in core:invalidate-archive-data command, instead add new non-API method to Piwik Core.
Diffstat (limited to 'core')
-rw-r--r-- | core/Period.php | 9 | ||||
-rw-r--r-- | core/Period/Day.php | 5 | ||||
-rw-r--r-- | core/Period/Month.php | 5 | ||||
-rw-r--r-- | core/Period/Range.php | 5 | ||||
-rw-r--r-- | core/Period/Week.php | 5 | ||||
-rw-r--r-- | core/Period/Year.php | 5 |
6 files changed, 34 insertions, 0 deletions
diff --git a/core/Period.php b/core/Period.php index 80dc9f6f21..6ee9e4c752 100644 --- a/core/Period.php +++ b/core/Period.php @@ -279,6 +279,15 @@ abstract class Period abstract public function getLocalizedLongString(); /** + * Returns the label of the period type that is one size smaller than this one, or null if + * it's the smallest. + * + * @ignore + * @return string|null + */ + abstract public function getImmediateChildPeriodLabel(); + + /** * Returns the date range string comprising two dates * * @return string eg, `'2012-01-01,2012-01-31'`. diff --git a/core/Period/Day.php b/core/Period/Day.php index 4933ddedf6..c760d5a09b 100644 --- a/core/Period/Day.php +++ b/core/Period/Day.php @@ -99,4 +99,9 @@ class Day extends Period { return $this->toString(); } + + public function getImmediateChildPeriodLabel() + { + return null; + } } diff --git a/core/Period/Month.php b/core/Period/Month.php index 4c779e4853..cf82b306fe 100644 --- a/core/Period/Month.php +++ b/core/Period/Month.php @@ -111,4 +111,9 @@ class Month extends Period $startDate = $startDate->addDay(1); } } + + public function getImmediateChildPeriodLabel() + { + return 'week'; + } } diff --git a/core/Period/Range.php b/core/Period/Range.php index e2b654ca21..9b33cbebca 100644 --- a/core/Period/Range.php +++ b/core/Period/Range.php @@ -513,4 +513,9 @@ class Range extends Period return $dateStart->toString("Y-m-d") . "," . $dateEnd->toString("Y-m-d"); } + + public function getImmediateChildPeriodLabel() + { + return 'day'; // ranges are made up of a collection of days + } } diff --git a/core/Period/Week.php b/core/Period/Week.php index ff2a23a844..dc3e0ff550 100644 --- a/core/Period/Week.php +++ b/core/Period/Week.php @@ -77,4 +77,9 @@ class Week extends Period $currentDay = $currentDay->addDay(1); } } + + public function getImmediateChildPeriodLabel() + { + return 'day'; + } } diff --git a/core/Period/Year.php b/core/Period/Year.php index cfda052bf5..2f0ab0e7bd 100644 --- a/core/Period/Year.php +++ b/core/Period/Year.php @@ -87,4 +87,9 @@ class Year extends Period return $stringMonth; } + + public function getImmediateChildPeriodLabel() + { + return 'month'; + } } |