Skip to content

Commit

Permalink
refactor: Update Duplicateable interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Aug 25, 2021
1 parent cb4b791 commit dff7e1b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Contract/Operation/Duplicateable.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,23 @@ interface Duplicateable
{
/**
* Find duplicated values from the collection.
* The operation has 2 optional parameters that allow you to customize precisely
* how values are accessed and compared to each other.
*
* The first parameter is the comparator. This is a curried function which takes
* first the left part, then the right part and then returns a boolean.
*
* The second parameter is the accessor. This binary function takes the value and the key
* of the current iterated value and then return the value to compare.
* This is useful when you want to compare objects.
*
* @see https://loophp-collection.readthedocs.io/en/stable/pages/api.html#duplicate
*
* @template U
*
* @param null|callable(U): (Closure(U): bool) $comparatorCallback
* @param null|callable(T, TKey): U $accessorCallback
*
* @return Collection<TKey, T>
*/
public function duplicate(?callable $comparatorCallback = null, ?callable $accessorCallback = null): Collection;
Expand Down

0 comments on commit dff7e1b

Please sign in to comment.