Code Duplication    Length = 12-12 lines in 3 locations

app/Controller/Course/CourseCreateController.php 1 location

@@ 87-98 (lines=12) @@
84
            return $this->responseManager->createResponse($request, 415);
85
        }
86
87
        if ([] !== $errors = $this->validator->validateObject($course)) {
88
            return $this->responseManager->createResponse(
89
                $request,
90
                422,
91
                $this->errorManager->createByValidationErrors(
92
                    $errors,
93
                    $this->requestManager->getAcceptLanguage($request, $this->defaultLanguage),
94
                    Error::SCOPE_BODY,
95
                    'course'
96
                )
97
            );
98
        }
99
100
        $this->repository->persist($course);
101

app/Controller/Course/CourseSearchController.php 1 location

@@ 84-95 (lines=12) @@
81
        /** @var CourseSearch $courseSearch */
82
        $courseSearch = $this->requestManager->getDataFromRequestQuery($request, CourseSearch::class);
83
84
        if ([] !== $errors = $this->validator->validateObject($courseSearch)) {
85
            return $this->responseManager->createResponse(
86
                $request,
87
                400,
88
                $this->errorManager->createByValidationErrors(
89
                    $errors,
90
                    $this->requestManager->getAcceptLanguage($request, $this->defaultLanguage),
91
                    Error::SCOPE_BODY,
92
                    Course::class
93
                )
94
            );
95
        }
96
97
        /** @var CourseSearch $courseSearch */
98
        $courseSearch = $this->repository->search($courseSearch);

app/Controller/Course/CourseUpdateController.php 1 location

@@ 100-111 (lines=12) @@
97
            return $this->responseManager->createResponse($request, 415);
98
        }
99
100
        if ([] !== $errors = $this->validator->validateObject($course)) {
101
            return $this->responseManager->createResponse(
102
                $request,
103
                422,
104
                $this->errorManager->createByValidationErrors(
105
                    $errors,
106
                    $this->requestManager->getAcceptLanguage($request, $this->defaultLanguage),
107
                    Error::SCOPE_BODY,
108
                    'course'
109
                )
110
            );
111
        }
112
113
        $this->repository->persist($course);
114