public function toXML(DOMElement $parent = null) : DOMElement
    {
        if ($parent === null) {
            $doc = DOMDocumentFactory::create();
            $e = $doc->createElementNS(Constants::NS_MD, 'md:EntitiesDescriptor');
            $doc->appendChild($e);
        } else {
            $e = $parent->ownerDocument->createElementNS(Constants::NS_MD, 'md:EntitiesDescriptor');
            $parent->appendChild($e);
        }

        if ($this->ID !== null) {
            $e->setAttribute('ID', $this->ID);
        }

        if ($this->validUntil !== null) {
            $e->setAttribute('validUntil', gmdate('Y-m-d\TH:i:s\Z', $this->validUntil));
        }

        if ($this->cacheDuration !== null) {
            $e->setAttribute('cacheDuration', $this->cacheDuration);
        }

        if ($this->Name !== null) {
            $e->setAttribute('Name', $this->Name);
        }

        Extensions::addList($e, $this->Extensions);

        /** @var \SAML2\XML\md\EntityDescriptor|\SAML2\XML\md\EntitiesDescriptor $node */
        foreach ($this->children as $node) {
            $node->toXML($e);
        }

        $this->signElement($e, $e->firstChild);

        return $e;
    }
public function toXML(DOMElement $parent = null) : DOMElement
    {
        if ($parent === null) {
            $doc = DOMDocumentFactory::create();
            $e = $doc->createElementNS(Constants::NS_MD, 'md:EntitiesDescriptor');
            $doc->appendChild($e);
        } else {
            $e = $parent->ownerDocument->createElementNS(Constants::NS_MD, 'md:EntitiesDescriptor');
            $parent->appendChild($e);
        }

        if ($this->ID !== null) {
            $e->setAttribute('ID', $this->ID);
        }

        if ($this->validUntil !== null) {
            $e->setAttribute('validUntil', gmdate('Y-m-d\TH:i:s\Z', $this->validUntil));
        }

        if ($this->cacheDuration !== null) {
            $e->setAttribute('cacheDuration', $this->cacheDuration);
        }

        if ($this->Name !== null) {
            $e->setAttribute('Name', $this->Name);
        }

        Extensions::addList($e, $this->Extensions);

        /** @var \SAML2\XML\md\EntityDescriptor|\SAML2\XML\md\EntitiesDescriptor $node */
        foreach ($this->children as $node) {
            $node->toXML($e);
        }

        $this->signElement($e, $e->firstChild);

        return $e;
    }
public function toXML ( DOMElement $ parent = null ) : DOMElement { if ( $ parent === null ) { $ doc = DOMDocumentFactory :: create ( ) ; $ e = $ doc -> createElementNS ( Constants :: NS_MD , 'md:EntitiesDescriptor' ) ; $ doc -> appendChild ( $ e ) ; } else { $ e = $ parent -> ownerDocument -> createElementNS ( Constants :: NS_MD , 'md:EntitiesDescriptor' ) ; $ parent -> appendChild ( $ e ) ; } if ( $ this -> ID !== null ) { $ e -> setAttribute ( 'ID' , $ this -> ID ) ; } if ( $ this -> validUntil !== null ) { $ e -> setAttribute ( 'validUntil' , gmdate ( 'Y-m-d\TH:i:s\Z' , $ this -> validUntil ) ) ; } if ( $ this -> cacheDuration !== null ) { $ e -> setAttribute ( 'cacheDuration' , $ this -> cacheDuration ) ; } if ( $ this -> Name !== null ) { $ e -> setAttribute ( 'Name' , $ this -> Name ) ; } Extensions :: addList ( $ e , $ this -> Extensions ) ; /** @var \SAML2\XML\md\EntityDescriptor|\SAML2\XML\md\EntitiesDescriptor $node */ foreach ( $ this -> children as $ node ) { $ node -> toXML ( $ e ) ; } $ this -> signElement ( $ e , $ e -> firstChild ) ; return $ e ; }
Convert this EntitiesDescriptor to XML.

@param \DOMElement|null $parent The EntitiesDescriptor we should append this EntitiesDescriptor to.
@return \DOMElement
Convert this EntitiesDescriptor to XML .