Code Duplication    Length = 14-14 lines in 2 locations

src/controllers/ServerController.php 2 locations

@@ 414-427 (lines=14) @@
411
                        'class' => RedirectAction::class,
412
                    ],
413
                ],
414
                'on beforeSave' => function (Event $event) {
415
                    /** @var \hipanel\actions\Action $action */
416
                    $action = $event->sender;
417
                    $type = Yii::$app->request->post('type');
418
                    $comment = Yii::$app->request->post('comment');
419
                    if (!empty($type)) {
420
                        foreach ($action->collection->models as $model) {
421
                            $model->setAttributes([
422
                                'type' => $type,
423
                                'comment' => $comment,
424
                            ]);
425
                        }
426
                    }
427
                },
428
            ],
429
            'bulk-enable-block-modal' => [
430
                'class' => PrepareBulkAction::class,
@@ 448-461 (lines=14) @@
445
                        'class' => RedirectAction::class,
446
                    ],
447
                ],
448
                'on beforeSave' => function (Event $event) {
449
                    /** @var \hipanel\actions\Action $action */
450
                    $action = $event->sender;
451
                    $type = Yii::$app->request->post('type');
452
                    $comment = Yii::$app->request->post('comment');
453
                    if (!empty($type)) {
454
                        foreach ($action->collection->models as $model) {
455
                            $model->setAttributes([
456
                                'comment' => $comment,
457
                                'type' => $type,
458
                            ]);
459
                        }
460
                    }
461
                },
462
            ],
463
            'bulk-disable-block-modal' => [
464
                'class' => PrepareBulkAction::class,