original_string: private function appendNode(\DOMNode $parentNode, $data, string $nodeName, string $key = null): bool
      {
          $node = $this->dom->createElement($nodeName);
          if (null !== $key) {
              $node->setAttribute('key', $key);
          }
          $appendNode = $this->selectNodeType($node, $data);
          // we may have decided not to append this node, either in error or if its $nodeName is not valid
          if ($appendNode) {
              $parentNode->appendChild($node);
          }
  
          return $appendNode;
      }
code: private function appendNode(\DOMNode $parentNode, $data, string $nodeName, string $key = null): bool
      {
          $node = $this->dom->createElement($nodeName);
          if (null !== $key) {
              $node->setAttribute('key', $key);
          }
          $appendNode = $this->selectNodeType($node, $data);
          // we may have decided not to append this node, either in error or if its $nodeName is not valid
          if ($appendNode) {
              $parentNode->appendChild($node);
          }
  
          return $appendNode;
      }
code_tokens: private function appendNode ( \ DOMNode $ parentNode , $ data , string $ nodeName , string $ key = null ) : bool { $ node = $ this -> dom -> createElement ( $ nodeName ) ; if ( null !== $ key ) { $ node -> setAttribute ( 'key' , $ key ) ; } $ appendNode = $ this -> selectNodeType ( $ node , $ data ) ; // we may have decided not to append this node, either in error or if its $nodeName is not valid if ( $ appendNode ) { $ parentNode -> appendChild ( $ node ) ; } return $ appendNode ; }
docstring: Selects the type of node to create and appends it to the parent.
  
  @param array|object $data
docstring_tokens: Selects the type of node to create and appends it to the parent .