protected function applyAttributes(\SimpleXMLElement $element, $attributes) { if ($attributes) { foreach ($attributes as $aKey => $aValue) { $element->addAttribute($aKey, $aValue); } } return $element; }