ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilTestSequenceFactory.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
27 {
29  private array $test_sequences = [];
30 
31  public function __construct(
32  private ilObjTest $test_obj,
33  private ilDBInterface $db,
34  private \ILIAS\TestQuestionPool\QuestionInfoService $questioninfo
35  ) {
36  }
37 
45  public function getSequenceByTestSession($testSession)
46  {
47  return $this->getSequenceByActiveIdAndPass($testSession->getActiveId(), $testSession->getPass());
48  }
49 
58  public function getSequenceByActiveIdAndPass($activeId, $pass)
59  {
60  if (!isset($this->test_sequences[$activeId][$pass])) {
61  if ($this->test_obj->isFixedTest()) {
62  $this->test_sequences[$activeId][$pass] = new ilTestSequenceFixedQuestionSet(
63  $this->db,
64  $activeId,
65  $pass,
66  $this->questioninfo
67  );
68  }
69 
70  if ($this->test_obj->isRandomTest()) {
71  $this->test_sequences[$activeId][$pass] = new ilTestSequenceRandomQuestionSet(
72  $this->db,
73  $activeId,
74  $pass,
75  $this->questioninfo
76  );
77  }
78  }
79 
80  return $this->test_sequences[$activeId][$pass];
81  }
82 }
Class ChatMainBarProvider .
getSequenceByTestSession($testSession)
creates and returns an instance of a test sequence that corresponds to the current test mode and the ...
__construct(private ilObjTest $test_obj, private ilDBInterface $db, private \ILIAS\TestQuestionPool\QuestionInfoService $questioninfo)
getSequenceByActiveIdAndPass($activeId, $pass)
creates and returns an instance of a test sequence that corresponds to the current test mode and give...