| Total Complexity | 4 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Coverage | 16.66% |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | final class ShowWasteMenu implements ViewControllerInterface |
||
| 17 | { |
||
| 18 | public const string VIEW_IDENTIFIER = 'SHOW_WASTEMENU'; |
||
|
|
|||
| 19 | |||
| 20 | /** |
||
| 21 | * @param SpacecraftLoaderInterface<SpacecraftWrapperInterface> $spaceCraftLoader |
||
| 22 | */ |
||
| 23 | 1 | public function __construct( |
|
| 24 | private SpacecraftLoaderInterface $spaceCraftLoader |
||
| 25 | 1 | ) {} |
|
| 26 | |||
| 27 | #[Override] |
||
| 28 | public function handle(GameControllerInterface $game): void |
||
| 29 | { |
||
| 30 | $userId = $game->getUser()->getId(); |
||
| 31 | |||
| 32 | $spacecraft = $this->spaceCraftLoader->getByIdAndUser(request::getIntFatal('id'), $userId); |
||
| 33 | |||
| 34 | if (!$game->getUser()->isNpc()) { |
||
| 35 | return; |
||
| 36 | } |
||
| 37 | |||
| 38 | $game->setPageTitle(_('Müllverbrennung')); |
||
| 39 | if ($game->getViewContext(ViewContextTypeEnum::NO_AJAX) === true) { |
||
| 40 | $game->showMacro('html/spacecraft/waste.twig'); |
||
| 41 | } else { |
||
| 42 | $game->setMacroInAjaxWindow('html/spacecraft/waste.twig'); |
||
| 43 | } |
||
| 44 | |||
| 45 | $game->setTemplateVar('SPACECRAFT', $spacecraft); |
||
| 46 | } |
||
| 47 | } |