public function prolepticYear(Era $era, $yearOfEra) { if ($era instanceof ThaiBuddhistEra === false) { throw new ClassCastException("Era must be BuddhistEra"); } return $era == ThaiBuddhistEra::BE() ? $yearOfEra : 1 - $yearOfEra; }
/** * Gets the era applicable at this date. * <p> * The Thai Buddhist calendar system has two eras, 'BE' and 'BEFORE_BE', * defined by {@link ThaiBuddhistEra}. * * @return ThaiBuddhistEra the era applicable at this date, not null */ public function getEra() { return $this->getProlepticYear() >= 1 ? ThaiBuddhistEra::BE() : ThaiBuddhistEra::BEFORE_BE(); }