Total Complexity | 3 |
Total Lines | 73 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | final class E extends Combinator |
||
20 | { |
||
21 | /** |
||
22 | * @var callable |
||
23 | */ |
||
24 | private $f; |
||
25 | |||
26 | /** |
||
27 | * @var callable |
||
28 | */ |
||
29 | private $g; |
||
30 | |||
31 | /** |
||
32 | * @var mixed |
||
33 | */ |
||
34 | private $x; |
||
35 | |||
36 | /** |
||
37 | * @var mixed |
||
38 | */ |
||
39 | private $y; |
||
40 | |||
41 | /** |
||
42 | * @var mixed |
||
43 | */ |
||
44 | private $z; |
||
45 | |||
46 | /** |
||
47 | * E constructor. |
||
48 | 1 | * |
|
49 | * @psalm-param callable(AType): callable(DType): EType $f |
||
50 | 1 | * @psalm-param AType $x |
|
51 | 1 | * @psalm-param callable(BType): callable(CType): DType $g |
|
52 | 1 | * @psalm-param BType $y |
|
53 | 1 | * @psalm-param CType $z |
|
54 | 1 | * |
|
55 | 1 | * @param callable $f |
|
56 | * @param mixed $x |
||
57 | * @param callable $g |
||
58 | * @param mixed $y |
||
59 | * @param mixed $z |
||
60 | 1 | */ |
|
61 | public function __construct(callable $f, $x, callable $g, $y, $z) |
||
68 | 1 | } |
|
69 | |||
70 | /** |
||
71 | 1 | * @psalm-return EType |
|
72 | 1 | */ |
|
73 | public function __invoke() |
||
74 | { |
||
75 | // Demander à Danny :-) |
||
76 | // const E = a => b => c => d => e => a(b)(c(d)(e)) |
||
77 | return (($this->f)($this->x))((($this->g)($this->y))($this->z)); |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * @param callable $a |
||
82 | * |
||
83 | * @return Closure |
||
84 | */ |
||
85 | public static function on(callable $a): Closure |
||
92 | }; |
||
93 | }; |
||
98 |