Skip to content

Commit

Permalink
Merge pull request #303 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 committed Nov 17, 2023
2 parents 503461e + 2fafec1 commit 32e23b0
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 32e23b0

Please sign in to comment.