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