ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
MainSettings.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
25
27{
36
37 public function __construct(
38 protected int $test_id,
39 protected int $obj_id,
48 ) {
49 foreach ([
58 ] as $setting) {
59 $this->throwOnDifferentTestId($setting);
60 }
61
62 $this->settings_general = $settings_general;
63 $this->settings_introduction = $settings_introduction;
64 $this->settings_access = $settings_access;
65 $this->settings_test_behaviour = $settings_test_behaviour;
66 $this->settings_question_behaviour = $settings_question_behaviour;
67 $this->settings_participant_functionality = $settings_participant_functionality;
68 $this->settings_finishing = $settings_finishing;
69 $this->settings_additional = $settings_additional;
70 }
71
73 {
74 if ($setting->getTestId() !== $this->getTestId()) {
75 throw new \LogicException('TestId mismatch in ' . get_class($setting));
76 }
77 }
78
79 public function getTestId(): int
80 {
81 return $this->test_id;
82 }
83 public function withTestId(int $test_id): self
84 {
85 $clone = clone $this;
86 $clone->test_id = $test_id;
87 $clone->settings_general = $clone->settings_general->withTestId($test_id);
88 $clone->settings_introduction = $clone->settings_introduction->withTestId($test_id);
89 $clone->settings_access = $clone->settings_access->withTestId($test_id);
90 $clone->settings_test_behaviour = $clone->settings_test_behaviour->withTestId($test_id);
91 $clone->settings_question_behaviour = $clone->settings_question_behaviour->withTestId($test_id);
92 $clone->settings_participant_functionality = $clone->settings_participant_functionality->withTestId($test_id);
93 $clone->settings_finishing = $clone->settings_finishing->withTestId($test_id);
94 $clone->settings_additional = $clone->settings_additional->withTestId($test_id);
95 return $clone;
96 }
97
98 public function getObjId(): int
99 {
100 return $this->obj_id;
101 }
102
103 public function withObjId(int $obj_id): int
104 {
105 $clone = clone $this;
106 $clone->obj_id = $obj_id;
107 return $clone;
108 }
109
111 {
113 }
114 public function withGeneralSettings(SettingsGeneral $settings): self
115 {
116 $this->throwOnDifferentTestId($settings);
117 $clone = clone $this;
118 $clone->settings_general = $settings;
119 return $clone;
120 }
121
123 {
125 }
126 public function withIntroductionSettings(SettingsIntroduction $settings): self
127 {
128 $this->throwOnDifferentTestId($settings);
129 $clone = clone $this;
130 $clone->settings_introduction = $settings;
131 return $clone;
132 }
133
135 {
137 }
138 public function withAccessSettings(SettingsAccess $settings): self
139 {
140 $this->throwOnDifferentTestId($settings);
141 $clone = clone $this;
142 $clone->settings_access = $settings;
143 return $clone;
144 }
145
147 {
149 }
150 public function withTestBehaviourSettings(SettingsTestBehaviour $settings): self
151 {
152 $this->throwOnDifferentTestId($settings);
153 $clone = clone $this;
154 $clone->settings_test_behaviour = $settings;
155 return $clone;
156 }
157
159 {
161 }
163 {
164 $this->throwOnDifferentTestId($settings);
165 $clone = clone $this;
166 $clone->settings_question_behaviour = $settings;
167 return $clone;
168 }
169
171 {
173 }
175 {
176 $this->throwOnDifferentTestId($settings);
177 $clone = clone $this;
178 $clone->settings_participant_functionality = $settings;
179 return $clone;
180 }
181
183 {
185 }
186 public function withFinishingSettings(SettingsFinishing $settings): self
187 {
188 $this->throwOnDifferentTestId($settings);
189 $clone = clone $this;
190 $clone->settings_finishing = $settings;
191 return $clone;
192 }
193
195 {
197 }
198 public function withAdditionalSettings(SettingsAdditional $settings): self
199 {
200 $this->throwOnDifferentTestId($settings);
201 $clone = clone $this;
202 $clone->settings_additional = $settings;
203 return $clone;
204 }
205
206 public function getArrayForLog(
207 AdditionalInformationGenerator $additional_info
208 ): array {
209 return $this->settings_general->toLog($additional_info)
210 + $this->settings_introduction->toLog($additional_info)
211 + $this->settings_access->toLog($additional_info)
212 + $this->settings_test_behaviour->toLog($additional_info)
213 + $this->settings_question_behaviour->toLog($additional_info)
214 + $this->settings_participant_functionality->toLog($additional_info)
215 + $this->settings_finishing->toLog($additional_info)
216 + $this->settings_additional->toLog($additional_info);
217 }
218}
withTestBehaviourSettings(SettingsTestBehaviour $settings)
withGeneralSettings(SettingsGeneral $settings)
getArrayForLog(AdditionalInformationGenerator $additional_info)
__construct(protected int $test_id, protected int $obj_id, SettingsGeneral $settings_general, SettingsIntroduction $settings_introduction, SettingsAccess $settings_access, SettingsTestBehaviour $settings_test_behaviour, SettingsQuestionBehaviour $settings_question_behaviour, SettingsParticipantFunctionality $settings_participant_functionality, SettingsFinishing $settings_finishing, SettingsAdditional $settings_additional)
withQuestionBehaviourSettings(SettingsQuestionBehaviour $settings)
withAccessSettings(SettingsAccess $settings)
withFinishingSettings(SettingsFinishing $settings)
SettingsParticipantFunctionality $settings_participant_functionality
SettingsQuestionBehaviour $settings_question_behaviour
withAdditionalSettings(SettingsAdditional $settings)
withIntroductionSettings(SettingsIntroduction $settings)
withParticipantFunctionalitySettings(SettingsParticipantFunctionality $settings)
ilSetting $setting
Definition: class.ilias.php:68
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...