AuthServiceProvider   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 76
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 12 1
A register() 0 10 1
A registerUserRepository() 0 6 1
A registerThrottler() 0 6 1
A registerDispatcher() 0 6 1
1
<?php namespace Cerbero\Auth;
2
3
use Illuminate\Support\ServiceProvider;
4
5
/**
6
 * Package service provider.
7
 *
8
 * @author	Andrea Marco Sartori
9
 */
10
class AuthServiceProvider extends ServiceProvider {
11
12
	/**
13
	 * Boot up the package.
14
	 *
15
	 * @return void
16
	 */
17
	public function boot()
18
	{
19
		$this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'auth');
20
21
		$this->publishes([__DIR__.'/../config/_auth.php' => config_path('_auth.php')], 'config');
22
23
		$this->publishes([__DIR__.'/../database/migrations/' => database_path('migrations')], 'migration');
24
25
		$this->publishes([__DIR__.'/../resources/lang/' => base_path('resources/lang/vendor/auth')], 'lang');
26
27
		include __DIR__.'/Http/routes.php';
28
	}
29
30
	/**
31
	 * Register the service provider.
32
	 *
33
	 * @return void
34
	 */
35
	public function register()
36
	{
37
		$this->mergeConfigFrom(__DIR__.'/../config/_auth.php', 'auth');
38
39
		$this->registerUserRepository();
40
41
		$this->registerThrottler();
42
43
		$this->registerDispatcher();
44
	}
45
46
	/**
47
	 * Register the user repository.
48
	 *
49
	 * @author	Andrea Marco Sartori
50
	 * @return	void
51
	 */
52
	private function registerUserRepository()
53
	{
54
		$userRepo = 'Cerbero\Auth\Repositories\EloquentUserRepository';
55
56
		$this->app->bind('Cerbero\Auth\Repositories\UserRepositoryInterface', $userRepo);
57
	}
58
59
	/**
60
	 * Register the login throttling service.
61
	 *
62
	 * @author	Andrea Marco Sartori
63
	 * @return	void
64
	 */
65
	private function registerThrottler()
66
	{
67
		$throttler = 'Cerbero\Auth\Services\Throttling\CachingThrottler';
68
69
		$this->app->bind('Cerbero\Auth\Services\Throttling\ThrottlerInterface', $throttler);
70
	}
71
72
	/**
73
	 * Register the dispatcher service.
74
	 *
75
	 * @author	Andrea Marco Sartori
76
	 * @return	void
77
	 */
78
	private function registerDispatcher()
79
	{
80
		$dispatcher = 'Cerbero\Auth\Services\Dispatcher\MarshalDispatcher';
81
82
		$this->app->bind('Cerbero\Auth\Services\Dispatcher\DispatcherInterface', $dispatcher);
83
	}
84
85
}
86