@@ 93-101 (lines=9) @@ | ||
90 | /** |
|
91 | * {@inheritDoc} |
|
92 | */ |
|
93 | public function get($key, $defaultValue = NULL) { |
|
94 | $this->checkKeyType($key); |
|
95 | ||
96 | if(!$this->containsKey($key)) { |
|
97 | return $defaultValue; |
|
98 | } |
|
99 | ||
100 | return $this->data[$key]; |
|
101 | } |
|
102 | ||
103 | /** |
|
104 | * {@inheritDoc} |
|
@@ 163-173 (lines=11) @@ | ||
160 | /** |
|
161 | * {@inheritDoc} |
|
162 | */ |
|
163 | public function putIfAbsent($key, $value) { |
|
164 | $this->checkKeyType($key); |
|
165 | ||
166 | if($this->containsKey($key)) { |
|
167 | return $this->get($key); |
|
168 | } |
|
169 | ||
170 | $this->put($key, $value); |
|
171 | ||
172 | return NULL; |
|
173 | } |
|
174 | ||
175 | /** |
|
176 | * {@inheritDoc} |
|
@@ 178-189 (lines=12) @@ | ||
175 | /** |
|
176 | * {@inheritDoc} |
|
177 | */ |
|
178 | public function remove($key) { |
|
179 | $this->checkKeyType($key); |
|
180 | ||
181 | if($this->containsKey($key)) { |
|
182 | $previousElement = $this->get($key); |
|
183 | unset($this->data[$key]); |
|
184 | ||
185 | return $previousElement; |
|
186 | } |
|
187 | ||
188 | return NULL; |
|
189 | } |
|
190 | ||
191 | /** |
|
192 | * {@inheritDoc} |