ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\KioskMode\State Class Reference

Keeps the state of a view in a simple stringly type key-value store. More...

+ Collaboration diagram for ILIAS\KioskMode\State:

Public Member Functions

 withValueFor (string $key, string $value)
 Set a value for a key of the state. More...
 
 withoutKey (string $key)
 Remove the key-value-pair. More...
 
 getValueFor (string $key)
 Get the value for the given key. More...
 
 serialize ()
 Get the key-value store as string. More...
 

Protected Attributes

array $store = null
 

Detailed Description

Keeps the state of a view in a simple stringly type key-value store.

Definition at line 26 of file State.php.

Member Function Documentation

◆ getValueFor()

ILIAS\KioskMode\State::getValueFor ( string  $key)

Get the value for the given key.

Definition at line 56 of file State.php.

56 : ?string
57 {
58 if (!$this->store) {
59 return null;
60 }
61 return $this->store[$key];
62 }

Referenced by StateTest\testValue().

+ Here is the caller graph for this function:

◆ serialize()

ILIAS\KioskMode\State::serialize ( )

Get the key-value store as string.

Definition at line 67 of file State.php.

67 : string
68 {
69 return json_encode($this->store, JSON_THROW_ON_ERROR);
70 }

Referenced by StateTest\testRemoveValue(), and StateTest\testSerialize().

+ Here is the caller graph for this function:

◆ withoutKey()

ILIAS\KioskMode\State::withoutKey ( string  $key)

Remove the key-value-pair.

Definition at line 46 of file State.php.

46 : State
47 {
48 $clone = clone $this;
49 unset($clone->store[$key]);
50 return $clone;
51 }

Referenced by StateTest\testRemoveValue().

+ Here is the caller graph for this function:

◆ withValueFor()

ILIAS\KioskMode\State::withValueFor ( string  $key,
string  $value 
)

Set a value for a key of the state.

Definition at line 36 of file State.php.

36 : State
37 {
38 $clone = clone $this;
39 $clone->store[$key] = $value;
40 return $clone;
41 }

Referenced by ilLearningModuleKioskModeView\buildInitialState(), StateTest\testRemoveValue(), StateTest\testValue(), and ilLearningModuleKioskModeView\updateGet().

+ Here is the caller graph for this function:

Field Documentation

◆ $store

array ILIAS\KioskMode\State::$store = null
protected

Definition at line 31 of file State.php.


The documentation for this class was generated from the following file: