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
NameTrait
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
 setName
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getName
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 hasName
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 * Name 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 NameTrait
28{
29
30    /**
31     * Name
32     * @var ?string
33     */
34    protected ?string $name = null;
35
36    /**
37     * Set the name
38     *
39     * @param  string $name
40     * @return static
41     */
42    public function setName(string $name): static
43    {
44        $this->name = $name;
45        return $this;
46    }
47
48    /**
49     * Get the name
50     *
51     * @return string|null
52     */
53    public function getName(): string|null
54    {
55        return $this->name;
56    }
57
58    /**
59     * Get the name
60     *
61     * @return bool
62     */
63    public function hasName(): bool
64    {
65        return ($this->name !== null);
66    }
67
68}