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

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