Skip to content

Commit

Permalink
Merge pull request #98 from silinternational/feature/smarter-listMembers
Browse files Browse the repository at this point in the history
Address a sonar issue
  • Loading branch information
mtompset authored Jun 18, 2024
2 parents fc68715 + d637e64 commit ddb0e5a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions SilMock/Google/Service/Directory/Resource/Members.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ public function listMembers($groupKey, $optParams = [])
$memberCounter = 0;
foreach ($directoryMemberRecords as $memberRecord) {
$memberData = json_decode($memberRecord['data'], true);
if ($memberData['groupKey'] === $groupKey) {
if ($memberCounter >= ($pageToken * $pageSize)) {
if (empty($expectedRoles) || in_array($memberData['member']['role'], $expectedRoles)) {
if (
$memberData['groupKey'] === $groupKey // Matches the expected group
&& $memberCounter >= ($pageToken * $pageSize) // Matches the subsection of all the members
&& (empty($expectedRoles) || in_array($memberData['member']['role'], $expectedRoles)) // Matches role
) {
$memberCounter = $memberCounter + 1;
$this->addToMembers($memberData, $members);
}
}
}
$currentMembers = $members->getMembers();
$currentResultSize = count($currentMembers);
Expand Down

0 comments on commit ddb0e5a

Please sign in to comment.