Code Duplication    Length = 10-17 lines in 2 locations

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

@@ 87-103 (lines=17) @@
84
        $this->loadModel('Menu.Menus');
85
        $menu = $this->Menus->get($id);
86
87
        if ($this->request->data()) {
88
            $menu = $this->Menus->patchEntity($menu, $this->request->data(), [
89
                'fieldList' => [
90
                    'title',
91
                    'description',
92
                    'settings',
93
                ],
94
                'validate' => false
95
            ]);
96
97
            if ($this->Menus->save($menu, ['atomic' => true])) {
98
                $this->Flash->success(__d('menu', 'Menu has been saved!'));
99
                $this->redirect($this->referer());
100
            } else {
101
                $this->Flash->danger(__d('menu', 'Menu could not be saved, please check your information'));
102
            }
103
        }
104
105
        $this->title(__d('menu', 'Editing Menu'));
106
        $this->set('menu', $menu);

plugins/User/src/Controller/GatewayController.php 1 location

@@ 267-276 (lines=10) @@
264
        $user = $this->Users->get(user()->id, ['conditions' => ['status' => 1]]);
265
        $languages = LocaleToolbox::languagesList();
266
267
        if ($this->request->data()) {
268
            $user->accessible(['id', 'username', 'roles', 'status'], false);
269
            $user = $this->Users->patchEntity($user, $this->request->data);
270
            if ($this->Users->save($user)) {
271
                $this->Flash->success(__d('user', 'User information successfully updated!'), ['key' => 'user_profile']);
272
                $this->redirect($this->referer());
273
            } else {
274
                $this->Flash->danger(__d('user', 'User information could not be saved, please check your information.'), ['key' => 'user_profile']);
275
            }
276
        }
277
278
        $this->title(__d('user', 'Account'));
279
        $this->set(compact('user', 'languages'));