diff --git a/src/Carbon.php b/src/Carbon.php index 48ff938..55d8c54 100644 --- a/src/Carbon.php +++ b/src/Carbon.php @@ -19,14 +19,34 @@ class Carbon extends CarbonBase case 'half': return (int) ceil($this->month / static::MONTHS_PER_HALF); - case 'quarter_string': - return sprintf('%dQ%d',$this->year,$this->quarter); + case 'quarter_string': + return sprintf('%dQ%d',$this->year,$this->quarter); default: return parent::__get($name); } } + public function addHalf(): self + { + return $this->addHalves(1); + } + + public function addHalves(int $unit): self + { + return $this->addQuarters(2*$unit); + } + + public function subHalf(): self + { + return $this->subHalves(1); + } + + public function subHalves(int $unit): self + { + return $this->subQuarters(2*$unit); + } + /** * Modify to the first occurrence of a given day of the week * in the current quarter. If no dayOfWeek is provided, modify to the