Code Duplication    Length = 9-9 lines in 2 locations

src/controllers/HubController.php 1 location

@@ 29-37 (lines=9) @@
26
                }
27
            ],
28
            'view' => [
29
                'on beforePerform' => function (Event $event) {
30
                    /** @var \hipanel\actions\SearchAction $action */
31
                    $action = $event->sender;
32
                    $dataProvider = $action->getDataProvider();
33
                    $dataProvider->query->joinWith(['bindings']);
34
                    $dataProvider->query
35
                        ->andWhere(['with_bindings' => 1])
36
                        ->andWhere(['with_servers' => 1]);
37
                },
38
                'class' => ViewAction::class,
39
            ],
40
            'create' => [

src/controllers/ServerController.php 1 location

@@ 114-122 (lines=9) @@
111
                'class' => SmartUpdateAction::class,
112
                'success' => Yii::t('hipanel:server:hub', 'Monitoring properties was changed'),
113
                'view' => 'monitoringSettings',
114
                'on beforeFetch' => function (Event $event) {
115
                    /** @var \hipanel\actions\SearchAction $action */
116
                    $action = $event->sender;
117
                    $dataProvider = $action->getDataProvider();
118
                    $dataProvider->query->joinWith(['monitoringSettings']);
119
                    $dataProvider->query
120
                        ->andWhere(['with_monitoringSettings' => 1])
121
                        ->select(['*']);
122
                },
123
                'data' => function ($action) {
124
                    return [
125
                        'nicMediaOptions' => $action->controller->getFullFromRef('type,nic_media'),