Passed
Pull Request — master (#6127)
by Angel Fernando Quiroz
07:52
created

ExerciseQuestionAnsweredEvent   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 9

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getTrackingExeId() 0 3 1
A getExerciseTitle() 0 7 2
A getQuestionId() 0 7 2
A getExerciseId() 0 7 2
A getQuestionWeigth() 0 7 2
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
declare(strict_types=1);
6
7
namespace Chamilo\CoreBundle\Event;
8
9
class ExerciseQuestionAnsweredEvent extends AbstractEvent
10
{
11
    public function getTrackingExeId(): ?int
12
    {
13
        return $this->data['exe_id'] ?? null;
14
    }
15
16
    public function getExerciseId(): ?int
17
    {
18
        if (!empty($this->data['exercise']['id'])) {
19
            return $this->data['exercise']['id'];
20
        }
21
22
        return null;
23
    }
24
25
    public function getExerciseTitle(): ?string
26
    {
27
        if (!empty($this->data['exercise']['title'])) {
28
            return $this->data['exercise']['title'];
29
        }
30
31
        return null;
32
    }
33
34
    public function getQuestionId(): ?int
35
    {
36
        if (!empty($this->data['question']['id'])) {
37
            return $this->data['question']['id'];
38
        }
39
40
        return null;
41
    }
42
43
    public function getQuestionWeigth(): ?float
44
    {
45
        if (!empty($this->data['question']['weight'])) {
46
            return $this->data['question']['weight'];
47
        }
48
49
        return null;
50
    }
51
}
52