| @@ 177-188 (lines=12) @@ | ||
| 174 | return $count; |
|
| 175 | } |
|
| 176 | ||
| 177 | public function intersect(self $other): self |
|
| 178 | { |
|
| 179 | $items = []; |
|
| 180 | ||
| 181 | foreach ($this->items as $key => $item) { |
|
| 182 | if ($other->contains($item)) { |
|
| 183 | $items[$key] = $item; |
|
| 184 | } |
|
| 185 | } |
|
| 186 | ||
| 187 | return new self($items); |
|
| 188 | } |
|
| 189 | ||
| 190 | public function intersectKeys(self $other): array |
|
| 191 | { |
|
| @@ 203-214 (lines=12) @@ | ||
| 200 | return $keys; |
|
| 201 | } |
|
| 202 | ||
| 203 | public function diff(self $other): self |
|
| 204 | { |
|
| 205 | $items = []; |
|
| 206 | ||
| 207 | foreach ($this->items as $key => $item) { |
|
| 208 | if (!$other->contains($item)) { |
|
| 209 | $items[$key] = $item; |
|
| 210 | } |
|
| 211 | } |
|
| 212 | ||
| 213 | return new self($items); |
|
| 214 | } |
|
| 215 | ||
| 216 | public function diffKeys(self $other): array |
|
| 217 | { |
|
| @@ 173-184 (lines=12) @@ | ||
| 170 | return $count; |
|
| 171 | } |
|
| 172 | ||
| 173 | public function intersect(self $other): self |
|
| 174 | { |
|
| 175 | $items = []; |
|
| 176 | ||
| 177 | foreach ($this->items as $item) { |
|
| 178 | if ($other->contains($item)) { |
|
| 179 | $items[] = $item; |
|
| 180 | } |
|
| 181 | } |
|
| 182 | ||
| 183 | return new self($items); |
|
| 184 | } |
|
| 185 | ||
| 186 | public function diff(self $other): self |
|
| 187 | { |
|
| @@ 186-197 (lines=12) @@ | ||
| 183 | return new self($items); |
|
| 184 | } |
|
| 185 | ||
| 186 | public function diff(self $other): self |
|
| 187 | { |
|
| 188 | $items = []; |
|
| 189 | ||
| 190 | foreach ($this->items as $item) { |
|
| 191 | if (!$other->contains($item)) { |
|
| 192 | $items[] = $item; |
|
| 193 | } |
|
| 194 | } |
|
| 195 | ||
| 196 | return new self($items); |
|
| 197 | } |
|
| 198 | ||
| 199 | /** |
|
| 200 | * The filter callable is given an equatable item, and should return |
|