ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 28 of file Collection.php.

Member Function Documentation

◆ add()

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

Definition at line 44 of file Collection.php.

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

44  : void
45  {
46  if ($this->exists($key)) {
47  throw new LogicException("Key $key already exists.");
48  }
49  $this->values[$key] = $value;
50  }
+ 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 75 of file Collection.php.

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

75  : bool
76  {
77  return isset($this->values[$key]);
78  }
+ 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 56 of file Collection.php.

Referenced by ilLMGSToolProvider\getToc().

57  {
58  return $this->values[$key];
59  }
+ Here is the caller graph for this function:

◆ getData()

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

Definition at line 35 of file Collection.php.

References ILIAS\GlobalScreen\ScreenContext\AdditionalData\Collection\$values.

35  : array
36  {
37  return $this->values;
38  }

◆ is()

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

Definition at line 66 of file Collection.php.

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

Referenced by ilLMGSToolProvider\getToc().

66  : bool
67  {
68  return ($this->exists($key) && $this->get($key) === $expected_value);
69  }
+ 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 84 of file Collection.php.

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

84  : void
85  {
86  if (!$this->exists($key)) {
87  throw new LogicException("Key $key does not exists.");
88  }
89  $this->values[$key] = $value;
90  }
+ 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: