Code Duplication    Length = 6-9 lines in 2 locations

plugins/Content/src/Controller/Admin/TypesController.php 1 location

@@ 111-116 (lines=6) @@
108
            $data = $this->request->data();
109
            $type = $this->ContentTypes->patchEntity($type, $data);
110
111
            if ($this->ContentTypes->save($type, ['associated' => ['Roles']])) {
112
                $this->Flash->success(__d('content', 'Content type updated!'));
113
                $this->redirect(['plugin' => 'Content', 'controller' => 'types', 'action' => 'edit', $type->slug]);
114
            } else {
115
                $this->Flash->danger(__d('content', 'Content type could not be updated, check your information.'));
116
            }
117
        } else {
118
            // fix for auto-fill "defaults.*" by FormHelper
119
            $this->request->data = $type->toArray();

plugins/Content/src/Controller/Admin/ManageController.php 1 location

@@ 305-313 (lines=9) @@
302
                'language' => $this->request->data['language'],
303
            ]);
304
305
            if ($this->Contents->save($newContent)) {
306
                $this->Flash->success(__d('content', 'Translation successfully created and was marked as unpublished. Complete the translation before publishing.'));
307
                $this->redirect(['plugin' => 'Content', 'controller' => 'manage', 'action' => 'edit', $newContent->id]);
308
            } else {
309
                $this->Flash->set(__d('content', 'Translation could not be created'), [
310
                    'element' => 'System.installer_errors',
311
                    'params' => ['errors' => $newContent->errors()],
312
                ]);
313
            }
314
        }
315
316
        $this->title(__d('content', 'Translate Content'));