HasCode   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 33.33%

Importance

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

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
use Doctrine\ORM\Mapping as ORM;
8
9
trait HasCode
10
{
11
    #[ORM\Column(type: 'string', length: 25, nullable: true, unique: true)]
12
    private ?string $code = null;
13
14
    /**
15
     * Set code.
16
     */
17
    public function setCode(?string $code): void
18
    {
19
        if (is_string($code) && trim($code) === '') {
20
            $code = null;
21
        }
22
23
        $this->code = $code;
24
    }
25
26
    /**
27
     * Get code.
28
     */
29 3
    public function getCode(): ?string
30
    {
31 3
        return $this->code;
32
    }
33
}
34