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

DatabaseProvider::__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\Component\Database\DatabaseEntryTypeEnum;
8
use Stu\Module\Control\GameControllerInterface;
9
use Stu\Orm\Repository\DatabaseCategoryRepositoryInterface;
10
11
final class DatabaseProvider implements ViewComponentProviderInterface
12
{
13
    private DatabaseCategoryRepositoryInterface $databaseCategoryRepository;
14
15
    public function __construct(
16
        DatabaseCategoryRepositoryInterface $databaseCategoryRepository
17
    ) {
18
        $this->databaseCategoryRepository = $databaseCategoryRepository;
19
    }
20
21
    public function setTemplateVariables(GameControllerInterface $game): void
22
    {
23
        $game->setTemplateVar(
24
            'RUMP_LIST',
25
            $this->databaseCategoryRepository->getByTypeId(DatabaseEntryTypeEnum::DATABASE_TYPE_RUMP)
26
        );
27
        $game->setTemplateVar(
28
            'RPG_SHIP_LIST',
29
            $this->databaseCategoryRepository->getByTypeId(DatabaseEntryTypeEnum::DATABASE_TYPE_RPGSHIPS)
30
        );
31
        $game->setTemplateVar(
32
            'POI_LIST',
33
            $this->databaseCategoryRepository->getByTypeId(DatabaseEntryTypeEnum::DATABASE_TYPE_POI)
34
        );
35
        $game->setTemplateVar(
36
            'MAP_LIST',
37
            $this->databaseCategoryRepository->getByTypeId(DatabaseEntryTypeEnum::DATABASE_TYPE_MAP)
38
        );
39
    }
40
}
41