Conditions | 3 |
Paths | 4 |
Total Lines | 14 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | 3 | public function getPrestigeOfSpacecraftOrFleet(ShipWrapperInterface|ShipInterface $spacecraft): int |
|
13 | { |
||
14 | 3 | $target = $spacecraft instanceof ShipInterface ? $spacecraft : $spacecraft->get(); |
|
15 | |||
16 | 3 | $fleet = $target->getFleet(); |
|
17 | 3 | if ($fleet !== null) { |
|
18 | 1 | return array_reduce( |
|
19 | 1 | $fleet->getShips()->toArray(), |
|
20 | 1 | fn(int $value, ShipInterface $fleetShip): int => $value + $fleetShip->getRump()->getPrestige(), |
|
21 | 1 | 0 |
|
22 | 1 | ); |
|
23 | } |
||
24 | |||
25 | 2 | return $target->getRump()->getPrestige(); |
|
26 | } |
||
52 |