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.

DebugBarServiceProvider::provides()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Nip\DebugBar;
4
5
use Nip\Container\ServiceProviders\Providers\AbstractSignatureServiceProvider;
6
use Nip\Container\ServiceProviders\Providers\BootableServiceProviderInterface;
7
use Nip\DebugBar\Middleware\DebugbarMiddleware;
8
use Nip\Http\Kernel\Kernel;
9
use Nip\Http\Kernel\KernelInterface;
10
11
/**
12
 * Class DebugBarServiceProvider
13
 * @package Nip\DebugBar
14
 */
15
class DebugBarServiceProvider extends AbstractSignatureServiceProvider implements BootableServiceProviderInterface
16
{
17
18
    /**
19
     * @inheritdoc
20
     */
21
    public function provides()
22
    {
23
        return ['debugbar'];
24
    }
25
26
    /**
27
     * @inheritdoc
28
     */
29
    public function register()
30
    {
31
        $this->getContainer()->alias(StandardDebugBar::class, DebugBar::class);
32
33
        $this->getContainer()->share('debugbar', function () {
34
            $debugbar = $this->getContainer()->get(DebugBar::class);
35
            return $debugbar;
36
        });
37
    }
38
39
    /**
40
     * Bootstrap the application events.
41
     *
42
     * @return void
43
     */
44
    public function boot()
45
    {
46
        $app = $this->getContainer()->get('app');
47
48
        // If enabled is null, set from the app.debug value
0 ignored issues
show
Unused Code Comprehensibility introduced by
36% 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...
49
//        $enabled = $this->app['config']->get('debugbar.enabled');
50
51
//        if (is_null($enabled)) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
64% 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...
52
        $enabled = $this->checkAppDebug();
53
//        }
54
55
        if (!$enabled) {
56
            return;
57
        }
58
59
        /** @var DebugBar $debugBar */
60
        $debugBar = $app->get('debugbar');
61
        $debugBar->enable();
62
        $debugBar->boot();
63
64
        $this->registerMiddleware(DebugbarMiddleware::class);
65
    }
66
67
    /**
68
     * Check the App Debug status
69
     */
70
    protected function checkAppDebug()
71
    {
72
        return $this->getContainer()->get('config')->get('app.debug');
73
    }
74
75
    /**
76
     * Register the Debugbar Middleware
77
     *
78
     * @param  string $middleware
79
     */
80
    protected function registerMiddleware($middleware)
81
    {
82
        /** @var Kernel $kernel */
83
        $kernel = $this->getContainer()->get(KernelInterface::class);
84
        $kernel->prependMiddleware($middleware);
85
    }
86
}
87