From 16b340486340243afc74ac0cd6f81572025b3a64 Mon Sep 17 00:00:00 2001 From: robmachado Date: Fri, 17 Nov 2023 16:20:19 -0300 Subject: [PATCH] DOMImproved.php adicionado metodo para adicionar atributos aos nodes --- src/DOMImproved.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/DOMImproved.php b/src/DOMImproved.php index 09ef657..1be2639 100755 --- a/src/DOMImproved.php +++ b/src/DOMImproved.php @@ -280,4 +280,19 @@ public function addArrayChild(?DOMElement &$parent, $arr) } return $num; } + + /** + * Adicona um atributo a uma tag + * @param DOMElement $node + * @param string $name + * @param string $value + * @return void + * @throws \DOMException + */ + public function addAttribute(DOMElement &$node, string $name, string $value) + { + $att = $this->createAttribute($name); + $att->value = $value; + $node->appendChild($att); + } }