Code Duplication    Length = 6-10 lines in 5 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 2 locations

@@ 560-566 (lines=7) @@
557
        // perform move operation
558
        $targetId = $this->request->getData('targetId');
559
        if (!empty($targetId)) {
560
            if ($this->Entries->threadMerge($sourceId, $targetId)) {
561
                $this->redirect('/entries/view/' . $sourceId);
562
563
                return;
564
            } else {
565
                $this->Flash->set(__('Error'), ['element' => 'error']);
566
            }
567
        }
568
569
        $this->viewBuilder()->setLayout('Admin.admin');
@@ 396-405 (lines=10) @@
393
        $data = $this->request->getData();
394
        if (!empty($data)) {
395
            $newEntry = $this->Entries->updatePosting($posting, $data, $this->CurrentUser);
396
            if ($newEntry) {
397
                return $this->redirect(['action' => 'view', $id]);
398
            } else {
399
                $this->Flash->set(
400
                    __(
401
                        'Something clogged the tubes. Could not save entry. Try again.'
402
                    ),
403
                    ['element' => 'warning']
404
                );
405
            }
406
        }
407
408
        // show editing form