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

SurfaceProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setTemplateVariables() 0 7 2
A __construct() 0 4 1
1
<?php
2
3
namespace Stu\Module\Colony\Lib\Gui\Component;
4
5
use request;
6
use Stu\Lib\Colony\PlanetFieldHostInterface;
7
use Stu\Module\Colony\Lib\ColonyLibFactoryInterface;
8
use Stu\Module\Control\GameControllerInterface;
9
10
final class SurfaceProvider implements GuiComponentProviderInterface
11
{
12
    private ColonyLibFactoryInterface $colonyLibFactory;
13
14
    public function __construct(
15
        ColonyLibFactoryInterface $colonyLibFactory
16
    ) {
17
        $this->colonyLibFactory = $colonyLibFactory;
18
    }
19
20
    public function setTemplateVariables(
21
        PlanetFieldHostInterface $host,
22
        GameControllerInterface $game
23
    ): void {
24
        $game->setTemplateVar(
25
            'SURFACE',
26
            $this->colonyLibFactory->createColonySurface($host, request::getInt('bid') !== 0 ? request::getInt('bid') : null)
27
        );
28
    }
29
}
30