ServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 11 1
A boot() 0 6 1
A registerCommands() 0 20 1
1
<?php
2
3
namespace LaravelLangBundler;
4
5
use LaravelLangBundler\Bundle\BundleMap;
6
use LaravelLangBundler\Commands\MakeBundleMod;
7
use LaravelLangBundler\Commands\MakeBundlesFolder;
8
use LaravelLangBundler\Commands\MakeNewBundleFile;
9
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
10
11
class ServiceProvider extends BaseServiceProvider
12
{
13
    /**
14
     * Register bindings in the container.
15
     *
16
     * @return void
17
     */
18
    public function register()
19
    {
20
        $this->app->singleton(LangBundler::class, function () {
21
            return new LangBundler(
22
                new BundleMap(),
23
                new Translator()
24
            );
25
        });
26
27
        $this->registerCommands();
28
    }
29
30
    /**
31
     * Perform post-registration booting of services.
32
     *
33
     * @return void
34
     */
35
    public function boot()
36
    {
37
        $this->publishes([
38
            __DIR__.DIRECTORY_SEPARATOR.'config.php' => config_path('lang-bundler.php'),
39
        ], 'config');
40
    }
41
42
    /**
43
     * Register Artisan commands.
44
     */
45
    protected function registerCommands()
46
    {
47
        $this->app->singleton('command.langb.start', function ($app) {
48
            return $app[MakeBundlesFolder::class];
49
        });
50
51
        $this->app->singleton('command.langb.new', function ($app) {
52
            return $app[MakeNewBundleFile::class];
53
        });
54
55
        $this->app->singleton('command.langb.mod', function ($app) {
56
            return $app[MakeBundleMod::class];
57
        });
58
59
        $this->commands('command.langb.start');
60
61
        $this->commands('command.langb.new');
62
63
        $this->commands('command.langb.mod');
64
    }
65
}
66