Passed
Push — master ( bef509...69203b )
by Pol
01:52
created

K::toClosure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace loophp\combinator\Combinator;
6
7
use loophp\combinator\Combinator;
8
9
/**
10
 * Class K.
11
 */
12
final class K extends Combinator
13
{
14
    /**
15
     * @var mixed
16
     */
17
    private $x;
18
19
    /**
20
     * @var mixed
21
     */
22
    private $y;
23
24
    /**
25
     * K constructor.
26
     *
27
     * @param mixed $x
28
     * @param mixed $y
29
     */
30 1
    public function __construct($x, $y)
31
    {
32 1
        $this->x = $x;
33 1
        $this->y = $y;
34 1
    }
35
36
    /**
37
     * @return mixed
38
     */
39 1
    public function __invoke()
40
    {
41 1
        return $this->x;
42
    }
43
44
    /**
45
     * @return callable
46
     */
47 1
    public static function closure(): callable
48
    {
49
        return static function ($x, $y) {
50 1
            return (new self($x, $y))();
51 1
        };
52
    }
53
}
54