ClonerServiceProvider   A
last analyzed

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 11
cts 11
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 5 1
A registerConfiguration() 0 5 1
A register() 0 9 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 42
    public function boot()
15
    {
16 42
        $this->publishes([
17 42
            __DIR__.'/../config/cloner.php' => config_path('cloner.php'),
18
        ], 'config');
19
    }
20
21
    /**
22
     * Register the application services.
23
     *
24
     * @return void
25
     */
26 42
    public function register()
27
    {
28 42
        $this->app->singleton(Cloner::class, function () {
29 2
            return new Cloner(new CloneService, new PersistenceService);
30
        });
31
32 42
        $this->app->alias(Cloner::class, 'cloner');
33
34 42
        $this->registerConfiguration();
35
    }
36
37
    /**
38
    * Register the configuration required for the package.
39
    *
40
    * @return void
41
    */
42 42
    public function registerConfiguration()
43
    {
44 42
        $this->mergeConfigFrom(
45 42
            __DIR__.'/../config/cloner.php',
46
            'cloner'
47
        );
48
    }
49
}
50