ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Export\ImportHandler\Parser\NodeInfo\Collection\EntryLockingStringMap Class Reference

Class EntryLockingStringMap. More...

+ Inheritance diagram for ILIAS\Export\ImportHandler\Parser\NodeInfo\Collection\EntryLockingStringMap:
+ Collaboration diagram for ILIAS\Export\ImportHandler\Parser\NodeInfo\Collection\EntryLockingStringMap:

Public Member Functions

 __construct ()
 EntryLockingStringMap constructor. More...
 
 get (string $key)
 Returns the value of the given key. More...
 
 toArray ()
 Returns all currently known entries. More...
 
 has (string $key)
 Probe if the key is known and associated with a value. More...
 
 put (string $key, string $value)
 Puts a new key value pair into the string array. More...
 

Private Attributes

ArrayObject $map
 

Detailed Description

Class EntryLockingStringMap.

Implementation of the StringMap which locks the entry after it got created. Therefore it is not possible to overwrite an existing key.

Author
Nicolas Schäfli ns@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Since
5.3
Version
1.0

Definition at line 37 of file EntryLockingStringMap.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Export\ImportHandler\Parser\NodeInfo\Collection\EntryLockingStringMap::__construct ( )

EntryLockingStringMap constructor.

Definition at line 46 of file EntryLockingStringMap.php.

47  {
48  $this->map = new \ArrayObject();
49  }

Member Function Documentation

◆ get()

ILIAS\Export\ImportHandler\Parser\NodeInfo\Collection\EntryLockingStringMap::get ( string  $key)

Returns the value of the given key.

Parameters
string$keyThe key which should be used to search the corresponding value.
Exceptions
NoSuchElementExceptionThrown if the entry is not found with the given key.

Implements ILIAS\Export\ImportHandler\Parser\NodeInfo\Collection\ImmutableStringMap.

Definition at line 61 of file EntryLockingStringMap.php.

61  : string
62  {
63  $this->stringTypeCheck($key, 'key');
64 
65  if ($this->map->offsetExists($key)) {
66  return $this->map->offsetGet($key);
67  }
68 
69  throw new NoSuchElementException("No meta data associated with key \"$key\".");
70  }

◆ has()

ILIAS\Export\ImportHandler\Parser\NodeInfo\Collection\EntryLockingStringMap::has ( string  $key)

Probe if the key is known and associated with a value.

Parameters
string$keyThe key which should be checked.
Exceptions

Implements ILIAS\Export\ImportHandler\Parser\NodeInfo\Collection\ImmutableStringMap.

Definition at line 94 of file EntryLockingStringMap.php.

94  : bool
95  {
96  $this->stringTypeCheck($key, 'key');
97 
98  return $this->map->offsetExists($key);
99  }

◆ put()

ILIAS\Export\ImportHandler\Parser\NodeInfo\Collection\EntryLockingStringMap::put ( string  $key,
string  $value 
)

Puts a new key value pair into the string array.

The put operation can not overwrite an existing pair.

Parameters
string$keyThe key which should be put into the map.
string$valueThe value which should be associated with the given key.
Exceptions
ElementAlreadyExistsExceptionThrown if the key already exists in the map.

Implements ILIAS\Export\ImportHandler\Parser\NodeInfo\Collection\StringMap.

Definition at line 114 of file EntryLockingStringMap.php.

114  : void
115  {
116  $this->stringTypeCheck($key, 'key');
117  $this->stringTypeCheck($value, 'value');
118 
119  if ($this->map->offsetExists($key)) {
120  throw new ElementAlreadyExistsException("Element $key can not be overwritten.");
121  }
122 
123  $this->map->offsetSet($key, $value);
124  }

◆ toArray()

ILIAS\Export\ImportHandler\Parser\NodeInfo\Collection\EntryLockingStringMap::toArray ( )

Returns all currently known entries.

Returns
string[]
Since
5.3

Implements ILIAS\Export\ImportHandler\Parser\NodeInfo\Collection\ImmutableStringMap.

Definition at line 80 of file EntryLockingStringMap.php.

80  : array
81  {
82  return $this->map->getArrayCopy();
83  }

Field Documentation

◆ $map

ArrayObject ILIAS\Export\ImportHandler\Parser\NodeInfo\Collection\EntryLockingStringMap::$map
private

Definition at line 40 of file EntryLockingStringMap.php.


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