Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
10 / 10 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
AbstractFinalTrait | |
100.00% |
10 / 10 |
|
100.00% |
4 / 4 |
6 | |
100.00% |
1 / 1 |
setAsAbstract | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
2 | |||
isAbstract | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setAsFinal | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
2 | |||
isFinal | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | /** |
3 | * Pop PHP Framework (http://www.popphp.org/) |
4 | * |
5 | * @link https://github.com/popphp/popphp-framework |
6 | * @author Nick Sagona, III <dev@nolainteractive.com> |
7 | * @copyright Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com) |
8 | * @license http://www.popphp.org/license New BSD License |
9 | */ |
10 | |
11 | /** |
12 | * @namespace |
13 | */ |
14 | namespace Pop\Code\Generator\Traits; |
15 | |
16 | /** |
17 | * Abstract final trait |
18 | * |
19 | * @category Pop |
20 | * @package Pop\Code |
21 | * @author Nick Sagona, III <dev@nolainteractive.com> |
22 | * @copyright Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com) |
23 | * @license http://www.popphp.org/license New BSD License |
24 | * @version 5.0.0 |
25 | */ |
26 | trait AbstractFinalTrait |
27 | { |
28 | |
29 | /** |
30 | * Method abstract flag |
31 | * @var bool |
32 | */ |
33 | protected bool $abstract = false; |
34 | |
35 | /** |
36 | * Method final flag |
37 | * @var bool |
38 | */ |
39 | protected bool $final = false; |
40 | |
41 | /** |
42 | * Set the method abstract flag |
43 | * |
44 | * @param bool $abstract |
45 | * @return static |
46 | */ |
47 | public function setAsAbstract(bool $abstract = true): static |
48 | { |
49 | $this->abstract = $abstract; |
50 | if ($this->abstract) { |
51 | $this->setAsFinal(false); |
52 | } |
53 | return $this; |
54 | } |
55 | |
56 | /** |
57 | * Get the method abstract flag |
58 | * |
59 | * @return bool |
60 | */ |
61 | public function isAbstract(): bool |
62 | { |
63 | return $this->abstract; |
64 | } |
65 | |
66 | /** |
67 | * Set the method final flag |
68 | * |
69 | * @param bool $final |
70 | * @return static |
71 | */ |
72 | public function setAsFinal(bool $final = true): static |
73 | { |
74 | $this->final = $final; |
75 | if ($this->final) { |
76 | $this->setAsAbstract(false); |
77 | } |
78 | return $this; |
79 | } |
80 | |
81 | /** |
82 | * Get the method final flag |
83 | * |
84 | * @return bool |
85 | */ |
86 | public function isFinal(): bool |
87 | { |
88 | return $this->final; |
89 | } |
90 | |
91 | } |