Code Duplication    Length = 14-16 lines in 2 locations

tests/EachTest.php 2 locations

@@ 62-75 (lines=14) @@
59
        $cur_cycle = 0;
60
        $array = [1, 2, 3];
61
62
        Each::shallow()->begin($array, function($bag) use(&$expected, &$cur_cycle, $array) {
63
            $actual = $bag->value();
64
            $this->assertEquals($expected, $actual);
65
66
            $expected++;
67
68
            $actual = $bag->cycle();
69
            $this->assertEquals($cur_cycle, $actual);
70
71
            if ($expected > $array[count($array) - 1]) {
72
                $expected = 1;
73
                $cur_cycle++;
74
            }
75
        }, $cycles);
76
    }
77
78
    public function testStandardDeepBegin()
@@ 98-113 (lines=16) @@
95
        $cur_cycle = 0;
96
        $array = [1, 2, 3, 4 => [4, 5, 6]];
97
98
        Each::deep()->begin($array, function($bag) use(&$expected, &$cur_cycle, $array) {
99
            $actual = $bag->value();
100
            $this->assertEquals($expected, $actual);
101
102
            $expected++;
103
104
            $actual = $bag->cycle();
105
            $this->assertEquals($cur_cycle, $actual);
106
107
            // Here the number six refers to the last item in the
108
            // array [1, 2, 3, 4 => [4, 5, 6]] if it were flattened.
109
            if ($expected > 6) {
110
                $expected = 1;
111
                $cur_cycle++;
112
            }
113
        }, $cycles);
114
    }
115
116
    public function testExtraDeepBeginMultipleCyclesAndFollowIndex()