Code Duplication    Length = 20-21 lines in 2 locations

src/AppBundle/Admin/PerformanceEventAdmin.php 2 locations

@@ 294-314 (lines=21) @@
291
     */
292
    public function getSeat(Venue $venue, $row, VenueSector $venueSector, $place = null)
293
    {
294
        if ($place === null) {
295
            $seat = $this->getEm()->getRepository('AppBundle:Seat')->findBy([
296
                'row' => $row,
297
                'venueSector' => $venueSector,
298
            ]);
299
            if (!$seat) {
300
                $this
301
                    ->getConfigurationPool()
302
                    ->getContainer()
303
                    ->get('session')
304
                    ->getFlashBag()
305
                    ->add(
306
                        'error',
307
                        "Помилка. В залi $venue немає $row ряда в секторі $venueSector!"
308
                    );
309
                throw new ModelManagerException('Error row!');
310
            }
311
            foreach ($seat as $placeAllInRow) {
312
                self::inspectSeatMoreThanOnePrice($row, $placeAllInRow->getPlace(), $venueSector);
313
            }
314
        }
315
        if ($place !== null) {
316
            $seat = $this->getEm()->getRepository('AppBundle:Seat')->findOneBy([
317
                'row' => $row,
@@ 315-334 (lines=20) @@
312
                self::inspectSeatMoreThanOnePrice($row, $placeAllInRow->getPlace(), $venueSector);
313
            }
314
        }
315
        if ($place !== null) {
316
            $seat = $this->getEm()->getRepository('AppBundle:Seat')->findOneBy([
317
                'row' => $row,
318
                'place' => $place,
319
                'venueSector' => $venueSector,
320
            ]);
321
            if (!$seat) {
322
                $this
323
                    ->getConfigurationPool()
324
                    ->getContainer()
325
                    ->get('session')
326
                    ->getFlashBag()
327
                    ->add(
328
                        'error',
329
                        "Помилка. В залi $venue немає $row - $place в секторі $venueSector!"
330
                    );
331
                throw new ModelManagerException('Error row-place!');
332
            }
333
            self::inspectSeatMoreThanOnePrice($row, $place, $venueSector);
334
        }
335
    }
336
337
    /**