Code Duplication    Length = 14-14 lines in 2 locations

src/Variables/Except.php 1 location

@@ 31-44 (lines=14) @@
28
        $right_condition = $this->right()->compile($negate);
29
30
        // normal case: left_condition and not right_condition
31
        if (!$negate) {
32
            return function(Node $n) use ($left_condition, $right_condition) {
33
                return $left_condition($n)
34
                    && !$right_condition($n);
35
            };
36
        }
37
        // negated case: not (left_condition and not right_condition)
38
        //             = not left_condition or right_condition
39
        else {
40
            return function(Node $n) use ($left_condition, $right_condition) {
41
                return $left_condition($n)
42
                    || !$right_condition($n);
43
            };
44
        }
45
    }
46
}
47

src/Variables/WithProperty.php 1 location

@@ 78-91 (lines=14) @@
75
        $property_condition = $this->property->compile($this->arguments, $negate);
76
77
        // normal case : left_condition AND property 
78
        if (!$negate) {
79
            return function(Node $n) use ($left_condition, $property_condition) {
80
                return $left_condition($n)
81
                    && $property_condition($n);
82
            };
83
        }
84
        // negated case: not (left_condition_left and property)
85
        //             = not left_condition or not property
86
        else {
87
            return function(Node $n) use ($left_condition, $property_condition) {
88
                return $left_condition($n)
89
                    || $property_condition($n);
90
            };
91
        }
92
    }
93
}
94