Code Duplication    Length = 12-12 lines in 2 locations

src/Ds/Map.php 1 location

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

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.