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

@@ 107-121 (lines=15) @@
104
     * )
105
     * @param string $eventId event id
106
     */
107
    public function viewAction(string $eventId): Response
108
    {
109
        /** @var EventRepository $eventRepository */
110
        $eventRepository = $this->get('rockparade.event_repository');
111
        $event = $eventRepository->findOneById($eventId);
112
113
        if ($event) {
114
            $response = new ApiResponse($event, Response::HTTP_OK);
115
        } else {
116
            $eventService = $this->get('rockparade.event');
117
            $response = $eventService->createEventNotFoundErrorResult($eventId);
118
        }
119
120
        return $this->respond($response);
121
    }
122
123
    /**
124
     * Create new event
@@ 235-252 (lines=18) @@
232
     * )
233
     * @param string $eventId event id
234
     */
235
    public function deleteEvent(string $eventId): Response
236
    {
237
        /** @var EventRepository $eventRepository */
238
        $eventRepository = $this->get('rockparade.event_repository');
239
        $event = $eventRepository->findOneById($eventId);
240
241
        if ($event) {
242
            $eventRepository->remove($event);
243
            $eventRepository->flush();
244
245
            $response = new EmptyApiResponse(Response::HTTP_NO_CONTENT);
246
        } else {
247
            $eventService = $this->get('rockparade.event');
248
            $response = $eventService->createEventNotFoundErrorResult($eventId);
249
        }
250
251
        return $this->respond($response);
252
    }
253
254
    /**
255
     * Add image to event