ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilTestRandomQuestionCollectionSubsetApplication.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
28{
32 protected $applicantId;
33
37 protected $requiredAmount;
38
42 public function getApplicantId(): int
43 {
44 return $this->applicantId;
45 }
46
51 {
52 $this->applicantId = $applicantId;
53 }
54
58 public function getRequiredAmount(): int
59 {
61 }
62
67 {
68 $this->requiredAmount = $requiredAmount;
69 }
70
71 /*
72 * returns the fact if required amount is still positive
73 */
74 public function hasRequiredAmountLeft(): bool
75 {
76 return $this->getRequiredAmount() > 0;
77 }
78
82 public function decrementRequiredAmount()
83 {
84 $this->setRequiredAmount($this->getRequiredAmount() - 1);
85 }
86
90 public function hasQuestion($questionId): bool
91 {
92 return $this->getQuestion($questionId) !== null;
93 }
94
98 public function getQuestion($questionId): ?ilTestRandomQuestionSetQuestion
99 {
100 foreach ($this as $question) {
101 if ($question->getQuestionId() != $questionId) {
102 continue;
103 }
104
105 return $question;
106 }
107
108 return null;
109 }
110}