| @@ 190-201 (lines=12) @@ | ||
| 187 | return new self($items); |
|
| 188 | } |
|
| 189 | ||
| 190 | public function intersectKeys(self $other): array |
|
| 191 | { |
|
| 192 | $keys = []; |
|
| 193 | ||
| 194 | foreach (array_keys($this->items) as $key) { |
|
| 195 | if ($other->containsKey($key)) { |
|
| 196 | $keys[] = $key; |
|
| 197 | } |
|
| 198 | } |
|
| 199 | ||
| 200 | return $keys; |
|
| 201 | } |
|
| 202 | ||
| 203 | public function diff(self $other): self |
|
| 204 | { |
|
| @@ 216-227 (lines=12) @@ | ||
| 213 | return new self($items); |
|
| 214 | } |
|
| 215 | ||
| 216 | public function diffKeys(self $other): array |
|
| 217 | { |
|
| 218 | $keys = []; |
|
| 219 | ||
| 220 | foreach (array_keys($this->items) as $key) { |
|
| 221 | if (!$other->containsKey($key)) { |
|
| 222 | $keys[] = $key; |
|
| 223 | } |
|
| 224 | } |
|
| 225 | ||
| 226 | return $keys; |
|
| 227 | } |
|
| 228 | ||
| 229 | /** |
|
| 230 | * The filter callable is given an equatable item, and should return |
|