src/CfdiUtils/Nodes/Attributes.php
public function set(string $name, string $value = null): self
    {
        if (null === $value) {
            $this->remove($name);
            return $this;
        }
        if (! Xml::isValidXmlName($name)) {
            throw new \UnexpectedValueException(sprintf('Cannot set attribute with an invalid xml name: "%s"', $name));
        }
        $this->attributes[$name] = $value;
        return $this;
    }
public function set(string $name, string $value = null): self
    {
        if (null === $value) {
            $this->remove($name);
            return $this;
        }
        if (! Xml::isValidXmlName($name)) {
            throw new \UnexpectedValueException(sprintf('Cannot set attribute with an invalid xml name: "%s"', $name));
        }
        $this->attributes[$name] = $value;
        return $this;
    }
public function set ( string $ name , string $ value = null ) : self { if ( null === $ value ) { $ this -> remove ( $ name ) ; return $ this ; } if ( ! Xml :: isValidXmlName ( $ name ) ) { throw new \ UnexpectedValueException ( sprintf ( 'Cannot set attribute with an invalid xml name: "%s"' , $ name ) ) ; } $ this -> attributes [ $ name ] = $ value ; return $ this ; }
Set a value in the collection

@param string $name
@param string|null $value If null then it will remove the value instead of setting to empty string
@return self
Set a value in the collection