Passed
Pull Request — master (#1696)
by Nico
49:43 queued 22:34
created

FighterShipyardProvider::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 2
cp 0
crap 2
rs 10
c 1
b 0
f 0
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 FighterShipyardProvider 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
            'BUILDABLE_SHIPS',
27
            $this->shipRumpRepository->getBuildableByUserAndBuildingFunction(
28
                $game->getUser()->getId(),
29
                BuildingEnum::BUILDING_FUNCTION_FIGHTER_SHIPYARD
30
            )
31
        );
32
    }
33
}
34