Code Duplication    Length = 7-7 lines in 7 locations

src/math.php 6 locations

@@ 21-27 (lines=7) @@
18
 * @param  int|float $y
19
 * @return int|float
20
 */
21
function plus() {
22
    static $plus = false;
23
    $plus = $plus ?: curry(function($x, $y){
24
        return $x + $y;
25
    });
26
    return _apply($plus, func_get_args());
27
}
28
29
/**
30
 * Computues `$x - $y`.
@@ 42-48 (lines=7) @@
39
 * @param  int|float $y
40
 * @return int|float
41
 */
42
function minus() {
43
    static $minus = false;
44
    $minus = $minus ?: curry(function($x, $y){
45
        return $x - $y;
46
    });
47
    return _apply($minus, func_get_args());
48
}
49
50
/**
51
 * Computes `- $x`.
@@ 63-69 (lines=7) @@
60
 * @param  int|float $x
61
 * @return int|float
62
 */
63
function negate() {
64
    static $negate = false;
65
    $negate = $negate ?: curry(function($x){
66
        return -$x;
67
    });
68
    return _apply($negate, func_get_args());
69
}
70
71
/**
72
 * Computes `$x * $y`.
@@ 85-91 (lines=7) @@
82
 * @param  int|float $y
83
 * @return int|float
84
 */
85
function multiply() {
86
    static $multiply = false;
87
    $multiply = $multiply ?: curry(function($x, $y){
88
        return $y * $x;
89
    });
90
    return _apply($multiply, func_get_args());
91
}
92
93
/**
94
 * Computes `$x / $y`.
@@ 106-112 (lines=7) @@
103
 * @param  int|float $y
104
 * @return int|float
105
 */
106
function divide() {
107
    static $divide = false;
108
    $divide = $divide ?: curry(function($x, $y){
109
        return $x / $y;
110
    });
111
    return _apply($divide, func_get_args());
112
}
113
114
/**
115
 * Computes `$x % $y`.
@@ 127-133 (lines=7) @@
124
 * @param  int|float $y
125
 * @return int|float
126
 */
127
function modulo() {
128
    static $modulo = false;
129
    $modulo = $modulo ?: curry(function($x, $y){
130
        return $x % $y;
131
    });
132
    return _apply($modulo, func_get_args());
133
}
134
135
/**
136
 * Computes the sum of an array of numbers.

src/operators.php 1 location

@@ 66-72 (lines=7) @@
63
 * @param  bool $x
64
 * @return bool
65
 */
66
function not() {
67
    static $not = false;
68
    $not = $not ?: curry(function($x) {
69
        return !$x;
70
    });
71
    return _apply($not, func_get_args());
72
}
73
74
/**
75
 * Returns `$x == $y`.