Passed
Pull Request — master (#2)
by Pol
02:21
created

E::closure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A E::__invoke() 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 E.
11
 *
12
 * @psalm-template XType
13
 * @psalm-template ResultType
14
 */
15
final class E extends Combinator
16
{
17
    /**
18
     * @var callable
19
     */
20
    private $f;
21
22
    /**
23
     * @var callable
24
     */
25
    private $g;
26
27
    /**
28
     * @var mixed
29
     */
30
    private $x;
31
32
    /**
33
     * @var mixed
34
     */
35
    private $y;
36
37
    /**
38
     * @var mixed
39
     */
40
    private $z;
41
42
    /**
43
     * E constructor.
44
     *
45
     * @psalm-param callable(XType) : ResultType $f
46
     * @psalm-param XType $x
47
     * @psalm-param callable(XType) : ResultType $g
48
     * @psalm-param XType $y
49
     * @psalm-param XType $z
50
     *
51
     * @param callable $f
52
     * @param mixed $x
53
     * @param callable $g
54
     * @param mixed $y
55
     * @param mixed $z
56
     */
57 1
    public function __construct(callable $f, $x, callable $g, $y, $z)
58
    {
59 1
        $this->f = $f;
60 1
        $this->g = $g;
61 1
        $this->x = $x;
62 1
        $this->y = $y;
63 1
        $this->z = $z;
64 1
    }
65
66
    /**
67
     * @psalm-return ResultType
68
     */
69 1
    public function __invoke()
70
    {
71 1
        return (($this->f)($this->x))((($this->g)($this->y))($this->z));
72
    }
73
}
74