@@ 146-157 (lines=12) @@ | ||
143 | return new self($items); |
|
144 | } |
|
145 | ||
146 | public function replaceKey(string $key, $replacementValue): self |
|
147 | { |
|
148 | if (!$this->containsKey($key)) { |
|
149 | throw OutOfRangeException::doesNotContainKey($key); |
|
150 | } |
|
151 | ||
152 | $items = $this->items; |
|
153 | ||
154 | $items[$key] = $replacementValue; |
|
155 | ||
156 | return new self($items); |
|
157 | } |
|
158 | ||
159 | public function remove($value): self |
|
160 | { |
|
@@ 185-196 (lines=12) @@ | ||
182 | return new self($items); |
|
183 | } |
|
184 | ||
185 | public function removeKey(string $key): self |
|
186 | { |
|
187 | if (!$this->containsKey($key)) { |
|
188 | throw OutOfRangeException::doesNotContainKey($key); |
|
189 | } |
|
190 | ||
191 | $items = $this->items; |
|
192 | ||
193 | unset($items[$key]); |
|
194 | ||
195 | return new self($items); |
|
196 | } |
|
197 | ||
198 | public function merge(self $other): self |
|
199 | { |