month / static::MONTHS_PER_HALF); default: return parent::__get($name); } } /** * Modify to the first occurrence of a given day of the week * in the current quarter. If no dayOfWeek is provided, modify to the * first day of the current quarter. Use the supplied constants * to indicate the desired dayOfWeek, ex. static::MONDAY. * * @param int|null $dayOfWeek * * @return static */ public function firstOfHalf($dayOfWeek = null) { return $this->setDate($this->year, $this->half * static::MONTHS_PER_HALF - 5, 1)->firstOfMonth($dayOfWeek); } /** * Modify to the last occurrence of a given day of the week * in the current quarter. If no dayOfWeek is provided, modify to the * last day of the current quarter. Use the supplied constants * to indicate the desired dayOfWeek, ex. static::MONDAY. * * @param int|null $dayOfWeek * * @return static */ public function lastOfHalf($dayOfWeek = null) { return $this->setDate($this->year, $this->half * static::MONTHS_PER_HALF, 1)->lastOfMonth($dayOfWeek); } }