Passed
Push — dev ( 6710c5...e67022 )
by Janko
21:17
created

ReloadMinimalEps   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 13
ccs 0
cts 6
cp 0
rs 10
c 1
b 0
f 0
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A reload() 0 10 4
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