Passed
Push — master ( bf860f...1dd8f7 )
by Nico
57:55 queued 29:36
created

SwitchView::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Module\Game\Action\SwitchView;
6
7
use request;
8
use Stu\Component\Game\ModuleViewEnum;
9
use Stu\Module\Control\ActionControllerInterface;
10
use Stu\Module\Control\GameControllerInterface;
11
use Stu\Module\Control\ViewContextTypeEnum;
12
use Stu\Module\Game\View\ShowInnerContent\ShowInnerContent;
13
14
final class SwitchView implements ActionControllerInterface
15
{
16
    public const ACTION_IDENTIFIER = 'B_SWITCH_VIEW';
17
18 3
    public function handle(GameControllerInterface $game): void
19
    {
20 3
        $moduleView = ModuleViewEnum::from(request::getStringFatal('view'));
21
22 1
        $game->setView(ShowInnerContent::VIEW_IDENTIFIER);
23 1
        $game->setViewContext(ViewContextTypeEnum::VIEW, $moduleView);
24
    }
25
26
    public function performSessionCheck(): bool
27
    {
28
        return false;
29
    }
30
}
31