Passed
Push — master ( 0f152c...b64aff )
by Pol
22:11 queued 07:09
created

I::on()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 0
cp 0
crap 2
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
 * @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 1
     * @psalm-param AType $x
25
     *
26 1
     * @param mixed $x
27 1
     */
28
    public function __construct($x)
29
    {
30
        $this->x = $x;
31
    }
32 1
33
    /**
34 1
     * @psalm-return AType
35
     */
36
    public function __invoke()
37
    {
38
        return $this->x;
39
    }
40 1
41
    /**
42
     * @param callable $a
43 1
     *
44 1
     * @return mixed
45
     */
46
    public static function on($a)
47
    {
48
        return (new self($a))();
49
    }
50
}
51