Code Duplication    Length = 6-9 lines in 4 locations

plugins/Admin/src/Controller/SmileyCodesController.php 1 location

@@ 132-140 (lines=9) @@
129
            return;
130
        }
131
        $smiley = $this->SmileyCodes->get($id);
132
        if ($this->SmileyCodes->delete($smiley)) {
133
            $this->Flash->set(
134
                __('Smiley code deleted'),
135
                ['element' => 'error']
136
            );
137
            $this->redirect(['action' => 'index']);
138
139
            return;
140
        }
141
        $this->Flash->set(
142
            __('Smiley code was not deleted'),
143
            ['element' => 'error']

plugins/Admin/src/Controller/SmiliesController.php 1 location

@@ 126-131 (lines=6) @@
123
            return;
124
        }
125
        $smiley = $this->Smilies->get($id);
126
        if ($this->Smilies->delete($smiley)) {
127
            $this->Flash->set(__('Smiley deleted.'), ['element' => 'success']);
128
            $this->redirect(['action' => 'index']);
129
130
            return;
131
        }
132
        $this->Flash->set(__('Smily was not deleted.'), ['element' => 'error']);
133
        $this->redirect(['action' => 'index']);
134
    }

plugins/Admin/src/Controller/UsersController.php 1 location

@@ 114-121 (lines=8) @@
111
                    __("You are not authorized to delete a user."),
112
                    ['element' => 'error']
113
                );
114
            } elseif ($this->Users->deleteAllExceptEntries($id)) {
115
                $this->Flash->set(
116
                    __('User {0} deleted.', $readUser->get('username')),
117
                    ['element' => 'success']
118
                );
119
120
                return $this->redirect('/');
121
            } else {
122
                $this->Flash->set(
123
                    __("Couldn't delete user."),
124
                    ['element' => 'error']

src/Controller/EntriesController.php 1 location

@@ 432-438 (lines=7) @@
429
        // perform move operation
430
        $targetId = $this->request->getData('targetId');
431
        if (!empty($targetId)) {
432
            if ($this->Entries->threadMerge($sourceId, $targetId)) {
433
                $this->redirect('/entries/view/' . $sourceId);
434
435
                return;
436
            } else {
437
                $this->Flash->set(__('Error'), ['element' => 'error']);
438
            }
439
        }
440
441
        $this->viewBuilder()->setLayout('Admin.admin');