Passed
Push — master ( 55cfd1...cb4d54 )
by Nico
22:41
created

ColonyShieldLayerRenderer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 13
ccs 7
cts 7
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A render() 0 10 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Lib\Map\VisualPanel\Layer\Render;
6
7
use Stu\Lib\Map\VisualPanel\AbstractVisualPanel;
8
use Stu\Lib\Map\VisualPanel\Layer\Data\ColonyShieldData;
9
use Stu\Lib\Map\VisualPanel\Layer\Data\CellDataInterface;
10
use Stu\Lib\Map\VisualPanel\Layer\PanelLayerEnum;
11
12
final class ColonyShieldLayerRenderer implements LayerRendererInterface
13
{
14
    /** @param ColonyShieldData $data */
15 2
    public function render(CellDataInterface $data, AbstractVisualPanel $panel): string
16
    {
17 2
        if (!$data->getShieldState()) {
0 ignored issues
show
Bug introduced by
The method getShieldState() does not exist on Stu\Lib\Map\VisualPanel\...\Data\CellDataInterface. It seems like you code against a sub-type of Stu\Lib\Map\VisualPanel\...\Data\CellDataInterface such as Stu\Lib\Map\VisualPanel\...r\Data\ColonyShieldData. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

17
        if (!$data->/** @scrutinizer ignore-call */ getShieldState()) {
Loading history...
18 1
            return '';
19
        }
20
21 1
        return sprintf(
22 1
            '<img src="/assets/planets/s1.png" class="lssColoShield" style="z-index: %d; %s" />',
23 1
            PanelLayerEnum::COLONY_SHIELD->value,
24 1
            $panel->getHeightAndWidth()
25 1
        );
26
    }
27
}
28