Code Duplication    Length = 5-5 lines in 3 locations

src/actions/SmartCreateAction.php 1 location

@@ 89-93 (lines=5) @@
86
                'save'    => true,
87
                'success' => [
88
                    'class' => RedirectAction::class,
89
                    'url'   => function ($action) {
90
                        return $action->collection->count() > 1
91
                            ? $action->controller->getSearchUrl()
92
                            : $action->controller->getActionUrl('view', ['id' => $action->model->id]);
93
                    },
94
                ],
95
                'error'   => [
96
                    'class'  => RenderAction::class,

src/actions/SmartUpdateAction.php 2 locations

@@ 160-164 (lines=5) @@
157
                'save'    => true,
158
                'success' => [
159
                    'class' => RedirectAction::class,
160
                    'url'   => function ($action) {
161
                        return $action->collection->count() > 1
162
                            ? $action->controller->getSearchUrl()
163
                            : $action->controller->getActionUrl('view', ['id' => $action->collection->first->id]);
164
                    },
165
                ],
166
                'error'   => [
167
                    'class'  => RenderAction::class,
@@ 207-211 (lines=5) @@
204
                'save'    => true,
205
                'success' => [
206
                    'class' => RedirectAction::class,
207
                    'url'   => function ($action) {
208
                        return $action->collection->count() > 1
209
                            ? $action->controller->getSearchUrl()
210
                            : $action->controller->getActionUrl('view', ['id' => $action->collection->first->id]);
211
                    },
212
                ],
213
            ],
214
        ]);