HasName   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 6
c 1
b 0
f 0
dl 0
loc 27
ccs 0
cts 6
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
A setName() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ecodev\Felix\Model\Traits;
6
7
use Doctrine\ORM\Mapping as ORM;
8
9
/**
10
 * Trait for all objects with a name.
11
 */
12
trait HasName
13
{
14
    #[ORM\Column(type: 'string', length: 191)]
15
    private string $name = '';
16
17
    /**
18
     * Constructor.
19
     */
20
    public function __construct(string $name = '')
21
    {
22
        $this->setName($name);
23
    }
24
25
    /**
26
     * Set name.
27
     */
28
    public function setName(string $name): void
29
    {
30
        $this->name = $name;
31
    }
32
33
    /**
34
     * Get name.
35
     */
36
    public function getName(): string
37
    {
38
        return $this->name;
39
    }
40
}
41