ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
EntryLockingStringMap.php
Go to the documentation of this file.
1<?php
2
4
7use ILIAS\FileUpload\ScalarTypeCheckAware;
8
21final class EntryLockingStringMap implements StringMap
22{
23 use ScalarTypeCheckAware;
27 private $map;
28
29
33 public function __construct()
34 {
35 $this->map = new \ArrayObject();
36 }
37
38
51 public function get($key)
52 {
53 $this->stringTypeCheck($key, 'key');
54
55 if ($this->map->offsetExists($key)) {
56 return $this->map->offsetGet($key);
57 }
58
59 throw new NoSuchElementException("No meta data associated with key \"$key\".");
60 }
61
62
70 public function toArray()
71 {
72 return $this->map->getArrayCopy();
73 }
74
75
87 public function has($key)
88 {
89 $this->stringTypeCheck($key, 'key');
90
91 return $this->map->offsetExists($key);
92 }
93
94
110 public function put($key, $value)
111 {
112 $this->stringTypeCheck($key, 'key');
113 $this->stringTypeCheck($value, 'value');
114
115 if ($this->map->offsetExists($key)) {
116 throw new ElementAlreadyExistsException("Element $key can not be overwritten.");
117 }
118
119 $this->map->offsetSet($key, $value);
120 }
121}
An exception for terminatinating execution or to throw for unit testing.
has($key)
Probe if the key is known and associated with a value.
put($key, $value)
Puts a new key value pair into the string array.
toArray()
Returns all currently known entries.
$key
Definition: croninfo.php:18