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::listFiles()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 8
cts 8
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 1
crap 1
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