private static function parseAttributeConsumerService(\SAML2\XML\md\AttributeConsumingService $element, &$sp)
{
assert('is_array($sp)');
$sp['name'] = $element->ServiceName;
$sp['description'] = $element->ServiceDescription;
$format = null;
$sp['attributes'] = array();
$sp['attributes.required'] = array();
foreach ($element->RequestedAttribute as $child) {
$attrname = $child->Name;
$sp['attributes'][] = $attrname;
if ($child->isRequired !== null && $child->isRequired === true) {
$sp['attributes.required'][] = $attrname;
}
if ($child->NameFormat !== null) {
$attrformat = $child->NameFormat;
} else {
$attrformat = \SAML2\Constants::NAMEFORMAT_UNSPECIFIED;
}
if ($format === null) {
$format = $attrformat;
} elseif ($format !== $attrformat) {
$format = \SAML2\Constants::NAMEFORMAT_UNSPECIFIED;
}
}
if (empty($sp['attributes'])) {
// a really invalid configuration: all AttributeConsumingServices should have one or more attributes
unset($sp['attributes']);
}
if (empty($sp['attributes.required'])) {
unset($sp['attributes.required']);
}
if ($format !== \SAML2\Constants::NAMEFORMAT_UNSPECIFIED && $format !== null) {
$sp['attributes.NameFormat'] = $format;
}
}