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.

BadgeController::get()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 21
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 21
rs 9.3142
cc 2
eloc 13
nc 2
nop 1
1
<?php
2
3
namespace BitPrepared\Bundle\D1b0Workspace\Controller\V1;
4
5
use Symfony\Component\HttpFoundation\Request;
6
use Symfony\Component\HttpFoundation\JsonResponse;
7
use Silex\Application;
8
use Silex\Api\ControllerProviderInterface;
9
use RedBeanPHP\Facade as R;
10
11
class BadgeController implements ControllerProviderInterface
12
{
13
    private $app;
14
15
    public function connect(Application $app)
16
    {
17
        $this->app = $app;
18
        $factory = $app['controllers_factory'];
19
        # il mount point e' precedente e non serve prima
20
        $this->app['db'];
21
        R::fancyDebug(TRUE);
22
        $factory->get('', array($this, 'get'));
23
        return $factory;
24
    }
25
    public function get(Request $request)
26
    {
27
        //$user_id = $this->getSessionId();
0 ignored issues
show
Unused Code Comprehensibility introduced by
60% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
28
        $filter = $request->get('filterBy');
29
        echo $filter;
30
31
        $badge = R::findAll("badge", "type = ? AND enable = 1", [$filter]);
32
33
        $res = [];
34
        foreach ($badge as $b) {
35
            array_push($res, [
36
                "id"=>intval($b->id),
37
                "name"=>$b->name,
38
                "descritpion"=>$b->description,
39
                "img"=>$b->img
40
            ]);
41
        }
42
43
        $headers = [];
44
        return JsonResponse::create($res, 200, $headers)->setSharedMaxAge(300);
45
    }
46
}
47