Skip to content

Commit

Permalink
Address a sonar issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mtompset committed Jun 18, 2024
1 parent b2a96e0 commit d637e64
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 d637e64

Please sign in to comment.