Passed
Push — master ( 519921...cb1b1b )
by Pol
50:23 queued 48:27
created

I::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
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 I.
11
 *
12
 * @psalm-template AType
13
 */
14
final class I extends Combinator
15
{
16
    /**
17
     * @var mixed
18
     */
19
    private $x;
20
21
    /**
22
     * I constructor.
23
     *
24
     * @psalm-param AType $x
25
     *
26
     * @param mixed $x
27
     */
28 1
    public function __construct($x)
29
    {
30 1
        $this->x = $x;
31 1
    }
32
33
    /**
34
     * @psalm-return AType
35
     */
36 1
    public function __invoke()
37
    {
38 1
        return $this->x;
39
    }
40
41
    /**
42
     * @param callable $a
43
     *
44
     * @return mixed
45
     */
46 1
    public static function on($a)
47
    {
48 1
        return (new self($a))();
49
    }
50
}
51