@@ 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} |
|
@@ 162-172 (lines=11) @@ | ||
159 | /** |
|
160 | * {@inheritDoc} |
|
161 | */ |
|
162 | public function putIfAbsent($key, $value) { |
|
163 | $this->checkKeyType($key); |
|
164 | ||
165 | if($this->containsKey($key)) { |
|
166 | return $this->get($key); |
|
167 | } |
|
168 | ||
169 | $this->put($key, $value); |
|
170 | ||
171 | return NULL; |
|
172 | } |
|
173 | ||
174 | /** |
|
175 | * {@inheritDoc} |
|
@@ 177-188 (lines=12) @@ | ||
174 | /** |
|
175 | * {@inheritDoc} |
|
176 | */ |
|
177 | public function remove($key) { |
|
178 | $this->checkKeyType($key); |
|
179 | ||
180 | if($this->containsKey($key)) { |
|
181 | $previousElement = $this->get($key); |
|
182 | unset($this->data[$key]); |
|
183 | ||
184 | return $previousElement; |
|
185 | } |
|
186 | ||
187 | return NULL; |
|
188 | } |
|
189 | ||
190 | /** |
|
191 | * {@inheritDoc} |