SimpleSAML_Metadata_SAMLParser::findEntityDescriptor PHP Method

findEntityDescriptor() private static method

This function will throw an exception if it is unable to locate the node.
private static findEntityDescriptor ( DOMDocument $doc ) : SAML2\XML\md\EntityDescriptor
$doc DOMDocument The DOMDocument where we should find the EntityDescriptor node.
return SAML2\XML\md\EntityDescriptor The DOMEntity which represents the EntityDescriptor.
    private static function findEntityDescriptor($doc)
    {
        assert('$doc instanceof DOMDocument');
        // find the EntityDescriptor DOMElement. This should be the first (and only) child of the DOMDocument
        $ed = $doc->documentElement;
        if ($ed === null) {
            throw new Exception('Failed to load SAML metadata from empty XML document.');
        }
        if (SimpleSAML\Utils\XML::isDOMElementOfType($ed, 'EntityDescriptor', '@md') === false) {
            throw new Exception('Expected first element in the metadata document to be an EntityDescriptor element.');
        }
        return new \SAML2\XML\md\EntityDescriptor($ed);
    }