Passed
Push — develop ( ee6f8b...860277 )
by BENARD
04:16
created

Proof::getStatusChoices()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 7
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace VideoGamesRecords\CoreBundle\Entity;
4
5
use DateTime;
6
use Doctrine\ORM\Mapping as ORM;
7
use Gedmo\Timestampable\Traits\TimestampableEntity;
8
use VideoGamesRecords\CoreBundle\ValueObject\ProofStatus;
9
10
/**
11
 * Proof
12
 * @ORM\Table(name="vgr_proof")
13
 * @ORM\Entity(repositoryClass="VideoGamesRecords\CoreBundle\Repository\ProofRepository")
14
 * @ORM\EntityListeners({"VideoGamesRecords\CoreBundle\EventListener\Entity\ProofListener"})
15
 */
16
class Proof
17
{
18
    use TimestampableEntity;
19
20
    /**
21
     * @ORM\Column(name="id", type="integer")
22
     * @ORM\Id
23
     * @ORM\GeneratedValue(strategy="IDENTITY")
24
     */
25
    private ?int $id = null;
26
27
    /**
28
     * @ORM\ManyToOne(targetEntity="VideoGamesRecords\CoreBundle\Entity\Picture")
29
     * @ORM\JoinColumns({
30
     *   @ORM\JoinColumn(name="idPicture", referencedColumnName="id", nullable=true)
31
     * })
32
     */
33
    private ?Picture $picture = null;
34
35
    /**
36
     * @ORM\ManyToOne(targetEntity="VideoGamesRecords\CoreBundle\Entity\Video")
37
     * @ORM\JoinColumns({
38
     *   @ORM\JoinColumn(name="idVideo", referencedColumnName="id", nullable=true)
39
     * })
40
     */
41
    private ?Video $video = null;
42
43
    /**
44
     * @ORM\Column(name="status", type="string", length=30, nullable=false)
45
     */
46
    private string $status = ProofStatus::STATUS_IN_PROGRESS;
47
48
    /**
49
     * @ORM\Column(name="response", type="text", nullable=true)
50
     */
51
    private ?string $response = null;
52
53
    /**
54
     * @ORM\ManyToOne(targetEntity="VideoGamesRecords\CoreBundle\Entity\Player")
55
     * @ORM\JoinColumns({
56
     *   @ORM\JoinColumn(name="idPlayerResponding", referencedColumnName="id", nullable=true)
57
     * })
58
     */
59
    private ?Player $playerResponding = null;
60
61
    /**
62
     * @ORM\ManyToOne(targetEntity="VideoGamesRecords\CoreBundle\Entity\Player")
63
     * @ORM\JoinColumns({
64
     *   @ORM\JoinColumn(name="idPlayer", referencedColumnName="id", nullable=false)
65
     * })
66
     */
67
    private Player $player;
68
69
    /**
70
     * @ORM\ManyToOne(targetEntity="VideoGamesRecords\CoreBundle\Entity\Chart", inversedBy="proofs")
71
     * @ORM\JoinColumns({
72
     *   @ORM\JoinColumn(name="idChart", referencedColumnName="id", nullable=false)
73
     * })
74
     */
75
    private Chart $chart;
76
77
    /**
78
     * @ORM\Column(name="checked_at", type="datetime", nullable=true)
79
     */
80
    private ?DateTime $checkedAt;
81
82
    /**
83
     * @ORM\OneToOne(targetEntity="\VideoGamesRecords\CoreBundle\Entity\PlayerChart", mappedBy="proof")
84
     */
85
    private ?PlayerChart $playerChart;
86
87
    public function __construct()
88
    {
89
    }
90
91
    /**
92
     * @return string
93
     */
94
    public function __toString()
95
    {
96
        return sprintf('Proof [%s]', $this->id);
97
    }
98
99
100
    /**
101
     * Set id
102
     * @param integer $id
103
     * @return Proof
104
     */
105
    public function setId(int $id): Proof
106
    {
107
        $this->id = $id;
108
        return $this;
109
    }
110
111
    /**
112
     * Get id
113
     * @return integer
114
     */
115
    public function getId(): ?int
116
    {
117
        return $this->id;
118
    }
119
120
    /**
121
     * Set picture
122
     * @param Picture $picture
123
     * @return Proof
124
     */
125
    public function setPicture(Picture $picture): Proof
126
    {
127
        $this->picture = $picture;
128
        return $this;
129
    }
130
131
    /**
132
     * Get picture
133
     * @return Picture
134
     */
135
    public function getPicture(): ?Picture
136
    {
137
        return $this->picture;
138
    }
139
140
    /**
141
     * Set video
142
     * @param Video $video
143
     * @return Proof
144
     */
145
    public function setVideo(Video $video): Proof
146
    {
147
        $this->video = $video;
148
        return $this;
149
    }
150
151
    /**
152
     * Get video
153
     * @return Video
154
     */
155
    public function getVideo(): ?Video
156
    {
157
        return $this->video;
158
    }
159
160
161
    /**
162
     * Set status
163
     * @param string $status
164
     * @return Proof
165
     */
166
    public function setStatus(string $status): Proof
167
    {
168
        $this->status = $status;
169
        return $this;
170
    }
171
172
    /**
173
     * Get status
174
     * @return ProofStatus
175
     */
176
    public function getStatus(): ProofStatus
177
    {
178
        return new ProofStatus($this->status);
179
    }
180
181
    /**
182
     * Set response
183
     * @param string $response
184
     * @return Proof
185
     */
186
    public function setResponse(string $response): Proof
187
    {
188
        $this->response = $response;
189
        return $this;
190
    }
191
192
    /**
193
     * Get response
194
     * @return string
195
     */
196
    public function getResponse(): ?string
197
    {
198
        return $this->response;
199
    }
200
201
    /**
202
     * Set playerResponding
203
     * @param Player|null $playerResponding
204
     * @return Proof
205
     */
206
    public function setPlayerResponding(Player $playerResponding = null): Proof
207
    {
208
        $this->playerResponding = $playerResponding;
209
210
        return $this;
211
    }
212
213
    /**
214
     * Get playerResponding
215
     * @return Player|null
216
     */
217
    public function getPlayerResponding(): ?Player
218
    {
219
        return $this->playerResponding;
220
    }
221
222
223
    /**
224
     * Set player
225
     * @param Player $player
226
     * @return Proof
227
     */
228
    public function setPlayer(Player $player): Proof
229
    {
230
        $this->player = $player;
231
232
        return $this;
233
    }
234
235
    /**
236
     * Get player
237
     * @return Player
238
     */
239
    public function getPlayer(): Player
240
    {
241
        return $this->player;
242
    }
243
244
    /**
245
     * Set chart
246
     * @param Chart $chart
247
     * @return Proof
248
     */
249
    public function setChart(Chart $chart): Proof
250
    {
251
        $this->chart = $chart;
252
253
        return $this;
254
    }
255
256
    /**
257
     * Get chart
258
     * @return Chart
259
     */
260
    public function getChart(): Chart
261
    {
262
        return $this->chart;
263
    }
264
265
    /**
266
     * Set checkedAt
267
     * @param DateTime $checkedAt
268
     * @return Proof
269
     */
270
    public function setCheckedAt(DateTime $checkedAt): Proof
271
    {
272
        $this->checkedAt = $checkedAt;
273
274
        return $this;
275
    }
276
277
    /**
278
     * Get checkedAt
279
     * @return DateTime
280
     */
281
    public function getCheckedAt(): ?DateTime
282
    {
283
        return $this->checkedAt;
284
    }
285
286
287
    /**
288
     * Get playerChart
289
     * @return PlayerChart
290
     */
291
    public function getPlayerChart(): ?PlayerChart
292
    {
293
        return $this->playerChart;
294
    }
295
296
    /**
297
     * @return string
298
     */
299
    public function getType(): string
300
    {
301
        return ($this->getPicture() != null) ? 'Picture' : 'Video';
302
    }
303
}
304