| 1 | <?php |
||
| 9 | trait ConditionTrait |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var mixed |
||
| 13 | */ |
||
| 14 | protected $value; |
||
| 15 | /** |
||
| 16 | * @var bool |
||
| 17 | */ |
||
| 18 | private $approved = true; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @param bool $condition |
||
| 22 | * |
||
| 23 | * @return $this |
||
| 24 | */ |
||
| 25 | 37 | final protected function approveIf(bool $condition): self |
|
| 31 | |||
| 32 | /** |
||
| 33 | * @return bool |
||
| 34 | */ |
||
| 35 | 37 | public function isApproved(): bool |
|
| 39 | |||
| 40 | /** |
||
| 41 | * @param mixed $value |
||
| 42 | * |
||
| 43 | * @return mixed |
||
| 44 | */ |
||
| 45 | 1 | public function then($value) |
|
| 49 | |||
| 50 | /** |
||
| 51 | * @param mixed $default |
||
| 52 | * |
||
| 53 | * @return mixed |
||
| 54 | */ |
||
| 55 | public function else($default) |
||
| 59 | } |
||
| 60 |