| @@ 198-209 (lines=12) @@ | ||
| 195 | return new self($items); |
|
| 196 | } |
|
| 197 | ||
| 198 | public function intersect(self $other): self |
|
| 199 | { |
|
| 200 | $items = []; |
|
| 201 | ||
| 202 | foreach ($this->items as $key => $item) { |
|
| 203 | if ($other->contains($item)) { |
|
| 204 | $items[$key] = $item; |
|
| 205 | } |
|
| 206 | } |
|
| 207 | ||
| 208 | return new self($items); |
|
| 209 | } |
|
| 210 | ||
| 211 | public function intersectKeys(self $other): self |
|
| 212 | { |
|
| @@ 211-222 (lines=12) @@ | ||
| 208 | return new self($items); |
|
| 209 | } |
|
| 210 | ||
| 211 | public function intersectKeys(self $other): self |
|
| 212 | { |
|
| 213 | $items = []; |
|
| 214 | ||
| 215 | foreach ($this->items as $key => $item) { |
|
| 216 | if ($other->containsKey($key)) { |
|
| 217 | $items[$key] = $item; |
|
| 218 | } |
|
| 219 | } |
|
| 220 | ||
| 221 | return new self($items); |
|
| 222 | } |
|
| 223 | ||
| 224 | public function diff(self $other): self |
|
| 225 | { |
|
| @@ 224-235 (lines=12) @@ | ||
| 221 | return new self($items); |
|
| 222 | } |
|
| 223 | ||
| 224 | public function diff(self $other): self |
|
| 225 | { |
|
| 226 | $items = []; |
|
| 227 | ||
| 228 | foreach ($this->items as $key => $item) { |
|
| 229 | if (!$other->contains($item)) { |
|
| 230 | $items[$key] = $item; |
|
| 231 | } |
|
| 232 | } |
|
| 233 | ||
| 234 | return new self($items); |
|
| 235 | } |
|
| 236 | ||
| 237 | public function diffKeys(self $other): self |
|
| 238 | { |
|
| @@ 237-248 (lines=12) @@ | ||
| 234 | return new self($items); |
|
| 235 | } |
|
| 236 | ||
| 237 | public function diffKeys(self $other): self |
|
| 238 | { |
|
| 239 | $items = []; |
|
| 240 | ||
| 241 | foreach ($this->items as $key => $item) { |
|
| 242 | if (!$other->containsKey($key)) { |
|
| 243 | $items[$key] = $item; |
|
| 244 | } |
|
| 245 | } |
|
| 246 | ||
| 247 | return new self($items); |
|
| 248 | } |
|
| 249 | ||
| 250 | /** |
|
| 251 | * The filter callable is given an item and it's key, and should |
|
| @@ 142-153 (lines=12) @@ | ||
| 139 | return new self($items); |
|
| 140 | } |
|
| 141 | ||
| 142 | public function intersect(self $other): self |
|
| 143 | { |
|
| 144 | $items = []; |
|
| 145 | ||
| 146 | foreach ($this->items as $item) { |
|
| 147 | if ($other->contains($item)) { |
|
| 148 | $items[] = $item; |
|
| 149 | } |
|
| 150 | } |
|
| 151 | ||
| 152 | return new self($items); |
|
| 153 | } |
|
| 154 | ||
| 155 | public function diff(self $other): self |
|
| 156 | { |
|
| @@ 155-166 (lines=12) @@ | ||
| 152 | return new self($items); |
|
| 153 | } |
|
| 154 | ||
| 155 | public function diff(self $other): self |
|
| 156 | { |
|
| 157 | $items = []; |
|
| 158 | ||
| 159 | foreach ($this->items as $item) { |
|
| 160 | if (!$other->contains($item)) { |
|
| 161 | $items[] = $item; |
|
| 162 | } |
|
| 163 | } |
|
| 164 | ||
| 165 | return new self($items); |
|
| 166 | } |
|
| 167 | ||
| 168 | /** |
|
| 169 | * The filter callable is given an item, and should return |
|