LeaderboardController::actionIndex()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
class LeaderboardController extends GameController
3
{
4
    public function actionIndex($range = '')
5
    {
6
        $this->makeBoard(Leaderboard::TYPE_PLAYER, $range);
7
    }
8
9
    public function actionClub($range = '')
10
    {
11
        $this->makeBoard(Leaderboard::TYPE_CLUB, $range);
12
    }
13
14
    /**
15
     * @param string $range
16
     */
17
    private function makeBoard($type, $range)
18
    {
19
        $board = new Leaderboard;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 12 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
20
        $board->uid = Yii::app()->player->model->uid;
0 ignored issues
show
Bug introduced by
The property uid cannot be accessed from this context as it is declared private in class Leaderboard.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
21
        $board->inClub = Yii::app()->player->model->in_club;
0 ignored issues
show
Bug introduced by
The property inClub cannot be accessed from this context as it is declared private in class Leaderboard.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
22
        $board->boardType = $type;
0 ignored issues
show
Bug introduced by
The property boardType cannot be accessed from this context as it is declared private in class Leaderboard.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
23
24
        switch ($range) {
25
            case 'prev':
26
                $board->setRange(Leaderboard::RANGE_PREVIOUS);
27
                break;
28
            case 'last':
29
                $board->setRange(Leaderboard::RANGE_LAST_SIX);
30
                break;
31
            default:
32
                $board->setRange(Leaderboard::RANGE_ACTUAL);
33
                break;
34
        }
35
        $board->fetchList();
36
37
        $this->render('index', [
38
            'board'=>$board,
39
            ]);
40
    }
41
}
0 ignored issues
show
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
42