ServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 5
dl 0
loc 58
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 8 1
A registerInstallCommand() 0 8 1
A registerAnonymizeCommand() 0 8 1
A registerMakeAnonymizerCommand() 0 8 1
1
<?php
2
3
namespace Arrilot\LaravelDataAnonymization;
4
5
use Arrilot\LaravelDataAnonymization\Commands\AnonymizationInstallCommand;
6
use Arrilot\LaravelDataAnonymization\Commands\DbAnonymizeCommand;
7
use Arrilot\LaravelDataAnonymization\Commands\MakeAnonymizerCommand;
8
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
9
10
11
class ServiceProvider extends BaseServiceProvider
12
{
13
    /**
14
     * Register the service provider.
15
     *
16
     * @return void
17
     */
18
    public function register()
19
    {
20
        $this->registerInstallCommand();
21
22
        $this->registerAnonymizeCommand();
23
24
        $this->registerMakeAnonymizerCommand();
25
    }
26
27
    /**
28
     * Register anonymization:install command.
29
     *
30
     * @return void
31
     */
32
    protected function registerInstallCommand()
33
    {
34
        $this->app->singleton('command.anonymization.install', function ($app) {
35
            return new AnonymizationInstallCommand($app['files'], $app['composer']);
36
        });
37
38
        $this->commands('command.anonymization.install');
39
    }
40
41
    /**
42
     * Register db:anonymize command.
43
     *
44
     * @return void
45
     */
46
    protected function registerAnonymizeCommand()
47
    {
48
        $this->app->singleton('command.db.anonymize', function ($app) {
0 ignored issues
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...
49
            return new DbAnonymizeCommand();
50
        });
51
52
        $this->commands('command.db.anonymize');
53
    }
54
55
    /**
56
     * Register make:anonymizer command.
57
     *
58
     * @return void
59
     */
60
    protected function registerMakeAnonymizerCommand()
61
    {
62
        $this->app->singleton('command.make.anonymizer', function ($app) {
63
            return new MakeAnonymizerCommand($app['files'], $app['composer']);
0 ignored issues
show
Unused Code introduced by
The call to MakeAnonymizerCommand::__construct() has too many arguments starting with $app['composer'].

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
64
        });
65
66
        $this->commands('command.make.anonymizer');
67
    }
68
}
69