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

SurfaceProvider::setTemplateVariables()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
nc 1
nop 2
dl 0
loc 7
ccs 0
cts 4
cp 0
crap 6
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