ILIAS  release_8 Revision v8.24
class.ilObjTestScoreSettings.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 protected int $test_id;
28
29 public function __construct(
30 int $test_id,
35 ) {
36 $this->test_id = $test_id;
37
38 foreach ([
43 ] as $setting) {
44 $this->throwOnDifferentTestId($setting);
45 }
46
49
50 $this->settings_scoring = $settings_scoring;
51 $this->settings_result_summary = $settings_result_summary;
52 $this->settings_result_details = $settings_result_details;
53 $this->settings_gamification = $settings_gamification;
54 }
55
56 protected function throwOnDifferentTestId(TestSettings $setting)
57 {
58 if ($setting->getTestId() !== $this->getTestId()) {
59 throw new \LogicException('TestId mismatch in ' . get_class($setting));
60 }
61 }
62
63 public function getTestId(): int
64 {
65 return $this->test_id;
66 }
67 public function withTestId(int $test_id): self
68 {
69 $clone = clone $this;
70 $clone->test_id = $test_id;
71 $clone->settings_scoring = $clone->settings_scoring->withTestId($test_id);
72 $clone->settings_result_summary = $clone->settings_result_summary->withTestId($test_id);
73 $clone->settings_result_details = $clone->settings_result_details->withTestId($test_id);
74 $clone->settings_gamification = $clone->settings_gamification->withTestId($test_id);
75 return $clone;
76 }
77
78
80 {
82 }
84 {
85 $this->throwOnDifferentTestId($settings);
86 $clone = clone $this;
87 $clone->settings_scoring = $settings;
88 return $clone;
89 }
90
92 {
94 }
96 {
97 $this->throwOnDifferentTestId($settings);
98 $clone = clone $this;
99 $clone->settings_result_summary = $settings;
100 return $clone;
101 }
102
104 {
106 }
108 {
109 $this->throwOnDifferentTestId($settings);
110 $clone = clone $this;
111 $clone->settings_result_details = $settings;
112 return $clone;
113 }
114
116 {
118 }
120 {
121 $this->throwOnDifferentTestId($settings);
122 $clone = clone $this;
123 $clone->settings_gamification = $settings;
124 return $clone;
125 }
126}
ilObjTestSettingsResultDetails $settings_result_details
withScoringSettings(ilObjTestSettingsScoring $settings)
withResultSummarySettings(ilObjTestSettingsResultSummary $settings)
ilObjTestSettingsScoring $settings_scoring
ilObjTestSettingsGamification $settings_gamification
throwOnDifferentTestId(TestSettings $setting)
__construct(int $test_id, ilObjTestSettingsScoring $settings_scoring, ilObjTestSettingsResultSummary $settings_result_summary, ilObjTestSettingsResultDetails $settings_result_details, ilObjTestSettingsGamification $settings_gamification)
withGamificationSettings(ilObjTestSettingsGamification $settings)
withResultDetailsSettings(ilObjTestSettingsResultDetails $settings)
ilObjTestSettingsResultSummary $settings_result_summary
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200