public function __construct($name, $value = null, $attributes = [])
{
if (is_string($name)) {
$document = new DOMDocument('1.0', 'UTF-8');
$node = $document->createElement($name);
$this->setNode($node);
} else {
$this->setNode($name);
}
if ($value !== null) {
$this->setValue($value);
}
if (!is_array($attributes)) {
throw new InvalidArgumentException(sprintf('%s expects parameter 3 to be array, %s given', __METHOD__, is_object($attributes) ? get_class($attributes) : gettype($attributes)));
}
foreach ($attributes as $name => $value) {
$this->setAttribute($name, $value);
}
}