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

I   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 6
c 1
b 0
f 0
dl 0
loc 32
ccs 7
cts 7
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 3 1
A __construct() 0 3 1
A closure() 0 4 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 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