Code Duplication    Length = 12-12 lines in 2 locations

src/Set.php 1 location

@@ 193-204 (lines=12) @@
190
     *
191
     * @return Set
192
     */
193
    public function filter(callable $predicate = null): Set
194
    {
195
        $filtered = new Set();
196
197
        foreach ($this as $value) {
198
            if ($predicate ? $predicate($value) : $value) {
199
                $filtered->add($value);
200
            }
201
        }
202
203
        return $filtered;
204
    }
205
206
    /**
207
     * Returns the first value in the set.

src/Map.php 1 location

@@ 286-297 (lines=12) @@
283
     *
284
     * @return Map
285
     */
286
    public function filter(callable $predicate = null): Map
287
    {
288
        $filtered = new self();
289
290
        foreach ($this as $key => $value) {
291
            if ($predicate ? $predicate($key, $value) : $value) {
292
                $filtered->put($key, $value);
293
            }
294
        }
295
296
        return $filtered;
297
    }
298
299
    /**
300
     * Returns the value associated with a key, or an optional default if the