Skip to content

Commit

Permalink
pkp#9253 Use shorter syntax to filter array
Browse files Browse the repository at this point in the history
  • Loading branch information
NateWr committed Aug 25, 2023
1 parent 54f28ae commit 9e7a6cc
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions api/v1/announcements/PKPAnnouncementHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,7 @@ protected function getContextId(): int
*/
protected function getSiteRoleAssignments(array $roleAssignments): array
{
$roleIds = array_keys($roleAssignments);
foreach ($roleIds as $roleId) {
if ($roleId !== Role::ROLE_ID_SITE_ADMIN) {
unset($roleAssignments[$roleId]);
}
}
return $roleAssignments;
return array_filter($roleAssignments, fn($key) => $key == Role::ROLE_ID_SITE_ADMIN, ARRAY_FILTER_USE_KEY);
}

/**
Expand Down

0 comments on commit 9e7a6cc

Please sign in to comment.