ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
StorageImpl.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
23 use ilSetting;
24 
25 class 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