Code Duplication    Length = 7-7 lines in 3 locations

backend/controllers/PostController.php 2 locations

@@ 212-218 (lines=7) @@
209
                $this->getPermission($model);
210
                $model->updateAttributes(['status' => Post::STATUS_PUBLISH]);
211
            }
212
        } elseif (Yii::$app->request->post('action') === Post::STATUS_DRAFT) {
213
            foreach (Yii::$app->request->post('ids', []) as $id) {
214
                $model = $this->findModel($id);
215
                $this->getPermission($model);
216
                $model->updateAttributes(['status' => Post::STATUS_DRAFT]);
217
            }
218
        } elseif (Yii::$app->request->post('action') === Post::STATUS_PRIVATE) {
219
            foreach (Yii::$app->request->post('ids', []) as $id) {
220
                $model = $this->findModel($id);
221
                $this->getPermission($model);
@@ 224-230 (lines=7) @@
221
                $this->getPermission($model);
222
                $model->updateAttributes(['status' => Post::STATUS_PRIVATE]);
223
            }
224
        } elseif (Yii::$app->request->post('action') === Post::STATUS_TRASH) {
225
            foreach (Yii::$app->request->post('ids', []) as $id) {
226
                $model = $this->findModel($id);
227
                $this->getPermission($model);
228
                $model->updateAttributes(['status' => Post::STATUS_TRASH]);
229
            }
230
        } elseif (Yii::$app->request->post('action') === Post::STATUS_REVIEW) {
231
            foreach (Yii::$app->request->post('ids', []) as $id) {
232
                $model = $this->findModel($id);
233
                $this->getPermission($model);

backend/controllers/UserController.php 1 location

@@ 170-176 (lines=7) @@
167
                $model = $this->findModel($id);
168
                $model->updateAttributes(['status' => User::STATUS_ACTIVE]);
169
            }
170
        } elseif (Yii::$app->request->post('action') === 'not-active') {
171
            foreach (Yii::$app->request->post('ids', []) as $id) {
172
                $model = $this->findModel($id);
173
                $this->checkPermission($model);
174
                $model->updateAttributes(['status' => User::STATUS_NOT_ACTIVE]);
175
            }
176
        } elseif (Yii::$app->request->post('action') === 'removed') {
177
            foreach (Yii::$app->request->post('ids', []) as $id) {
178
                $model = $this->findModel($id);
179
                $this->checkPermission($model);