diff options
author | sgiehl <stefangiehl@gmail.com> | 2013-01-18 18:10:36 +0400 |
---|---|---|
committer | sgiehl <stefangiehl@gmail.com> | 2013-01-18 18:10:36 +0400 |
commit | ede21a6a135707ae38c6a982ae37498fbd6ec004 (patch) | |
tree | afdad642cd87b3b4aee30d47209ea63dcb1a81d3 /core/Period.php | |
parent | e744db6442c6b0475d20af5ead27ac024968555f (diff) |
fixed some doc blocks
git-svn-id: http://dev.piwik.org/svn/trunk@7782 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'core/Period.php')
-rw-r--r-- | core/Period.php | 65 |
1 files changed, 50 insertions, 15 deletions
diff --git a/core/Period.php b/core/Period.php index 0e23b4782b..7c26e017e3 100644 --- a/core/Period.php +++ b/core/Period.php @@ -26,17 +26,29 @@ */ abstract class Piwik_Period { - protected $subperiods = array(); + /** + * Array of subperiods + * @var Piwik_Period[] + */ + protected $subperiods = array(); protected $subperiodsProcessed = false; - protected $label = null; + + /** + * @var string + */ + protected $label = null; /** * @var Piwik_Date */ protected $date = null; static protected $errorAvailablePeriods = 'day, week, month, year, range'; - - public function __construct( $date ) + + /** + * Constructor + * @param Piwik_Date $date + */ + public function __construct( $date ) { $this->checkInputDate( $date ); $this->date = clone $date; @@ -148,7 +160,11 @@ abstract class Piwik_Period return Piwik::$idPeriods[$this->getLabel()]; } - public function getLabel() + /** + * Returns the label for the current period + * @return string + */ + public function getLabel() { return $this->label; } @@ -159,9 +175,16 @@ abstract class Piwik_Period protected function getDate() { return $this->date; - } - - protected function checkInputDate($date) + } + + /** + * Checks if the given date is an instance of Piwik_Date + * + * @param Piwik_Date $date + * + * @throws Exception + */ + protected function checkInputDate($date) { if( !($date instanceof Piwik_Date)) { @@ -173,8 +196,12 @@ abstract class Piwik_Period { $this->subperiodsProcessed = true; } - - public function getNumberOfSubperiods() + + /** + * Returns the number of available subperiods + * @return int + */ + public function getNumberOfSubperiods() { if(!$this->subperiodsProcessed) { @@ -203,14 +230,22 @@ abstract class Piwik_Period * * Protected because it not yet supported to add periods after the initialization * - * @param Piwik_Date Valid Piwik_Date object + * @param Piwik_Period $period Valid Piwik_Period object */ - protected function addSubperiod( $date ) + protected function addSubperiod( $period ) { - $this->subperiods[] = $date; + $this->subperiods[] = $period; } - - public function toString($format = "Y-m-d") + + /** + * Returns a string representing the current period + * Given param will be used to format the returned value + * + * @param string $format + * + * @return array + */ + public function toString($format = "Y-m-d") { if(!$this->subperiodsProcessed) { |