Completed
Push — develop ( 0378c4...91f7cb )
by Bradley
03:49
created

SettingServiceProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 4
Bugs 0 Features 1
Metric Value
c 4
b 0
f 1
dl 0
loc 57
wmc 3
lcom 0
cbo 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 10 1
A register() 0 15 1
A provides() 0 4 1
1
<?php namespace Cornford\Setter;
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, 'googlmapper');
39
40
		$this->app['setting'] = $this->app->share(function($app)
41
		{
42
			return new Setting(
43
				$this->app->make('Illuminate\Database\DatabaseManager'),
44
				$this->app->make('Illuminate\Config\Repository'),
45
				$this->app->make('Illuminate\Cache\Repository'),
46
				$app['config']->get('googlmapper')
47
			);
48
		});
49
	}
50
51
	/**
52
	 * Get the services provided by the provider.
53
	 *
54
	 * @return array
55
	 */
56
	public function provides()
57
	{
58
		return array('setting');
59
	}
60
61
}
62