Completed
Push — develop ( a9ad07...41d6b2 )
by Verlhac
03:06
created

PlayerChart   A

Complexity

Total Complexity 28

Size/Duplication

Total Lines 359
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 359
rs 10
c 0
b 0
f 0
wmc 28

23 Methods

Rating   Name   Duplication   Size   Complexity  
A setPointChart() 0 4 1
A getDateInvestigation() 0 3 1
A getPointChart() 0 3 1
A setRank() 0 4 1
A getPlatform() 0 3 1
A getIdPlayerChart() 0 3 1
A getStatus() 0 3 1
A setPlatform() 0 4 1
A getDateModif() 0 3 1
A setDateModif() 0 4 1
A setProof() 0 5 1
A getProof() 0 3 1
A getRank() 0 3 1
A setTopScore() 0 4 1
A getChart() 0 3 1
A setStatus() 0 5 1
A setIdPlayerChart() 0 4 1
A setDateInvestigation() 0 4 1
A setChart() 0 5 1
A setNbEqual() 0 4 1
A getNbEqual() 0 3 1
A isTopScore() 0 3 1
B preUpdate() 0 12 6
1
<?php
2
3
namespace VideoGamesRecords\CoreBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use VideoGamesRecords\ProofBundle\Entity\Proof;
0 ignored issues
show
Bug introduced by
The type VideoGamesRecords\ProofBundle\Entity\Proof 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...
7
use Knp\DoctrineBehaviors\Model\Timestampable\Timestampable;
8
9
/**
10
 * PlayerChart
11
 *
12
 * @ORM\Table(name="vgr_player_chart", indexes={@ORM\Index(name="idxIdChart", columns={"idChart"}), @ORM\Index(name="idxIdPlayer", columns={"idPlayer"})})
13
 * @ORM\Entity(repositoryClass="VideoGamesRecords\CoreBundle\Repository\PlayerChartRepository")
14
 * @ORM\HasLifecycleCallbacks()
15
 */
16
class PlayerChart
17
{
18
    use Timestampable;
19
    use \VideoGamesRecords\CoreBundle\Model\Player;
20
21
    /**
22
     * @var integer
23
     *
24
     * @ORM\Column(name="idPlayerChart", type="integer")
25
     * @ORM\Id
26
     * @ORM\GeneratedValue(strategy="IDENTITY")
27
     */
28
    private $idPlayerChart;
29
30
    /**
31
     * @var integer
32
     *
33
     * @ORM\Column(name="rank", type="integer", nullable=true)
34
     */
35
    private $rank;
36
37
    /**
38
     * @var integer
39
     *
40
     * @ORM\Column(name="nbEqual", type="integer", nullable=false)
41
     */
42
    private $nbEqual = 0;
43
44
    /**
45
     * @var integer
46
     *
47
     * @ORM\Column(name="pointChart", type="integer", nullable=false)
48
     */
49
    private $pointChart = 0;
50
51
    /**
52
     * @var boolean
53
     *
54
     * @ORM\Column(name="isTopScore", type="boolean", nullable=false)
55
     */
56
    private $topScore = false;
57
58
    /**
59
     * @var \DateTime
60
     *
61
     * @ORM\Column(name="dateModif", type="datetime", nullable=false)
62
     */
63
    private $dateModif;
64
65
    /**
66
     * @var \DateTime
67
     *
68
     * @ORM\Column(name="dateInvestigation", type="date", nullable=true)
69
     */
70
    private $dateInvestigation;
71
72
    /**
73
     * @var Chart
74
     *
75
     * @ORM\ManyToOne(targetEntity="VideoGamesRecords\CoreBundle\Entity\Chart", inversedBy="playerCharts")
76
     * @ORM\JoinColumns({
77
     *   @ORM\JoinColumn(name="idChart", referencedColumnName="id", nullable=false)
78
     * })
79
     */
80
    private $chart;
81
82
    /**
83
     * @var Proof
84
     *
85
     * @ORM\ManyToOne(targetEntity="VideoGamesRecords\ProofBundle\Entity\Proof")
86
     * @ORM\JoinColumns({
87
     *   @ORM\JoinColumn(name="idProof", referencedColumnName="idProof")
88
     * })
89
     */
90
    private $proof;
91
92
    /**
93
     * @var PlayerChartStatus
94
     *
95
     * @ORM\ManyToOne(targetEntity="VideoGamesRecords\CoreBundle\Entity\PlayerChartStatus")
96
     * @ORM\JoinColumns({
97
     *   @ORM\JoinColumn(name="idStatus", referencedColumnName="idStatus", nullable=false)
98
     * })
99
     */
100
    private $status;
101
102
    /**
103
     * @var Platform
104
     *
105
     * @ORM\ManyToOne(targetEntity="VideoGamesRecords\CoreBundle\Entity\Platform")
106
     * @ORM\JoinColumns({
107
     *   @ORM\JoinColumn(name="idPlatform", referencedColumnName="idPlatform")
108
     * })
109
     */
110
    private $platform;
111
112
    /**
113
     * Set idPlayerChart
114
     *
115
     * @param integer $idPlayerChart
116
     * @return PlayerChart
117
     */
118
    public function setIdPlayerChart($idPlayerChart)
119
    {
120
        $this->idPlayerChart = $idPlayerChart;
121
        return $this;
122
    }
123
124
    /**
125
     * Get idPlayerChart
126
     *
127
     * @return integer
128
     */
129
    public function getIdPlayerChart()
130
    {
131
        return $this->idPlayerChart;
132
    }
133
134
    /**
135
     * Set rank
136
     *
137
     * @param integer $rank
138
     * @return PlayerChart
139
     */
140
    public function setRank($rank)
141
    {
142
        $this->rank = $rank;
143
        return $this;
144
    }
145
146
    /**
147
     * Get rank
148
     *
149
     * @return integer
150
     */
151
    public function getRank()
152
    {
153
        return $this->rank;
154
    }
155
156
    /**
157
     * Set nbEqual
158
     *
159
     * @param integer $nbEqual
160
     * @return PlayerChart
161
     */
162
    public function setNbEqual($nbEqual)
163
    {
164
        $this->nbEqual = $nbEqual;
165
        return $this;
166
    }
167
168
    /**
169
     * Get nbEqual
170
     *
171
     * @return integer
172
     */
173
    public function getNbEqual()
174
    {
175
        return $this->nbEqual;
176
    }
177
178
    /**
179
     * Set pointChart
180
     *
181
     * @param float $pointChart
182
     * @return PlayerChart
183
     */
184
    public function setPointChart($pointChart)
185
    {
186
        $this->pointChart = $pointChart;
187
        return $this;
188
    }
189
190
    /**
191
     * Get pointChart
192
     *
193
     * @return float
194
     */
195
    public function getPointChart()
196
    {
197
        return $this->pointChart;
198
    }
199
200
    /**
201
     * Set topScore
202
     *
203
     * @param bool $topScore
204
     *
205
     * @return PlayerChart
206
     */
207
    public function setTopScore($topScore)
208
    {
209
        $this->topScore = $topScore;
210
        return $this;
211
    }
212
213
    /**
214
     * Get topScore
215
     *
216
     * @return bool
217
     */
218
    public function isTopScore()
219
    {
220
        return $this->topScore;
221
    }
222
223
    /**
224
     * Set dateModif
225
     *
226
     * @param \DateTime $dateModif
227
     * @return PlayerChart
228
     */
229
    public function setDateModif($dateModif)
230
    {
231
        $this->dateModif = $dateModif;
232
        return $this;
233
    }
234
235
    /**
236
     * Get dateModif
237
     *
238
     * @return \DateTime
239
     */
240
    public function getDateModif()
241
    {
242
        return $this->dateModif;
243
    }
244
245
    /**
246
     * Set dateInvestigation
247
     *
248
     * @param \DateTime $dateInvestigation
249
     * @return PlayerChart
250
     */
251
    public function setDateInvestigation($dateInvestigation)
252
    {
253
        $this->dateInvestigation = $dateInvestigation;
254
        return $this;
255
    }
256
257
    /**
258
     * Get dateInvestigation
259
     *
260
     * @return \DateTime
261
     */
262
    public function getDateInvestigation()
263
    {
264
        return $this->dateInvestigation;
265
    }
266
267
    /**
268
     * Set chart
269
     *
270
     * @param Chart $chart
271
     * @return PlayerChart
272
     */
273
    public function setChart(Chart $chart = null)
274
    {
275
        $this->chart = $chart;
276
277
        return $this;
278
    }
279
280
    /**
281
     * Get chart
282
     *
283
     * @return Chart
284
     */
285
    public function getChart()
286
    {
287
        return $this->chart;
288
    }
289
290
    /**
291
     * Set proof
292
     *
293
     * @param Proof $proof
294
     * @return PlayerChart
295
     */
296
    public function setProof(Proof $proof = null)
297
    {
298
        $this->proof = $proof;
299
300
        return $this;
301
    }
302
303
    /**
304
     * Get proof
305
     *
306
     * @return Proof
307
     */
308
    public function getProof()
309
    {
310
        return $this->proof;
311
    }
312
313
314
    /**
315
     * Set platform
316
     *
317
     * @param Platform $platform
318
     * @return PlayerChart
319
     */
320
    public function setPlatform(Platform $platform = null)
321
    {
322
        $this->platform = $platform;
323
        return $this;
324
    }
325
326
    /**
327
     * Get platform
328
     *
329
     * @return Platform
330
     */
331
    public function getPlatform()
332
    {
333
        return $this->platform;
334
    }
335
336
337
    /**
338
     * Set status
339
     *
340
     * @param PlayerChartStatus $status
341
     * @return PlayerChart
342
     */
343
    public function setStatus(PlayerChartStatus $status = null)
344
    {
345
        $this->status = $status;
346
347
        return $this;
348
    }
349
350
    /**
351
     * Get status
352
     *
353
     * @return PlayerChartStatus
354
     */
355
    public function getStatus()
356
    {
357
        return $this->status;
358
    }
359
360
    /**
361
     * @ORM\PreUpdate()
362
     */
363
    public function preUpdate()
364
    {
365
        $this->setTopScore(false);
366
        if ($this->getRank() === 1) {
367
            $this->setTopScore(true);
368
        }
369
370
        if (null === $this->getDateInvestigation() && PlayerChartStatus::ID_STATUS_INVESTIGATION === $this->getStatus()->getIdStatus()) {
371
            $this->setDateInvestigation(new \DateTime());
372
        }
373
        if (null !== $this->getDateInvestigation() && in_array($this->getStatus()->getIdStatus(), [PlayerChartStatus::ID_STATUS_PROOVED, PlayerChartStatus::ID_STATUS_NOT_PROOVED], true)) {
374
            $this->setDateInvestigation(null);
375
        }
376
    }
377
}
378