Passed
Push — dev ( c12b3a...6ad196 )
by Janko
24:31 queued 10:07
created

isMatrixScannerHealthy()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
namespace Stu\Component\Spacecraft\Trait;
4
5
use Stu\Component\Spacecraft\System\SpacecraftSystemTypeEnum;
6
7
trait SpacecraftSystemHealthTrait
8
{
9
    use SpacecraftTrait;
10
    use HasSpacecraftSystemTrait;
11
12 17
    public function isSystemHealthy(SpacecraftSystemTypeEnum $type): bool
13
    {
14 17
        if (!$this->hasSpacecraftSystem($type)) {
15 14
            return false;
16
        }
17
18 5
        return $this->getSpacecraftSystem($type)->isHealthy();
19
    }
20
21
    public function isDeflectorHealthy(): bool
22
    {
23
        return $this->isSystemHealthy(SpacecraftSystemTypeEnum::DEFLECTOR);
24
    }
25
26
    public function isMatrixScannerHealthy(): bool
27
    {
28
        return $this->isSystemHealthy(SpacecraftSystemTypeEnum::MATRIX_SCANNER);
29
    }
30
31 10
    public function isTorpedoStorageHealthy(): bool
32
    {
33 10
        return $this->isSystemHealthy(SpacecraftSystemTypeEnum::TORPEDO_STORAGE);
34
    }
35
36 1
    public function isShuttleRampHealthy(): bool
37
    {
38 1
        return $this->isSystemHealthy(SpacecraftSystemTypeEnum::SHUTTLE_RAMP);
39
    }
40
41 1
    public function isWebEmitterHealthy(): bool
42
    {
43 1
        return $this->isSystemHealthy(SpacecraftSystemTypeEnum::THOLIAN_WEB);
44
    }
45
}
46