| Conditions | 4 |
| Paths | 4 |
| Total Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | public function run() |
||
| 34 | { |
||
| 35 | if ($this->make(DefaultEmailChangeStrategy::class, [$this->form])->run()) { |
||
| 36 | $token = TokenFactory::makeConfirmOldMailToken($this->form->getUser()->id); |
||
|
|
|||
| 37 | $mailService = MailFactory::makeReconfirmationMailerService($this->form->getUser(), $token); |
||
| 38 | |||
| 39 | if ($mailService->run()) { |
||
| 40 | // unset flags if they exist |
||
| 41 | $this->form->getUser()->flags &= ~User::NEW_EMAIL_CONFIRMED; |
||
| 42 | $this->form->getUser()->flags &= ~User::OLD_EMAIL_CONFIRMED; |
||
| 43 | if ($this->form->getUser()->save(false)) { |
||
| 44 | Yii::$app |
||
| 45 | ->session |
||
| 46 | ->setFlash( |
||
| 47 | 'info', |
||
| 48 | Yii::t( |
||
| 49 | 'usuario', |
||
| 50 | 'We have sent confirmation links to both old and new email addresses. You must click both links to complete your request.' |
||
| 51 | ) |
||
| 52 | ); |
||
| 53 | |||
| 54 | return true; |
||
| 55 | } |
||
| 56 | } |
||
| 57 | } |
||
| 58 | |||
| 59 | return false; |
||
| 60 | } |
||
| 61 | } |
||
| 62 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: