Passed
Push — dev ( 98511f...00baf5 )
by Janko
15:17
created

SpacecraftSystemExistenceTrait::hasPhaser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Stu\Component\Spacecraft\Trait;
4
5
use Stu\Component\Spacecraft\System\SpacecraftSystemTypeEnum;
6
7
trait SpacecraftSystemExistenceTrait
8
{
9
    use SpacecraftTrait;
10
11 38
    public function hasSpacecraftSystem(SpacecraftSystemTypeEnum $type): bool
12
    {
13 38
        return $this->getThis()->getSystems()->containsKey($type->value);
14
    }
15
16 4
    public function hasPhaser(): bool
17
    {
18 4
        return $this->hasSpacecraftSystem(SpacecraftSystemTypeEnum::PHASER);
19
    }
20
21 6
    public function hasTorpedo(): bool
22
    {
23 6
        return $this->hasSpacecraftSystem(SpacecraftSystemTypeEnum::TORPEDO);
24
    }
25
26 4
    public function hasCloak(): bool
27
    {
28 4
        return $this->hasSpacecraftSystem(SpacecraftSystemTypeEnum::CLOAK);
29
    }
30
31 4
    public function hasShuttleRamp(): bool
32
    {
33 4
        return $this->hasSpacecraftSystem(SpacecraftSystemTypeEnum::SHUTTLE_RAMP);
34
    }
35
36 6
    public function hasWarpdrive(): bool
37
    {
38 6
        return $this->hasSpacecraftSystem(SpacecraftSystemTypeEnum::WARPDRIVE);
39
    }
40
41 1
    public function hasReactor(): bool
42
    {
43 1
        return $this->hasSpacecraftSystem(SpacecraftSystemTypeEnum::WARPCORE) ||
44 1
            $this->hasSpacecraftSystem(SpacecraftSystemTypeEnum::FUSION_REACTOR) ||
45 1
            $this->hasSpacecraftSystem(SpacecraftSystemTypeEnum::SINGULARITY_REACTOR);
46
    }
47
48 2
    public function hasNbsLss(): bool
49
    {
50 2
        return $this->hasSpacecraftSystem(SpacecraftSystemTypeEnum::LSS);
51
    }
52
53 7
    public function hasUplink(): bool
54
    {
55 7
        return $this->hasSpacecraftSystem(SpacecraftSystemTypeEnum::UPLINK);
56
    }
57
}
58