TransitionProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 5
dl 0
loc 32
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 9 2
A register() 0 18 1
1
<?php
2
3
namespace Transitions;
4
5
use Illuminate\Contracts\Foundation\Application;
6
use Illuminate\Support\ServiceProvider;
7
use Transitions\Console\GenerateTransition;
8
9
class TransitionProvider extends ServiceProvider
10
{
11
12 12
    public function boot() : void
13
    {
14
15 12
        if ($this->app->runningInConsole()) {
16 12
            $this->publishes([
17 12
                __DIR__ . '/../config/config.php' => config_path('transitions.php'),
18
            ]);
19
        }
20 12
    }
21
22 12
    public function register() : void
23
    {
24
25 12
        $this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'transitions');
26
27
        $this->app->bind(TransitionFactory::class, function (Application $app) {
28
29 3
            return new LaravelTransitionFactory($app);
30 12
        });
31
32
        $this->app->bind(TransitionMiddleware::class, function (Application $app) {
33
34 3
            $config = Config::fromArray($app->make('config')->get('transitions'));
35 3
            return new TransitionMiddleware($config, $app->make(TransitionFactory::class));
36 12
        });
37
38 12
        $this->commands([GenerateTransition::class]);
39 12
    }
40
}
41