Code Duplication    Length = 12-12 lines in 5 locations

src/AppBundle/Controller/EditCounterController.php 5 locations

@@ 334-345 (lines=12) @@
331
     * @param string $key API key.
332
     * @return JsonResponse
333
     */
334
    public function pairDataApiAction(Request $request, $project, $username, $key)
335
    {
336
        $ret = $this->setUpEditCounter($project, $username, $key);
337
        if ($ret instanceof RedirectResponse) {
338
            return $ret;
339
        }
340
341
        return new JsonResponse(
342
            $this->editCounter->getPairData(),
343
            Response::HTTP_OK
344
        );
345
    }
346
347
    /**
348
     * Get various log counts for the user as JSON.
@@ 356-367 (lines=12) @@
353
     * @param string $key API key.
354
     * @return JsonResponse
355
     */
356
    public function logCountsApiAction(Request $request, $project, $username, $key)
357
    {
358
        $ret = $this->setUpEditCounter($project, $username, $key);
359
        if ($ret instanceof RedirectResponse) {
360
            return $ret;
361
        }
362
363
        return new JsonResponse(
364
            $this->editCounter->getLogCounts(),
365
            Response::HTTP_OK
366
        );
367
    }
368
369
    /**
370
     * Get edit sizes for the user as JSON.
@@ 378-389 (lines=12) @@
375
     * @param string $key API key.
376
     * @return JsonResponse
377
     */
378
    public function editSizesApiAction(Request $request, $project, $username, $key)
379
    {
380
        $ret = $this->setUpEditCounter($project, $username, $key);
381
        if ($ret instanceof RedirectResponse) {
382
            return $ret;
383
        }
384
385
        return new JsonResponse(
386
            $this->editCounter->getEditSizeData(),
387
            Response::HTTP_OK
388
        );
389
    }
390
391
    /**
392
     * Get the namespace totals for the user as JSON.
@@ 400-411 (lines=12) @@
397
     * @param string $key API key.
398
     * @return Response
399
     */
400
    public function namespaceTotalsApiAction(Request $request, $project, $username, $key)
401
    {
402
        $ret = $this->setUpEditCounter($project, $username, $key);
403
        if ($ret instanceof RedirectResponse) {
404
            return $ret;
405
        }
406
407
        return new JsonResponse(
408
            $this->editCounter->namespaceTotals(),
409
            Response::HTTP_OK
410
        );
411
    }
412
413
    /**
414
     * Display or fetch the month counts for the user.
@@ 422-433 (lines=12) @@
419
     * @param string $key API key.
420
     * @return Response
421
     */
422
    public function monthcountsApiAction(Request $request, $project, $username, $key)
423
    {
424
        $ret = $this->setUpEditCounter($project, $username, $key);
425
        if ($ret instanceof RedirectResponse) {
426
            return $ret;
427
        }
428
429
        return new JsonResponse(
430
            $this->editCounter->monthCounts(),
431
            Response::HTTP_OK
432
        );
433
    }
434
}
435