Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 14 |
|
0.00% |
0 / 8 |
CRAP | |
0.00% |
0 / 1 |
Participant | |
0.00% |
0 / 14 |
|
0.00% |
0 / 8 |
72 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
getUser | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getRegisteredAt | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getParticipantID | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
isPrivateRegistration | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getAnswers | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getFirstAnswerTimestamp | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getAggregationTimestamp | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | declare( strict_types=1 ); |
4 | |
5 | namespace MediaWiki\Extension\CampaignEvents\Participants; |
6 | |
7 | use MediaWiki\Extension\CampaignEvents\MWEntity\CentralUser; |
8 | use MediaWiki\Extension\CampaignEvents\Questions\Answer; |
9 | |
10 | class Participant { |
11 | private CentralUser $user; |
12 | private string $registeredAt; |
13 | private int $participantID; |
14 | private bool $privateRegistration; |
15 | /** @var Answer[] */ |
16 | private array $answers; |
17 | private ?string $firstAnswerTimestamp; |
18 | private ?string $aggregationTimestamp; |
19 | |
20 | /** |
21 | * @param CentralUser $user |
22 | * @param string $registeredAt Timestamp in the TS_UNIX format |
23 | * @param int $participantID participant_id, ID generated when a participant register for an event |
24 | * @param bool $privateRegistration |
25 | * @param Answer[] $answers |
26 | * @param string|null $firstAnswerTimestamp Timestamp in the TS_UNIX format |
27 | * @param string|null $aggregationTimestamp Timestamp in the TS_UNIX format |
28 | */ |
29 | public function __construct( |
30 | CentralUser $user, |
31 | string $registeredAt, |
32 | int $participantID, |
33 | bool $privateRegistration, |
34 | array $answers, |
35 | ?string $firstAnswerTimestamp, |
36 | ?string $aggregationTimestamp |
37 | ) { |
38 | $this->user = $user; |
39 | $this->registeredAt = $registeredAt; |
40 | $this->participantID = $participantID; |
41 | $this->privateRegistration = $privateRegistration; |
42 | $this->answers = $answers; |
43 | $this->firstAnswerTimestamp = $firstAnswerTimestamp; |
44 | $this->aggregationTimestamp = $aggregationTimestamp; |
45 | } |
46 | |
47 | /** |
48 | * @return CentralUser |
49 | */ |
50 | public function getUser(): CentralUser { |
51 | return $this->user; |
52 | } |
53 | |
54 | /** |
55 | * @return string Timestamp in the TS_UNIX format |
56 | */ |
57 | public function getRegisteredAt(): string { |
58 | return $this->registeredAt; |
59 | } |
60 | |
61 | /** |
62 | * @return int participant_id, ID generated when a participant register for an event |
63 | */ |
64 | public function getParticipantID(): int { |
65 | return $this->participantID; |
66 | } |
67 | |
68 | /** |
69 | * @return bool privateRegistration, true if registration is private. |
70 | */ |
71 | public function isPrivateRegistration(): bool { |
72 | return $this->privateRegistration; |
73 | } |
74 | |
75 | /** |
76 | * @return Answer[] |
77 | */ |
78 | public function getAnswers(): array { |
79 | return $this->answers; |
80 | } |
81 | |
82 | /** |
83 | * @return string|null Timestamp in the TS_UNIX format, or null |
84 | */ |
85 | public function getFirstAnswerTimestamp(): ?string { |
86 | return $this->firstAnswerTimestamp; |
87 | } |
88 | |
89 | /** |
90 | * @return string|null Timestamp in the TS_UNIX format, or null |
91 | */ |
92 | public function getAggregationTimestamp(): ?string { |
93 | return $this->aggregationTimestamp; |
94 | } |
95 | } |