Skip to content

Commit

Permalink
Add Set::diffByKey()
Browse files Browse the repository at this point in the history
  • Loading branch information
joshdifabio committed Nov 1, 2017
1 parent 6de68d1 commit 70116ae
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/SetTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ public function diff(self $otherSet): self
return $result;
}

/**
* @return static
*/
public function diffByKey(self $otherSet): self
{
$result = new self;
$result->items = \array_diff_key($this->items, $otherSet->items);
return $result;
}

public function overlaps(self $otherSet): bool
{
foreach ($this->items as $key => $item) {
Expand Down

0 comments on commit 70116ae

Please sign in to comment.