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 | final protected function approveIf(bool $condition) |
||
31 | |||
32 | /** |
||
33 | * @return bool |
||
34 | */ |
||
35 | public function isApproved(): bool |
||
39 | |||
40 | /** |
||
41 | * @param $value |
||
42 | * |
||
43 | * @return mixed |
||
44 | */ |
||
45 | public function then($value) |
||
49 | |||
50 | /** |
||
51 | * @param $default |
||
52 | * |
||
53 | * @return mixed |
||
54 | */ |
||
55 | public function else($default) |
||
59 | } |