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

@@ 177-188 (lines=12) @@
174
     *
175
     * @return Set
176
     */
177
    public function filter(callable $predicate = null): Set
178
    {
179
        $filtered = new Set();
180
181
        foreach ($this as $value) {
182
            if ($predicate ? $predicate($value) : $value) {
183
                $filtered->add($value);
184
            }
185
        }
186
187
        return $filtered;
188
    }
189
190
    /**
191
     * Returns the first value in the set.