Code Duplication    Length = 7-9 lines in 3 locations

src/SAML2/AttributeQuery.php 1 location

@@ 154-160 (lines=7) @@
151
            }
152
153
            foreach ($values as $value) {
154
                if (is_string($value)) {
155
                    $type = 'xs:string';
156
                } elseif (is_int($value)) {
157
                    $type = 'xs:integer';
158
                } else {
159
                    $type = null;
160
                }
161
162
                $attributeValue = Utils::addString($attribute, Constants::NS_SAML, 'saml:AttributeValue', $value);
163
                if ($type !== null) {

src/SAML2/Assertion.php 2 locations

@@ 1600-1608 (lines=9) @@
1597
                }
1598
1599
                // if no type get from types, use default behaviour
1600
                if (is_null($type)) {
1601
                    if (is_string($value)) {
1602
                        $type = 'xs:string';
1603
                    } elseif (is_int($value)) {
1604
                        $type = 'xs:integer';
1605
                    } else {
1606
                        $type = null;
1607
                    }
1608
                }
1609
1610
                $attributeValue = $document->createElementNS(Constants::NS_SAML, 'saml:AttributeValue');
1611
                $attribute->appendChild($attributeValue);
@@ 1659-1665 (lines=7) @@
1656
            }
1657
1658
            foreach ($values as $value) {
1659
                if (is_string($value)) {
1660
                    $type = 'xs:string';
1661
                } elseif (is_int($value)) {
1662
                    $type = 'xs:integer';
1663
                } else {
1664
                    $type = null;
1665
                }
1666
1667
                $attributeValue = $document2->createElementNS(Constants::NS_SAML, 'saml:AttributeValue');
1668
                $attribute->appendChild($attributeValue);