Passed
Push — dev ( 45bf8d...5b8f46 )
by Janko
10:07
created

AnomalyData   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 23
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getAnomalyTypes() 0 10 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Lib\Map\VisualPanel\Layer\Data;
6
7
use Doctrine\ORM\Mapping\Column;
8
use Doctrine\ORM\Mapping\Entity;
9
10
#[Entity]
11
class AnomalyData extends AbstractData
12
{
13 2
    public function __construct(
14
        int $x,
15
        int $y,
16
        #[Column(type: 'string', nullable: true)]
17
        private ?string $anomalytypes = null
18
    ) {
19 2
        parent::__construct($x, $y);
20
    }
21
22
    /** @return null|array<string> */
23 2
    public function getAnomalyTypes(): ?array
24
    {
25
        if (
26 2
            $this->anomalytypes === null
27 2
            || $this->anomalytypes === ''
28
        ) {
29 1
            return null;
30
        }
31
32 1
        return explode(",", $this->anomalytypes);
33
    }
34
}
35