ContestController::actionView()   B
last analyzed

Complexity

Conditions 6
Paths 18

Size

Total Lines 39
Code Lines 25

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 39
rs 8.439
c 0
b 0
f 0
cc 6
eloc 25
nc 18
nop 1
1
<?php
2
class ContestController extends GameController
3
{
4
    public function actionIndex()
5
    {
6
        $cl = new ContestList();
7
        $this->redirect(['/contest/view', 'id'=>$cl->lastId]);
8
    }
9
10
    public function actionView($id)
11
    {
12
        $cl = new ContestList();
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...
13
        $cl->id = $id;
0 ignored issues
show
Bug introduced by
The property id cannot be accessed from this context as it is declared private in class ContestList.

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 2 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...
14
        $cl->uid = Yii::app()->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 ContestList.

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...
15
16
        //redirections
17
        if (!$cl->isValid) {
0 ignored issues
show
Bug introduced by
The property isValid cannot be accessed from this context as it is declared private in class ContestList.

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...
18
            $lastId = $cl->lastId;
19
            if ($lastId) {
20
                Yii::app()->user->setFlash('error', 'A keresett verseny nem található, helyette a legújabbat láthatod.');
21
                $this->redirect(['/contest/view', 'id'=>$lastId]);
22
            } else {
23
                Yii::app()->user->setFlash('error', 'Még nem található horgászvarseny a játékban, de ez hamarosan megváltozik.');
24
                $this->redirect('/site');
25
            }
26
        }
27
28
        $cl->fetchDetails();
29
        $cl->fetchList();
30
        if ($cl->maxScore) {
0 ignored issues
show
Bug introduced by
The property maxScore cannot be accessed from this context as it is declared private in class ContestList.

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...
31
            $cl->listBestPlayers();
32
        }
33
        $cl->seeContest();
34
35
        //claim prize
36
        $r = Yii::app()->request;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 8 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...
37
        $getPrize = $r->getParam('getPrize', 0);
38
        if ($getPrize) {
39
            if ($cl->claimPrize()) {
40
                Yii::app()->user->setFlash('success', 'A nyereményt jóváírtuk. Gratulálunk!');
41
                $this->redirect(['/contest/view', 'id'=>$cl->id]);
0 ignored issues
show
Bug introduced by
The property id cannot be accessed from this context as it is declared private in class ContestList.

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...
42
            }
43
        }
44
45
        $this->render('view', [
46
            'contestList'=>$cl,
47
            ]);
48
    }
49
50
    public function actionHistory()
51
    {
52
        $cl = new ContestList();
53
54
        $this->render('history', [
55
            'contestList'=>$cl,
56
            ]);
57
    }
58
}
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...
59