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

TorpedoFabProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setTemplateVariables() 0 8 1
A __construct() 0 4 1
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