Code Duplication    Length = 5-6 lines in 3 locations

src/Controller/Admin/SettingsController.php 2 locations

@@ 52-57 (lines=6) @@
49
        if ($this->request->is('post')) {
50
            $setting->last_updated_user_id = $this->Auth->user('id');
51
52
            if ($this->Settings->save($setting)) {
53
                Cache::delete('settings', 'database');
54
                $this->Flash->success(__d('admin', 'This setting has been created successfully !'));
55
56
                return $this->redirect(['action' => 'index']);
57
            }
58
        }
59
60
        $this->set(compact('setting'));
@@ 88-93 (lines=6) @@
85
86
            $setting->last_updated_user_id = $this->Auth->user('id');
87
88
            if ($this->Settings->save($setting)) {
89
                Cache::delete('settings', 'database');
90
                $this->Flash->success(__d('admin', 'This setting has been edited successfully !'));
91
92
                return $this->redirect(['action' => 'index']);
93
            }
94
        }
95
96
        $this->set(compact('setting'));

src/Controller/Admin/PollsController.php 1 location

@@ 99-103 (lines=5) @@
96
            $poll->polls_answers = $pollAnswers;
97
            $poll->unsetProperty('anwsers');
98
99
            if ($poll = $this->Polls->save($poll)) {
100
                $this->Flash->success(__d('admin', 'Your poll has been created successfully !'));
101
102
                return $this->redirect(['action' => 'index']);
103
            }
104
        }
105
106
        $this->set(compact('poll', 'articles'));