|
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); |
|
|
|
|
|
|
56
|
|
|
} catch (InvalidParamException $ex) { |
|
57
|
|
|
throw new BadRequestHttpException($ex->getMessage()); |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.