We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8e0f7e1 commit 40b69e4Copy full SHA for 40b69e4
src/Civ13/RankTrait.php
@@ -15,8 +15,8 @@ trait RankTrait
15
public function checkRank(?Collection $roles = null, array $allowed_ranks = []): bool
16
{
17
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];
+ $filtered_ranks = array_filter($allowed_ranks, fn($rank) => isset($this->civ13->role_ids[$rank]));
+ $resolved_ranks = array_map(fn($rank) => $this->civ13->role_ids[$rank], $filtered_ranks);
20
foreach ($roles as $role) if (in_array($role->id, $resolved_ranks)) return true;
21
return false;
22
}
0 commit comments