depth; } public function increaseDepth(): void { $this->depth += 1; } public function decreaseDepth(): void { if ($this->depth <= 0) { throw new LogicException('Depth cannot be smaller than zero.'); } $this->depth -= 1; } }