Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Lines | 9 |
Ratio | 56.25 % |
Changes | 0 |
1 | <?php |
||
25 | public function actionIndex($email, $password) |
||
26 | { |
||
27 | $user = UserModel::findByEmail($email); |
||
28 | |||
29 | View Code Duplication | if ($user === null) { |
|
|
|||
30 | $this->stdout(Yii::t('yii2mod.user', 'User is not found.') . "\n", Console::FG_RED); |
||
31 | } else { |
||
32 | if ($user->resetPassword($password)) { |
||
33 | $this->stdout(Yii::t('yii2mod.user', 'Password has been changed.') . "\n", Console::FG_GREEN); |
||
34 | } else { |
||
35 | $this->stdout(Yii::t('yii2mod.user', 'Error occurred while changing password.') . "\n", Console::FG_RED); |
||
36 | } |
||
37 | } |
||
38 | |||
39 | return self::EXIT_CODE_NORMAL; |
||
40 | } |
||
41 | } |
||
42 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.