From c5b0387bcfef0d3c43789b2e8e36980b92f7107f Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Mon, 16 May 2022 11:33:57 -0400 Subject: [PATCH] Ensure fullName matches first and last names concatenated if missing --- SilMock/Google/Service/Directory/UsersResource.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/SilMock/Google/Service/Directory/UsersResource.php b/SilMock/Google/Service/Directory/UsersResource.php index 98da575..fa2a398 100644 --- a/SilMock/Google/Service/Directory/UsersResource.php +++ b/SilMock/Google/Service/Directory/UsersResource.php @@ -323,11 +323,13 @@ public function listUsers($parameters = []) $userEntry = json_decode($userRecord['data'], true); if ($this->doesUserMatch($userEntry, $parameters['query'])) { /** @var \Google_Service_Directory_UserName $newName */ - $newName = new \Google_Service_Directory_UserName(array( + $newName = new \Google_Service_Directory_UserName([ 'familyName' => $userEntry['name']['familyName'], - 'fullName' => $userEntry['name']['fullName'], + 'fullName' => + $userEntry['name']['fullName'] ?? + $userEntry['name']['givenName'] . ' ' . $userEntry['name']['familyName'], 'givenName' => $userEntry['name']['givenName'], - )); + ]); /** @var \Google_Service_Directory_User $newEntry */ $newEntry = new \Google_Service_Directory_User(array( 'primaryEmail' => $userEntry['primaryEmail'],