Total Complexity | 5 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | trait SkippableTrait |
||
21 | { |
||
22 | public bool $enabled = true; |
||
23 | |||
24 | /** |
||
25 | * Return true if the behavior is enabled |
||
26 | * on the current model instance |
||
27 | */ |
||
28 | public function getEnabled(): bool |
||
29 | { |
||
30 | return $this->enabled; |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * Set true to enable the behavior |
||
35 | * on the current model instance |
||
36 | */ |
||
37 | public function setEnabled(bool $enabled): void |
||
38 | { |
||
39 | $this->enabled = $enabled; |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Enable the behavior |
||
44 | * on the current model instance |
||
45 | */ |
||
46 | public function enable(): void |
||
47 | { |
||
48 | $this->setEnabled(true); |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * Disable the behavior |
||
53 | * on the current model instance |
||
54 | */ |
||
55 | public function disable(): void |
||
56 | { |
||
57 | $this->setEnabled(false); |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * Return true if the behavior is enabled |
||
62 | * on the current model instance |
||
63 | */ |
||
64 | public function isEnabled(): bool |
||
67 | } |
||
68 | } |
||
69 |