Passed
Push — dev ( 25004f...be11ce )
by Janko
16:12
created

ColonyChangeable::setMaxStorage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
ccs 0
cts 3
cp 0
crap 2
rs 10
c 1
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\Id;
10
use Doctrine\ORM\Mapping\JoinColumn;
11
use Doctrine\ORM\Mapping\ManyToOne;
12
use Doctrine\ORM\Mapping\OneToOne;
13
use Doctrine\ORM\Mapping\Table;
14
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...
15
16
#[Table(name: 'stu_colony_changeable')]
17
#[Entity]
18
class ColonyChangeable implements ColonyChangeableInterface
19
{
20
    #[Id]
21
    #[OneToOne(targetEntity: 'Colony', inversedBy: 'changeable')]
22
    #[JoinColumn(name: 'colony_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')]
23
    private ColonyInterface $colony;
24
25
    #[Column(type: 'integer', length: 5)]
26
    private int $bev_work = 0;
27
28
    #[Column(type: 'integer', length: 5)]
29
    private int $bev_free = 0;
30
31
    #[Column(type: 'integer', length: 5)]
32
    private int $bev_max = 0;
33
34
    #[Column(type: 'integer', length: 5)]
35
    private int $eps = 0;
36
37
    #[Column(type: 'integer', length: 5)]
38
    private int $max_eps = 0;
39
40
    #[Column(type: 'integer', length: 5)]
41
    private int $max_storage = 0;
42
43
    #[Column(type: 'integer', length: 5)]
44
    private int $populationlimit = 0;
45
46
    #[Column(type: 'boolean')]
47
    private bool $immigrationstate = true;
48
49
    #[Column(type: 'integer', length: 6, nullable: true)]
50
    private ?int $shields = 0;
51
52
    #[Column(type: 'integer', length: 6, nullable: true)]
53
    private ?int $shield_frequency = 0;
54
55
    #[ManyToOne(targetEntity: 'TorpedoType')]
56
    #[JoinColumn(name: 'torpedo_type', referencedColumnName: 'id')]
57
    private ?TorpedoTypeInterface $torpedo = null;
58
59
    #[Override]
60
    public function getColony(): ColonyInterface
61
    {
62
        return $this->colony;
63
    }
64
65 10
    #[Override]
66
    public function getWorkers(): int
67
    {
68 10
        return $this->bev_work;
69
    }
70
71
    #[Override]
72
    public function setWorkers(int $bev_work): ColonyChangeableInterface
73
    {
74
        $this->bev_work = $bev_work;
75
        return $this;
76
    }
77
78 10
    #[Override]
79
    public function getWorkless(): int
80
    {
81 10
        return $this->bev_free;
82
    }
83
84
    #[Override]
85
    public function setWorkless(int $bev_free): ColonyChangeableInterface
86
    {
87
        $this->bev_free = $bev_free;
88
        return $this;
89
    }
90
91 5
    #[Override]
92
    public function getMaxBev(): int
93
    {
94 5
        return $this->bev_max;
95
    }
96
97
    #[Override]
98
    public function setMaxBev(int $bev_max): ColonyChangeableInterface
99
    {
100
        $this->bev_max = $bev_max;
101
        return $this;
102
    }
103
104 11
    #[Override]
105
    public function getEps(): int
106
    {
107 11
        return $this->eps;
108
    }
109
110
    #[Override]
111
    public function setEps(int $eps): ColonyChangeableInterface
112
    {
113
        $this->eps = $eps;
114
        return $this;
115
    }
116
117 9
    #[Override]
118
    public function getMaxEps(): int
119
    {
120 9
        return $this->max_eps;
121
    }
122
123
    #[Override]
124
    public function setMaxEps(int $max_eps): ColonyChangeableInterface
125
    {
126
        $this->max_eps = $max_eps;
127
        return $this;
128
    }
129
130 13
    #[Override]
131
    public function getMaxStorage(): int
132
    {
133 13
        return $this->max_storage;
134
    }
135
136
    #[Override]
137
    public function setMaxStorage(int $max_storage): ColonyChangeableInterface
138
    {
139
        $this->max_storage = $max_storage;
140
        return $this;
141
    }
142
143 6
    #[Override]
144
    public function getPopulationlimit(): int
145
    {
146 6
        return $this->populationlimit;
147
    }
148
149
    #[Override]
150
    public function setPopulationlimit(int $populationlimit): ColonyChangeableInterface
151
    {
152
        $this->populationlimit = $populationlimit;
153
        return $this;
154
    }
155
156 6
    #[Override]
157
    public function getImmigrationstate(): bool
158
    {
159 6
        return $this->immigrationstate;
160
    }
161
162
    #[Override]
163
    public function setImmigrationstate(bool $immigrationstate): ColonyChangeableInterface
164
    {
165
        $this->immigrationstate = $immigrationstate;
166
        return $this;
167
    }
168
169
    #[Override]
170
    public function getShields(): ?int
171
    {
172
        return $this->shields;
173
    }
174
175
    #[Override]
176
    public function setShields(?int $shields): ColonyChangeableInterface
177
    {
178
        $this->shields = $shields;
179
        return $this;
180
    }
181
182
    #[Override]
183
    public function getShieldFrequency(): ?int
184
    {
185
        return $this->shield_frequency;
186
    }
187
188
    #[Override]
189
    public function setShieldFrequency(?int $shieldFrequency): ColonyChangeableInterface
190
    {
191
        $this->shield_frequency = $shieldFrequency;
192
        return $this;
193
    }
194
195
    #[Override]
196
    public function getTorpedo(): ?TorpedoTypeInterface
197
    {
198
        return $this->torpedo;
199
    }
200
201
    #[Override]
202
    public function setTorpedo(?TorpedoTypeInterface $torpedoType): ColonyChangeableInterface
203
    {
204
        $this->torpedo = $torpedoType;
205
        return $this;
206
    }
207
208 10
    #[Override]
209
    public function getPopulation(): int
210
    {
211 10
        return $this->getWorkers() + $this->getWorkless();
212
    }
213
214 4
    #[Override]
215
    public function getFreeHousing(): int
216
    {
217 4
        return $this->getMaxBev() - $this->getPopulation();
218
    }
219
220
    #[Override]
221
    public function lowerEps(int $value): void
222
    {
223
        $this->setEps($this->getEps() - $value);
224
    }
225
226
    #[Override]
227
    public function upperEps(int $value): void
228
    {
229
        $this->setEps($this->getEps() + $value);
230
    }
231
}
232