NextAction::run()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 15
rs 9.4285
cc 2
eloc 10
nc 2
nop 2
1
<?php
2
3
namespace Chrl\AppBundle\GameAction;
4
5
class NextAction extends BaseGameAction implements GameActionInterface
6
{
7
    public function run($message, $user)
8
    {
9
        $game = $this->gameService->findGame($message);
10
11
        if ($game->status == 1) {
12
            $this->botApi->sendMessage(
13
                $game->chatId,
14
                'Ok, changing question.',
15
                'markdown'
16
            );
17
            $this->gameService->em->persist($game);
18
            $this->gameService->em->flush();
19
            $this->gameService->askQuestion($game);
20
        }
21
    }
22
}
23