Code Duplication    Length = 17-18 lines in 2 locations

src/Controller/ConversationsController.php 2 locations

@@ 133-150 (lines=18) @@
130
        $array = $this->request->getData('conversations');
131
132
        switch ($action) {
133
            case "star":
134
                foreach ($array as $conversationId) {
135
                    $this->ConversationsUsers->updateAll(
136
                        ['is_star' => 1],
137
                        [
138
                            'conversation_id' => $conversationId,
139
                            'user_id' => $this->Auth->user('id')
140
                        ]
141
                    );
142
                }
143
144
                $json['message'] = __d('conversations', 'Your conversation(s) has been Stared.');
145
                $json['error'] = '0';
146
                $json['redirect'] = Router::url(['action' => 'index']);
147
148
                $this->set(compact('json'));
149
150
                break;
151
152
            case "normal":
153
                foreach ($array as $conversationId) {
@@ 152-168 (lines=17) @@
149
150
                break;
151
152
            case "normal":
153
                foreach ($array as $conversationId) {
154
                    $this->ConversationsUsers->updateAll(
155
                        ['is_star' => 0],
156
                        [
157
                            'conversation_id' => $conversationId,
158
                            'user_id' => $this->Auth->user('id')
159
                        ]
160
                    );
161
                }
162
163
                $json['message'] = __d('conversations', 'Your conversation(s) has been set normal.');
164
                $json['error'] = '0';
165
                $json['redirect'] = Router::url(['action' => 'index']);
166
167
                $this->set(compact('json'));
168
                break;
169
170
            case "exit":
171
                foreach ($array as $conversationId) {