Test Failed
Pull Request — develop (#72)
by
unknown
03:19
created

PlayerChartLib   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 184
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 32
dl 0
loc 184
rs 10
c 0
b 0
f 0
wmc 12

12 Methods

Rating   Name   Duplication   Size   Complexity  
A setParseValue() 0 4 1
A getValue() 0 3 1
A setValue() 0 4 1
A getPlayerChart() 0 3 1
A setParseValueFromValue() 0 7 1
A setId() 0 4 1
A getId() 0 3 1
A setPlayerChart() 0 4 1
A getLibChart() 0 3 1
A setValueFromPaseValue() 0 7 1
A setLibChart() 0 4 1
A getParseValue() 0 4 1
1
<?php
2
3
namespace VideoGamesRecords\CoreBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use VideoGamesRecords\CoreBundle\Tools\Score;
7
8
/**
9
 * PlayerChartLib
10
 *
11
 * @ORM\Table(name="vgr_player_chartlib", indexes={@ORM\Index(name="idxIdLibChart", columns={"idLibChart"}), @ORM\Index(name="idxIdPlayer", columns={"idPlayer"})})
12
 * @ORM\Entity(repositoryClass="VideoGamesRecords\CoreBundle\Repository\PlayerChartLibRepository")
13
 * @ORM\HasLifecycleCallbacks()
14
 */
15
class PlayerChartLib
16
{
17
18
    /**
19
     * @var integer
20
     *
21
     * @ORM\Column(name="id", type="integer")
22
     * @ORM\Id
23
     * @ORM\GeneratedValue(strategy="IDENTITY")
24
     */
25
    private $id;
26
27
28
    /**
29
     * @var integer
30
     *
31
     * @ORM\Column(name="value", type="integer", nullable=false)
32
     */
33
    private $value;
34
35
36
    /**
37
     * @var ChartLib
38
     *
39
     * @ORM\ManyToOne(targetEntity="VideoGamesRecords\CoreBundle\Entity\ChartLib")
40
     * @ORM\JoinColumns({
41
     *   @ORM\JoinColumn(name="idLibChart", referencedColumnName="idLibChart")
42
     * })
43
     */
44
    private $libChart;
45
46
47
    /**
48
     * @var playerChart
49
     *
50
     * @ORM\ManyToOne(targetEntity="VideoGamesRecords\CoreBundle\Entity\PlayerChart")
51
     * @ORM\JoinColumns({
52
     *   @ORM\JoinColumn(name="idPlayerChart", referencedColumnName="idPlayerChart")
53
     * })
54
     */
55
    private $playerChart;
56
57
58
    private $parseValue;
59
60
61
    /**
62
     * Set id
63
     *
64
     * @param integer $id
65
     * @return $this
66
     */
67
    public function setId($id)
68
    {
69
        $this->id = $id;
70
        return $this;
71
    }
72
73
    /**
74
     * Get idP
75
     *
76
     * @return integer
77
     */
78
    public function getId()
79
    {
80
        return $this->id;
81
    }
82
83
    /**
84
     * Get value
85
     *
86
     * @return integer
87
     */
88
    public function getValue()
89
    {
90
        return $this->value;
91
    }
92
93
    /**
94
     * Set value
95
     *
96
     * @param integer $value
97
     * @return $this
98
     */
99
    public function setValue($value)
100
    {
101
        $this->value = $value;
102
        return $this;
103
    }
104
105
    /**
106
     * Set lib
107
     *
108
     * @param ChartLib $libChart
109
     * @return $this
110
     */
111
    public function setLibChart(ChartLib $libChart = null)
112
    {
113
        $this->libChart = $libChart;
114
        return $this;
115
    }
116
117
    /**
118
     * Get lib
119
     *
120
     * @return ChartLib
121
     */
122
    public function getLibChart()
123
    {
124
        return $this->libChart;
125
    }
126
127
128
    /**
129
     * Set player
130
     *
131
     * @param PlayerChart $playerChart
132
     * @return $this
133
     */
134
    public function setPlayerChart(PlayerChart $playerChart = null)
135
    {
136
        $this->playerChart = $playerChart;
137
        return $this;
138
    }
139
140
    /**
141
     * Get playerChart
142
     *
143
     * @return PlayerChart
144
     */
145
    public function getPlayerChart()
146
    {
147
        return $this->playerChart;
148
    }
149
150
151
    /**
152
     * Get parseValue
153
     *
154
     * @return array
155
     */
156
    public function getParseValue()
157
    {
158
        $this->setParseValueFromValue();
159
        return $this->parseValue;
160
    }
161
162
    /**
163
     * Set parseValue
164
     *
165
     * @param $parseValue
166
     * @return $this
167
     */
168
    public function setParseValue($parseValue)
169
    {
170
        $this->parseValue = $parseValue;
171
        return $this;
172
    }
173
174
175
    /**
176
     *
177
     */
178
    public function setParseValueFromValue()
179
    {
180
        $this->parseValue = Score::getValues(
181
            $this->getLibChart()
182
                ->getType()
183
                ->getMask(),
184
            $this->value
185
        );
186
    }
187
188
189
    /**
190
     *
191
     */
192
    public function setValueFromPaseValue()
193
    {
194
        $this->value = Score::formToBdd(
0 ignored issues
show
Documentation Bug introduced by
The property $value was declared of type integer, but VideoGamesRecords\CoreBu...k(), $this->parseValue) is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
195
            $this->getLibChart()
196
                ->getType()
197
                ->getMask(),
198
            $this->parseValue
199
        );
200
    }
201
}
202