| 1 | <?php |
||
| 7 | final class Conditional |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var callable |
||
| 11 | */ |
||
| 12 | private $if; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @var callable |
||
| 16 | */ |
||
| 17 | private $then; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var callable |
||
| 21 | */ |
||
| 22 | private $else; |
||
| 23 | |||
| 24 | private function __construct(callable $if, callable $then, callable $else) |
||
| 30 | |||
| 31 | public static function ifThenElse(callable $if, callable $then, callable $else) |
||
| 35 | |||
| 36 | public function __invoke(... $args) |
||
| 44 | } |
||
| 45 |