code: public static function appendChild(stdClass $object, $propertyName, DOMNode $node)
      {
          if (isset($object->{$propertyName})) {
              $node->appendChild($node->ownerDocument->createElement($propertyName, $object->{$propertyName}));
          }
      }
docs: Conditionally adds a child node to $node. The value comes from the specified $object
  and will only be added if the $propertyName has a value.
  
  @param stdClass $object The object to get values from
  @param string $propertyName The property name to access
  @param DOMNode $node The node to add the child to
  
  @deprecated Use NodeInterface on entities instead