Skip to content

Commit

Permalink
DOMImproved.php adicionado metodo para adicionar atributos aos nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
robmachado committed Nov 17, 2023
1 parent 16b3404 commit 2fafec1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/DOMImproved.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,17 @@ public function addArrayChild(?DOMElement &$parent, $arr)

/**
* Adicona um atributo a uma tag
* @param DOMElement $node
* @param \DOMElement $node
* @param string $name
* @param string $value
* @param string|null $value
* @return void
* @throws \DOMException
*/
public function addAttribute(DOMElement &$node, string $name, string $value)
public function addAttribute(\DOMElement &$node, string $name, string $value = null)
{
if (is_null($value)) {
return;
}
$att = $this->createAttribute($name);
$att->value = $value;
$node->appendChild($att);
Expand Down

0 comments on commit 2fafec1

Please sign in to comment.