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

ShowBuoyList   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 20
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 8 1
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
}