{ throw new \OutOfRangeException("࣍ճߋ৽͕༗ޮͳൣғʹ͋Γ·ͤΜɻ"); } return new Period($this->startDay, $renewal_day); } public function canShorten(DueDate $renewal_day) { $candidate = $this->candidateShortenPeriod(); return $candidate->includes($renewal_day); } public function candidateShortenPeriod() { // ݄࣍ͷ1ʙݱࡏͷ࣍ճߋ৽·Ͱ͕ॖͷީิ return new static( new DueDate(new \DateTimeImmutable('first day of next month')), $this->renewalDay() ); } public function includes(DueDate $renewal_day) { return ($renewal_day == $this->startDay || $renewal_day->after($this- >startDay)) && ($renewal_day == $this->renewal_day || $renewal_day->before($this- >renewal_day)); } }