Code Duplication    Length = 10-10 lines in 2 locations

action.post.php 2 locations

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