public function setAttributes(
        SimpleXMLElement $element,
        array $attributes
    ) {
        $storage = $element->attributes();
        foreach ($attributes as $key => $value) {
            if (isset($storage->{$key})) {
                $storage->{$key} = $value;
            } else {
                $element->addAttribute($key, $value);
            }
        }
    }
public function setAttributes(
        SimpleXMLElement $element,
        array $attributes
    ) {
        $storage = $element->attributes();
        foreach ($attributes as $key => $value) {
            if (isset($storage->{$key})) {
                $storage->{$key} = $value;
            } else {
                $element->addAttribute($key, $value);
            }
        }
    }
public function setAttributes ( SimpleXMLElement $ element , array $ attributes ) { $ storage = $ element -> attributes ( ) ; foreach ( $ attributes as $ key => $ value ) { if ( isset ( $ storage -> { $ key } ) ) { $ storage -> { $ key } = $ value ; } else { $ element -> addAttribute ( $ key , $ value ) ; } } }
Set the attributes of a node.

@param SimpleXMLElement $element
@param array            $attributes

@return void
Set the attributes of a node .