Completed
Pull Request — master (#4)
by
unknown
03:09 queued 01:32
created

SafeurlServiceProvider   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
c 2
b 0
f 0
lcom 1
cbo 3
dl 0
loc 54
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 8 1
A register() 0 9 2
A isLumen() 0 4 1
A provides() 0 4 1
1
<?php namespace Jaybizzle\Safeurl;
2
3
use Illuminate\Support\ServiceProvider;
4
5
class SafeurlServiceProvider 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
			__DIR__.'/../../config/config.php' => base_path('config/safeurl.php')
23
		]);
24
25
		$this->mergeConfigFrom(__DIR__.'/../../config/config.php', 'safeurl');
26
	}
27
28
	/**
29
	 * Register the service provider.
30
	 *
31
	 * @return void
32
	 */
33
	public function register()
34
	{
35
		$this->app->bind('Jaybizzle\Safeurl\Safeurl', function ($app) {
36
			if ($this->isLumen()) {
37
				$app->configure('safeurl');
38
			}
39
			return new Safeurl();
40
		});
41
	}
42
43
	private function isLumen()
44
	{
45
		return is_a(\app(), 'Laravel\Lumen\Application');
46
	}
47
48
	/**
49
	 * Get the services provided by the provider.
50
	 *
51
	 * @return array
52
	 */
53
	public function provides()
54
	{
55
		return array();
56
	}
57
58
}
59