Conditions | 7 |
Paths | 8 |
Total Lines | 26 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 56 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
28 | private function isAllowed(WormholeRestriction $restriction, User|Spacecraft $source): bool |
||
29 | { |
||
30 | $user = $source instanceof User ? $source : $source->getUser(); |
||
31 | $userAlliance = $user->getAlliance(); |
||
32 | |||
33 | $privilegeType = $restriction->getPrivilegeType(); |
||
34 | if ($privilegeType === null) { |
||
35 | return false; |
||
36 | } |
||
37 | |||
38 | $isMatch = match ($privilegeType) { |
||
39 | WormholeEntryTypeEnum::USER => $restriction->getTargetId() === $user->getId(), |
||
40 | WormholeEntryTypeEnum::ALLIANCE => $userAlliance !== null && $restriction->getTargetId() === $userAlliance->getId(), |
||
41 | WormholeEntryTypeEnum::FACTION => $restriction->getTargetId() == $user->getFactionId(), |
||
42 | WormholeEntryTypeEnum::SHIP => $source instanceof Spacecraft && $restriction->getTargetId() == $source->getId(), |
||
43 | }; |
||
44 | |||
45 | if (!$isMatch) { |
||
46 | return false; |
||
47 | } |
||
48 | |||
49 | if ($restriction->getMode() === WormholeEntryModeEnum::DENY->value) { |
||
50 | throw new WormholeEntryUnallowedException(); |
||
51 | } |
||
52 | |||
53 | return true; |
||
54 | } |
||
55 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths