Completed
Push — master ( 60317f...230022 )
by Andreas
04:22 queued 12s
created

ClonerServiceProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 1 Features 0
Metric Value
eloc 11
c 3
b 1
f 0
dl 0
loc 40
ccs 5
cts 5
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 5 1
A register() 0 9 1
A registerConfiguration() 0 5 1
1
<?php
2
3
namespace Anfischer\Cloner;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class ClonerServiceProvider extends ServiceProvider
8
{
9
    /**
10
    * Bootstrap any application services.
11
    *
12
    * @return void
13
    */
14 32
    public function boot()
15
    {
16
        $this->publishes([
17 2
            __DIR__.'/../config/cloner.php' => config_path('cloner.php'),
18 32
        ], 'config');
19
    }
20 32
21 32
    /**
22
     * Register the application services.
23
     *
24
     * @return void
25
     */
26
    public function register()
27
    {
28
        $this->app->singleton(Cloner::class, function () {
29
            return new Cloner(new CloneService, new PersistenceService);
30
        });
31
32
        $this->app->alias(Cloner::class, 'cloner');
33
34
        $this->registerConfiguration();
35
    }
36
37
    /**
38
    * Register the configuration required for the package.
39
    *
40
    * @return void
41
    */
42
    public function registerConfiguration()
43
    {
44
        $this->mergeConfigFrom(
45
            __DIR__.'/../config/cloner.php',
46
            'cloner'
47
        );
48
    }
49
}
50