ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
class.ilAssQuestionProcessLockerFactory.php
Go to the documentation of this file.
1<?php
2
20
28{
29 protected ?int $question_id = null;
30 protected ?int $user_id = null;
31
32 public function __construct(
33 private readonly ilSetting $settings,
34 private readonly ilDBInterface $db,
35 private readonly ilLogger|TestLogger $logger
36 ) {
37 }
38
39 public function setQuestionId(int $question_id): void
40 {
41 $this->question_id = $question_id;
42 }
43
44 public function getQuestionId(): ?int
45 {
46 return $this->question_id;
47 }
48
49 public function setUserId(int $user_id): void
50 {
51 $this->user_id = $user_id;
52 }
53
54 public function getUserId(): ?int
55 {
56 return $this->user_id;
57 }
58
59 private function getLockModeSettingValue(): ?string
60 {
61 return $this->settings->get('ass_process_lock_mode', ilObjTestFolder::ASS_PROC_LOCK_MODE_NONE);
62 }
63
65 {
66 switch ($this->getLockModeSettingValue()) {
69
71 $storage = new ilAssQuestionProcessLockFileStorage($this->getQuestionId(), $this->getUserId());
72 $storage->create();
73 return new ilAssQuestionProcessLockerFile($storage, $this->logger);
74
76 return new ilAssQuestionProcessLockerDb($this->db);
77 }
78 }
79}
__construct(private readonly ilSetting $settings, private readonly ilDBInterface $db, private readonly ilLogger|TestLogger $logger)
Component logger with individual log levels by component id.
const ASS_PROC_LOCK_MODE_NONE
const ASS_PROC_LOCK_MODE_FILE
ILIAS Setting Class.
Interface ilDBInterface.