Code Duplication    Length = 24-24 lines in 2 locations

Admin/Admin.php 2 locations

@@ 209-232 (lines=24) @@
206
     *
207
     * @return bool true if the entity was saved without errors
208
     */
209
    public function save()
210
    {
211
        try {
212
            foreach ($this->entities as $entity) {
213
                $this
214
                    ->dataProvider
215
                    ->save($entity);
216
            }
217
            // inform user everything went fine
218
            $this
219
                ->messageHandler
220
                ->handleSuccess('lag.admin.' . $this->name . '.saved');
221
            $success = true;
222
        } catch (Exception $e) {
223
            $this
224
                ->messageHandler
225
                ->handleError(
226
                    'lag.admin.saved_errors',
227
                    "An error has occurred while saving an entity : {$e->getMessage()}, stackTrace: {$e->getTraceAsString()}"
228
                );
229
            $success = false;
230
        }
231
        return $success;
232
    }
233
234
    /**
235
     * Remove an entity with data provider
@@ 239-262 (lines=24) @@
236
     *
237
     * @return bool true if the entity was saved without errors
238
     */
239
    public function remove()
240
    {
241
        try {
242
            foreach ($this->entities as $entity) {
243
                $this
244
                    ->dataProvider
245
                    ->remove($entity);
246
            }
247
            // inform user everything went fine
248
            $this
249
                ->messageHandler
250
                ->handleSuccess('lag.admin.' . $this->name . '.deleted');
251
            $success = true;
252
        } catch (Exception $e) {
253
            $this
254
                ->messageHandler
255
                ->handleError(
256
                    'lag.admin.deleted_errors',
257
                    "An error has occurred while deleting an entity : {$e->getMessage()}, stackTrace: {$e->getTraceAsString()} "
258
                );
259
            $success = false;
260
        }
261
        return $success;
262
    }
263
264
    /**
265
     * Generate a route for admin and action name (like lag.admin.my_admin)