JanitorServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 9
c 3
b 0
f 0
dl 0
loc 33
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 9 2
A provides() 0 3 1
A register() 0 4 1
1
<?php
2
3
namespace Signifly\Janitor;
4
5
use Illuminate\Contracts\Support\DeferrableProvider;
6
use Illuminate\Support\ServiceProvider;
7
use Signifly\Janitor\Contracts\Factory;
8
9
class JanitorServiceProvider extends ServiceProvider implements DeferrableProvider
10
{
11
    public function boot()
12
    {
13
        if ($this->app->runningInConsole()) {
14
            $this->publishes([
15
                __DIR__.'/../config/janitor.php' => config_path('janitor.php'),
16
            ], 'janitor-config');
17
        }
18
19
        $this->mergeConfigFrom(__DIR__.'/../config/janitor.php', 'janitor');
20
    }
21
22
    /**
23
     * Register the service provider.
24
     *
25
     * @return void
26
     */
27
    public function register()
28
    {
29
        $this->app->singleton(Factory::class, function ($app) {
30
            return new JanitorManager($app);
31
        });
32
    }
33
34
    /**
35
     * Get the services provided by the provider.
36
     *
37
     * @return array
38
     */
39
    public function provides()
40
    {
41
        return [Factory::class];
42
    }
43
}
44