diff --git a/SilMock/Google/Service/Directory/UsersResource.php b/SilMock/Google/Service/Directory/UsersResource.php index 1eac160..474d65d 100644 --- a/SilMock/Google/Service/Directory/UsersResource.php +++ b/SilMock/Google/Service/Directory/UsersResource.php @@ -356,12 +356,14 @@ public function listUsers($parameters = []) $userEntry = json_decode($userRecord['data'], true); if ($this->doesUserMatch($userEntry, $parameters['query'])) { /** @var \Google_Service_Directory_UserName $newName */ + $nameEntry = $userEntry['name'] ?? null; + $givenName = $nameEntry['givenName'] ?? null; + $familyName = $nameEntry['familyName'] ?? null; + $fullName = $nameEntry['fullName'] ?? trim($givenName . ' ' . $familyName); $newName = new \Google_Service_Directory_UserName([ - 'familyName' => $userEntry['name']['familyName'], - 'fullName' => - $userEntry['name']['fullName'] ?? - $userEntry['name']['givenName'] . ' ' . $userEntry['name']['familyName'], - 'givenName' => $userEntry['name']['givenName'], + 'familyName' => $familyName, + 'fullName' => $fullName, + 'givenName' => $givenName, ]); $userEntry['customerId'] = $userEntry['primaryEmail']; /** @var \Google_Service_Directory_User $newEntry */