public function filter(callable $callback): CollectionInterface
    {
        $collection = clone $this;
        $collection->data = \array_merge([], \array_filter($collection->data, $callback));

        return $collection;
    }
public function filter(callable $callback): CollectionInterface
    {
        $collection = clone $this;
        $collection->data = \array_merge([], \array_filter($collection->data, $callback));

        return $collection;
    }
public function filter ( callable $ callback ) : CollectionInterface { $ collection = clone $ this ; $ collection -> data = \ array_merge ( [ ] , \ array_filter ( $ collection -> data , $ callback ) ) ; return $ collection ; }
Returns a filtered collection.

{@inheritdoc}

@param callable $callback A callable to use for filtering elements.

@return self
Returns a filtered collection .