Passed
Push — dev ( 2eb11f...3c2dab )
by Janko
09:11
created

SpacecraftSystemWrapperFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 9
ccs 4
cts 4
cp 1
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->hasSpacecraftSystem($type)) {
12 2
            return null;
13
        }
14
15 1
        return new SpacecraftSystemWrapper($spacecraft, $type);
16
    }
17
}
18