Test Failed
Pull Request — master (#1764)
by Nico
12:03
created

ShowBuoyList::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Module\Ship\View\ShowBuoyList;
6
7
use Stu\Module\Control\GameControllerInterface;
8
use Stu\Module\Control\ViewControllerInterface;
9
use Stu\Orm\Repository\BuoyRepositoryInterface;
10
11
final class ShowBuoyList implements ViewControllerInterface
12
{
13
    public const VIEW_IDENTIFIER = 'SHOW_BUOY_LIST';
14
15
    private BuoyRepositoryInterface $buoyRepository;
16
17
    public function __construct(
18
        BuoyRepositoryInterface $buoyRepository,
19
    ) {
20
        $this->buoyRepository = $buoyRepository;
21
    }
22
23
    public function handle(GameControllerInterface $game): void
24
    {
25
        $userId = $game->getUser()->getId();
26
27
        $buoy = $this->buoyRepository->findByUserId($userId);
28
29
        $game->setTemplateVar('BUOY', $buoy);
30
        $game->showMacro('html/buoylist.twig');
31
    }
32
}