Code Duplication    Length = 10-11 lines in 2 locations

src/Http/Api/IssueController.php 2 locations

@@ 964-974 (lines=11) @@
961
            ->where('parent_id', $id)
962
            ->where('del_flg', '<>', 1)
963
            ->get();
964
        foreach ($subtasks as $subtask)
965
        {
966
            $sub_id = $subtask['_id']->__toString();
967
            DB::collection($table)->where('_id', $sub_id)->update([ 'del_flg' => 1 ]);
968
969
            // delete linked relation
970
            DB::collection('linked')->where('src', $sub_id)->orWhere('dest', $sub_id)->delete();
971
972
            Event::fire(new IssueEvent($project_key, $sub_id, $user, [ 'event_key' => 'del_issue' ]));
973
            $ids[] = $sub_id;
974
        }
975
976
        // delete linked relation
977
        DB::collection('linked')->where('src', $id)->orWhere('dest', $id)->delete();
@@ 2852-2861 (lines=10) @@
2849
                ->where('parent_id', $id)
2850
                ->where('del_flg', '<>', 1)
2851
                ->get();
2852
            foreach ($subtasks as $subtask)
2853
            {
2854
                $sub_id = $subtask['_id']->__toString();
2855
                DB::collection($table)->where('_id', $sub_id)->update([ 'del_flg' => 1 ]);
2856
2857
                // delete linked relation
2858
                DB::collection('linked')->where('src', $sub_id)->orWhere('dest', $sub_id)->delete();
2859
2860
                Event::fire(new IssueEvent($project_key, $sub_id, $user, [ 'event_key' => 'del_issue' ]));
2861
            }
2862
2863
            // delete linked relation
2864
            DB::collection('linked')->where('src', $id)->orWhere('dest', $id)->delete();