code: public function getNestingLevel()
      {
          $nestingLevel = 0;
  
          $parent = $this->getParent();
          while ($parent instanceof SpgrContainer) {
              ++$nestingLevel;
              $parent = $parent->getParent();
          }
  
          return $nestingLevel;
      }
docs: Get the nesting level of this spContainer. This is the number of spgrContainers between this spContainer and
  the dgContainer. A value of 1 = immediately within first spgrContainer
  Higher nesting level occurs if and only if spContainer is part of a shape group.
  
  @return int Nesting level