src/SoapMessageEventSubscriber.php
protected function moveChildNamespacesToEnvelope(\SimpleXMLElement $element): \SimpleXMLElement
    {
        $dom = dom_import_simplexml($element);

        foreach ($element->getNamespaces(true) as $prefix => $namespace) {
            if (!in_array($namespace, $element->getDocNamespaces())) {
                $dom->setAttributeNS(
                    'http://www.w3.org/2000/xmlns/',
                    $prefix ? 'xmlns:' . $prefix : 'xmlns',
                    $namespace
                );
            }
        }

        return simplexml_import_dom($dom->ownerDocument);
    }
protected function moveChildNamespacesToEnvelope(\SimpleXMLElement $element): \SimpleXMLElement
    {
        $dom = dom_import_simplexml($element);

        foreach ($element->getNamespaces(true) as $prefix => $namespace) {
            if (!in_array($namespace, $element->getDocNamespaces())) {
                $dom->setAttributeNS(
                    'http://www.w3.org/2000/xmlns/',
                    $prefix ? 'xmlns:' . $prefix : 'xmlns',
                    $namespace
                );
            }
        }

        return simplexml_import_dom($dom->ownerDocument);
    }
protected function moveChildNamespacesToEnvelope ( \ SimpleXMLElement $ element ) : \ SimpleXMLElement { $ dom = dom_import_simplexml ( $ element ) ; foreach ( $ element -> getNamespaces ( true ) as $ prefix => $ namespace ) { if ( ! in_array ( $ namespace , $ element -> getDocNamespaces ( ) ) ) { $ dom -> setAttributeNS ( 'http://www.w3.org/2000/xmlns/' , $ prefix ? 'xmlns:' . $ prefix : 'xmlns' , $ namespace ) ; } } return simplexml_import_dom ( $ dom -> ownerDocument ) ; }
Move all underlying namespaces to root element.

@param \SimpleXMLElement $element

@return \SimpleXMLElement
Move all underlying namespaces to root element .