Failed Conditions
Push — master ( 1176d7...a379d1 )
by Adrien
16:06
created

HasCode   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 33.33%

Importance

Changes 0
Metric Value
wmc 4
eloc 6
c 0
b 0
f 0
dl 0
loc 27
ccs 2
cts 6
cp 0.3333
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setCode() 0 7 3
A getCode() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Application\Traits;
6
7
trait HasCode
8
{
9
    /**
10
     * @var null|string
11
     *
12
     * @ORM\Column(type="string", length=25, nullable=true, unique=true)
13
     */
14
    private $code;
15
16
    /**
17
     * Set code.
18
     */
19
    public function setCode(?string $code): void
20
    {
21
        if (is_string($code) && trim($code) === '') {
22
            $code = null;
23
        }
24
25
        $this->code = $code;
26
    }
27
28
    /**
29
     * Get code.
30
     */
31 3
    public function getCode(): ?string
32
    {
33 3
        return $this->code;
34
    }
35
}
36