Code Duplication    Length = 10-13 lines in 2 locations

src/actions/SmartUpdateAction.php 2 locations

@@ 123-135 (lines=13) @@
120
                'class'  => RenderAction::class,
121
                'data'   => $this->data,
122
                'view'   => $this->view,
123
                'params' => function ($action) {
124
                    $models = $this->fetchModels();
125
                    if (empty($models)) {
126
                        throw new NotFoundHttpException('Search result is empty.');
127
                    }
128
                    foreach ($models as $model) {
129
                        $model->scenario = $this->scenario;
130
                    }
131
132
                    return [
133
                        'models' => $models,
134
                        'model' => reset($models),
135
                    ];
136
                },
137
            ],
138
            'GET ajax' => [
@@ 143-152 (lines=10) @@
140
                    'class' => RenderAjaxAction::class,
141
                    'data'   => $this->data,
142
                    'view'   => $this->view,
143
                    'params' => function ($action) {
144
                        $models = $this->fetchModels();
145
                        foreach ($models as $model) {
146
                            $model->scenario = $this->scenario;
147
                        }
148
149
                        return [
150
                            'models' => $models,
151
                            'model' => reset($models),
152
                        ];
153
                    },
154
                ],
155
            ],