public function prepareArrayBeforeToXmlConvert(array $data, $primaryKey = '')
    {
        $result = [];
        $iterator = new RecursiveArrayIterator($data);
        $this->arrayWalk($iterator, $result, '');

        return '' !== (string) $primaryKey ? [$primaryKey => $result] : $result;
    }
public function prepareArrayBeforeToXmlConvert(array $data, $primaryKey = '')
    {
        $result = [];
        $iterator = new RecursiveArrayIterator($data);
        $this->arrayWalk($iterator, $result, '');

        return '' !== (string) $primaryKey ? [$primaryKey => $result] : $result;
    }
public function prepareArrayBeforeToXmlConvert ( array $ data , $ primaryKey = '' ) { $ result = [ ] ; $ iterator = new RecursiveArrayIterator ( $ data ) ; $ this -> arrayWalk ( $ iterator , $ result , '' ) ; return '' !== ( string ) $ primaryKey ? [ $ primaryKey => $ result ] : $ result ; }
Preparing the array to convert to XML

@param array  $data       Source array
@param string $primaryKey Parent element name

@return array
Preparing the array to convert to XML