Completed
Push — master ( 663af3...8c89d0 )
by vistart
20:53
created

JoinController::actionIndex()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 2
eloc 6
nc 2
nop 1
1
<?php
2
3
/**
4
 *  _   __ __ _____ _____ ___  ____  _____
5
 * | | / // // ___//_  _//   ||  __||_   _|
6
 * | |/ // /(__  )  / / / /| || |     | |
7
 * |___//_//____/  /_/ /_/ |_||_|     |_|
8
 * @link https://vistart.me/
9
 * @copyright Copyright (c) 2016 - 2017 vistart
10
 * @license https://vistart.me/license/
11
 */
12
13
14
namespace rhosocial\organization\web\organization\controllers;
15
16
use rhosocial\organization\web\organization\Module;
17
use yii\base\InvalidParamException;
18
use yii\web\BadRequestHttpException;
19
use yii\web\Controller;
20
use yii\web\Response;
21
22
/**
23
 * Class JoinController
24
 * @package rhosocial\organization\web\organization\controllers
25
 * @version 1.0
26
 * @author vistart <[email protected]>
27
 */
28
class JoinController extends Controller
29
{
30
    public $layout = 'main';
31
32
    /**
33
     * @param $entrance
34
     * @throws BadRequestHttpException
35
     * @return Response|string
36
     */
37
    public function actionIndex($entrance)
38
    {
39
        try {
40
            $organization = Module::getOrganizationByEntrance($entrance);
41
        } catch (InvalidParamException $ex) {
42
            throw new BadRequestHttpException($ex->getMessage());
43
        }
44
        return $this->render('index', ['organization' => $organization]);
45
    }
46
47
    /**
48
     * @param $entrance
49
     * @throws BadRequestHttpException
50
     * @return Response|string
51
     */
52
    public function actionJoin($entrance)
53
    {
54
        try {
55
            $organization = Module::getOrganizationByEntrance($entrance);
0 ignored issues
show
Unused Code introduced by
$organization is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
56
        } catch (InvalidParamException $ex) {
57
            throw new BadRequestHttpException($ex->getMessage());
58
        }
59
    }
60
}
61