| Total Complexity | 8 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | final class LastTutorial implements ActionControllerInterface |
||
| 14 | { |
||
| 15 | public const ACTION_IDENTIFIER = 'B_TUTORIAL_BACK'; |
||
| 16 | |||
| 17 | |||
| 18 | private UserRepositoryInterface $userRepository; |
||
| 19 | |||
| 20 | public function __construct( |
||
| 24 | } |
||
| 25 | |||
| 26 | public function handle(GameControllerInterface $game): void |
||
| 27 | { |
||
| 28 | $user = $game->getUser(); |
||
| 29 | |||
| 30 | if ((int) $user->getState() === UserEnum::USER_STATE_COLONIZATION_SHIP || (int) $user->getState() === UserEnum::USER_STATE_UNCOLONIZED) { |
||
| 31 | throw new AccessViolation(); |
||
| 32 | } |
||
| 33 | |||
| 34 | if ((int) $user->getState() === UserEnum::USER_STATE_TUTORIAL2) { |
||
| 35 | $user->setState(UserEnum::USER_STATE_TUTORIAL1); |
||
| 36 | } |
||
| 37 | |||
| 38 | if ((int) $user->getState() === UserEnum::USER_STATE_TUTORIAL3) { |
||
| 39 | $user->setState(UserEnum::USER_STATE_TUTORIAL2); |
||
| 40 | } |
||
| 41 | |||
| 42 | if ((int) $user->getState() === UserEnum::USER_STATE_TUTORIAL4) { |
||
| 43 | $user->setState(UserEnum::USER_STATE_TUTORIAL3); |
||
| 44 | } |
||
| 45 | |||
| 46 | $this->userRepository->save($user); |
||
| 47 | } |
||
| 48 | |||
| 49 | |||
| 50 | public function performSessionCheck(): bool |
||
| 53 | } |
||
| 54 | } |
||
| 55 |