BootstrapServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php namespace Cornford\Bootstrapper;
2
3
use Illuminate\Support\ServiceProvider;
4
5
class BootstrapServiceProvider extends ServiceProvider {
6
7
	/**
8
	 * Indicates if loading of the provider is deferred.
9
	 *
10
	 * @var bool
11
	 */
12
	protected $defer = true;
13
14
	/**
15
	 * Bootstrap the application events.
16
	 *
17
	 * @return void
18
	 */
19
	public function boot()
20
	{
21
		$assetPath = __DIR__.'/../../../public';
22
		$this->publishes([$assetPath => public_path('packages/cornford/bootstrapper')], 'bootstrapper');
23
	}
24
25
	/**
26
	 * Register the service provider.
27
	 *
28
	 * @return void
29
	 */
30
	public function register()
31
	{
32
		$this->app->singleton('bootstrap', function($app)
33
		{
34
			return new Bootstrap(
35
				$this->app->make('Illuminate\Html\FormBuilder', ['csrfToken' => $app['session.store']->getToken()]),
36
				$this->app->make('Illuminate\Html\HtmlBuilder'),
37
				$this->app->make('Illuminate\Http\Request')
38
			);
39
		});
40
	}
41
42
	/**
43
	 * Get the services provided by the provider.
44
	 *
45
	 * @return string[]
46
	 */
47
	public function provides()
48
	{
49
		return array('bootstrap');
50
	}
51
52
}
53