summaryrefslogtreecommitdiffstats
path: root/lib/SAML2/Utils.php
diff options
context:
space:
mode:
authorOlav Morken <olav.morken@uninett.no>2010-03-05 15:12:00 +0000
committerOlav Morken <olav.morken@uninett.no>2010-03-05 15:12:00 +0000
commit9df140ba6ed4d485d9760bc9d584a356dbaed9dd (patch)
treeb735228ae33bdd52f3271d3c33284397ef6eb844 /lib/SAML2/Utils.php
parent3f0b242e3232560a46d1c6af34067cf20c3246eb (diff)
downloadsimplesamlphp-9df140ba6ed4d485d9760bc9d584a356dbaed9dd.zip
simplesamlphp-9df140ba6ed4d485d9760bc9d584a356dbaed9dd.tar.gz
simplesamlphp-9df140ba6ed4d485d9760bc9d584a356dbaed9dd.tar.bz2
SAML2_Utils: Add the new extractStrings()-function.
git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2199 44740490-163a-0410-bde0-09ae8108e29a
Diffstat (limited to 'lib/SAML2/Utils.php')
-rw-r--r--lib/SAML2/Utils.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/SAML2/Utils.php b/lib/SAML2/Utils.php
index 45bd0bb..8cf8442 100644
--- a/lib/SAML2/Utils.php
+++ b/lib/SAML2/Utils.php
@@ -348,4 +348,23 @@ class SAML2_Utils {
return $ret;
}
+
+ /**
+ * Extract strings from a set of nodes.
+ *
+ * @param DOMElement $parent The element we should rund the XPath query on.
+ * @param string $query The XPath query we should use to retrieve the nodes.
+ * @return array The string values of the various nodes.
+ */
+ public static function extractStrings(DOMElement $parent, $query) {
+ assert('is_string($query)');
+
+ $ret = array();
+ foreach (self::xpQuery($parent, $query) as $node) {
+ $ret[] = trim($node->textContent);
+ }
+
+ return $ret;
+ }
+
}