Code Duplication    Length = 10-11 lines in 2 locations

src/controllers/HdomainController.php 1 location

@@ 154-163 (lines=10) @@
151
                        'class' => RedirectAction::class,
152
                    ],
153
                ],
154
                'on beforeSave' => function (Event $event) {
155
                    /** @var \hipanel\actions\Action $action */
156
                    $action = $event->sender;
157
                    $comment = Yii::$app->request->post('comment');
158
                    if (!empty($type)) {
159
                        foreach ($action->collection->models as $model) {
160
                            $model->setAttribute('comment', $comment);
161
                        }
162
                    }
163
                },
164
            ],
165
            'bulk-disable-block-modal' => [
166
                'class' => PrepareBulkAction::class,

src/controllers/AccountController.php 1 location

@@ 201-211 (lines=11) @@
198
                        'class' => RedirectAction::class,
199
                    ],
200
                ],
201
                'on beforeSave' => function (Event $event) {
202
                    /** @var \hipanel\actions\Action $action */
203
                    $action = $event->sender;
204
                    $type = Yii::$app->request->post('type');
205
                    $comment = Yii::$app->request->post('comment');
206
                    if (!empty($type)) {
207
                        foreach ($action->collection->models as $model) {
208
                            $model->setAttribute('comment', $comment);
209
                        }
210
                    }
211
                },
212
            ],
213
            'bulk-disable-block-modal' => [
214
                'class' => PrepareBulkAction::class,