ILIAS  release_8 Revision v8.24
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 12 of file State.php.

Member Function Documentation

◆ getValueFor()

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

Get the value for the given key.

Definition at line 42 of file State.php.

42 : ?string
43 {
44 if (!$this->store) {
45 return null;
46 }
47 return $this->store[$key];
48 }
string $key
Consumer key/client ID value.
Definition: System.php:193

References ILIAS\LTI\ToolProvider\$key.

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 53 of file State.php.

53 : string
54 {
55 return json_encode($this->store, JSON_THROW_ON_ERROR);
56 }

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 32 of file State.php.

32 : State
33 {
34 $clone = clone $this;
35 unset($clone->store[$key]);
36 return $clone;
37 }

References ILIAS\LTI\ToolProvider\$key.

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 22 of file State.php.

22 : State
23 {
24 $clone = clone $this;
25 $clone->store[$key] = $value;
26 return $clone;
27 }

References ILIAS\LTI\ToolProvider\$key.

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 17 of file State.php.


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