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

I   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

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