Neos\Neos\Service\HtmlAugmenter::mergeAttributes PHP Метод

mergeAttributes() защищенный Метод

Merges the attributes of $element with the given $newAttributes If an attribute exists in both collections, it is merged to " " (if both values differ)
protected mergeAttributes ( DOMNode $element, array &$newAttributes ) : void
$element DOMNode
$newAttributes array
Результат void
    protected function mergeAttributes(\DOMNode $element, array &$newAttributes)
    {
        /** @var $attribute \DOMAttr */
        foreach ($element->attributes as $attribute) {
            $oldAttributeValue = $attribute->hasChildNodes() ? $attribute->value : null;
            $newAttributeValue = isset($newAttributes[$attribute->name]) ? $newAttributes[$attribute->name] : null;
            $mergedAttributes = array();
            if ($newAttributeValue !== null && $newAttributeValue !== $oldAttributeValue) {
                $mergedAttributes[] = $newAttributeValue;
            }
            if ($oldAttributeValue !== null) {
                $mergedAttributes[] = $oldAttributeValue;
            }
            $newAttributes[$attribute->name] = $mergedAttributes !== array() ? implode(' ', $mergedAttributes) : null;
        }
    }