LaravelTacticianServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 5
dl 0
loc 59
ccs 26
cts 26
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A registerConfig() 0 12 1
A register() 0 32 1
1
<?php
2
3
namespace Victormln\LaravelTactician\Providers;
4
5
use Illuminate\Support\ServiceProvider;
6
use Victormln\LaravelTactician\Commands\MakeTacticianCommand;
7
use Victormln\LaravelTactician\Commands\MakeTacticianCommandCommand;
8
use Victormln\LaravelTactician\Commands\MakeTacticianHandlerCommand;
9
10
/**
11
 * Class LaravelTacticianServiceProvider
12
 *
13
 * @package Victormln\LaravelTactician\Providers
14
 */
15
class LaravelTacticianServiceProvider extends ServiceProvider
16
{
17
18
    /**
19
     * Do the bindings so any implementation can be swapped
20
     *
21
     * @return void
22
     */
23 26
    public function register()
24
    {
25 26
        $this->registerConfig();
26 26
        $this->app->bind('Victormln\LaravelTactician\Locator\LocatorInterface', config('laravel-tactician.locator'));
27 26
        $this->app->bind('League\Tactician\Handler\MethodNameInflector\MethodNameInflector', config('laravel-tactician.inflector'));
28 26
        $this->app->bind('League\Tactician\Handler\CommandNameExtractor\CommandNameExtractor', config('laravel-tactician.extractor'));
29 26
        $this->app->bind('Victormln\LaravelTactician\CommandBusInterface', config('laravel-tactician.bus'));
30
31
        // Register Command Generator
32 26
        $this->app->singleton(
33
            'laravel-tactician.make.command', function ($app) {
34 8
                return new MakeTacticianCommandCommand($app['files']);
35 26
            }
36
        );
37 26
        $this->commands('laravel-tactician.make.command');
38
39
        // Register Handler Generator
40 26
        $this->app->singleton(
41
            'laravel-tactician.make.handler', function ($app) {
42 8
                return new MakeTacticianHandlerCommand($app['files']);
43 26
            }
44
        );
45 26
        $this->commands('laravel-tactician.make.handler');
46
47
        // Register Comman+Handler Generator Command
48 26
        $this->app->singleton(
49
            'laravel-tactician.make.tactician', function () {
50 8
                return new MakeTacticianCommand();
51 26
            }
52
        );
53 26
        $this->commands('laravel-tactician.make.tactician');
54 26
    }
55
56
    /**
57
     * Register config.
58
     *
59
     * @return void
60
     */
61 26
    protected function registerConfig()
62
    {
63 26
        $this->publishes(
64
            [
65 26
            __DIR__.'/../../config/config.php' => config_path('laravel-tactician.php'),
66
            ]
67
        );
68 26
        $this->mergeConfigFrom(
69 26
            __DIR__.'/../../config/config.php',
70 26
            'laravel-tactician'
71
        );
72 26
    }
73
}
74