Completed
Push — master ( dc6f94...d4342e )
by Alessandro
06:08
created

ComposerSecurityCheckServiceProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 88.89%
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 53
ccs 16
cts 18
cp 0.8889
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 12 1
A register() 0 10 1
A provides() 0 4 1
1
<?php
2
namespace Padosoft\LaravelComposerSecurity;
3
4
use Illuminate\Support\ServiceProvider;
5
use GuzzleHttp\Client;
6
7
class ComposerSecurityCheckServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Indicates if loading of the provider is deferred.
11
     *
12
     * @var bool
13
     */
14
    protected $defer = true;
15
16
    /**
17
     * Bootstrap the application events.
18
     *
19
     * @return void
20
     */
21 18
    public function boot()
22
    {
23 18
        $this->publishes([
24 18
            __DIR__ . '/config/composer-security-check.php' => config_path('composer-security-check.php'),
25 18
        ], 'config');
26
27 18
        $this->loadViewsFrom(__DIR__ . '/views', 'composer-security-check');
28
29 18
        $this->publishes([
30 18
            __DIR__ . '/views' => base_path('resources/views/padosoft/composer-security-check'),
31 18
        ]);
32 18
    }
33
34
    /**
35
     * Register the service provider.
36
     *
37
     * @return void
38
     */
39 18
    public function register()
40
    {
41 18
        $this->app['command.composer-security:check'] = $this->app->share(
1 ignored issue
show
Bug introduced by
The method share() does not seem to exist on object<Illuminate\Contra...Foundation\Application>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
42 2
            function ($app) {
1 ignored issue
show
Unused Code introduced by
The parameter $app is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
43 2
                return new ComposerSecurityCheck(new client);
44
            }
45 18
        );
46 18
        $this->commands('command.composer-security:check');
47
48 18
    }
49
50
    /**
51
     * Get the services provided by the provider.
52
     *
53
     * @return array
54
     */
55
    public function provides()
56
    {
57
        return ['command.composer-security:check'];
58
    }
59
}
60