public function visitElementNode(\JBBCode\ElementNode $elementNode)
 {
     $tagName = strtolower($elementNode->getTagName());
     // Update this tag name's frequency
     if (isset($this->frequencies[$tagName])) {
         $this->frequencies[$tagName]++;
     } else {
         $this->frequencies[$tagName] = 1;
     }
     // Visit all the node's childrens
     foreach ($elementNode->getChildren() as $child) {
         $child->accept($this);
     }
 }
 public function visitElementNode(\JBBCode\ElementNode $elementNode)
 {
     $tagName = strtolower($elementNode->getTagName());
     if (isset($this->depth[$tagName])) {
         /* Update the current depth for this tag name. */
         $this->depth[$tagName]++;
     } else {
         $this->depth[$tagName] = 1;
     }
     if ($elementNode->getCodeDefinition()->getNestLimit() != -1 && $elementNode->getCodeDefinition()->getNestLimit() < $this->depth[$tagName]) {
         /* Check if $elementNode is nested too deeply. */
         $elementNode->getParent()->removeChild($elementNode);
     } else {
         foreach ($elementNode->getChildren() as $child) {
             /* This element is not nested too deeply. Visit all of its children. */
             $child->accept($this);
         }
     }
     $this->depth[$tagName]--;
     /* Now that we're done visiting this node, decrement the depth. */
 }