Weapon::setVariance()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
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 1
dl 0
loc 5
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\OneToOne;
14
use Doctrine\ORM\Mapping\Table;
15
use Stu\Orm\Repository\WeaponRepository;
16
17
#[Table(name: 'stu_weapons')]
18
#[Index(name: 'weapon_module_idx', columns: ['module_id'])]
19
#[Entity(repositoryClass: WeaponRepository::class)]
20
class Weapon
21
{
22
    #[Id]
23
    #[Column(type: 'integer')]
24
    #[GeneratedValue(strategy: 'IDENTITY')]
25
    private int $id;
26
27
    #[Column(type: 'string')]
28
    private string $name = '';
29
30
    #[Column(type: 'smallint')]
31
    private int $variance = 0;
32
33
    #[Column(type: 'smallint')]
34
    private int $critical_chance = 0;
35
36
    #[Column(type: 'smallint')]
37
    private int $type = 0;
38
39
    #[Column(type: 'smallint')]
40
    private int $firing_mode = 0;
41
42
    #[Column(type: 'integer')]
43
    private int $module_id = 0;
44
45
    #[OneToOne(targetEntity: Module::class, inversedBy: 'weapon')]
46
    #[JoinColumn(name: 'module_id', nullable: false, referencedColumnName: 'id')]
47
    private Module $module;
0 ignored issues
show
introduced by
The private property $module is not used, and could be removed.
Loading history...
48
49
    public function getId(): int
50
    {
51
        return $this->id;
52
    }
53
54
    public function getName(): string
55
    {
56
        return $this->name;
57
    }
58
59
    public function setName(string $name): Weapon
60
    {
61
        $this->name = $name;
62
63
        return $this;
64
    }
65
66
    public function getVariance(): int
67
    {
68
        return $this->variance;
69
    }
70
71
    public function setVariance(int $variance): Weapon
72
    {
73
        $this->variance = $variance;
74
75
        return $this;
76
    }
77
78
    public function getCriticalChance(): int
79
    {
80
        return $this->critical_chance;
81
    }
82
83
    public function setCriticalChance(int $criticalChance): Weapon
84
    {
85
        $this->critical_chance = $criticalChance;
86
87
        return $this;
88
    }
89
90
    public function getType(): int
91
    {
92
        return $this->type;
93
    }
94
95
    public function setType(int $type): Weapon
96
    {
97
        $this->type = $type;
98
99
        return $this;
100
    }
101
102
    public function getFiringMode(): int
103
    {
104
        return $this->firing_mode;
105
    }
106
107
    public function setFiringMode(int $firingMode): Weapon
108
    {
109
        $this->firing_mode = $firingMode;
110
111
        return $this;
112
    }
113
114
    public function getModuleId(): int
115
    {
116
        return $this->module_id;
117
    }
118
119
    public function setModuleId(int $moduleId): Weapon
120
    {
121
        $this->module_id = $moduleId;
122
123
        return $this;
124
    }
125
}
126