public function maxDepth(int $depth = null): int
    {
        if (null === $depth) {
            return $this->maxDepth;
        }

        $previous = $this->maxDepth;
        
        $this->maxDepth = 0 > $depth ? 0 : $depth;

        return $previous;
    }