ModelManagerServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 76.47%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 56
ccs 13
cts 17
cp 0.7647
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 6 1
A register() 0 10 1
A registerCommands() 0 10 1
A provides() 0 7 1
1
<?php
2
3
namespace Ablunier\Laravel\Database\Manager;
4
5
use Ablunier\Laravel\Database\Console\Commands\SchemaUpdate;
6
use Ablunier\Laravel\Database\Manager\Eloquent\ModelManager;
7
use Illuminate\Support\ServiceProvider;
8
9
class ModelManagerServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Indicates if loading of the provider is deferred.
13
     *
14
     * @var bool
15
     */
16
    protected $defer = true;
17 43
18
    public function boot()
19 43
    {
20 43
        $this->publishes([
21 43
            __DIR__.'/../../config/laravel-database.php' => config_path('laravel-database.php'),
22 43
        ], 'config');
23
    }
24
25
    /**
26
     * Register the service provider.
27
     *
28
     * @return void
29 43
     */
30
    public function register()
31 43
    {
32
        $this->mergeConfigFrom(__DIR__.'/../../config/laravel-database.php', 'laravel-database');
33 43
34
        $this->app->bind('Ablunier\Laravel\Database\Contracts\Manager\ModelManager', function ($app) {
35 43
            return new ModelManager($app);
36
        });
37 43
38 43
        $this->registerCommands();
39
    }
40 43
41
    protected function registerCommands()
42
    {
43
        /*$this->app->singleton('command.database.schema-update', function ($app) {
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...
44
            $console = $app->make('Illuminate\Contracts\Console\Kernel');
45
46
            return new SchemaUpdate($app, $console);
47
        });
48
49 43
        $this->commands('command.database.schema-update');*/
50
    }
51
52
    /**
53
     * Get the services provided by the provider.
54
     *
55
     * @return array
56
     */
57
    public function provides()
58
    {
59
        return [
60
            'Ablunier\Laravel\Database\Contracts\Manager\ModelManager',
61
            //'command.database.schema-update'
62
        ];
63
    }
64
}
65