Code Duplication    Length = 12-12 lines in 2 locations

src/Zicht/Itertools/reductions.php 2 locations

@@ 70-81 (lines=12) @@
67
 *
68
 * @return \Closure
69
 */
70
function min()
71
{
72
    return function ($a, $b) {
73
        if (!(is_numeric($a) || $a instanceof \DateTime)) {
74
            throw new \InvalidArgumentException(sprintf('Argument $A must be numeric to determine minimum, not %s', is_object($a) ? get_class($a) : gettype($a)));
75
        }
76
        if (!(is_numeric($b) || $b instanceof \DateTime)) {
77
            throw new \InvalidArgumentException(sprintf('Argument $B must be numeric to determine minimum, not %s', is_object($b) ? get_class($b) : gettype($b)));
78
        }
79
        return $a < $b ? $a : $b;
80
    };
81
}
82
83
/**
84
 * Returns a closure that returns the largest of two numbers
@@ 88-99 (lines=12) @@
85
 *
86
 * @return \Closure
87
 */
88
function max()
89
{
90
    return function ($a, $b) {
91
        if (!(is_numeric($a) || $a instanceof \DateTime)) {
92
            throw new \InvalidArgumentException(sprintf('Argument $A must be numeric to determine maximum, not %s', is_object($a) ? get_class($a) : gettype($a)));
93
        }
94
        if (!(is_numeric($b) || $b instanceof \DateTime)) {
95
            throw new \InvalidArgumentException(sprintf('Argument $B must be numeric to determine maximum, not %s', is_object($b) ? get_class($b) : gettype($b)));
96
        }
97
        return $a < $b ? $b : $a;
98
    };
99
}
100
101
/**
102
 * Returns a closure that concatenates two strings using $glue