Code Duplication    Length = 11-16 lines in 5 locations

src/SAML2/XML/ds/X509Data.php 1 location

@@ 62-77 (lines=16) @@
59
     * @param \DOMElement $parent The element we should append this X509Data element to.
60
     * @return \DOMElement
61
     */
62
    public function toXML(\DOMElement $parent)
63
    {
64
        assert('is_array($this->data)');
65
66
        $doc = $parent->ownerDocument;
67
68
        $e = $doc->createElementNS(XMLSecurityDSig::XMLDSIGNS, 'ds:X509Data');
69
        $parent->appendChild($e);
70
71
        /** @var \SAML2\XML\Chunk|\SAML2\XML\ds\X509Certificate $n */
72
        foreach ($this->data as $n) {
73
            $n->toXML($e);
74
        }
75
76
        return $e;
77
    }
78
}
79

src/SAML2/XML/mdattr/EntityAttributes.php 1 location

@@ 57-72 (lines=16) @@
54
     * @param \DOMElement $parent The element we should append to.
55
     * @return \DOMElement
56
     */
57
    public function toXML(\DOMElement $parent)
58
    {
59
        assert('is_array($this->children)');
60
61
        $doc = $parent->ownerDocument;
62
63
        $e = $doc->createElementNS(EntityAttributes::NS, 'mdattr:EntityAttributes');
64
        $parent->appendChild($e);
65
66
        /** @var \SAML2\XML\saml\Attribute|\SAML2\XML\Chunk $child */
67
        foreach ($this->children as $child) {
68
            $child->toXML($e);
69
        }
70
71
        return $e;
72
    }
73
}
74

src/SAML2/XML/samlp/Extensions.php 1 location

@@ 38-50 (lines=13) @@
35
     * @param \DOMElement        $parent     The element we should add the extensions to.
36
     * @param \SAML2\XML\Chunk[] $extensions List of extension objects.
37
     */
38
    public static function addList(\DOMElement $parent, array $extensions)
39
    {
40
        if (empty($extensions)) {
41
            return;
42
        }
43
44
        $extElement = $parent->ownerDocument->createElementNS(Constants::NS_SAMLP, 'samlp:Extensions');
45
        $parent->appendChild($extElement);
46
47
        foreach ($extensions as $ext) {
48
            $ext->toXML($extElement);
49
        }
50
    }
51
}
52

src/SAML2/XML/alg/DigestMethod.php 1 location

@@ 48-58 (lines=11) @@
45
     * @param \DOMElement $parent The element we should append to.
46
     * @return \DOMElement
47
     */
48
    public function toXML(\DOMElement $parent)
49
    {
50
        assert('is_string($this->Algorithm)');
51
52
        $doc = $parent->ownerDocument;
53
        $e = $doc->createElementNS(Common::NS, 'alg:DigestMethod');
54
        $parent->appendChild($e);
55
        $e->setAttribute('Algorithm', $this->Algorithm);
56
57
        return $e;
58
    }
59
}
60

src/SAML2/XML/md/Extensions.php 1 location

@@ 77-89 (lines=13) @@
74
     * @param \DOMElement        $parent     The element we should add the extensions to.
75
     * @param \SAML2\XML\Chunk[] $extensions List of extension objects.
76
     */
77
    public static function addList(\DOMElement $parent, array $extensions)
78
    {
79
        if (empty($extensions)) {
80
            return;
81
        }
82
83
        $extElement = $parent->ownerDocument->createElementNS(Constants::NS_MD, 'md:Extensions');
84
        $parent->appendChild($extElement);
85
86
        foreach ($extensions as $ext) {
87
            $ext->toXML($extElement);
88
        }
89
    }
90
}
91