From d637e6468137ea952b2188d4388bb93dd1d956c2 Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Tue, 18 Jun 2024 19:21:51 -0400 Subject: [PATCH] Address a sonar issue --- SilMock/Google/Service/Directory/Resource/Members.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SilMock/Google/Service/Directory/Resource/Members.php b/SilMock/Google/Service/Directory/Resource/Members.php index 577e374..f0b8ddb 100644 --- a/SilMock/Google/Service/Directory/Resource/Members.php +++ b/SilMock/Google/Service/Directory/Resource/Members.php @@ -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);