Set attributes on $node using [$name => $value]

@param DOMNode $node  Node to set attributes on
@param array   $attrs $key => $value array of attributes to set
508392
protected function setAttributes(\DOMNode &$node, array $attrs = array())
	{
		$attrs = array_filter('is_string', $attrs);
		if (! is_array($attrs) or empty($attrs)) {
			return;
		}
		array_map(
			[$node, 'setAttribute'],
			array_keys($attrs),
			array_values($attrs)
		);
	}
341265
function attributes(node) {
    var obj = {};
    each(function(attr) {
      obj[attr.name] = attr.value;
    }, node.attributes);
    return obj;
  }
868872
private function appendDOMNode(\DOMDocument $dom, $node, $name, $value = null, $hasAttributes = false)
    {
        $element = $dom->createElement($name);

        if ($hasAttributes && $this->nodeValueKey === $name) {
            $this->setElementValue($dom, $node, $value);

            return;
        }

        $this->setElementValue($dom, $element, $value);
        $node->appendChild($element);
    }
1269653
public function node(\DOMNode $node) {
        // A listing of types is at http://php.net/manual/en/dom.constants.php
        switch ($node->nodeType) {
            case XML_ELEMENT_NODE:
                $this->rules->element($node);
                break;
            case XML_TEXT_NODE:
                $this->rules->text($node);
                break;
            case XML_CDATA_SECTION_NODE:
                $this->rules->cdata($node);
                break;
            // FIXME: It appears that the parser doesn't do PI's.
            case XML_PI_NODE:
                $this->rules->processorInstruction($node);
                break;
            case XML_COMMENT_NODE:
                $this->rules->comment($node);
                break;
            // Currently we don't support embedding DTDs.
            default:
                print '<!-- Skipped -->';
                break;
        }
    }
342494
public function setAttribute(string $name, $value): void
	{
		Arr::set($this->attributes, $name, $value);
	}
1001380
public function assignNode(NodeInterface $node, array $propertyNames = ['name', 'path', 'identifier', 'properties', 'nodeType'])
    {
        $this->setConfiguration(
            [
                'value' => [
                    'data' => [
                        '_only' => ['name', 'path', 'identifier', 'properties', 'nodeType'],
                        '_descend' => ['properties' => $propertyNames]
                    ]
                ]
            ]
        );
        $this->assign('value', ['data' => $node, 'success' => true]);
    }
697536
public function setAttribute($key, $value)
	{
		if ($value instanceof BaseModel || $value instanceof Collection)
			$this->setRelationship($value, $key);
		elseif ( !is_array($value))
			$this->attributes[$key] = $value;
		else
			$this->setRelationship($value, $key);
	}
774812
public function setAttributes(array $attrs) {

		foreach($attrs as $k => $v) {
			$this->setAttribute($k, $v);
		}

		return $this;

	}
671605
public function addElement($attrs)
    {
        if (!$this->getPrefix($attrs['type'])) {
            $attrs['type'] = $this->schemaTargetNamespace . ':' . $attrs['type'];
        }
        $this->elements[$attrs['name']] = $attrs;
        $this->elements[$attrs['name']]['typeClass'] = 'element';

        $this->xdebug("addElement " . $attrs['name']);
        $this->appendDebug($this->varDump($this->elements[$attrs['name']]));
    }
206231
protected function extendedAttrRequired(DOMNode $node, DOMAttr $attr)
	{
		$id = $node->getAttribute('id');

		$message = $attr->value;
		$this->js []= "addValidator('required', '#$id', '$message');";

	}
472845
public function removeAttribute($node, $name)
    {
        if (is_string($node)) {
            $node = $this->getNode($node);
        }

        if ($node) {
            $node->removeAttribute($name);
        } else {
            throw new Dom\Exception('Missing target node.');
        }
    }
102607
public function set_attribute($attr, $value = null)
	{
		$attr = is_array($attr) ? $attr : array($attr => $value);
		foreach ($attr as $key => $value)
		{
			if ($value === null)
			{
				unset($this->attributes[$key]);
			}
			else
			{
				$this->attributes[$key] = $value;
			}
		}

		return $this;
	}
1237283
function(node, val) {
                var attr = node.attributes.value;
                if (!attr) {
                    attr = node[OWNER_DOCUMENT].createAttribute('value');
                    node.setAttributeNode(attr);
                }

                attr.value = val;
            }
1003076
public function assign($attrs)
    {
        foreach ($attrs as $key => $val) {
            if (property_exists($this, $key)) {
                $this->$key = $val;
            }
        }
    }
612458
protected function setNode($node)
    {
        $allowedClasses = ['DOMElement', 'DOMText', 'DOMComment', 'DOMCdataSection'];

        if (!is_object($node) || !in_array(get_class($node), $allowedClasses, true)) {
            throw new InvalidArgumentException(sprintf('Argument 1 passed to %s must be an instance of DOMElement, DOMText, DOMComment or DOMCdataSection, %s given', __METHOD__, (is_object($node) ? get_class($node) : gettype($node))));
        }

        $this->node = $node;

        return $this;
    }
595019
private function mapAttributes(\DOMNode $node, $key, $value)
    {
        if (null !== $attrName = $this->getAttributeName($key)) {
            foreach ((array)$value as $attrKey => $attrValue) {
                $node->setAttribute($attrKey, $this->getAttributeValue($attrValue, $attrKey));
            }


            return true;
        }

        if (is_scalar($value) && $this->isMappedAttribute($node->nodeName, $key) && $this->isValidNodeName($key)) {
            $node->setAttribute($key, $this->getAttributeValue($value, $key));

            return true;
        }

        return false;
    }
288158
private function setAllChildren(\DOMDocument $dom, \DOMElement $node, array $attributes, $depth = 0)
    {
        static $iloop = 0;
        if ($depth == 0) {
            $iloop = 0;
        }

        foreach ($attributes as $a => $v) {
            $node->setAttribute($a, $v);
        }

        if (($iloop++ % 100) == 0) {
            usleep(1000);
        }

        for ($n = $node->firstChild; $n; $n = $n->nextSibling) {
            $this->setAllChildren($dom, $n, $attributes, $depth + 1);
        }
    }