Code Duplication    Length = 5-5 lines in 3 locations

src/actions/SmartCreateAction.php 1 location

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

src/actions/SmartUpdateAction.php 2 locations

@@ 146-150 (lines=5) @@
143
                'save'    => true,
144
                'success' => [
145
                    'class' => RedirectAction::class,
146
                    'url'   => function ($action) {
147
                        return $action->collection->count() > 1
148
                            ? $action->controller->getSearchUrl()
149
                            : $action->controller->getActionUrl('view', ['id' => $action->collection->first->id]);
150
                    },
151
                ],
152
                'error'   => [
153
                    'class'  => RenderAction::class,
@@ 193-197 (lines=5) @@
190
                'save'    => true,
191
                'success' => [
192
                    'class' => RedirectAction::class,
193
                    'url'   => function ($action) {
194
                        return $action->collection->count() > 1
195
                            ? $action->controller->getSearchUrl()
196
                            : $action->controller->getActionUrl('view', ['id' => $action->collection->first->id]);
197
                    },
198
                ],
199
            ],
200
        ]);