public function serializeArray(
            $array,
            XmlStreamWriter $xmlWriter,
            string $tagName = null,
            string $elementTagName = null
    ): XmlStreamWriter {
        if (null === $tagName) {
            $tagName = 'array';
        }

        if (!empty($tagName)) {
            $xmlWriter->writeStartElement($tagName);
        }

        foreach ($array as $key => $value) {
            if (is_int($key)) {
                $this->serialize($value, $xmlWriter, $elementTagName);
            } else {
                $this->serialize($value, $xmlWriter, $key);
            }
        }

        if (!empty($tagName)) {
            $xmlWriter->writeEndElement();
        }

        return $xmlWriter;
    }
public function serializeArray(
            $array,
            XmlStreamWriter $xmlWriter,
            string $tagName = null,
            string $elementTagName = null
    ): XmlStreamWriter {
        if (null === $tagName) {
            $tagName = 'array';
        }

        if (!empty($tagName)) {
            $xmlWriter->writeStartElement($tagName);
        }

        foreach ($array as $key => $value) {
            if (is_int($key)) {
                $this->serialize($value, $xmlWriter, $elementTagName);
            } else {
                $this->serialize($value, $xmlWriter, $key);
            }
        }

        if (!empty($tagName)) {
            $xmlWriter->writeEndElement();
        }

        return $xmlWriter;
    }
public function serializeArray ( $ array , XmlStreamWriter $ xmlWriter , string $ tagName = null , string $ elementTagName = null ) : XmlStreamWriter { if ( null === $ tagName ) { $ tagName = 'array' ; } if ( ! empty ( $ tagName ) ) { $ xmlWriter -> writeStartElement ( $ tagName ) ; } foreach ( $ array as $ key => $ value ) { if ( is_int ( $ key ) ) { $ this -> serialize ( $ value , $ xmlWriter , $ elementTagName ) ; } else { $ this -> serialize ( $ value , $ xmlWriter , $ key ) ; } } if ( ! empty ( $ tagName ) ) { $ xmlWriter -> writeEndElement ( ) ; } return $ xmlWriter ; }
serializes an array to xml

@param   array                          $array           array to serialize
@param   \stubbles\xml\XmlStreamWriter  $xmlWriter       xml writer to write serialized array into
@param   string                         $tagName         name of the surrounding xml tag
@param   string                         $elementTagName  necurring element tag name for lists
@return  \stubbles\xml\XmlStreamWriter
@since   1.6.0
serializes an array to xml