GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

LaravelServiceProvider   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 6
dl 0
loc 74
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 12 1
A getDecorators() 0 4 1
A registerContainer() 0 4 1
A registerCommandHandlerResolver() 0 6 1
A registerBusses() 0 5 1
A registerSyncCommandBus() 0 7 1
A registerQueueCommandBus() 0 7 1
A registerEventDispatcher() 0 4 1
A registerChief() 0 7 1
1
<?php
2
3
namespace Chief\Bridge\Laravel;
4
5
use Chief\Busses\SynchronousCommandBus;
6
use Chief\Chief;
7
use Chief\Decorators\CommandQueueingDecorator;
8
use Chief\Resolvers\NativeCommandHandlerResolver;
9
use Illuminate\Support\ServiceProvider;
10
11
class LaravelServiceProvider extends ServiceProvider
12
{
13
    protected $defaultBus = 'Chief\Busses\SynchronousCommandBus';
14
15
    public function register()
16
    {
17
        $this->registerContainer();
18
19
        $this->registerCommandHandlerResolver();
20
21
        $this->registerEventDispatcher();
22
23
        $this->registerBusses();
24
25
        $this->registerChief();
26
    }
27
28
    /**
29
     * Override me to easily add decorators
30
     *
31
     * @return array Array of \Chief\Decorator objects
32
     */
33
    protected function getDecorators()
34
    {
35
        return [];
36
    }
37
38
    protected function registerContainer()
39
    {
40
        $this->app->bind('Chief\Container', 'Chief\Bridge\Laravel\IlluminateContainer');
41
    }
42
43
    protected function registerCommandHandlerResolver()
44
    {
45
        $this->app->bind('Chief\CommandHandlerResolver', function () {
46
            return new NativeCommandHandlerResolver($this->app->make('Chief\Container'));
47
        });
48
    }
49
50
    protected function registerBusses()
51
    {
52
        $this->registerSyncCommandBus();
53
        $this->registerQueueCommandBus();
54
    }
55
56
    protected function registerSyncCommandBus()
57
    {
58
        $this->app->bind('Chief\Busses\SynchronousCommandBus', function () {
59
            $resolver = $this->app->make('Chief\CommandHandlerResolver');
60
            return new SynchronousCommandBus($resolver);
61
        });
62
    }
63
64
    protected function registerQueueCommandBus()
65
    {
66
        $this->app->bind('Chief\Busses\QueueingCommandBus', function () {
67
            $resolver = $this->app->make('Chief\CommandHandlerResolver');
68
            return new CommandQueueingDecorator($this->app->make('Chief\Bridge\Laravel\IlluminateQueuer'), $resolver);
69
        });
70
    }
71
72
    protected function registerEventDispatcher()
73
    {
74
        $this->app->bind('Chief\Decorators\EventDispatcher', 'Chief\Bridge\Laravel\IlluminateEventDispatcher');
75
    }
76
77
    protected function registerChief()
78
    {
79
        $this->app->bind('Chief\CommandBus', function () {
80
            $bus = $this->app->make($this->defaultBus);
81
            return new Chief($bus, $this->getDecorators());
82
        });
83
    }
84
}
85