Passed
Push — dev ( 91186a...20d5e2 )
by Janko
05:17
created

ShipSubspaceDataProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Test Coverage

Coverage 62.5%

Importance

Changes 0
Metric Value
eloc 22
dl 0
loc 45
ccs 15
cts 24
cp 0.625
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A provideDataForMap() 0 10 1
A __construct() 0 12 1
A provideDataForSystemMap() 0 9 1
A getDataClassString() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Lib\Map\VisualPanel\Layer\DataProvider\Subspace;
6
7
use Override;
0 ignored issues
show
Bug introduced by
The type Override was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Stu\Lib\Map\VisualPanel\Layer\Data\SpacecraftSignatureData;
9
use Stu\Lib\Map\VisualPanel\PanelBoundaries;
10
use Stu\Module\Control\StuTime;
11
use Stu\Orm\Repository\LocationRepositoryInterface;
12
use Stu\Orm\Repository\MapRepositoryInterface;
13
use Stu\Orm\Repository\StarSystemMapRepositoryInterface;
14
15
final class ShipSubspaceDataProvider extends AbstractSubspaceDataProvider
16
{
17 1
    public function __construct(
18
        private int $shipId,
19
        private readonly StuTime $stuTime,
20
        LocationRepositoryInterface $locationRepository,
21
        MapRepositoryInterface $mapRepository,
22
        StarSystemMapRepositoryInterface $starSystemMapRepository,
23
        private ?int $rumpId = null
24
    ) {
25 1
        parent::__construct(
26 1
            $locationRepository,
27 1
            $mapRepository,
28 1
            $starSystemMapRepository
29 1
        );
30
    }
31
32 1
    #[Override]
33
    protected function getDataClassString(): string
34
    {
35 1
        return SpacecraftSignatureData::class;
36
    }
37
38
    #[Override]
39
    protected function provideDataForMap(PanelBoundaries $boundaries): array
40
    {
41
        return $this->mapRepository->getShipSubspaceLayerData(
42
            $boundaries,
43
            $this->shipId,
44
            $this->stuTime->time(),
45
            $this->createResultSetMapping(),
46
            true,
47
            $this->rumpId
48
        );
49
    }
50
51 1
    #[Override]
52
    protected function provideDataForSystemMap(PanelBoundaries $boundaries): array
53
    {
54 1
        return $this->starSystemMapRepository->getShipSubspaceLayerData(
55 1
            $boundaries,
56 1
            $this->shipId,
57 1
            $this->stuTime->time(),
58 1
            $this->createResultSetMapping(),
59 1
            $this->rumpId
60 1
        );
61
    }
62
}
63