Code Duplication    Length = 7-9 lines in 2 locations

src/get.php 1 location

@@ 9-15 (lines=7) @@
6
7
function get(...$args)
8
{
9
    $get = partial(function (array $xss, $x, $notfound = false) {
10
        $fn = ifElse(has($x), function (array $xss) use ($x) {
11
            return $xss[$x];
12
        }, always($notfound));
13
14
        return $fn($xss);
15
    });
16
17
    return $get(...$args);
18
}

src/when.php 1 location

@@ 7-15 (lines=9) @@
4
5
const when = __NAMESPACE__.'\when';
6
7
function when(...$args)
8
{
9
    $when = partial(function (callable $pred, callable $success, $x) {
10
        $fn = ifElse($pred, $success, id);
11
        return $fn($x);
12
    });
13
14
    return $when(...$args);
15
}
16