ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
class.ilTestRandomQuestionCollectionSubsetApplication.php
Go to the documentation of this file.
1 <?php
2 
19 declare(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 
50  public function setApplicantId($applicantId)
51  {
52  $this->applicantId = $applicantId;
53  }
54 
58  public function getRequiredAmount(): int
59  {
60  return $this->requiredAmount;
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 }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null