Failed Conditions
Push — master ( 5e6761...398dce )
by Adrien
04:14 queued 01:57
created

HasName   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

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
    /**
15
     * @var string
16
     * @ORM\Column(type="string", length=191)
17
     */
18
    private $name;
19
20
    /**
21
     * Constructor
22
     *
23
     * @param string $name
24
     */
25
    public function __construct($name = '')
26
    {
27
        $this->setName($name);
28
    }
29
30
    /**
31
     * Set name
32
     *
33
     * @param string $name
34
     */
35
    public function setName($name): void
36
    {
37
        $this->name = $name;
38
    }
39
40
    /**
41
     * Get name
42
     *
43
     * @return string
44
     */
45
    public function getName(): string
46
    {
47
        return (string) $this->name;
48
    }
49
}
50