Code Duplication    Length = 8-10 lines in 3 locations

src/controllers/ServerController.php 1 location

@@ 341-350 (lines=10) @@
338
                        'class' => RedirectAction::class,
339
                    ],
340
                ],
341
                'on beforeSave' => function (Event $event) {
342
                    /** @var \hipanel\actions\Action $action */
343
                    $action = $event->sender;
344
                    $comment = Yii::$app->request->post('comment');
345
                    if (!empty($type)) {
346
                        foreach ($action->collection->models as $model) {
347
                            $model->setAttribute('comment', $comment);
348
                        }
349
                    }
350
                },
351
            ],
352
            'bulk-disable-block-modal' => [
353
                'class' => PrepareBulkAction::class,

src/controllers/PreOrderController.php 2 locations

@@ 61-68 (lines=8) @@
58
                        'class' => RedirectAction::class,
59
                    ],
60
                ],
61
                'on beforeSave' => function (Event $event) {
62
                    /** @var \hipanel\actions\Action $action */
63
                    $action = $event->sender;
64
                    $comment = Yii::$app->request->post('comment');
65
                    foreach ($action->collection->models as $model) {
66
                        $model->setAttribute('comment', $comment);
67
                    }
68
                },
69
            ],
70
            'bulk-approve-modal' => [
71
                'class' => PrepareBulkAction::class,
@@ 89-96 (lines=8) @@
86
                        'class' => RedirectAction::class,
87
                    ],
88
                ],
89
                'on beforeSave' => function (Event $event) {
90
                    /** @var \hipanel\actions\Action $action */
91
                    $action = $event->sender;
92
                    $comment = Yii::$app->request->post('comment');
93
                    foreach ($action->collection->models as $model) {
94
                        $model->setAttribute('comment', $comment);
95
                    }
96
                },
97
            ],
98
            'bulk-reject-modal' => [
99
                'class' => PrepareBulkAction::class,