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

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