File: Endpoint.php

package info (click to toggle)
simplesamlphp 1.19.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 43,240 kB
  • sloc: php: 200,806; javascript: 15,025; xml: 3,336; sh: 265; perl: 82; makefile: 70; python: 5
file content (38 lines) | stat: -rw-r--r-- 1,018 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php

namespace SimpleSAML\Module\adfs\SAML2\XML\fed;

/**
 * Class representing fed Endpoint.
 *
 * @package SimpleSAMLphp
 */

class Endpoint
{
    /**
     * Add this endpoint to an XML element.
     *
     * @param \DOMElement $parent  The element we should append this endpoint to.
     * @param string $name  The name of the element we should create.
     * @param string $address
     * @return \DOMElement
     */
    public static function appendXML(\DOMElement $parent, $name, $address)
    {
        assert(is_string($name));
        assert(is_string($address));

        $e = $parent->ownerDocument->createElement($name);
        $parent->appendChild($e);

        $endpoint = $parent->ownerDocument->createElement('EndpointReference');
        $endpoint->setAttribute('xmlns', 'http://www.w3.org/2005/08/addressing');
        $e->appendChild($endpoint);

        $address = $parent->ownerDocument->createElement('Address', $address);
        $endpoint->appendChild($address);

        return $e;
    }
}