protected final function appendValueTo(
       SimpleXMLElement $parent,
       $key,
       $value): SimpleXMLElement
   {
       $parent->addChild($key);
       if (is_object($value) || is_array($value)) {
           foreach ($value as $subKey => $subValue) {
               $this->appendValueTo($parent->{$key}, $subKey, $subValue);
           }
           if (!isset($subKey)) {
               $parent->{$key}[0] = "";
           }
       } else if (is_scalar($value) || !$value) {
           $parent->{$key}[0] = (string) $value;
       }
       return $parent->{$key};
   }