GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 3db8c2...905420 )
by Damian
16:49
created

IndexController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 30.56 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 11
loc 36
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A listAction() 11 11 2
A listFiles() 0 11 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace App\Controller;
4
5
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
6
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
7
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
8
use Symfony\Component\HttpFoundation\JsonResponse;
9
10
class IndexController extends Controller
11
{
12
    use CredentialsCheckTrait;
13
14
    /**
15
     * @Route("/api/list/{name}", requirements={"name" = "^[a-f0-9]{32}$"})
16
     * @Method({"GET"})
17
     *
18
     * @param $name string
19
     *
20
     * @return JsonResponse
21
     */
22 4 View Code Duplication
    public function listAction($name)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
23
    {
24
        try {
25 4
            return $this->listFiles($name);
26 2
        } catch (\Exception $e) {
27 2
            return new JsonResponse([
28 2
                'status'  => 'error',
29 2
                'message' => $e->getMessage(),
30 2
            ]);
31
        }
32
    }
33
34 4
    private function listFiles($name)
35
    {
36 4
        $this->checkCredentials();
37 3
        $files = $this->get('app.file_collection_manager')->listFiles($name);
38
39 2
        return new JsonResponse([
40 2
            'status'          => 'ok',
41 2
            'collection_name' => $name,
42 2
            'files'           => $files,
43 2
        ]);
44
    }
45
}
46