ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ILIAS\FileUpload\Collection\EntryLockingStringMap Class Reference

Class EntryLockingStringMap. More...

+ Inheritance diagram for ILIAS\FileUpload\Collection\EntryLockingStringMap:
+ Collaboration diagram for ILIAS\FileUpload\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 34 of file EntryLockingStringMap.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\FileUpload\Collection\EntryLockingStringMap::__construct ( )

EntryLockingStringMap constructor.

Definition at line 43 of file EntryLockingStringMap.php.

44  {
45  $this->map = new \ArrayObject();
46  }

Member Function Documentation

◆ get()

ILIAS\FileUpload\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\FileUpload\Collection\ImmutableStringMap.

Definition at line 58 of file EntryLockingStringMap.php.

References ILIAS\LTI\ToolProvider\$key.

58  : string
59  {
60  $this->stringTypeCheck($key, 'key');
61 
62  if ($this->map->offsetExists($key)) {
63  return $this->map->offsetGet($key);
64  }
65 
66  throw new NoSuchElementException("No meta data associated with key \"$key\".");
67  }
string $key
Consumer key/client ID value.
Definition: System.php:193

◆ has()

ILIAS\FileUpload\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\FileUpload\Collection\ImmutableStringMap.

Definition at line 91 of file EntryLockingStringMap.php.

91  : bool
92  {
93  $this->stringTypeCheck($key, 'key');
94 
95  return $this->map->offsetExists($key);
96  }
string $key
Consumer key/client ID value.
Definition: System.php:193

◆ put()

ILIAS\FileUpload\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\FileUpload\Collection\StringMap.

Definition at line 111 of file EntryLockingStringMap.php.

111  : void
112  {
113  $this->stringTypeCheck($key, 'key');
114  $this->stringTypeCheck($value, 'value');
115 
116  if ($this->map->offsetExists($key)) {
117  throw new ElementAlreadyExistsException("Element $key can not be overwritten.");
118  }
119 
120  $this->map->offsetSet($key, $value);
121  }
string $key
Consumer key/client ID value.
Definition: System.php:193

◆ toArray()

ILIAS\FileUpload\Collection\EntryLockingStringMap::toArray ( )

Returns all currently known entries.

Returns
string[]
Since
5.3

Implements ILIAS\FileUpload\Collection\ImmutableStringMap.

Definition at line 77 of file EntryLockingStringMap.php.

77  : array
78  {
79  return $this->map->getArrayCopy();
80  }

Field Documentation

◆ $map

ArrayObject ILIAS\FileUpload\Collection\EntryLockingStringMap::$map
private

Definition at line 37 of file EntryLockingStringMap.php.


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