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