Code Duplication    Length = 16-17 lines in 4 locations

app/Http/Controllers/Api/CommentController.php 1 location

@@ 62-77 (lines=16) @@
59
     *
60
     * @return \Illuminate\Http\JsonResponse
61
     */
62
    public function postComments(Request $request, Guard $auth)
63
    {
64
        try {
65
            $comment = $this->dispatch(new AddCommentCommand(
66
                $request->get('message'),
67
                $request->get('target_type'),
68
                $request->get('target_id'),
69
                $request->get('author_id'),
70
                $request->get('project_id')
71
            ));
72
        } catch (QueryException $e) {
73
            throw new BadRequestHttpException();
74
        }
75
76
        return $this->item($comment);
77
    }
78
79
    /**
80
     * Update an existing comment.

app/Http/Controllers/Api/IssueController.php 1 location

@@ 88-103 (lines=16) @@
85
     *
86
     * @return \Illuminate\Http\JsonResponse
87
     */
88
    public function putIssue(Request $request, Issue $issue)
89
    {
90
        try {
91
            $issue = $this->dispatch(new UpdateIssueCommand(
92
                $issue,
93
                $request->get('title'),
94
                $request->get('description'),
95
                $request->get('author_id'),
96
                $request->get('project_id')
97
            ));
98
        } catch (QueryException $e) {
99
            throw new BadRequestHttpException();
100
        }
101
102
        return $this->item($issue);
103
    }
104
105
    /**
106
     * Delete an existing issue.

app/Http/Controllers/Api/OwnerController.php 2 locations

@@ 58-73 (lines=16) @@
55
     *
56
     * @return \Illuminate\Http\JsonResponse
57
     */
58
    public function postOwners(Request $request)
59
    {
60
        try {
61
            $owner = $this->dispatch(new AddOwnerCommand(
62
                $request->get('name'),
63
                $request->get('path'),
64
                $request->get('user_id'),
65
                $request->get('description'),
66
                $request->get('type')
67
            ));
68
        } catch (QueryException $e) {
69
            throw new BadRequestHttpException();
70
        }
71
72
        return $this->item($owner);
73
    }
74
75
    /**
76
     * Update an existing owner.
@@ 82-98 (lines=17) @@
79
     *
80
     * @return \Illuminate\Http\JsonResponse
81
     */
82
    public function putOwner(Request $request, Owner $owner)
83
    {
84
        try {
85
            $owner = $this->dispatch(new UpdateOwnerCommand(
86
                $owner,
87
                $request->get('name'),
88
                $request->get('path'),
89
                $request->get('user_id'),
90
                $request->get('description'),
91
                $request->get('type')
92
            ));
93
        } catch (QueryException $e) {
94
            throw new BadRequestHttpException();
95
        }
96
97
        return $this->item($owner);
98
    }
99
100
    /**
101
     * Delete an existing owner.