diff --git a/includes/class-CategoryYear.php b/includes/class-CategoryYear.php index e509e2f..238e3fc 100644 --- a/includes/class-CategoryYear.php +++ b/includes/class-CategoryYear.php @@ -1,66 +1,75 @@ . namespace itwikidelbot; /** * Handle a yearly category * * e.g. https://it.wikipedia.org/wiki/Categoria:Cancellazioni_-_2017 */ class CategoryYear extends CategoryTemplated { /** * Template name of this category * * @override CategoryTemplated::TEMPLATE_NAME */ const TEMPLATE_NAME = 'CATEGORY_YEAR'; /** * Year * * @var int */ private $year; /** * Constructor * * @param $year int * @see CategoryTemplated::__construct() */ public function __construct( $year ) { $this->year = $year; parent::__construct(); } + /** + * Get the year + * + * @return int + */ + public function getYear() { + return $this->year; + } + /** * Template arguments * * @override CategoryTemplated::getTemplateArguments() */ public function getTemplateArguments() { - return [ $this->year ]; + return [ $this->getYear() ]; } } diff --git a/includes/class-CategoryYearMonth.php b/includes/class-CategoryYearMonth.php index 8d5a40a..f55989b 100644 --- a/includes/class-CategoryYearMonth.php +++ b/includes/class-CategoryYearMonth.php @@ -1,81 +1,82 @@ . namespace itwikidelbot; /** * Handle a monthly category * * e.g. https://it.wikipedia.org/wiki/Categoria:Cancellazioni_-_aprile_2018 */ -class CategoryYearMonth extends CategoryTemplated { +class CategoryYearMonth extends CategoryYear { /** * Template name of this category * * @override CategoryTemplated::TEMPLATE_NAME */ const TEMPLATE_NAME = 'CATEGORY_MONTH'; - /** - * Year - * - * @var int - */ - private $year; - /** * Month * * @var int 1-12 */ private $month; /** * Constructor * * @param $year int * @param $month int 1-12 - * @see CategoryTemplated::__construct() + * @see CategoryYear::__construct() */ public function __construct( $year, $month ) { - $this->year = $year; $this->month = $month; - parent::__construct(); + parent::__construct( $year ); + } + + /** + * Get the month + * + * @return int 1-12 + */ + public function getMonth() { + return $this->month; } /** * Template arguments * * @override CategoryTemplated::getTemplateArguments() */ public function getTemplateArguments() { return [ - ( new CategoryYear( $this->year ) ) + ( new parent( $this->getYear() ) ) ->getTemplatedTitle(), - $this->year, - $this->month, - Months::number2name( $this->month - 1 ), + $this->getYear(), + $this->getMonth(), + Months::number2name( $this->getMonth() - 1 ), ]; } } diff --git a/includes/class-CategoryYearMonthDay.php b/includes/class-CategoryYearMonthDay.php index 3b0f4ee..de1e260 100644 --- a/includes/class-CategoryYearMonthDay.php +++ b/includes/class-CategoryYearMonthDay.php @@ -1,91 +1,85 @@ . namespace itwikidelbot; /** * Handle a daily category * * e.g. https://it.wikipedia.org/wiki/Categoria:Cancellazioni_del_19_febbraio_2018 */ -class CategoryYearMonthDay extends CategoryTemplated { +class CategoryYearMonthDay extends CategoryYearMonth { /** * Template name * * @override CategoryTemplated::TEMPLATE_NAME */ const TEMPLATE_NAME = 'CATEGORY_DAY'; - /** - * Year - * - * @var int - */ - private $year; - - /** - * Month - * - * @var int 1-12 - */ - private $month; - /** * Day * * @var int 1-31 */ private $day; /** * Constructor * * @param $year int * @param $month int 1-12 * @param $day int 1-31 - * @see CategoryTemplated::__construct() + * @see CategoryYearMonth::__construct() */ public function __construct( $year, $month, $day ) { - $this->year = $year; - $this->month = $month; $this->day = $day; - parent::__construct(); + parent::__construct( $year, $month ); } + /** + * Get the day + * + * @return int 1-13 + */ + public function getDay() { + return $this->day; + } + + /** * Template arguments * * @override CategoryTemplated::getTemplateArguments() */ public function getTemplateArguments() { return [ - ( new CategoryYearMonth( $this->year, $this->month ) ) + ( new parent( $this->getYear(), $this->getMonth() ) ) ->getTemplatedTitle(), - $this->year, - $this->month, - Months::number2name( $this->month - 1 ), - $this->day, + $this->getYear(), + $this->getMonth(), + Months::number2name( $this->getMonth() - 1 ), + $this->getDay(), ]; } }