Code Duplication    Length = 12-12 lines in 2 locations

src/Ds/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/Ds/Map.php 1 location

@@ 294-305 (lines=12) @@
291
     *
292
     * @return Map
293
     */
294
    public function filter(callable $predicate = null): Map
295
    {
296
        $filtered = new self();
297
298
        foreach ($this as $key => $value) {
299
            if ($predicate ? $predicate($key, $value) : $value) {
300
                $filtered->put($key, $value);
301
            }
302
        }
303
304
        return $filtered;
305
    }
306
307
    /**
308
     * Returns the value associated with a key, or an optional default if the