| Total Complexity | 3 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | final class Q extends Combinator |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * @var callable |
||
| 21 | */ |
||
| 22 | private $f; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var callable |
||
| 26 | */ |
||
| 27 | private $g; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @var mixed |
||
| 31 | */ |
||
| 32 | private $x; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Q constructor. |
||
| 36 | 1 | * |
|
| 37 | * @psalm-param callable(AType): BType $f |
||
| 38 | 1 | * @psalm-param callable(BType): CType $g |
|
| 39 | 1 | * @psalm-param AType $x |
|
| 40 | 1 | * |
|
| 41 | 1 | * @param callable $f |
|
| 42 | * @param callable $g |
||
| 43 | * @param mixed $x |
||
| 44 | */ |
||
| 45 | public function __construct(callable $f, callable $g, $x) |
||
| 46 | 1 | { |
|
| 47 | $this->f = $f; |
||
| 48 | 1 | $this->g = $g; |
|
| 49 | $this->x = $x; |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @psalm-return CType |
||
| 54 | 1 | */ |
|
| 55 | public function __invoke() |
||
| 56 | { |
||
| 57 | 1 | return ($this->g)((($this->f)($this->x))); |
|
| 58 | 1 | } |
|
| 59 | |||
| 60 | /** |
||
| 61 | * @param callable $a |
||
| 62 | * |
||
| 63 | * @return Closure |
||
| 64 | */ |
||
| 65 | public static function on(callable $a): Closure |
||
| 70 | }; |
||
| 71 | }; |
||
| 72 | } |
||
| 74 |