ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\GlobalScreen\ScreenContext\AdditionalData\Collection Class Reference

Class Collection. More...

+ Collaboration diagram for ILIAS\GlobalScreen\ScreenContext\AdditionalData\Collection:

Public Member Functions

 getData ()
 
 add (string $key, $value)
 
 get (string $key)
 
 is (string $key, $expected_value)
 
 exists (string $key)
 
 replace (string $key, $value)
 

Private Attributes

array $values = []
 

Detailed Description

Class Collection.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 29 of file Collection.php.

Member Function Documentation

◆ add()

ILIAS\GlobalScreen\ScreenContext\AdditionalData\Collection::add ( string  $key,
  $value 
)
Parameters
string$key
$value

Definition at line 45 of file Collection.php.

45 : void
46 {
47 if ($this->exists($key)) {
48 throw new LogicException("Key $key already exists.");
49 }
50 $this->values[$key] = $value;
51 }

References ILIAS\GlobalScreen\ScreenContext\AdditionalData\Collection\exists().

+ Here is the call graph for this function:

◆ exists()

ILIAS\GlobalScreen\ScreenContext\AdditionalData\Collection::exists ( string  $key)
Parameters
string$key
Returns
bool

Definition at line 76 of file Collection.php.

76 : bool
77 {
78 return isset($this->values[$key]);
79 }

Referenced by ILIAS\GlobalScreen\ScreenContext\AdditionalData\Collection\add(), ilLMGSToolProvider\getToc(), ILIAS\GlobalScreen\ScreenContext\AdditionalData\Collection\is(), and ILIAS\GlobalScreen\ScreenContext\AdditionalData\Collection\replace().

+ Here is the caller graph for this function:

◆ get()

ILIAS\GlobalScreen\ScreenContext\AdditionalData\Collection::get ( string  $key)
Parameters
string$key
Returns
mixed

Definition at line 57 of file Collection.php.

58 {
59 return $this->values[$key];
60 }

Referenced by ilLMGSToolProvider\getToc().

+ Here is the caller graph for this function:

◆ getData()

ILIAS\GlobalScreen\ScreenContext\AdditionalData\Collection::getData ( )

◆ is()

ILIAS\GlobalScreen\ScreenContext\AdditionalData\Collection::is ( string  $key,
  $expected_value 
)
Parameters
string$key
$expected_value
Returns
bool

Definition at line 67 of file Collection.php.

67 : bool
68 {
69 return ($this->exists($key) && $this->get($key) === $expected_value);
70 }

References ILIAS\GlobalScreen\ScreenContext\AdditionalData\Collection\exists().

Referenced by ilLMGSToolProvider\getToc().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ replace()

ILIAS\GlobalScreen\ScreenContext\AdditionalData\Collection::replace ( string  $key,
  $value 
)
Parameters
string$key
$value

Definition at line 85 of file Collection.php.

85 : void
86 {
87 if (!$this->exists($key)) {
88 throw new LogicException("Key $key does not exists.");
89 }
90 $this->values[$key] = $value;
91 }

References ILIAS\GlobalScreen\ScreenContext\AdditionalData\Collection\exists().

+ Here is the call graph for this function:

Field Documentation

◆ $values

array ILIAS\GlobalScreen\ScreenContext\AdditionalData\Collection::$values = []
private

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