protected function toString($data)
    {
        if ($data instanceof \SimpleXMLElement) {
            return $data->asXML();
        } elseif ($data instanceof \DOMDocument) {
            return $data->saveXML();
        } elseif (is_string($data)) {
            return $data;
        }

        throw new \InvalidArgumentException(
            sprintf(
                'Invalid XML content type, %s provided.',
                gettype($data)
            )
        );
    }
protected function toString($data)
    {
        if ($data instanceof \SimpleXMLElement) {
            return $data->asXML();
        } elseif ($data instanceof \DOMDocument) {
            return $data->saveXML();
        } elseif (is_string($data)) {
            return $data;
        }

        throw new \InvalidArgumentException(
            sprintf(
                'Invalid XML content type, %s provided.',
                gettype($data)
            )
        );
    }
protected function toString ( $ data ) { if ( $ data instanceof \ SimpleXMLElement ) { return $ data -> asXML ( ) ; } elseif ( $ data instanceof \ DOMDocument ) { return $ data -> saveXML ( ) ; } elseif ( is_string ( $ data ) ) { return $ data ; } throw new \ InvalidArgumentException ( sprintf ( 'Invalid XML content type, %s provided.' , gettype ( $ data ) ) ) ; }
Convert XML object to string.

@param   \SimpleXMLElement|\DOMDocument|string $data XML object or data.

@return  string  Converted XML string.
Convert XML object to string .