GateController::actionLogout()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
class GateController extends LoginController
3
{
4
    public function actionIndex()
0 ignored issues
show
Coding Style introduced by
actionIndex uses the super-global variable $_SESSION which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
5
    {
6
        $session = Yii::app()->session;
7
        $session->open();
8
        $this->incrementLoginDays(@$_SESSION['uid']);
9
10
        $b = new CommonBadgeActivator;
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...
11
        $b->uid = @$_SESSION['uid'];
12
        $b->triggerLoginDays();
13
14
        $this->redirect(['check']);
15
    }
16
    public function actionCheck()
17
    {
18
        $enabledCookie = isset(Yii::app()->request->cookies['PHPSESSID']->value);
19
        if ($enabledCookie) {
20
            $this->redirect(Yii::app()->homeUrl);
21
        }
22
23
        $this->render('check');
24
    }
25
26
    public function actionCookie()
27
    {
28
        $this->render('check');
29
    }
30
31
    public function actionLogout()
32
    {
33
        header('Location: ' . Yii::app()->params['wlineHost'] . 'menu.php#btm');
34
        Yii::app()->end();
35
    }
36
37
    public function actionForum()
38
    {
39
        header('Location: ' . Yii::app()->params['wlineHost'] . 'forum_read.php?id=1865');
40
        Yii::app()->end();
41
    }
42
43
    public function actionBank()
44
    {
45
        header('Location: ' . Yii::app()->params['wlineHost'] . 'bank.php?page=zset_to_gold');
46
        Yii::app()->end();
47
    }
48
49 View Code Duplication
    protected function beforeAction($action)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
50
    {
51
        if (!Yii::app()->params['isPartOfWline']) {
52
            throw new CHttpException(1, 'Ez az aloldal nem használható. ' . CHtml::link('főoldal', '/')); //own nick
53
        }
54
55
        return true;
56
    }
57
}
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...
58