Passed
Push — master ( bb5d68...d9c4a7 )
by Nico
56:35 queued 26:36
created

AirfieldProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setTemplateVariables() 0 14 1
A __construct() 0 4 1
1
<?php
2
3
namespace Stu\Module\Colony\Lib\Gui\Component;
4
5
use Stu\Component\Building\BuildingEnum;
6
use Stu\Lib\Colony\PlanetFieldHostInterface;
7
use Stu\Module\Control\GameControllerInterface;
8
use Stu\Orm\Repository\ShipRumpRepositoryInterface;
9
10
final class AirfieldProvider implements GuiComponentProviderInterface
11
{
12
    private ShipRumpRepositoryInterface $shipRumpRepository;
13
14
    public function __construct(
15
        ShipRumpRepositoryInterface $shipRumpRepository
16
    ) {
17
        $this->shipRumpRepository = $shipRumpRepository;
18
    }
19
20
    public function setTemplateVariables(
21
        PlanetFieldHostInterface $host,
22
        GameControllerInterface $game
23
    ): void {
24
25
        $game->setTemplateVar(
26
            'STARTABLE_SHIPS',
27
            $this->shipRumpRepository->getStartableByColony($host->getId())
28
        );
29
        $game->setTemplateVar(
30
            'BUILDABLE_SHIPS',
31
            $this->shipRumpRepository->getBuildableByUserAndBuildingFunction(
32
                $game->getUser()->getId(),
33
                BuildingEnum::BUILDING_FUNCTION_AIRFIELD
34
            )
35
        );
36
    }
37
}
38