Code Duplication    Length = 18-18 lines in 2 locations

app/Models/ProjectGroupRoleModel.php 1 location

@@ 180-197 (lines=18) @@
177
     *
178
     * @return bool
179
     */
180
    public function duplicate($project_src_id, $project_dst_id)
181
    {
182
        $rows = $this->db->table(self::TABLE)->eq('project_id', $project_src_id)->findAll();
183
184
        foreach ($rows as $row) {
185
            $result = $this->db->table(self::TABLE)->save([
186
                'project_id' => $project_dst_id,
187
                'group_id'   => $row['group_id'],
188
                'role'       => $row['role'],
189
            ]);
190
191
            if (!$result) {
192
                return false;
193
            }
194
        }
195
196
        return true;
197
    }
198
}
199

app/Models/ProjectUserRoleModel.php 1 location

@@ 296-313 (lines=18) @@
293
     *
294
     * @return bool
295
     */
296
    public function duplicate($project_src_id, $project_dst_id)
297
    {
298
        $rows = $this->db->table(self::TABLE)->eq('project_id', $project_src_id)->findAll();
299
300
        foreach ($rows as $row) {
301
            $result = $this->db->table(self::TABLE)->save([
302
                'project_id' => $project_dst_id,
303
                'user_id'    => $row['user_id'],
304
                'role'       => $row['role'],
305
            ]);
306
307
            if (!$result) {
308
                return false;
309
            }
310
        }
311
312
        return true;
313
    }
314
}
315