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