SAML2\Assertion::parseAttributes PHP Method

parseAttributes() private method

Parse attribute statements in assertion.
private parseAttributes ( DOMElement $xml )
$xml DOMElement The XML element with the assertion.
    private function parseAttributes(\DOMElement $xml)
    {
        $firstAttribute = true;
        $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] = array();
            }
            $this->parseAttributeValue($attribute, $name);
        }
    }