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

TorpedoFabProvider::setTemplateVariables()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 8
ccs 0
cts 4
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\Lib\Colony\PlanetFieldHostInterface;
6
use Stu\Module\Control\GameControllerInterface;
7
use Stu\Orm\Repository\TorpedoTypeRepositoryInterface;
8
9
final class TorpedoFabProvider implements GuiComponentProviderInterface
10
{
11
    private TorpedoTypeRepositoryInterface $torpedoTypeRepository;
12
13
    public function __construct(
14
        TorpedoTypeRepositoryInterface $torpedoTypeRepository
15
    ) {
16
        $this->torpedoTypeRepository = $torpedoTypeRepository;
17
    }
18
19
    public function setTemplateVariables(
20
        PlanetFieldHostInterface $host,
21
        GameControllerInterface $game
22
    ): void {
23
24
        $game->setTemplateVar(
25
            'BUILDABLE_TORPEDO_TYPES',
26
            $this->torpedoTypeRepository->getForUser($game->getUser()->getId())
27
        );
28
    }
29
}
30