Skip to content

Commit

Permalink
Merge pull request #114 from silinternational/develop
Browse files Browse the repository at this point in the history
Release 2.11.4 -- Handle null user name fields gracefully
  • Loading branch information
mtompset authored Nov 5, 2024
2 parents 9fc35a9 + ac79b62 commit a28819c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions SilMock/Google/Service/Directory/UsersResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit a28819c

Please sign in to comment.