Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| NameTrait | |
100.00% |
4 / 4 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
| setName | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| hasName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Pop PHP Framework (https://www.popphp.org/) |
| 4 | * |
| 5 | * @link https://github.com/popphp/popphp-framework |
| 6 | * @author Nick Sagona, III <dev@noladev.com> |
| 7 | * @copyright Copyright (c) 2009-2025 NOLA Interactive, LLC. |
| 8 | * @license https://www.popphp.org/license New BSD License |
| 9 | */ |
| 10 | |
| 11 | /** |
| 12 | * @namespace |
| 13 | */ |
| 14 | namespace Pop\Code\Generator\Traits; |
| 15 | |
| 16 | /** |
| 17 | * Name trait |
| 18 | * |
| 19 | * @category Pop |
| 20 | * @package Pop\Code |
| 21 | * @author Nick Sagona, III <dev@noladev.com> |
| 22 | * @copyright Copyright (c) 2009-2025 NOLA Interactive, LLC. |
| 23 | * @license https://www.popphp.org/license New BSD License |
| 24 | * @version 5.0.4 |
| 25 | */ |
| 26 | trait NameTrait |
| 27 | { |
| 28 | |
| 29 | /** |
| 30 | * Name |
| 31 | * @var ?string |
| 32 | */ |
| 33 | protected ?string $name = null; |
| 34 | |
| 35 | /** |
| 36 | * Set the name |
| 37 | * |
| 38 | * @param string $name |
| 39 | * @return static |
| 40 | */ |
| 41 | public function setName(string $name): static |
| 42 | { |
| 43 | $this->name = $name; |
| 44 | return $this; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Get the name |
| 49 | * |
| 50 | * @return string|null |
| 51 | */ |
| 52 | public function getName(): string|null |
| 53 | { |
| 54 | return $this->name; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Get the name |
| 59 | * |
| 60 | * @return bool |
| 61 | */ |
| 62 | public function hasName(): bool |
| 63 | { |
| 64 | return ($this->name !== null); |
| 65 | } |
| 66 | |
| 67 | } |