private function buildXML(array $params = [])
    {
        $xml = new \SimpleXMLElement('<?xml version="1.0"?><membership></membership>');

        foreach ($params as $k => $v) {
            if ('role_ids' === $k && is_array($v)) {
                $item = $xml->addChild($k);
                $item->addAttribute('type', 'array');
                foreach ($v as $role) {
                    $item->addChild('role_id', $role);
                }
            } else {
                $xml->addChild($k, $v);
            }
        }

        return $xml;
    }
private function buildXML(array $params = [])
    {
        $xml = new \SimpleXMLElement('<?xml version="1.0"?><membership></membership>');

        foreach ($params as $k => $v) {
            if ('role_ids' === $k && is_array($v)) {
                $item = $xml->addChild($k);
                $item->addAttribute('type', 'array');
                foreach ($v as $role) {
                    $item->addChild('role_id', $role);
                }
            } else {
                $xml->addChild($k, $v);
            }
        }

        return $xml;
    }
private function buildXML ( array $ params = [ ] ) { $ xml = new \ SimpleXMLElement ( '<?xml version="1.0"?><membership></membership>' ) ; foreach ( $ params as $ k => $ v ) { if ( 'role_ids' === $ k && is_array ( $ v ) ) { $ item = $ xml -> addChild ( $ k ) ; $ item -> addAttribute ( 'type' , 'array' ) ; foreach ( $ v as $ role ) { $ item -> addChild ( 'role_id' , $ role ) ; } } else { $ xml -> addChild ( $ k , $ v ) ; } } return $ xml ; }
Build the XML for a membership.

@param array $params for the new/updated membership data

@return \SimpleXMLElement
Build the XML for a membership .