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

SettingServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
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