Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
4 / 4 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
NamespaceTrait | |
100.00% |
4 / 4 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
setNamespace | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getNamespace | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
hasNamespace | |
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 | use Pop\Code\Generator\NamespaceGenerator; |
17 | |
18 | /** |
19 | * Namespace trait |
20 | * |
21 | * @category Pop |
22 | * @package Pop\Code |
23 | * @author Nick Sagona, III <dev@nolainteractive.com> |
24 | * @copyright Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com) |
25 | * @license http://www.popphp.org/license New BSD License |
26 | * @version 5.0.0 |
27 | */ |
28 | trait NamespaceTrait |
29 | { |
30 | |
31 | /** |
32 | * Namespace generator object |
33 | * @var ?NamespaceGenerator |
34 | */ |
35 | protected ?NamespaceGenerator $namespace = null; |
36 | |
37 | |
38 | /** |
39 | * Set the namespace generator object |
40 | * |
41 | * @param NamespaceGenerator $namespace |
42 | * @return static |
43 | */ |
44 | public function setNamespace(NamespaceGenerator $namespace): static |
45 | { |
46 | $this->namespace = $namespace; |
47 | return $this; |
48 | } |
49 | |
50 | /** |
51 | * Access the namespace generator object |
52 | * |
53 | * @return NamespaceGenerator|null |
54 | */ |
55 | public function getNamespace(): NamespaceGenerator|null |
56 | { |
57 | return $this->namespace; |
58 | } |
59 | |
60 | /** |
61 | * Has a namespace generator object |
62 | * |
63 | * @return bool |
64 | */ |
65 | public function hasNamespace(): bool |
66 | { |
67 | return ($this->namespace !== null); |
68 | } |
69 | |
70 | } |