Code Duplication    Length = 13-18 lines in 3 locations

src/AppBundle/Controller/BandController.php 1 location

@@ 186-198 (lines=13) @@
183
     *     }
184
     * )
185
     */
186
    public function listMembersAction(string $bandName): Response
187
    {
188
        $bandRepository = $this->get('rockparade.band_repository');
189
        $band = $bandRepository->findOneByName($bandName);
190
191
        if (!$band) {
192
            $response = $this->createBandNotFoundErrorResult($bandName);
193
        } else {
194
            $response = new ApiResponse($band->getMembers(), Response::HTTP_OK);
195
        }
196
197
        return $this->respond($response);
198
    }
199
200
    /**
201
     * Add member to band

src/AppBundle/Controller/EventController.php 2 locations

@@ 108-122 (lines=15) @@
105
     * )
106
     * @param string $eventId event id
107
     */
108
    public function viewAction(string $eventId): Response
109
    {
110
        /** @var EventRepository $eventRepository */
111
        $eventRepository = $this->get('rockparade.event_repository');
112
        $event = $eventRepository->findOneById($eventId);
113
114
        if ($event) {
115
            $response = new ApiResponse($event, Response::HTTP_OK);
116
        } else {
117
            $eventService = $this->get('rockparade.event');
118
            $response = $eventService->createEventNotFoundErrorResult($eventId);
119
        }
120
121
        return $this->respond($response);
122
    }
123
124
    /**
125
     * Create new event
@@ 220-237 (lines=18) @@
217
     * )
218
     * @param string $eventId event id
219
     */
220
    public function deleteEvent(string $eventId): Response
221
    {
222
        /** @var EventRepository $eventRepository */
223
        $eventRepository = $this->get('rockparade.event_repository');
224
        $event = $eventRepository->findOneById($eventId);
225
226
        if ($event) {
227
            $eventRepository->remove($event);
228
            $eventRepository->flush();
229
230
            $response = new EmptyApiResponse(Response::HTTP_NO_CONTENT);
231
        } else {
232
            $eventService = $this->get('rockparade.event');
233
            $response = $eventService->createEventNotFoundErrorResult($eventId);
234
        }
235
236
        return $this->respond($response);
237
    }
238
239
    /**
240
     * Add image to event