private function parseAttributes(DOMElement $xml) : void
    {
        $firstAttribute = true;
        /** @var \DOMElement[] $attributes */
        $attributes = Utils::xpQuery($xml, './saml_assertion:AttributeStatement/saml_assertion:Attribute');
        foreach ($attributes as $attribute) {
            if (!$attribute->hasAttribute('Name')) {
                throw new \Exception('Missing name on <saml:Attribute> element.');
            }
            $name = $attribute->getAttribute('Name');

            if ($attribute->hasAttribute('NameFormat')) {
                $nameFormat = $attribute->getAttribute('NameFormat');
            } else {
                $nameFormat = Constants::NAMEFORMAT_UNSPECIFIED;
            }

            if ($firstAttribute) {
                $this->nameFormat = $nameFormat;
                $firstAttribute = false;
            } else {
                if ($this->nameFormat !== $nameFormat) {
                    $this->nameFormat = Constants::NAMEFORMAT_UNSPECIFIED;
                }
            }

            if (!array_key_exists($name, $this->attributes)) {
                $this->attributes[$name] = [];
                $this->attributesValueTypes[$name] = [];
            }

            $this->parseAttributeValue($attribute, $name);
        }
    }
private function parseAttributes(DOMElement $xml) : void
    {
        $firstAttribute = true;
        /** @var \DOMElement[] $attributes */
        $attributes = Utils::xpQuery($xml, './saml_assertion:AttributeStatement/saml_assertion:Attribute');
        foreach ($attributes as $attribute) {
            if (!$attribute->hasAttribute('Name')) {
                throw new \Exception('Missing name on <saml:Attribute> element.');
            }
            $name = $attribute->getAttribute('Name');

            if ($attribute->hasAttribute('NameFormat')) {
                $nameFormat = $attribute->getAttribute('NameFormat');
            } else {
                $nameFormat = Constants::NAMEFORMAT_UNSPECIFIED;
            }

            if ($firstAttribute) {
                $this->nameFormat = $nameFormat;
                $firstAttribute = false;
            } else {
                if ($this->nameFormat !== $nameFormat) {
                    $this->nameFormat = Constants::NAMEFORMAT_UNSPECIFIED;
                }
            }

            if (!array_key_exists($name, $this->attributes)) {
                $this->attributes[$name] = [];
                $this->attributesValueTypes[$name] = [];
            }

            $this->parseAttributeValue($attribute, $name);
        }
    }
private function parseAttributes ( DOMElement $ xml ) : void { $ firstAttribute = true ; /** @var \DOMElement[] $attributes */ $ attributes = Utils :: xpQuery ( $ xml , './saml_assertion:AttributeStatement/saml_assertion:Attribute' ) ; foreach ( $ attributes as $ attribute ) { if ( ! $ attribute -> hasAttribute ( 'Name' ) ) { throw new \ Exception ( 'Missing name on <saml:Attribute> element.' ) ; } $ name = $ attribute -> getAttribute ( 'Name' ) ; if ( $ attribute -> hasAttribute ( 'NameFormat' ) ) { $ nameFormat = $ attribute -> getAttribute ( 'NameFormat' ) ; } else { $ nameFormat = Constants :: NAMEFORMAT_UNSPECIFIED ; } if ( $ firstAttribute ) { $ this -> nameFormat = $ nameFormat ; $ firstAttribute = false ; } else { if ( $ this -> nameFormat !== $ nameFormat ) { $ this -> nameFormat = Constants :: NAMEFORMAT_UNSPECIFIED ; } } if ( ! array_key_exists ( $ name , $ this -> attributes ) ) { $ this -> attributes [ $ name ] = [ ] ; $ this -> attributesValueTypes [ $ name ] = [ ] ; } $ this -> parseAttributeValue ( $ attribute , $ name ) ; } }
Parse attribute statements in assertion.

@param \DOMElement $xml The XML element with the assertion.
@throws \Exception
@return void
Parse attribute statements in assertion .