Code Duplication    Length = 6-7 lines in 3 locations

src/controllers/ServiceController.php 2 locations

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

src/controllers/AccountController.php 1 location

@@ 77-83 (lines=7) @@
74
                'findOptions' => [
75
                    'with_mail_settings' => true,
76
                ],
77
                'on beforePerform' => function (Event $event) {
78
                    /** @var \hipanel\actions\SearchAction $action */
79
                    $action = $event->sender;
80
                    $dataProvider = $action->getDataProvider();
81
                    $dataProvider->query->joinWith(['blocking']);
82
                    $dataProvider->query->andWhere(['with_blocking' => 1]);
83
                },
84
                'data' => function ($action) {
85
                    return [
86
                        'blockReasons' => $action->controller->getBlockReasons(),