src/DS/Set/AbstractSet.php
public function filter(?callable $callback = null): SetInterface
    {
        $items = $callback ?
            $this->items->filter($callback) :
            $this->items->filter();


        return $this->duplicate($items);
    }
public function filter(?callable $callback = null): SetInterface
    {
        $items = $callback ?
            $this->items->filter($callback) :
            $this->items->filter();


        return $this->duplicate($items);
    }
public function filter ( ? callable $ callback = null ) : SetInterface { $ items = $ callback ? $ this -> items -> filter ( $ callback ) : $ this -> items -> filter ( ) ; return $ this -> duplicate ( $ items ) ; }
Returns a new set containing only the values for which a callback
returns true. A boolean test will be used if a callback is not provided.

@param callable|null $callback Accepts a value, returns a boolean:
true : include the value,
false: skip the value.

@return \PlanB\DS\Set\SetInterface
Returns a new set containing only the values for which a callback returns true . A boolean test will be used if a callback is not provided .