Passed
Push — master ( f3b60f...e63ea7 )
by Yannick
09:11
created

GradebookEvaluation::setVisible()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/* For licensing terms, see /license.txt */
6
7
namespace Chamilo\CoreBundle\Entity;
8
9
use Chamilo\CoreBundle\Traits\CourseTrait;
10
use DateTime;
11
use Doctrine\ORM\Mapping as ORM;
12
use Gedmo\Mapping\Annotation as Gedmo;
13
use Symfony\Component\Validator\Constraints as Assert;
14
15
#[ORM\Table(name: 'gradebook_evaluation')]
16
#[ORM\Index(name: 'idx_ge_cat', columns: ['category_id'])]
17
#[ORM\Entity]
18
class GradebookEvaluation
19
{
20
    use CourseTrait;
21
22
    #[ORM\Column(name: 'id', type: 'integer')]
23
    #[ORM\Id]
24
    #[ORM\GeneratedValue]
25
    protected ?int $id = null;
26
27
    #[Assert\NotBlank]
28
    #[ORM\Column(name: 'title', type: 'text', nullable: false)]
29
    protected string $title;
30
31
    #[ORM\Column(name: 'description', type: 'text', nullable: true)]
32
    protected ?string $description = null;
33
34
    #[ORM\ManyToOne(targetEntity: Course::class, inversedBy: 'gradebookEvaluations')]
35
    #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
36
    protected Course $course;
37
38
    #[ORM\ManyToOne(targetEntity: GradebookCategory::class, inversedBy: 'evaluations')]
39
    #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
40
    protected GradebookCategory $category;
41
42
    #[Gedmo\Timestampable(on: 'create')]
43
    #[ORM\Column(name: 'created_at', type: 'datetime', nullable: false)]
44
    protected DateTime $createdAt;
45
46
    #[Assert\NotBlank]
47
    #[ORM\Column(name: 'weight', type: 'float', precision: 10, scale: 0, nullable: false)]
48
    protected float $weight;
49
50
    #[Assert\NotBlank]
51
    #[ORM\Column(name: 'max', type: 'float', precision: 10, scale: 0, nullable: false)]
52
    protected float $max;
53
54
    #[Assert\NotBlank]
55
    #[ORM\Column(name: 'visible', type: 'integer', nullable: false)]
56
    protected int $visible;
57
58
    #[Assert\NotBlank]
59
    #[ORM\Column(name: 'type', type: 'string', length: 40, nullable: false)]
60
    protected string $type;
61
62
    #[Assert\NotBlank]
63
    #[ORM\Column(name: 'locked', type: 'integer', nullable: false)]
64
    protected int $locked;
65
66
    #[ORM\Column(name: 'best_score', type: 'float', precision: 6, scale: 2, nullable: true)]
67
    protected ?float $bestScore = null;
68
69
    #[ORM\Column(name: 'average_score', type: 'float', precision: 6, scale: 2, nullable: true)]
70
    protected ?float $averageScore = null;
71
72
    #[ORM\Column(name: 'score_weight', type: 'float', precision: 6, scale: 2, nullable: true)]
73
    protected ?float $scoreWeight = null;
74
75
    #[ORM\Column(name: 'user_score_list', type: 'array', nullable: true)]
76
    protected ?array $userScoreList = null;
77
78
    #[ORM\Column(name: 'min_score', type: 'float', precision: 6, scale: 2, nullable: true)]
79
    protected ?float $minScore = null;
80
81
    public function __construct()
82
    {
83
        $this->locked = 0;
84
        $this->visible = 1;
85
    }
86
87
    public function setTitle(string $title): self
88
    {
89
        $this->title = $title;
90
91
        return $this;
92
    }
93
94
    /**
95
     * Get title.
96
     *
97
     * @return string
98
     */
99
    public function getTitle()
100
    {
101
        return $this->title;
102
    }
103
104
    public function setDescription(?string $description): self
105
    {
106
        $this->description = $description;
107
108
        return $this;
109
    }
110
111
    /**
112
     * Get description.
113
     *
114
     * @return string
115
     */
116
    public function getDescription()
117
    {
118
        return $this->description;
119
    }
120
121
    public function setCreatedAt(DateTime $createdAt): self
122
    {
123
        $this->createdAt = $createdAt;
124
125
        return $this;
126
    }
127
128
    /**
129
     * Get createdAt.
130
     *
131
     * @return DateTime
132
     */
133
    public function getCreatedAt()
134
    {
135
        return $this->createdAt;
136
    }
137
138
    public function setWeight(float $weight): self
139
    {
140
        $this->weight = $weight;
141
142
        return $this;
143
    }
144
145
    /**
146
     * Get weight.
147
     *
148
     * @return float
149
     */
150
    public function getWeight()
151
    {
152
        return $this->weight;
153
    }
154
155
    public function setMax(float $max): self
156
    {
157
        $this->max = $max;
158
159
        return $this;
160
    }
161
162
    /**
163
     * Get max.
164
     *
165
     * @return float
166
     */
167
    public function getMax()
168
    {
169
        return $this->max;
170
    }
171
172
    public function setVisible(int $visible): self
173
    {
174
        $this->visible = $visible;
175
176
        return $this;
177
    }
178
179
    /**
180
     * Get visible.
181
     *
182
     * @return int
183
     */
184
    public function getVisible()
185
    {
186
        return $this->visible;
187
    }
188
189
    public function setType(string $type): self
190
    {
191
        $this->type = $type;
192
193
        return $this;
194
    }
195
196
    /**
197
     * Get type.
198
     *
199
     * @return string
200
     */
201
    public function getType()
202
    {
203
        return $this->type;
204
    }
205
206
    public function setLocked(int $locked): self
207
    {
208
        $this->locked = $locked;
209
210
        return $this;
211
    }
212
213
    /**
214
     * Get locked.
215
     *
216
     * @return int
217
     */
218
    public function getLocked()
219
    {
220
        return $this->locked;
221
    }
222
223
    /**
224
     * Get id.
225
     *
226
     * @return int
227
     */
228
    public function getId()
229
    {
230
        return $this->id;
231
    }
232
233
    /**
234
     * @return float
235
     */
236
    public function getBestScore()
237
    {
238
        return $this->bestScore;
239
    }
240
241
    public function setBestScore(float $bestScore): self
242
    {
243
        $this->bestScore = $bestScore;
244
245
        return $this;
246
    }
247
248
    /**
249
     * @return float
250
     */
251
    public function getAverageScore()
252
    {
253
        return $this->averageScore;
254
    }
255
256
    public function setAverageScore(float $averageScore): self
257
    {
258
        $this->averageScore = $averageScore;
259
260
        return $this;
261
    }
262
263
    /**
264
     * @return array
265
     */
266
    public function getUserScoreList()
267
    {
268
        if (empty($this->userScoreList)) {
269
            return [];
270
        }
271
272
        return $this->userScoreList;
273
    }
274
275
    /**
276
     * @return GradebookEvaluation
277
     */
278
    public function setUserScoreList(array $userScoreList)
279
    {
280
        $this->userScoreList = $userScoreList;
281
282
        return $this;
283
    }
284
285
    /**
286
     * @return float
287
     */
288
    public function getScoreWeight()
289
    {
290
        return $this->scoreWeight;
291
    }
292
293
    /**
294
     * @return GradebookEvaluation
295
     */
296
    public function setScoreWeight(float $scoreWeight)
297
    {
298
        $this->scoreWeight = $scoreWeight;
299
300
        return $this;
301
    }
302
303
    public function getCategory(): GradebookCategory
304
    {
305
        return $this->category;
306
    }
307
308
    public function setCategory(GradebookCategory $category): self
309
    {
310
        $this->category = $category;
311
312
        return $this;
313
    }
314
315
    public function getMinScore(): ?float
316
    {
317
        return $this->minScore;
318
    }
319
320
    public function setMinScore(?float $minScore): self
321
    {
322
        $this->minScore = $minScore;
323
324
        return $this;
325
    }
326
}
327