Passed
Pull Request — master (#1699)
by Nico
43:19 queued 18:45
created

ResearchProvider::__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 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 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Module\Game\Lib\View\Provider;
6
7
use Stu\Module\Control\GameControllerInterface;
8
use Stu\Module\Game\Lib\View\Provider\ViewComponentProviderInterface;
9
use Stu\Module\Research\TechlistRetrieverInterface;
10
11
final class ResearchProvider implements ViewComponentProviderInterface
12
{
13
    private TechlistRetrieverInterface $techlistRetriever;
14
15
    public function __construct(
16
        TechlistRetrieverInterface $techlistRetriever
17
    ) {
18
        $this->techlistRetriever = $techlistRetriever;
19
    }
20
21
    public function setTemplateVariables(GameControllerInterface $game): void
22
    {
23
        $user = $game->getUser();
24
25
        $game->setTemplateVar(
26
            'RESEARCH_LIST',
27
            $this->techlistRetriever->getResearchList($user)
28
        );
29
        $game->setTemplateVar(
30
            'RESEARCHED_LIST',
31
            $this->techlistRetriever->getResearchedList($user)
32
        );
33
    }
34
}
35