Skip to content

Commit

Permalink
Merge pull request #302 from robmachado/master
Browse files Browse the repository at this point in the history
DOMImproved.php adicionado método para adicionar atributos aos nodes
  • Loading branch information
robmachado authored Nov 17, 2023
2 parents 0660b2d + 16b3404 commit 503461e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/DOMImproved.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 503461e

Please sign in to comment.