Code Duplication    Length = 14-14 lines in 2 locations

src/controllers/ServerController.php 2 locations

@@ 403-416 (lines=14) @@
400
                        'class' => RedirectAction::class,
401
                    ],
402
                ],
403
                'on beforeSave' => function (Event $event) {
404
                    /** @var \hipanel\actions\Action $action */
405
                    $action = $event->sender;
406
                    $type = Yii::$app->request->post('type');
407
                    $comment = Yii::$app->request->post('comment');
408
                    if (!empty($type)) {
409
                        foreach ($action->collection->models as $model) {
410
                            $model->setAttributes([
411
                                'type' => $type,
412
                                'comment' => $comment,
413
                            ]);
414
                        }
415
                    }
416
                },
417
            ],
418
            'bulk-enable-block-modal' => [
419
                'class' => PrepareBulkAction::class,
@@ 437-450 (lines=14) @@
434
                        'class' => RedirectAction::class,
435
                    ],
436
                ],
437
                'on beforeSave' => function (Event $event) {
438
                    /** @var \hipanel\actions\Action $action */
439
                    $action = $event->sender;
440
                    $type = Yii::$app->request->post('type');
441
                    $comment = Yii::$app->request->post('comment');
442
                    if (!empty($type)) {
443
                        foreach ($action->collection->models as $model) {
444
                            $model->setAttributes([
445
                                'comment' => $comment,
446
                                'type' => $type
447
                            ]);
448
                        }
449
                    }
450
                },
451
            ],
452
            'bulk-disable-block-modal' => [
453
                'class' => PrepareBulkAction::class,