ILIAS  release_8 Revision v8.24
class.ilTestRandomQuestionCollectionSubsetApplication.php
Go to the documentation of this file.
1<?php
2
26{
30 protected $applicantId;
31
35 protected $requiredAmount;
36
40 public function getApplicantId(): int
41 {
42 return $this->applicantId;
43 }
44
49 {
50 $this->applicantId = $applicantId;
51 }
52
56 public function getRequiredAmount(): int
57 {
59 }
60
65 {
66 $this->requiredAmount = $requiredAmount;
67 }
68
69 /*
70 * returns the fact if required amount is still positive
71 */
72 public function hasRequiredAmountLeft(): bool
73 {
74 return $this->getRequiredAmount() > 0;
75 }
76
80 public function decrementRequiredAmount()
81 {
82 $this->setRequiredAmount($this->getRequiredAmount() - 1);
83 }
84
88 public function hasQuestion($questionId): bool
89 {
90 return $this->getQuestion($questionId) !== null;
91 }
92
96 public function getQuestion($questionId): ?ilTestRandomQuestionSetQuestion
97 {
98 foreach ($this as $question) {
99 if ($question->getQuestionId() != $questionId) {
100 continue;
101 }
102
103 return $question;
104 }
105
106 return null;
107 }
108}