PlayerController   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 6
dl 0
loc 72
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
B actionProfile() 0 40 4
A actionBadges() 0 10 1
A advancement() 0 15 3
1
<?php
2
class PlayerController extends GameController
3
{
4
    public $defaultAction = 'profile';
5
6
    public function actionProfile($uid = 0)
7
    {
8
        $player = Yii::app()->player->model;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 11 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...
9
        $playerStats = new PlayerStats;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 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...
10
        $playerStats->uid = $player->uid;
0 ignored issues
show
Bug introduced by
The property uid cannot be accessed from this context as it is declared private in class PlayerStats.

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...
11
12
        //other player
13
        if ($uid) {
14
            $player = new Player;
15
            $player->setAllAttributes($uid);
16
            $playerStats->uid = $uid;
0 ignored issues
show
Bug introduced by
The property uid cannot be accessed from this context as it is declared private in class PlayerStats.

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...
17
18
            if (!$player->uid) {
0 ignored issues
show
Bug introduced by
The property uid cannot be accessed from this context as it is declared private in class Player.

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...
19
                throw new CHttpException(404, 'A keresett felhasználó nem található.');
20
            }
21
            
22
            $duelShiel = new DuelShield();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 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...
23
            $duelShiel->uid = $uid;
0 ignored issues
show
Bug introduced by
The property uid cannot be accessed from this context as it is declared private in class DuelShield.

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...
24
            if ($duelShiel->lifeTime > 0) {
25
                $player->activateDuelShield();
26
            }
27
        }
28
29
        $advancement = $this->advancement($player);
30
31
        //stats
32
        $playerStats->fetchStats();
33
34
        //badges
35
        $badgeList = new BadgeList;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 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...
36
        $badgeList->uid = $uid;
37
        $badgeList->fetchOwned();
38
39
        $this->render('profile', [
40
            'player' => $player,
41
            'playerStats' => $playerStats,
42
            'badgeList' => $badgeList,
43
            'advancement' => $advancement
44
            ]);
45
    }
46
47
    public function actionBadges()
48
    {
49
        $badgeList = new BadgeList;
50
        $badgeList->fetchOwned();
51
        $badgeList->fetchAll();
52
53
        $this->render('badges', [
54
            'badgeList' => $badgeList
55
            ]);
56
    }
57
58
    protected function advancement($player)
59
    {
60
        $advancement = null;
61
        if ($player->status_points) {
62
            $advancement = new Advancement;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 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...
63
            $advancement->uid = $player->uid;
0 ignored issues
show
Bug introduced by
The property uid cannot be accessed from this context as it is declared private in class Advancement.

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...
64
65
            $increment_id = Yii::app()->request->getPost('increment_id', 0);
66
            if ($increment_id) {
67
                $advancement->incrementForStatuspoint($increment_id);
68
            }
69
        }
70
71
        return $advancement;
72
    }
73
}
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...
74