SimpleSAML\Utils\XML::getDOMChildren PHP Method

getDOMChildren() public static method

This function accepts the same shortcuts for namespaces as the isDOMElementOfType function.
public static getDOMChildren ( DOMElement $element, string $localName, string $namespaceURI ) : array
$element DOMElement The element we should look in.
$localName string The name the element should have.
$namespaceURI string The namespace the element should have.
return array Array with the matching elements in the order they are found. An empty array is returned if no elements match.
    public static function getDOMChildren(\DOMElement $element, $localName, $namespaceURI)
    {
        if (!$element instanceof \DOMElement || !is_string($localName) || !is_string($namespaceURI)) {
            throw new \InvalidArgumentException('Invalid input parameters.');
        }
        $ret = array();
        for ($i = 0; $i < $element->childNodes->length; $i++) {
            $child = $element->childNodes->item($i);
            // skip text nodes and comment elements
            if ($child instanceof \DOMText || $child instanceof \DOMComment) {
                continue;
            }
            if (self::isDOMElementOfType($child, $localName, $namespaceURI) === true) {
                $ret[] = $child;
            }
        }
        return $ret;
    }