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

SafeurlServiceProvider::isLumen()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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