Completed
Push — master ( f8b64c...b3b7dc )
by Kirill
02:31
created

TopAction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 13 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: chrl
5
 * Date: 27/10/16
6
 * Time: 11:08
7
 */
8
9
namespace Chrl\AppBundle\GameAction;
10
11
use Chrl\AppBundle\Entity\Game;
12
13
class TopAction extends BaseGameAction implements GameActionInterface
14
{
15
    public function run($message, $user)
16
    {
17
        $top = $this->gameService->getTopUsers();
18
19
        $text = 'Current top 10: '."\n";
20
        $i = 0;
21
22
        foreach ($top as $user) {
23
            $text .= ++$i.') '.$user['name']." (".$user['points']." points)\n";
24
        }
25
26
        $this->botApi->sendMessage($message['chat']['id'], $text);
27
    }
28
}
29