BootstrapServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A provides() 0 4 1
A boot() 0 5 1
A register() 0 11 1
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