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

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