SettingServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 60
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 10 1
A register() 0 18 1
A provides() 0 4 1
1
<?php namespace Cornford\Setter\Providers;
2
3
use Illuminate\Support\ServiceProvider;
4
5
class SettingServiceProvider extends ServiceProvider {
6
7
	/**
8
	 * Indicates if loading of the provider is deferred.
9
	 *
10
	 * @var bool
11
	 */
12
	protected $defer = false;
13
14
	/**
15
	 * Bootstrap the application events.
16
	 *
17
	 * @return void
18
	 */
19
	public function boot()
20
	{
21
		$this->publishes(
22
			[
23
				__DIR__ . '/../../config/config.php' => config_path('setter.php'),
24
				__DIR__ . '/../../migrations/' => database_path('/migrations')
25
			],
26
			'setter'
27
		);
28
	}
29
30
	/**
31
	 * Register the service provider.
32
	 *
33
	 * @return void
34
	 */
35
	public function register()
36
	{
37
		$configPath = __DIR__ . '/../../config/config.php';
38
		$this->mergeConfigFrom($configPath, 'setting');
39
40
		$this->app->singleton(
41
		    'setting',
42
            function($app)
43
            {
44
                return new Setting(
45
                    $this->app->make('Illuminate\Database\DatabaseManager'),
46
                    $this->app->make('Illuminate\Config\Repository'),
47
                    $this->app->make('Illuminate\Cache\Repository'),
48
                    $app['config']->get('setting')
49
                );
50
            }
51
		);
52
	}
53
54
	/**
55
	 * Get the services provided by the provider.
56
	 *
57
	 * @return array
58
	 */
59
	public function provides()
60
	{
61
		return array('setting');
62
	}
63
64
}
65