+ /**
+ * Build the user display name from the (potentially multiple) attributes defined by the configuration.
+ */
+ protected function getUserDisplayName(array $userDetails, array $displayNameAttrs, string $defaultValue): string
+ {
+ $displayNameParts = [];
+ foreach ($displayNameAttrs as $dnAttr) {
+ $dnComponent = $this->getUserResponseProperty($userDetails, $dnAttr, null);
+ if ($dnComponent) {
+ $displayNameParts[] = $dnComponent;
+ }
+ }
+
+ if (empty($displayNameParts)) {
+ return $defaultValue;
+ }
+
+ return implode(' ', $displayNameParts);
+ }
+