Passed
Push — master ( 1d5530...fba2a1 )
by Nico
56:37 queued 25:57
created

Anomaly::setStarsystemMap()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Orm\Entity;
6
7
use Doctrine\ORM\Mapping\Column;
8
use Doctrine\ORM\Mapping\Entity;
9
use Doctrine\ORM\Mapping\GeneratedValue;
10
use Doctrine\ORM\Mapping\Id;
11
use Doctrine\ORM\Mapping\Index;
12
use Doctrine\ORM\Mapping\JoinColumn;
13
use Doctrine\ORM\Mapping\ManyToOne;
14
use Doctrine\ORM\Mapping\Table;
15
use Override;
0 ignored issues
show
Bug introduced by
The type Override was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use Stu\Orm\Repository\AnomalyRepository;
17
18
#[Table(name: 'stu_anomaly')]
19
#[Index(name: 'anomaly_to_type_idx', columns: ['anomaly_type_id'])]
20
#[Index(name: 'anomaly_remaining_idx', columns: ['remaining_ticks'])]
21
#[Entity(repositoryClass: AnomalyRepository::class)]
22
class Anomaly implements AnomalyInterface
23
{
24
    #[Id]
25
    #[Column(type: 'integer')]
26
    #[GeneratedValue(strategy: 'IDENTITY')]
27
    private int $id;
28
29
    #[Column(type: 'integer')]
30
    private int $remaining_ticks;
31
32
    #[Column(type: 'integer')]
33
    private int $anomaly_type_id;
0 ignored issues
show
introduced by
The private property $anomaly_type_id is not used, and could be removed.
Loading history...
34
35
    #[Column(type: 'integer')]
36
    private int $location_id = 0;
0 ignored issues
show
introduced by
The private property $location_id is not used, and could be removed.
Loading history...
37
38
    #[ManyToOne(targetEntity: 'AnomalyType')]
39
    #[JoinColumn(name: 'anomaly_type_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
40
    private AnomalyTypeInterface $anomalyType;
41
42
    #[ManyToOne(targetEntity: 'Location')]
43
    #[JoinColumn(name: 'location_id', referencedColumnName: 'id')]
44
    private LocationInterface $location;
45
46
    #[Override]
47
    public function getId(): int
48
    {
49
        return $this->id;
50
    }
51
52
    #[Override]
53
    public function getRemainingTicks(): int
54
    {
55
        return $this->remaining_ticks;
56
    }
57
58
    #[Override]
59
    public function setRemainingTicks(int $remainingTicks): AnomalyInterface
60
    {
61
        $this->remaining_ticks = $remainingTicks;
62
63
        return $this;
64
    }
65
66
    #[Override]
67
    public function isActive(): bool
68
    {
69
        return $this->getRemainingTicks() > 0;
70
    }
71
72
    #[Override]
73
    public function getAnomalyType(): AnomalyTypeInterface
74
    {
75
        return $this->anomalyType;
76
    }
77
78
    #[Override]
79
    public function setAnomalyType(AnomalyTypeInterface $anomalyType): AnomalyInterface
80
    {
81
        $this->anomalyType = $anomalyType;
82
83
        return $this;
84
    }
85
86
    #[Override]
87
    public function getLocation(): LocationInterface
88
    {
89
        return $this->location;
90
    }
91
92
    #[Override]
93
    public function setLocation(LocationInterface $location): AnomalyInterface
94
    {
95
        $this->location = $location;
96
97
        return $this;
98
    }
99
}
100