Changes the xs:all to an xs:sequence node

@param \DOMElement $all
@return \DOMElement
351247
private function changeAllToSequence($all)
    {
        if ($all->nodeName !== 'xsd:all') {
            return $all;
        }
        $sequence = $all->ownerDocument->createElement('xsd:sequence');
        if ($all->attributes->length) {
            foreach ($all->attributes as $attribute) {
                $sequence->setAttribute($attribute->nodeName, $attribute->nodeValue);
            }
        }
        while ($all->firstChild) {
            $sequence->appendChild($all->firstChild);
        }
        return $sequence;
    }
384112
public function normalize(DOMElement $template)
	{
		$this->ownerDocument = $template->ownerDocument;
		$this->xpath         = new DOMXPath($this->ownerDocument);
		foreach ($this->getNodes() as $node)
		{
			$this->normalizeNode($node);
		}
		$this->reset();
	}
1236757
public function toXML(DOMElement $parent) : DOMElement
    {
        $e = parent::toXML($parent);

        if (is_bool($this->AuthnRequestsSigned)) {
            $e->setAttribute('AuthnRequestsSigned', $this->AuthnRequestsSigned ? 'true' : 'false');
        }

        if (is_bool($this->WantAssertionsSigned)) {
            $e->setAttribute('WantAssertionsSigned', $this->WantAssertionsSigned ? 'true' : 'false');
        }

        foreach ($this->AssertionConsumerService as $ep) {
            $ep->toXML($e, 'md:AssertionConsumerService');
        }

        foreach ($this->AttributeConsumingService as $acs) {
            $acs->toXML($e);
        }

        return $e;
    }
61275
protected function getNextSiblingOfTypeDOMElement(\DOMNode $node)
    {
        do {
            $node = $node->nextSibling;
        } while (!($node === null || $node instanceof \DOMElement));

        return $node;
    }
1135799
public function toASN1(): Sequence
    {
        if (!count($this->_subtrees)) {
            throw new \LogicException("No subtrees.");
        }
        $elements = array_map(
            function (GeneralSubtree $gs) {
                return $gs->toASN1();
            }, $this->_subtrees);
        return new Sequence(...$elements);
    }
1009627
public function replace(DOMElement &$old, &$new)
    {
        // Check if the element has a parent node
        if (empty($old->parentNode)) {
            throw new DOMException('The current DOMItem has no parent.');
        }

        // Replace the element
        $old->parentNode->replaceChild($new, $old);

        return $new;
    }
607319
public function setDOMElementPayload(DOMElement $element)
    {
        $this->setPayload($element->ownerDocument->saveXML($element));

        return $this;
    }
487763
public static function fromXml(\DOMElement $xml)
    {
        $static = new static();

        $isRenewable = $xml->getElementsByTagName('renewable');
        $static->isRenewable = BoolLiteral::fromXml($isRenewable);
        $message = $xml->getElementsByTagName('renewableMessage');
        $static->message = StringLiteral::fromXml($message);
        $cost = $xml->getElementsByTagName('renewalCost');
        $static->cost = StringLiteral::fromXml($cost);

        return $static;
    }
1208755
public function toUnsignedXML() : DOMElement
    {
        $root = parent::toUnsignedXML();

        /** @var \SAML2\Assertion|\SAML2\EncryptedAssertion $assertion */
        foreach ($this->assertions as $assertion) {
            $assertion->toXML($root);
        }

        return $root;
    }
1020332
public function getAllElements ($elementType)
    {
        $iterator = new \DirectoryIterator($this->getUserSubDirectory("{$elementType}s"));
        $allElements = [];

        /** @var \SplFileInfo $file */
        foreach ($iterator as $file)
        {
            if ($file->isDir() || ("twig" !== $file->getExtension()))
            {
                continue;
            }

            $reference = "@{$elementType}/{$file->getBasename()}";
            $element = new Element($reference);
            $allElements[$element->getKey()] = $element;
        }

        return $allElements;
    }
485714
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;
    }
234276
private function convertElement(DOMElement $element, $value)
    {
        $sequential = $this->isArrayAllKeySequential($value);

        if (! is_array($value)) {
            $element->nodeValue = htmlspecialchars($value);
            return;
        }

        foreach ($value as $key => $data) {
            if (! $sequential) {
                if (($key === '_attributes') || ($key === '@attributes')) {
                    $this->addAttributes($element, $data);
                } elseif ((($key === '_value') || ($key === '@value')) && is_string($data)) {
                    $element->nodeValue = htmlspecialchars($data);
                } elseif ($element->nodeName == $key) {
                    $this->addCollectionNode($element, $data);
                    continue;
                } else {
                    $this->addNode($element, $key, $data);
                }
            } elseif (is_array($data)) {
                $this->addCollectionNode($element, $data);
            } else {
                $this->addSequentialNode($element, $data);
            }
        }
    }
523734
protected function element(string $name): \DOMElement
    {
        if (\strpos($name, ':') !== false)
        {
            $keys = explode(':', $name);

            return $this->document()->createElementNS(
                $this->namespaces[$this->options()->getNamespace() . ':' . \current($keys)],
                $name
            );
        }

        return $this->createElement($name);
    }
880132
public function toXML(DOMElement $parent = null) : DOMElement
    {
        if (($this->Saml2IssuerShowAll && ($this->Format === Constants::NAMEID_ENTITY))
            || ($this->Format !== Constants::NAMEID_ENTITY)
        ) {
            return parent::toXML($parent);
        }

        /*
         * if $this->Saml2IssuerShowAll is set false
         * From saml-core-2.0-os 8.3.6, when the entity Format is used: "The NameQualifier, SPNameQualifier, and
         * SPProvidedID attributes MUST be omitted."
         * if $this->isSaml2IssuerShowAll() is set true when the entity Format is used: "The NameQualifier,
         * SPNameQualifier, and SPProvidedID attributes are not omitted."
         */

        if ($parent === null) {
            $parent = DOMDocumentFactory::create();
            $doc = $parent;
        } else {
            $doc = $parent->ownerDocument;
        }
        $element = $doc->createElementNS(Constants::NS_SAML, 'saml:Issuer');
        $parent->appendChild($element);

        if (empty($this->value)) {
            throw new \Exception("Cannot convert Issuer to XML with no value.");
        }
        $value = $element->ownerDocument->createTextNode($this->value);
        $element->appendChild($value);

        return $element;
    }
1072047
public function toXML(DOMElement $parent) : DOMElement
    {
        Assert::notEmpty($this->AttributeService);

        $e = parent::toXML($parent);

        foreach ($this->AttributeService as $ep) {
            $ep->toXML($e, 'md:AttributeService');
        }

        foreach ($this->AssertionIDRequestService as $ep) {
            $ep->toXML($e, 'md:AssertionIDRequestService');
        }

        Utils::addStrings($e, Constants::NS_MD, 'md:NameIDFormat', false, $this->NameIDFormat);

        Utils::addStrings($e, Constants::NS_MD, 'md:AttributeProfile', false, $this->AttributeProfile);

        foreach ($this->Attribute as $a) {
            $a->toXML($e);
        }

        return $e;
    }
1237297
protected static function nodeToXpath(\DOMNode $domnode) {
		$dom = new \DOMDocument();
		$dom->formatOutput = true;
		$node = $dom->importNode($domnode, true);
		if($node instanceof \DOMElement)
			$dom->appendChild($node);
		return new \DOMXPath($dom);
	}
2895
public function toXML(DOMElement $parent) : DOMElement
    {
        $e = $this->toXMLInternal($parent, Constants::NS_MD, 'md:RequestedAttribute');

        if (is_bool($this->isRequired)) {
            $e->setAttribute('isRequired', $this->isRequired ? 'true' : 'false');
        }

        return $e;
    }