Code Duplication    Length = 17-18 lines in 2 locations

src/Controller/ConversationsController.php 2 locations

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