Code Duplication    Length = 9-10 lines in 3 locations

answer.php 3 locations

@@ 155-163 (lines=9) @@
152
                $faqObj->sendNotifications([Constants::SF_NOT_FAQ_PUBLISHED]);
153
                break;
154
155
            case 2:
156
                // Answer for an open question submitted, auto-approved; became Q&A, need approbation
157
                if (isset($_POST['notifypub']) && 1 == $_POST['notifypub']) {
158
                    require_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
159
                    $notificationHandler->subscribe('faq', $faqObj->faqid(), 'approved', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
160
                }
161
                // Send notifications
162
                $faqObj->sendNotifications([Constants::SF_NOT_FAQ_SUBMITTED]);
163
                break;
164
165
            case 3:
166
                // Answer submitted, needs approbation
@@ 165-173 (lines=9) @@
162
                $faqObj->sendNotifications([Constants::SF_NOT_FAQ_SUBMITTED]);
163
                break;
164
165
            case 3:
166
                // Answer submitted, needs approbation
167
                if (isset($_POST['notifypub']) && 1 == $_POST['notifypub']) {
168
                    require_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
169
                    $notificationHandler->subscribe('question', $newAnswerObj->answerid(), 'approved', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
170
                }
171
                // Send notifications
172
                $faqObj->sendNotifications([Constants::SF_NOT_QUESTION_SUBMITTED]);
173
                break;
174
            case 4:
175
                // New answer submitted for a published Q&A, auto-approved
176
                // TODO...
@@ 179-188 (lines=10) @@
176
                // TODO...
177
                break;
178
179
            case 5:
180
                // New answer submitted for a published Q&A, need approbation
181
                // Send notifications
182
                if (isset($_POST['notifypub']) && 1 == $_POST['notifypub']) {
183
                    require_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
184
                    $notificationHandler->subscribe('faq', $newAnswerObj->answerid(), 'answer_approved', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
185
                }
186
187
                $faqObj->sendNotifications([Constants::SF_NOT_NEW_ANSWER_PROPOSED]);
188
                break;
189
        }
190
191
        redirect_header('index.php', 3, $redirect_msg);