+ /**
+ * Get a property from an LDAP user response fetch.
+ * Handles properties potentially being part of an array.
+ * @param array $userDetails
+ * @param string $propertyKey
+ * @param $defaultValue
+ * @return mixed
+ */
+ protected function getUserResponseProperty(array $userDetails, string $propertyKey, $defaultValue)
+ {
+ if (isset($userDetails[$propertyKey])) {
+ return (is_array($userDetails[$propertyKey]) ? $userDetails[$propertyKey][0] : $userDetails[$propertyKey]);
+ }
+
+ return $defaultValue;
+ }
+