Passed
Push — dev ( 0f4afd...29c427 )
by Janko
25:18 queued 14:48
created

SpacecraftCountDataProviderFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 0
nc 1
nop 3
dl 0
loc 5
ccs 2
cts 2
cp 1
crap 1
rs 10
c 1
b 1
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Lib\Map\VisualPanel\Layer\DataProvider\Spacecraftcount;
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\DataProvider\AbstractPanelLayerDataProvider;
9
use Stu\Orm\Repository\LocationRepositoryInterface;
10
use Stu\Orm\Repository\MapRepositoryInterface;
11
use Stu\Orm\Repository\StarSystemMapRepositoryInterface;
12
13
final class SpacecraftCountDataProviderFactory implements SpacecraftCountDataProviderFactoryInterface
14
{
15 2
    public function __construct(
16
        private LocationRepositoryInterface $locationRepository,
17
        private MapRepositoryInterface $mapRepository,
18
        private StarSystemMapRepositoryInterface $starSystemMapRepository
19 2
    ) {}
20
21 4
    #[Override]
22
    public function getDataProvider(int $id, SpacecraftCountLayerTypeEnum $type): AbstractPanelLayerDataProvider
23
    {
24
25 4
        return match ($type) {
26 4
            SpacecraftCountLayerTypeEnum::ALL =>
27 4
            new GeneralSpacecraftCountDataProvider($this->locationRepository, $this->mapRepository, $this->starSystemMapRepository),
28 4
            SpacecraftCountLayerTypeEnum::ALLIANCE_ONLY =>
29
            new AllianceSpacecraftCountDataProvider($id, $this->locationRepository, $this->mapRepository, $this->starSystemMapRepository),
30 4
            SpacecraftCountLayerTypeEnum::USER_ONLY =>
31
            new UserSpacecraftCountDataProvider($id, $this->locationRepository, $this->mapRepository, $this->starSystemMapRepository),
32 4
            SpacecraftCountLayerTypeEnum::SPACECRAFT_ONLY =>
33 4
            new SpacecraftSpacecraftCountDataProvider($id, $this->locationRepository, $this->mapRepository, $this->starSystemMapRepository),
34 4
        };
35
    }
36
}
37