Code Duplication    Length = 12-12 lines in 2 locations

src/Map.php 1 location

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

src/Set.php 1 location

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