| Conditions | 3 |
| Paths | 8 |
| Total Lines | 17 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | public function run($id) |
||
| 35 | { |
||
| 36 | $organization = Module::getOrganization($id); |
||
| 37 | try { |
||
| 38 | if ($organization->removeMember(Yii::$app->user->identity)) { |
||
| 39 | Yii::$app->session->setFlash(Module::SESSION_KEY_RESULT, Module::RESULT_SUCCESS); |
||
| 40 | Yii::$app->session->setFlash(Module::SESSION_KEY_MESSAGE, ''); |
||
| 41 | return $this->controller->redirect(['index']); |
||
|
|
|||
| 42 | } else { |
||
| 43 | Yii::$app->session->setFlash(Module::SESSION_KEY_RESULT, Module::RESULT_FAILED); |
||
| 44 | Yii::$app->session->setFlash(Module::SESSION_KEY_MESSAGE, ''); |
||
| 45 | } |
||
| 46 | } catch (\Exception $ex) { |
||
| 47 | throw new UnauthorizedHttpException($ex->getMessage()); |
||
| 48 | } |
||
| 49 | return $this->controller->redirect(['index']); |
||
| 50 | } |
||
| 51 | } |
||
| 52 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: