Code Duplication    Length = 10-10 lines in 2 locations

action.post.php 2 locations

@@ 79-88 (lines=10) @@
76
        $forums      = [];
77
        $criteria    = new \Criteria('post_id', '(' . implode(',', $post_id) . ')', 'IN');
78
        $postsObject = $postHandler->getObjects($criteria, true);
79
        foreach ($post_id as $post) {
80
            /** @var Newbb\Post $postObject */
81
            $postObject = $postsObject[$post];
82
            if (!empty($topic_id) && $topic_id !== $postObject->getVar('topic_id')) {
83
                continue;
84
            }
85
            $postHandler->approve($postObject);
86
            $topics[$postObject->getVar('topic_id')] = $post;
87
            $forums[$postObject->getVar('forum_id')] = 1;
88
        }
89
        foreach (array_keys($topics) as $topic) {
90
            $topicHandler->synchronization($topic);
91
        }
@@ 131-140 (lines=10) @@
128
        rsort($post_id);
129
        $topics = [];
130
        $forums = [];
131
        foreach ($post_id as $post) {
132
            $postObject = $postHandler->get($post);
133
            if (!empty($topic_id) && $topic_id !== $postObject->getVar('topic_id')) {
134
                continue;
135
            }
136
            $topics[$postObject->getVar('topic_id')] = 1;
137
            $forums[$postObject->getVar('forum_id')] = 1;
138
            $postHandler->delete($postObject, true);
139
            unset($postObject);
140
        }
141
        foreach (array_keys($topics) as $topic) {
142
            $topicHandler->synchronization($topic);
143
        }