Completed
Push — master ( 6d1e94...2cd5f8 )
by Kirill
02:09
created

NextAction   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 5
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 13 1
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($game);
0 ignored issues
show
Bug introduced by
The variable $game seems only to be defined at a later point. Did you maybe move this code here without moving the variable definition?

This error can happen if you refactor code and forget to move the variable initialization.

Let’s take a look at a simple example:

function someFunction() {
    $x = 5;
    echo $x;
}

The above code is perfectly fine. Now imagine that we re-order the statements:

function someFunction() {
    echo $x;
    $x = 5;
}

In that case, $x would be read before it is initialized. This was a very basic example, however the principle is the same for the found issue.

Loading history...
10
11
		$this->botApi->sendMessage(
12
			$game->chatId,
13
			'Ok, changing question.',
14
			'markdown'
15
		);
16
		$this->gameService->em->persist($game);
17
		$this->gameService->em->flush();
18
		$this->gameService->askQuestion($game);
19
    }
20
}
21