SAML2\Assertion::parseAttributeValue PHP Method

parseAttributeValue() private method

private parseAttributeValue ( DOMNode $attribute, string $attributeName )
$attribute DOMNode
$attributeName string
    private function parseAttributeValue($attribute, $attributeName)
    {
        /** @var \DOMElement[] $values */
        $values = Utils::xpQuery($attribute, './saml_assertion:AttributeValue');
        if ($attributeName === Constants::EPTI_URN_MACE || $attributeName === Constants::EPTI_URN_OID) {
            foreach ($values as $index => $eptiAttributeValue) {
                $eptiNameId = Utils::xpQuery($eptiAttributeValue, './saml_assertion:NameID');
                if (count($eptiNameId) !== 1) {
                    throw new RuntimeException(sprintf('A "%s" (EPTI) attribute value must be a NameID, none found for value no. "%d"', $attributeName, $index));
                }
                $this->attributes[$attributeName][] = new XML\saml\NameID($eptiNameId[0]);
            }
            return;
        }
        foreach ($values as $value) {
            $hasNonTextChildElements = false;
            foreach ($value->childNodes as $childNode) {
                /** @var \DOMNode $childNode */
                if ($childNode->nodeType !== XML_TEXT_NODE) {
                    $hasNonTextChildElements = true;
                    break;
                }
            }
            if ($hasNonTextChildElements) {
                $this->attributes[$attributeName][] = $value->childNodes;
                continue;
            }
            $type = $value->getAttribute('xsi:type');
            if ($type === 'xs:integer') {
                $this->attributes[$attributeName][] = (int) $value->textContent;
            } else {
                $this->attributes[$attributeName][] = trim($value->textContent);
            }
        }
    }