1 | <?php |
||
11 | trait EnforcementTrait |
||
12 | { |
||
13 | /** |
||
14 | * @var Enforcement|null |
||
15 | */ |
||
16 | private $enforcement; |
||
17 | |||
18 | /** |
||
19 | * @param string|Exception $exception |
||
20 | * @param array ...$args |
||
21 | * |
||
22 | * @return $this |
||
23 | */ |
||
24 | final public function orThrow($exception, ...$args) |
||
32 | |||
33 | /** |
||
34 | * @return bool |
||
35 | */ |
||
36 | final public function verify(): bool |
||
46 | |||
47 | /** |
||
48 | * @param bool $condition |
||
49 | * |
||
50 | * @return $this |
||
51 | */ |
||
52 | final protected function enforce(bool $condition) |
||
63 | |||
64 | /** |
||
65 | * @param Enforcement $enforcement |
||
66 | */ |
||
67 | private function approveEnforcementWith(Enforcement $enforcement) |
||
77 | |||
78 | /** |
||
79 | * |
||
80 | */ |
||
81 | private function approveEnforcement() |
||
87 | |||
88 | /** |
||
89 | * @return bool |
||
90 | */ |
||
91 | final protected function isEnforcementFulfilled(): bool |
||
95 | |||
96 | /** |
||
97 | * @return bool |
||
98 | */ |
||
99 | private function hasEnforcement(): bool |
||
103 | } |