src/LightSaml/Model/Metadata/Organization.php
public function serialize(\DOMNode $parent, SerializationContext $context)
    {
        if (!$this->lang) {
            throw new LightSamlXmlException('Lang is required');
        }

        $result = $this->createElement('Organization', SamlConstants::NS_METADATA, $parent, $context);

        $elements = array('OrganizationName', 'OrganizationDisplayName', 'OrganizationURL');
        $this->singleElementsToXml(
            $elements,
            $result,
            $context,
            SamlConstants::NS_METADATA
        );

        /** @var \DOMNode $node */
        foreach ($result->childNodes as $node) {
            if ($node instanceof \DOMElement) {
                if (in_array($node->tagName, $elements)) {
                    $node->setAttribute('xml:lang', $this->lang);
                }
            }
        }
    }
public function serialize(\DOMNode $parent, SerializationContext $context)
    {
        if (!$this->lang) {
            throw new LightSamlXmlException('Lang is required');
        }

        $result = $this->createElement('Organization', SamlConstants::NS_METADATA, $parent, $context);

        $elements = array('OrganizationName', 'OrganizationDisplayName', 'OrganizationURL');
        $this->singleElementsToXml(
            $elements,
            $result,
            $context,
            SamlConstants::NS_METADATA
        );

        /** @var \DOMNode $node */
        foreach ($result->childNodes as $node) {
            if ($node instanceof \DOMElement) {
                if (in_array($node->tagName, $elements)) {
                    $node->setAttribute('xml:lang', $this->lang);
                }
            }
        }
    }
@param \DOMNode             $parent
@param SerializationContext $context

@return void