47        parent::__construct(
'AttributeQuery', 
$xml);
 
   49        $this->attributes = array();
 
   50        $this->nameFormat = Constants::NAMEFORMAT_UNSPECIFIED;
 
   56        $firstAttribute = 
true;
 
   59            if (!$attribute->hasAttribute(
'Name')) {
 
   60                throw new \Exception(
'Missing name on <saml:Attribute> element.');
 
   62            $name = $attribute->getAttribute(
'Name');
 
   64            if ($attribute->hasAttribute(
'NameFormat')) {
 
   65                $nameFormat = $attribute->getAttribute(
'NameFormat');
 
   67                $nameFormat = Constants::NAMEFORMAT_UNSPECIFIED;
 
   70            if ($firstAttribute) {
 
   71                $this->nameFormat = $nameFormat;
 
   72                $firstAttribute = 
false;
 
   74                if ($this->nameFormat !== $nameFormat) {
 
   75                    $this->nameFormat = Constants::NAMEFORMAT_UNSPECIFIED;
 
   79            if (!array_key_exists(
$name, $this->attributes)) {
 
   80                $this->attributes[
$name] = array();
 
   83            $values = Utils::xpQuery($attribute, 
'./saml_assertion:AttributeValue');
 
   85                $this->attributes[
$name][] = trim($value->textContent);
 
  120        return $this->nameFormat;
 
  130        assert(is_string($nameFormat));
 
  132        $this->nameFormat = $nameFormat;
 
  142        $root = parent::toUnsignedXML();
 
  145            $attribute = 
$root->ownerDocument->createElementNS(Constants::NS_SAML, 
'saml:Attribute');
 
  146            $root->appendChild($attribute);
 
  147            $attribute->setAttribute(
'Name', 
$name);
 
  149            if ($this->nameFormat !== Constants::NAMEFORMAT_UNSPECIFIED) {
 
  150                $attribute->setAttribute(
'NameFormat', $this->nameFormat);
 
  154                if (is_string($value)) {
 
  156                } elseif (is_int($value)) {
 
  157                    $type = 
'xs:integer';
 
  162                $attributeValue = Utils::addString($attribute, Constants::NS_SAML, 
'saml:AttributeValue', $value);
 
  163                if (
$type !== 
null) {
 
  164                    $attributeValue->setAttributeNS(Constants::NS_XSI, 
'xsi:type', 
$type);
 
An exception for terminatinating execution or to throw for unit testing.
toUnsignedXML()
Convert the attribute query message to an XML element.
__construct(\DOMElement $xml=null)
Constructor for SAML 2 attribute query messages.
setAttributes(array $attributes)
Set all requested attributes.
setAttributeNameFormat($nameFormat)
Set the NameFormat used on all attributes.
getAttributeNameFormat()
Retrieve the NameFormat used on all attributes.
getAttributes()
Retrieve all requested attributes.
if(array_key_exists('yes', $_REQUEST)) $attributes