diff --git a/includes/class-Months.php b/includes/class-Months.php index c65e8a4..33584c2 100644 --- a/includes/class-Months.php +++ b/includes/class-Months.php @@ -1,90 +1,90 @@ . namespace itwikidelbot; /** * Singleton that handle months */ class Months { /** * Months * * @var array */ private static $_months; /** * Get the names of the months * * @return array Names of months */ public static function months() { if( ! self::$_months ) { self::$_months = [ 'gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre' ]; } return self::$_months; } /** * Get a month number from a month name * * @param $month_name string Month name e.g. 'gennaio' * @return int Month number 0-11 e.g. 0 */ - public static function monthName2MonthNumber( $month_name ) { + public static function name2number( $month_name ) { $i = array_search( $month_name, self::months(), true ); if( false === $i ) { throw new \InvalidArgumentException( 'unexpected month name' ); } return $i; } /** * Get a month name from a month number * * @param $month_number int Month number 0-11 e.g. 0 * @return string Month name e.g. 'gennaio' */ - public static function monthNumber2MonthName( $month_number ) { + public static function number2name( $month_number ) { if( $month_number < 0 || $month_number > 11 ) { throw new \InvalidArgumentException( 'unexpected month number' ); } $months = self::months(); return $months[ $month_number ]; } }