Passed
Push — master ( f4068b...77f637 )
by Nico
40:27 queued 14:09
created

ShipTakeover   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 97
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 21
dl 0
loc 97
ccs 0
cts 22
cp 0
rs 10
c 1
b 0
f 0
wmc 9

9 Methods

Rating   Name   Duplication   Size   Complexity  
A setPrestige() 0 4 1
A getId() 0 3 1
A setSourceShip() 0 5 1
A getTargetShip() 0 3 1
A setTargetShip() 0 5 1
A setStartTurn() 0 4 1
A getPrestige() 0 3 1
A getStartTurn() 0 3 1
A getSourceShip() 0 3 1
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
16
/**
17
 * @Entity(repositoryClass="Stu\Orm\Repository\ShipTakeoverRepository")
18
 * @Table(
19
 *     name="stu_ship_takeover",
20
 *     indexes={
21
 *         @Index(name="ship_takeover_source_idx", columns={"source_ship_id"}),
22
 *         @Index(name="ship_takeover_target_idx", columns={"target_ship_id"})
23
 *     }
24
 * )
25
 **/
26
class ShipTakeover implements ShipTakeoverInterface
27
{
28
    /**
29
     * @Id
30
     * @Column(type="integer")
31
     * @GeneratedValue(strategy="IDENTITY")
32
     *
33
     */
34
    private int $id;
35
36
    /**
37
     * @Column(type="integer")
38
     *
39
     */
40
    private int $source_ship_id;
0 ignored issues
show
introduced by
The private property $source_ship_id is not used, and could be removed.
Loading history...
41
42
    /**
43
     * @Column(type="integer")
44
     *
45
     */
46
    private int $target_ship_id;
0 ignored issues
show
introduced by
The private property $target_ship_id is not used, and could be removed.
Loading history...
47
48
    /**
49
     * @Column(type="integer")
50
     *
51
     */
52
    private int $start_turn = 0;
53
54
    /**
55
     * @Column(type="integer")
56
     *
57
     */
58
    private int $prestige = 0;
59
60
    /**
61
     *
62
     * @OneToOne(targetEntity="Ship")
63
     * @JoinColumn(name="source_ship_id", referencedColumnName="id", onDelete="CASCADE")
64
     */
65
    private ShipInterface $source;
66
67
    /**
68
     *
69
     * @OneToOne(targetEntity="Ship")
70
     * @JoinColumn(name="target_ship_id", referencedColumnName="id", onDelete="CASCADE")
71
     */
72
    private ShipInterface $target;
73
74
    public function getId(): int
75
    {
76
        return $this->id;
77
    }
78
79
    public function setSourceShip(ShipInterface $ship): ShipTakeoverInterface
80
    {
81
        $this->source = $ship;
82
83
        return $this;
84
    }
85
86
    public function getSourceShip(): ShipInterface
87
    {
88
        return $this->source;
89
    }
90
91
    public function setTargetShip(ShipInterface $ship): ShipTakeoverInterface
92
    {
93
        $this->target = $ship;
94
95
        return $this;
96
    }
97
98
    public function getTargetShip(): ShipInterface
99
    {
100
        return $this->target;
101
    }
102
103
    public function getStartTurn(): int
104
    {
105
        return $this->start_turn;
106
    }
107
108
    public function setStartTurn(int $turn): ShipTakeoverInterface
109
    {
110
        $this->start_turn = $turn;
111
        return $this;
112
    }
113
114
    public function getPrestige(): int
115
    {
116
        return $this->prestige;
117
    }
118
119
    public function setPrestige(int $prestige): ShipTakeoverInterface
120
    {
121
        $this->prestige = $prestige;
122
        return $this;
123
    }
124
}
125