/** * Return the number of days in a month for a given year and calendar. * * Shim implementation of \cal_days_in_month() * * @link https://php.net/cal_days_in_month * * @param $calendar * @param $month * @param $year * * @return int The number of days in the specified month */ public static function calDaysInMonth($calendar, $month, $year) { switch ($calendar) { case CAL_GREGORIAN: $gregorian = new GregorianCalendar(); return $gregorian->daysInMonth($year, $month); case CAL_JULIAN: $julian = new JulianCalendar(); return $julian->daysInMonth($year, $month); case CAL_FRENCH: $french = new FrenchCalendar(); return $french->daysInMonth($year, $month); case CAL_JEWISH: $jewish = new JewishCalendar(); return $jewish->daysInMonth($year, $month); default: return trigger_error('invalid calendar ID ' . $calendar . '.', E_USER_WARNING); } }