示例#1
0
 /**
  * Get number of days after March 21 on which Easter falls for a given year.
  *
  * Shim implementation of \easter_days()
  *
  * @link https://php.net/easter_days
  *
  * @param int $year
  * @param int $method   Use the Julian or Gregorian calendar
  *
  * @return int
  */
 public static function easterDays($year, $method)
 {
     $julian = new JulianCalendar();
     $gregorian = new GregorianCalendar();
     switch ($method) {
         case CAL_EASTER_ROMAN:
             if ($year <= 1582) {
                 return $julian->easterDays($year);
             } else {
                 return $gregorian->easterDays($year);
             }
         case CAL_EASTER_ALWAYS_GREGORIAN:
             return $gregorian->easterDays($year);
         case CAL_EASTER_ALWAYS_JULIAN:
             return $julian->easterDays($year);
         default:
             // CAL_EASTER_DEFAULT or any other value
             if ($year <= 1752) {
                 return $julian->easterDays($year);
             } else {
                 return $gregorian->easterDays($year);
             }
     }
 }