Passed
Push — dev ( 243230...a6e38c )
by Nico
12:30
created

BuildplanHangar::getBuildplan()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 2
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\JoinColumn;
12
use Doctrine\ORM\Mapping\ManyToOne;
13
use Doctrine\ORM\Mapping\Table;
14
use Doctrine\ORM\Mapping\UniqueConstraint;
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\BuildplanHangarRepository;
17
18
#[Table(name: 'stu_buildplans_hangar')]
19
#[UniqueConstraint(name: 'rump_idx', columns: ['rump_id'])]
20
#[Entity(repositoryClass: BuildplanHangarRepository::class)]
21
class BuildplanHangar implements BuildplanHangarInterface
22
{
23
    #[Id]
24
    #[Column(type: 'integer')]
25
    #[GeneratedValue(strategy: 'IDENTITY')]
26
    private int $id;
27
28
    #[Column(type: 'integer')]
29
    private int $rump_id = 0;
30
31
    #[Column(type: 'integer')]
32
    private int $buildplan_id = 0;
33
34
    #[Column(type: 'integer', nullable: true)]
35
    private ?int $default_torpedo_type_id = null;
36
37
    #[Column(type: 'integer')]
38
    private int $start_energy_costs;
39
40
    #[ManyToOne(targetEntity: 'TorpedoType')]
41
    #[JoinColumn(name: 'default_torpedo_type_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
42
    private ?TorpedoTypeInterface $defaultTorpedoType = null;
43
44
    #[ManyToOne(targetEntity: 'SpacecraftBuildplan')]
45
    #[JoinColumn(name: 'buildplan_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
46
    private SpacecraftBuildplanInterface $buildplan;
47
48
    #[ManyToOne(targetEntity: 'SpacecraftRump', inversedBy: 'startHangar')]
49
    #[JoinColumn(name: 'rump_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
50
    private SpacecraftRumpInterface $spacecraftRump;
0 ignored issues
show
introduced by
The private property $spacecraftRump is not used, and could be removed.
Loading history...
51
52
    #[Override]
53
    public function getId(): int
54
    {
55
        return $this->id;
56
    }
57
58
    #[Override]
59
    public function getBuildplanId(): int
60
    {
61
        return $this->buildplan_id;
62
    }
63
64
    #[Override]
65
    public function setBuildplanId(int $buildplanId): BuildplanHangarInterface
66
    {
67
        $this->buildplan_id = $buildplanId;
68
69
        return $this;
70
    }
71
72
    #[Override]
73
    public function getDefaultTorpedoTypeId(): int
74
    {
75
        return $this->default_torpedo_type_id;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->default_torpedo_type_id could return the type null which is incompatible with the type-hinted return integer. Consider adding an additional type-check to rule them out.
Loading history...
76
    }
77
78
    #[Override]
79
    public function setDefaultTorpedoTypeId(int $defaultTorpedoTypeId): BuildplanHangarInterface
80
    {
81
        $this->default_torpedo_type_id = $defaultTorpedoTypeId;
82
83
        return $this;
84
    }
85
86
    #[Override]
87
    public function getDefaultTorpedoType(): ?TorpedoTypeInterface
88
    {
89
        return $this->defaultTorpedoType;
90
    }
91
92
    #[Override]
93
    public function getBuildplan(): SpacecraftBuildplanInterface
94
    {
95
        return $this->buildplan;
96
    }
97
98
    #[Override]
99
    public function setStartEnergyCosts(int $startEnergyCosts): BuildplanHangarInterface
100
    {
101
        $this->start_energy_costs = $startEnergyCosts;
102
        return $this;
103
    }
104
105
    #[Override]
106
    public function getStartEnergyCosts(): int
107
    {
108
        return $this->start_energy_costs;
109
    }
110
111
    #[Override]
112
    public function getRumpId(): int
113
    {
114
        return $this->rump_id;
115
    }
116
}
117