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

SurfaceProvider::__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 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