| Conditions | 4 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | public function run() |
||
| 25 | { |
||
| 26 | $model = new ContactForm(); |
||
| 27 | if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) { |
||
| 28 | Yii::$app->session->setFlash('contactFormSubmitted'); |
||
| 29 | |||
| 30 | if ($this->redirect) { |
||
| 31 | return $this->controller->redirect(['/', '#' => $this->anchor]); |
||
|
|
|||
| 32 | } else { |
||
| 33 | return $this->controller->refresh('#' . $this->anchor); |
||
| 34 | } |
||
| 35 | } |
||
| 36 | |||
| 37 | return $this->controller->render('contact', compact('model')); |
||
| 38 | } |
||
| 39 | } |
||
| 40 |
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: