Code Duplication    Length = 11-14 lines in 3 locations

src/controllers/AccountController.php 2 locations

@@ 135-148 (lines=14) @@
132
                        'class' => RedirectAction::class,
133
                    ],
134
                ],
135
                'on beforeSave' => function (Event $event) {
136
                    /** @var \hipanel\actions\Action $action */
137
                    $action = $event->sender;
138
                    $type = Yii::$app->request->post('type');
139
                    $comment = Yii::$app->request->post('comment');
140
                    if (!empty($type)) {
141
                        foreach ($action->collection->models as $model) {
142
                            $model->setAttributes([
143
                                'type' => $type,
144
                                'comment' => $comment,
145
                            ]);
146
                        }
147
                    }
148
                },
149
            ],
150
            'bulk-enable-block-modal' => [
151
                'class' => PrepareBulkAction::class,
@@ 169-179 (lines=11) @@
166
                        'class' => RedirectAction::class,
167
                    ],
168
                ],
169
                'on beforeSave' => function (Event $event) {
170
                    /** @var \hipanel\actions\Action $action */
171
                    $action = $event->sender;
172
                    $type = Yii::$app->request->post('type');
173
                    $comment = Yii::$app->request->post('comment');
174
                    if (!empty($type)) {
175
                        foreach ($action->collection->models as $model) {
176
                            $model->setAttribute('comment', $comment);
177
                        }
178
                    }
179
                },
180
            ],
181
            'bulk-disable-block-modal' => [
182
                'class' => PrepareBulkAction::class,

src/controllers/HdomainController.php 1 location

@@ 141-154 (lines=14) @@
138
                        'class' => RedirectAction::class,
139
                    ],
140
                ],
141
                'on beforeSave' => function (Event $event) {
142
                    /** @var \hipanel\actions\Action $action */
143
                    $action = $event->sender;
144
                    $type = Yii::$app->request->post('type');
145
                    $comment = Yii::$app->request->post('comment');
146
                    if (!empty($type)) {
147
                        foreach ($action->collection->models as $model) {
148
                            $model->setAttributes([
149
                                'type' => $type,
150
                                'comment' => $comment,
151
                            ]);
152
                        }
153
                    }
154
                },
155
            ],
156
            'bulk-enable-block-modal' => [
157
                'class' => PrepareBulkAction::class,