Code Duplication    Length = 10-10 lines in 2 locations

src/PeacefulBit/Packet/Modules/Logic.php 2 locations

@@ 34-43 (lines=10) @@
31
                return !$visit($argument);
32
            });
33
        }),
34
        'if' => new NativeNode('if', function (NodeCalculatorVisitor $visitor, array $arguments) {
35
            if (sizeof($arguments) != 3) {
36
                throw new RuntimeException("Function 'if' accepts only three arguments");
37
            }
38
            list ($exp, $cons, $alt) = $arguments;
39
            $visitExp = $visitor->getVisitor($exp);
40
            $visitCons = $visitor->getVisitor($cons);
41
            $visitAlt = $visitor->getVisitor($alt);
42
            return $visitExp($exp) ? $visitCons($cons) : $visitAlt($alt);
43
        }),
44
        'unless' => new NativeNode('unless', function (NodeCalculatorVisitor $visitor, array $arguments) {
45
            if (sizeof($arguments) != 3) {
46
                throw new RuntimeException("Function 'unless' accepts only three arguments");
@@ 44-53 (lines=10) @@
41
            $visitAlt = $visitor->getVisitor($alt);
42
            return $visitExp($exp) ? $visitCons($cons) : $visitAlt($alt);
43
        }),
44
        'unless' => new NativeNode('unless', function (NodeCalculatorVisitor $visitor, array $arguments) {
45
            if (sizeof($arguments) != 3) {
46
                throw new RuntimeException("Function 'unless' accepts only three arguments");
47
            }
48
            list ($exp, $cons, $alt) = $arguments;
49
            $visitExp = $visitor->getVisitor($exp);
50
            $visitCons = $visitor->getVisitor($cons);
51
            $visitAlt = $visitor->getVisitor($alt);
52
            return $visitExp($exp) ? $visitAlt($alt) : $visitCons($cons);
53
        })
54
    ];
55
}
56