original_string: protected static function loopEncode($data, $domElement)
      {
          if (is_array($data)) {
              foreach ($data as $index => $mixedElement) {
                  if (is_int($index)) {
                      if ($index == 0) {
                          $node = $domElement;
                      } else {
                          $node = new DOMElement($domElement->tagName);
                          $domElement->parentNode->appendChild($node);
                      }
                  } else {
                      $node = new DOMElement($index);
                      $domElement->appendChild($node);
                  }
                   
                  self::loopEncode($mixedElement, $node);
              }
          } else {
              $domElement->appendChild(new DOMText($data));
          }
  
          return $domElement;
      }
code: protected static function loopEncode($data, $domElement)
      {
          if (is_array($data)) {
              foreach ($data as $index => $mixedElement) {
                  if (is_int($index)) {
                      if ($index == 0) {
                          $node = $domElement;
                      } else {
                          $node = new DOMElement($domElement->tagName);
                          $domElement->parentNode->appendChild($node);
                      }
                  } else {
                      $node = new DOMElement($index);
                      $domElement->appendChild($node);
                  }
                   
                  self::loopEncode($mixedElement, $node);
              }
          } else {
              $domElement->appendChild(new DOMText($data));
          }
  
          return $domElement;
      }
code_tokens: protected static function loopEncode ( $ data , $ domElement ) { if ( is_array ( $ data ) ) { foreach ( $ data as $ index => $ mixedElement ) { if ( is_int ( $ index ) ) { if ( $ index == 0 ) { $ node = $ domElement ; } else { $ node = new DOMElement ( $ domElement -> tagName ) ; $ domElement -> parentNode -> appendChild ( $ node ) ; } } else { $ node = new DOMElement ( $ index ) ; $ domElement -> appendChild ( $ node ) ; } self :: loopEncode ( $ mixedElement , $ node ) ; } } else { $ domElement -> appendChild ( new DOMText ( $ data ) ) ; } return $ domElement ; }
docstring: Lets loop through our data
  @param  mixed                  $data       Data to encode
  @param  DOMDocument|DOMElement $domElement Document to initialize and then it'll call itself with inner Element(s)
  @return DOMDocument
docstring_tokens: Lets loop through our data