diff --git a/includes/class-PageYearMonth.php b/includes/class-PageYearMonth.php index 5d491a8..e4bdfac 100644 --- a/includes/class-PageYearMonth.php +++ b/includes/class-PageYearMonth.php @@ -1,64 +1,73 @@ . namespace itwikidelbot; /** * Abstraction of a page related to a month (in a certain year) */ abstract class PageYearMonth extends PageYear { /** * Month * * @var int 1-12 */ private $month; /** * Constructor * * @param $year int * @param $month int 1-12 * @see PageYear::__construct() */ public function __construct( $year, $month ) { $this->month = $month; parent::__construct( $year ); } /** * Get the month * * @return int 1-12 */ public function getMonth() { return $this->month; } + /** + * Get the month name + * + * @return string e.g. 'aprile' + */ + public function getMonthName() { + return Months::number2name( $this->getMonth() - 1 ); + } + /** * Template arguments * * @override PageYear::getTemplateArguments() */ public function getTemplateArguments() { return array_merge( parent::getTemplateArguments(), [ $this->getMonth(), Months::number2name( $this->getMonth() - 1 ), ] ); } }