ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
StorageImpl.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use ilSetting;
24
25class StorageImpl implements Storage
26{
27 private const string P_READING_TIME_STATUS = 'reading_time_status';
28
29 public function __construct(private readonly ilSetting $globalSettings)
30 {
31 }
32
33 public function getSettings(): Settings
34 {
35 $settings = new Settings();
36
37 if ($this->globalSettings->get(self::P_READING_TIME_STATUS, '0')) {
38 $settings = $settings->withEnabledReadingTime();
39 } else {
40 $settings = $settings->withDisabledReadingTime();
41 }
42
43 return $settings;
44 }
45
46 public function store(Settings $settings): void
47 {
48 $this->globalSettings->set(self::P_READING_TIME_STATUS, ((string) (int) $settings->isReadingTimeEnabled()));
49 }
50}
__construct(private readonly ilSetting $globalSettings)
Definition: StorageImpl.php:29
ILIAS Setting Class.