ILIAS  release_7 Revision v7.30-3-g800a261c036
StorageImpl.php
Go to the documentation of this file.
1<?php declare(strict_types=1);
2/* Copyright (c) 1998-2020 ILIAS open source, Extended GPL, see docs/LICENSE */
3
5
6use ilSetting;
7
13class StorageImpl implements Storage
14{
15 private const P_READING_TIME_STATUS = 'reading_time_status';
16
19
25 {
26 $this->globalSettings = $globalSettings;
27 }
28
32 public function getSettings() : Settings
33 {
34 $settings = new Settings();
35
36 if ($this->globalSettings->get(self::P_READING_TIME_STATUS, false)) {
37 $settings = $settings->withEnabledReadingTime();
38 } else {
39 $settings = $settings->withDisabledReadingTime();
40 }
41
42 return $settings;
43 }
44
48 public function store(Settings $settings) : void
49 {
50 $this->globalSettings->set(self::P_READING_TIME_STATUS, ((string) (int) $settings->isReadingTimeEnabled()));
51 }
52}
An exception for terminatinating execution or to throw for unit testing.
__construct(ilSetting $globalSettings)
StorageImpl constructor.
Definition: StorageImpl.php:24
store(Settings $settings)
@inheritDoc
Definition: StorageImpl.php:48
ILIAS Setting Class.