Code Duplication    Length = 11-15 lines in 2 locations

Mbh/Collection/Traits/Functional.php 2 locations

@@ 42-52 (lines=11) @@
39
    /**
40
     * @inheritDoc
41
     */
42
    public function map(callable $callback)
43
    {
44
        $count = count($this);
45
        $sfa = new SplFixedArray($count);
46
47
        for ($i = 0; $i < $count; $i++) {
48
            $sfa[$i] = $callback($this[$i], $i, $this);
49
        }
50
51
        return new static($sfa);
52
    }
53
54
    /**
55
     * @inheritDoc
@@ 69-83 (lines=15) @@
66
    /**
67
     * @inheritDoc
68
     */
69
    public function filter(callable $callback)
70
    {
71
        $count = count($this);
72
        $sfa = new SplFixedArray($count);
73
        $newCount = 0;
74
75
        foreach ($this as $elem) {
76
            if ($callback($elem)) {
77
                $sfa[$newCount++] = $elem;
78
            }
79
        }
80
81
        $sfa->setSize($newCount);
82
        return new static($sfa);
83
    }
84
85
    /**
86
     * @inheritDoc