Code Duplication    Length = 8-10 lines in 2 locations

src/Map.php 2 locations

@@ 44-51 (lines=8) @@
41
     * @param callable $callback Accepts two arguments: key and value, should
42
     *                           return what the updated value will be.
43
     */
44
    public function apply(callable $callback): Map
45
    {
46
        foreach ($this->pairs as &$pair) {
47
            $pair->value = $callback($pair->key, $pair->value);
48
        }
49
50
        return $mapped;
51
    }
52
53
    /**
54
     * @inheritDoc
@@ 340-349 (lines=10) @@
337
     *
338
     * @return Map
339
     */
340
    public function map(callable $callback): Map
341
    {
342
        $mapped = new self();
343
344
        foreach ($this->pairs as $pair) {
345
            $mapped[$pair->key] = $callback($pair->key, $pair->value);
346
        }
347
348
        return $mapped;
349
    }
350
351
    /**
352
     * Returns a sequence of pairs representing all associations.