src/Template/XMLTemplate.php
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};
   }
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};
   }
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 } ; }
Append a value to a SimpleXmlElement

@param SimpleXMLElement $parent parent node
@param string $key value key
@param mixed $value value
@return SimpleXMLElement
Append a value to a SimpleXmlElement