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

TopAction::run()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 7
nc 2
nop 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