Skip to content

Commit 40b69e4

Browse files
committed
Update RankTrait.php
1 parent 8e0f7e1 commit 40b69e4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Civ13/RankTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ trait RankTrait
1515
public function checkRank(?Collection $roles = null, array $allowed_ranks = []): bool
1616
{
1717
if (empty($allowed_ranks)) return true;
18-
$resolved_ranks = [];
19-
foreach ($allowed_ranks as $rank) if (isset($this->civ13->role_ids[$rank])) $resolved_ranks[] = $this->civ13->role_ids[$rank];
18+
$filtered_ranks = array_filter($allowed_ranks, fn($rank) => isset($this->civ13->role_ids[$rank]));
19+
$resolved_ranks = array_map(fn($rank) => $this->civ13->role_ids[$rank], $filtered_ranks);
2020
foreach ($roles as $role) if (in_array($role->id, $resolved_ranks)) return true;
2121
return false;
2222
}

0 commit comments

Comments
 (0)