Passed
Push — master ( 0f152c...b64aff )
by Pol
22:11 queued 07:09
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 8
cts 8
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 __construct() 0 3 1
A on() 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 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