Code Duplication    Length = 6-6 lines in 3 locations

src/controllers/ServiceController.php 2 locations

@@ 53-58 (lines=6) @@
50
        return array_merge(parent::actions(), [
51
            'index' => [
52
                'class' => IndexAction::class,
53
                'on beforePerform' => function (Event $event) {
54
                    /** @var \hipanel\actions\SearchAction $action */
55
                    $action = $event->sender;
56
                    $dataProvider = $action->getDataProvider();
57
                    $dataProvider->query->joinWith(['ips'])->addSelect('objects_count');
58
                },
59
                'filterStorageMap' => [
60
                    'ip' => 'hosting.ip.ip',
61
                    'state' => 'hosting.service.state',
@@ 75-80 (lines=6) @@
72
            ],
73
            'view' => [
74
                'class' => ViewAction::class,
75
                'on beforeSave' => function (Event $event) {
76
                    /** @var \hipanel\actions\SearchAction $action */
77
                    $action = $event->sender;
78
                    $dataProvider = $action->getDataProvider();
79
                    $dataProvider->query->joinWith('ips')->addSelect('objects_count');
80
                },
81
            ],
82
            'create' => [
83
                'class' => SmartCreateAction::class,

src/controllers/HdomainController.php 1 location

@@ 82-87 (lines=6) @@
79
                    'show_aliases'  => true,
80
                    'with_blocking' => true,
81
                ],
82
                'on beforePerform' => function (Event $event) {
83
                    /** @var \hipanel\actions\SearchAction $action */
84
                    $action = $event->sender;
85
                    $dataProvider = $action->getDataProvider();
86
                    $dataProvider->query->joinWith(['blocking']);
87
                },
88
                'data' => function ($action) {
89
                    return [
90
                        'blockReasons' => $this->getBlockReasons(),