Passed
Push — master ( 6b02b9...a180a6 )
by Nico
26:39 queued 18:43
created

MapItem   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 30
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getMapGraphicPath() 0 11 2
A __construct() 0 6 1
A getMap() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Module\Admin\View\Map\EditSection;
6
7
use Stu\Component\Map\EncodedMapInterface;
8
use Stu\Orm\Entity\MapInterface;
9
10
class MapItem
11
{
12
    private EncodedMapInterface $encodedMap;
13
14
    private MapInterface $map;
15
16
    public function __construct(
17
        EncodedMapInterface $encodedMap,
18
        MapInterface $map
19
    ) {
20
        $this->encodedMap = $encodedMap;
21
        $this->map = $map;
22
    }
23
24
    public function getMap(): MapInterface
25
    {
26
        return $this->map;
27
    }
28
29
    public function getMapGraphicPath(): string
30
    {
31
        $layer = $this->map->getLayer();
32
33
        if ($layer->isEncoded()) {
34
            return $this->encodedMap->getEncodedMapPath(
35
                $this->map->getFieldId(),
36
                $layer
37
            );
38
        }
39
        return sprintf('%d/%d.png', $layer->getId(), $this->map->getFieldId());
40
    }
41
}
42