From d3532994568981e7331ffb558c7b6bd31e8ae3d7 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Mon, 3 Aug 2009 12:45:21 +0000
Subject: [PATCH] MetadataStorageHandler: Add function to retrieve metadata as
 configuration object.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1601 44740490-163a-0410-bde0-09ae8108e29a
---
 .../Metadata/MetaDataStorageHandler.php        | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php
index f9b2586bc..eb088b28d 100644
--- a/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php
+++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php
@@ -316,6 +316,24 @@ class SimpleSAML_Metadata_MetaDataStorageHandler {
 		throw new Exception('Unable to locate metadata for \'' . $index . '\' in set \'' . $set . '\'.');
 	}
 
+
+	/**
+	 * Retrieve the metadata as a configuration object.
+	 *
+	 * This function will throw an exception if it is unable to locate the metadata.
+	 *
+	 * @param string $entityId  The entity ID we are looking up.
+	 * @param string $set  The metadata set we are searching.
+	 * @return SimpleSAML_Configuration  The configuration object representing the metadata.
+	 */
+	public function getMetaDataConfig($entityId, $set) {
+		assert('is_string($entityId)');
+		assert('is_string($set)');
+
+		$metadata = $this->getMetaData($entityId, $set);
+		return SimpleSAML_Configuration::loadFromArray($metadata, $set . '/' . var_export($entityId, TRUE));
+	}
+
 }
 
 ?>
\ No newline at end of file
-- 
GitLab