Revision: 1945
Author: olavmrk
Date: Wed Nov 4 05:51:53 2009
Log: SimpleSAML_Configuration: Add getDefaultEndpoint function.
http://code.google.com/p/simplesamlphp/source/detail?r=1945
Modified:
/trunk/lib/SimpleSAML/Configuration.php
=======================================
--- /trunk/lib/SimpleSAML/Configuration.php Wed Nov 4 05:51:34 2009
+++ /trunk/lib/SimpleSAML/Configuration.php Wed Nov 4 05:51:53 2009
@@ -943,6 +943,32 @@
return $eps;
}
+
+
+ /**
+ * Find the default endpoint of the given type.
+ *
+ * @param string $endpointType The endpoint type.
+ * @param array $bindings Array with acceptable bindings. Can be NULL
if
any binding is allowed.
+ * @param mixed $default The default value to return if no matching
endpoint is found. If no default is provided, an exception will be thrown.
+ * @return array|NULL The default endpoint, or NULL if no acceptable
endpoints are used.
+ */
+ public function getDefaultEndpoint($endpointType, array $bindings =
NULL,
$default = self::REQUIRED_OPTION) {
+ assert('is_string($endpointType)');
+
+ $endpoints = $this->getEndpoints($endpointType);
+ $defaultEndpoint =
SimpleSAML_Utilities::getDefaultEndpoint($endpoints,
$bindings);
+ if ($defaultEndpoint !== NULL) {
+ return $defaultEndpoint;
+ }
+
+ if ($default === self::REQUIRED_OPTION) {
+ $loc = $this->location . '[' .
var_export($endpointType, TRUE) . ']:';
+ throw new Exception($loc . 'Could not find a supported
' .
$endpointType . ' endpoint.');
+ }
+
+ return $default;
+ }
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"simpleSAMLphp commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/simplesamlphp-commits?hl=en
-~----------~----~----~----~------~----~------~--~---