Conditions | 4 |
Paths | 4 |
Total Lines | 17 |
Lines | 9 |
Ratio | 52.94 % |
Changes | 0 |
1 | <?php |
||
24 | public function actionIndex($email) |
||
25 | { |
||
26 | if ($this->confirm(Yii::t('yii2mod.user', 'Are you sure you want to delete this user?'))) { |
||
27 | $user = UserModel::findByEmail($email); |
||
28 | View Code Duplication | if ($user === null) { |
|
|
|||
29 | $this->stdout(Yii::t('yii2mod.user', 'User is not found.') . "\n", Console::FG_RED); |
||
30 | } else { |
||
31 | if ($user->delete()) { |
||
32 | $this->stdout(Yii::t('yii2mod.user', 'User has been deleted.') . "\n", Console::FG_GREEN); |
||
33 | } else { |
||
34 | $this->stdout(Yii::t('yii2mod.user', 'Error occurred while deleting user.') . "\n", Console::FG_RED); |
||
35 | } |
||
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.