Passed
Push — dev ( b0a7f5...f0d097 )
by Janko
20:47
created

ReloadMinimalEps::reload()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 6
nc 3
nop 1
dl 0
loc 10
ccs 0
cts 6
cp 0
crap 20
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Stu\Lib\Pirate\Component;
4
5
use Stu\Module\Ship\Lib\FleetWrapperInterface;
6
7
class ReloadMinimalEps implements ReloadMinimalEpsInterface
8
{
9
10
    public function reload(FleetWrapperInterface $fleetWrapper): void
11
    {
12
        foreach ($fleetWrapper->getShipWrappers() as $wrapper) {
13
            $epsSystem = $wrapper->getEpsSystemData();
14
15
            if (
16
                $epsSystem !== null
17
                && $epsSystem->getEpsPercentage() < 20
18
            ) {
19
                $epsSystem->setEps((int)($epsSystem->getMaxEps() * 0.2))->update();
20
            }
21
        }
22
    }
23
}
24