19 declare(strict_types=1);
    46         $this->questions[] = $question;
    51         $current = 
current($this->questions);
    52         return $current !== 
false ? $current : null;
    55     public function next(): void
    57         next($this->questions);
    60     public function key(): ?string
    62         return (
string) 
key($this->questions);
    67         return key($this->questions) !== null;
    72         reset($this->questions);
    78         return count($this->questions) > $amount;
    83         return count($this->questions) < $amount;
    92         $difference = $requiredAmount - count($this->questions);
    93         $missingCount = $difference < 0 ? 0 : $difference;
   100         shuffle($this->questions);
   105         $this->questions = array_merge($this->questions, $questionCollection->getQuestions());
   110         $uniqueQuestions = array();
   115             if (!isset($uniqueQuestions[$question->getQuestionId()])) {
   116                 $uniqueQuestions[$question->getQuestionId()] = $question;
   120         $uniqueQuestionCollection = 
new self();
   121         $uniqueQuestionCollection->setQuestions($uniqueQuestions);
   123         return $uniqueQuestionCollection;
   140         $questionIds = array_flip($questionCollection->getInvolvedQuestionIds());
   142         $relativeComplementCollection = 
new self();
   145             if (!isset($questionIds[$question->getQuestionId()])) {
   146                 $relativeComplementCollection->
addQuestion($question);
   150         return $relativeComplementCollection;
   155         $questionIds = array_flip($questionCollection->getInvolvedQuestionIds());
   157         $intersectionCollection = 
new self();
   160             if (!isset($questionIds[$question->getQuestionId()])) {
   167         return $intersectionCollection;
   178         $questionIds = array();
   181             $questionIds[] = $question->getQuestionId();
   191         $randomQuestionCollection = 
new self();
   193         foreach ($randomKeys as $randomKey) {
   194             $randomQuestionCollection->addQuestion($this->questions[$randomKey]);
   197         return $randomQuestionCollection;
   207             return array_rand($array, $numKeys);
   210         return array( array_rand($array, $numKeys) );
 getIntersectionCollection(self $questionCollection)
 
mergeQuestionCollection(self $questionCollection)
 
setQuestions(array $questions)
 
getRandomArrayKeys($array, $numKeys)
 
getMissingCount($requiredAmount)
 
getRelativeComplementCollection(self $questionCollection)
 
getRandomQuestionCollection($requiredAmount)
 
addQuestion(ilTestRandomQuestionSetQuestion $question)
 
getUniqueQuestionCollection()