Passed
Pull Request — master (#1976)
by Janko
29:19 queued 17:22
created

SpacecraftSystemWrapperFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 9
ccs 3
cts 4
cp 0.75
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 7 2
1
<?php
2
3
namespace Stu\Component\Spacecraft\System;
4
5
use Stu\Orm\Entity\SpacecraftInterface;
6
7
class SpacecraftSystemWrapperFactory implements SpacecraftSystemWrapperFactoryInterface
8
{
9 2
    public function create(SpacecraftInterface $spacecraft, SpacecraftSystemTypeEnum $type): ?SpacecraftSystemWrapper
10
    {
11 2
        if (!$spacecraft->hasShipSystem($type)) {
12 2
            return null;
13
        }
14
15
        return new SpacecraftSystemWrapper($spacecraft, $type);
16
    }
17
}
18